Lines Matching refs:hash

75     PROV_DRBG_HASH *hash = (PROV_DRBG_HASH *)drbg->data;  in hash_df()  local
76 EVP_MD_CTX *ctx = hash->ctx; in hash_df()
77 unsigned char *vtmp = hash->vtmp; in hash_df()
105 if (!(EVP_DigestInit_ex(ctx, ossl_prov_digest_md(&hash->digest), NULL) in hash_df()
112 if (outlen < hash->blocklen) { in hash_df()
116 OPENSSL_cleanse(vtmp, hash->blocklen); in hash_df()
122 outlen -= hash->blocklen; in hash_df()
127 out += hash->blocklen; in hash_df()
180 PROV_DRBG_HASH *hash = (PROV_DRBG_HASH *)drbg->data; in add_hash_to_v() local
181 EVP_MD_CTX *ctx = hash->ctx; in add_hash_to_v()
183 return EVP_DigestInit_ex(ctx, ossl_prov_digest_md(&hash->digest), NULL) in add_hash_to_v()
185 && EVP_DigestUpdate(ctx, hash->V, drbg->seedlen) in add_hash_to_v()
187 && EVP_DigestFinal(ctx, hash->vtmp, NULL) in add_hash_to_v()
188 && add_bytes(drbg, hash->V, hash->vtmp, hash->blocklen); in add_hash_to_v()
211 PROV_DRBG_HASH *hash = (PROV_DRBG_HASH *)drbg->data; in hash_gen() local
216 memcpy(hash->vtmp, hash->V, drbg->seedlen); in hash_gen()
218 if (!EVP_DigestInit_ex(hash->ctx, ossl_prov_digest_md(&hash->digest), in hash_gen()
220 || !EVP_DigestUpdate(hash->ctx, hash->vtmp, drbg->seedlen)) in hash_gen()
223 if (outlen < hash->blocklen) { in hash_gen()
224 if (!EVP_DigestFinal(hash->ctx, hash->vtmp, NULL)) in hash_gen()
226 memcpy(out, hash->vtmp, outlen); in hash_gen()
229 if (!EVP_DigestFinal(hash->ctx, out, NULL)) in hash_gen()
231 outlen -= hash->blocklen; in hash_gen()
234 out += hash->blocklen; in hash_gen()
236 add_bytes(drbg, hash->vtmp, &one, 1); in hash_gen()
255 PROV_DRBG_HASH *hash = (PROV_DRBG_HASH *)drbg->data; in drbg_hash_instantiate() local
257 EVP_MD_CTX_free(hash->ctx); in drbg_hash_instantiate()
258 hash->ctx = EVP_MD_CTX_new(); in drbg_hash_instantiate()
261 return hash->ctx != NULL in drbg_hash_instantiate()
262 && hash_df(drbg, hash->V, INBYTE_IGNORE, in drbg_hash_instantiate()
265 && hash_df1(drbg, hash->C, 0x00, hash->V, drbg->seedlen); in drbg_hash_instantiate()
303 PROV_DRBG_HASH *hash = (PROV_DRBG_HASH *)drbg->data; in drbg_hash_reseed() local
307 if (!hash_df(drbg, hash->C, 0x01, hash->V, drbg->seedlen, ent, ent_len, in drbg_hash_reseed()
310 memcpy(hash->V, hash->C, drbg->seedlen); in drbg_hash_reseed()
312 return hash_df1(drbg, hash->C, 0x00, hash->V, drbg->seedlen); in drbg_hash_reseed()
338 PROV_DRBG_HASH *hash = (PROV_DRBG_HASH *)drbg->data; in drbg_hash_generate() local
347 return hash->ctx != NULL in drbg_hash_generate()
358 && add_bytes(drbg, hash->V, hash->C, drbg->seedlen) in drbg_hash_generate()
360 && add_bytes(drbg, hash->V, counter, 4); in drbg_hash_generate()
375 PROV_DRBG_HASH *hash = (PROV_DRBG_HASH *)drbg->data; in drbg_hash_uninstantiate() local
377 OPENSSL_cleanse(hash->V, sizeof(hash->V)); in drbg_hash_uninstantiate()
378 OPENSSL_cleanse(hash->C, sizeof(hash->C)); in drbg_hash_uninstantiate()
379 OPENSSL_cleanse(hash->vtmp, sizeof(hash->vtmp)); in drbg_hash_uninstantiate()
402 PROV_DRBG_HASH *hash = (PROV_DRBG_HASH *)drbg->data; in drbg_hash_verify_zeroization() local
408 PROV_DRBG_VERIFY_ZEROIZATION(hash->V); in drbg_hash_verify_zeroization()
409 PROV_DRBG_VERIFY_ZEROIZATION(hash->C); in drbg_hash_verify_zeroization()
410 PROV_DRBG_VERIFY_ZEROIZATION(hash->vtmp); in drbg_hash_verify_zeroization()
421 PROV_DRBG_HASH *hash; in drbg_hash_new() local
423 hash = OPENSSL_secure_zalloc(sizeof(*hash)); in drbg_hash_new()
424 if (hash == NULL) in drbg_hash_new()
429 ctx->data = hash; in drbg_hash_new()
453 PROV_DRBG_HASH *hash; in drbg_hash_free() local
455 if (drbg != NULL && (hash = (PROV_DRBG_HASH *)drbg->data) != NULL) { in drbg_hash_free()
456 EVP_MD_CTX_free(hash->ctx); in drbg_hash_free()
457 ossl_prov_digest_reset(&hash->digest); in drbg_hash_free()
458 OPENSSL_secure_clear_free(hash, sizeof(*hash)); in drbg_hash_free()
466 PROV_DRBG_HASH *hash = (PROV_DRBG_HASH *)drbg->data; in drbg_hash_get_ctx_params() local
482 md = ossl_prov_digest_md(&hash->digest); in drbg_hash_get_ctx_params()
510 PROV_DRBG_HASH *hash = (PROV_DRBG_HASH *)ctx->data; in drbg_hash_set_ctx_params_locked() local
519 if (!ossl_prov_digest_load_from_params(&hash->digest, params, libctx)) in drbg_hash_set_ctx_params_locked()
522 md = ossl_prov_digest_md(&hash->digest); in drbg_hash_set_ctx_params_locked()
531 hash->blocklen = md_size; in drbg_hash_set_ctx_params_locked()
533 ctx->strength = 64 * (hash->blocklen >> 3); in drbg_hash_set_ctx_params_locked()
536 if (hash->blocklen > MAX_BLOCKLEN_USING_SMALL_SEEDLEN) in drbg_hash_set_ctx_params_locked()