Path: blob/main/crypto/openssl/providers/implementations/rands/drbg_hash.c
48383 views
/*1* Copyright 2011-2025 The OpenSSL Project Authors. All Rights Reserved.2*3* Licensed under the Apache License 2.0 (the "License"). You may not use4* this file except in compliance with the License. You can obtain a copy5* in the file LICENSE in the source distribution or at6* https://www.openssl.org/source/license.html7*/89#include <assert.h>10#include <stdlib.h>11#include <string.h>12#include <openssl/sha.h>13#include <openssl/crypto.h>14#include <openssl/err.h>15#include <openssl/rand.h>16#include <openssl/core_dispatch.h>17#include <openssl/proverr.h>18#include "internal/thread_once.h"19#include "prov/providercommon.h"20#include "prov/provider_ctx.h"21#include "prov/provider_util.h"22#include "prov/implementations.h"23#include "drbg_local.h"24#include "crypto/evp.h"25#include "crypto/evp/evp_local.h"26#include "internal/provider.h"2728static OSSL_FUNC_rand_newctx_fn drbg_hash_new_wrapper;29static OSSL_FUNC_rand_freectx_fn drbg_hash_free;30static OSSL_FUNC_rand_instantiate_fn drbg_hash_instantiate_wrapper;31static OSSL_FUNC_rand_uninstantiate_fn drbg_hash_uninstantiate_wrapper;32static OSSL_FUNC_rand_generate_fn drbg_hash_generate_wrapper;33static OSSL_FUNC_rand_reseed_fn drbg_hash_reseed_wrapper;34static OSSL_FUNC_rand_settable_ctx_params_fn drbg_hash_settable_ctx_params;35static OSSL_FUNC_rand_set_ctx_params_fn drbg_hash_set_ctx_params;36static OSSL_FUNC_rand_gettable_ctx_params_fn drbg_hash_gettable_ctx_params;37static OSSL_FUNC_rand_get_ctx_params_fn drbg_hash_get_ctx_params;38static OSSL_FUNC_rand_verify_zeroization_fn drbg_hash_verify_zeroization;3940static int drbg_hash_set_ctx_params_locked(void *vctx, const OSSL_PARAM params[]);4142/* 888 bits from SP800-90Ar1 10.1 table 2 */43#define HASH_PRNG_MAX_SEEDLEN (888/8)4445/* 440 bits from SP800-90Ar1 10.1 table 2 */46#define HASH_PRNG_SMALL_SEEDLEN (440/8)4748/* Determine what seedlen to use based on the block length */49#define MAX_BLOCKLEN_USING_SMALL_SEEDLEN (256/8)50#define INBYTE_IGNORE ((unsigned char)0xFF)5152typedef struct rand_drbg_hash_st {53PROV_DIGEST digest;54EVP_MD_CTX *ctx;55size_t blocklen;56unsigned char V[HASH_PRNG_MAX_SEEDLEN];57unsigned char C[HASH_PRNG_MAX_SEEDLEN];58/* Temporary value storage: should always exceed max digest length */59unsigned char vtmp[HASH_PRNG_MAX_SEEDLEN];60} PROV_DRBG_HASH;6162/*63* SP800-90Ar1 10.3.1 Derivation function using a Hash Function (Hash_df).64* The input string used is composed of:65* inbyte - An optional leading byte (ignore if equal to INBYTE_IGNORE)66* in - input string 1 (A Non NULL value).67* in2 - optional input string (Can be NULL).68* in3 - optional input string (Can be NULL).69* These are concatenated as part of the DigestUpdate process.70*/71static int hash_df(PROV_DRBG *drbg, unsigned char *out,72const unsigned char inbyte,73const unsigned char *in, size_t inlen,74const unsigned char *in2, size_t in2len,75const unsigned char *in3, size_t in3len)76{77PROV_DRBG_HASH *hash = (PROV_DRBG_HASH *)drbg->data;78EVP_MD_CTX *ctx = hash->ctx;79unsigned char *vtmp = hash->vtmp;80/* tmp = counter || num_bits_returned || [inbyte] */81unsigned char tmp[1 + 4 + 1];82int tmp_sz = 0;83size_t outlen = drbg->seedlen;84size_t num_bits_returned = outlen * 8;85/*86* No need to check outlen size here, as the standard only ever needs87* seedlen bytes which is always less than the maximum permitted.88*/8990/* (Step 3) counter = 1 (tmp[0] is the 8 bit counter) */91tmp[tmp_sz++] = 1;92/* tmp[1..4] is the fixed 32 bit no_of_bits_to_return */93tmp[tmp_sz++] = (unsigned char)((num_bits_returned >> 24) & 0xff);94tmp[tmp_sz++] = (unsigned char)((num_bits_returned >> 16) & 0xff);95tmp[tmp_sz++] = (unsigned char)((num_bits_returned >> 8) & 0xff);96tmp[tmp_sz++] = (unsigned char)(num_bits_returned & 0xff);97/* Tack the additional input byte onto the end of tmp if it exists */98if (inbyte != INBYTE_IGNORE)99tmp[tmp_sz++] = inbyte;100101/* (Step 4) */102for (;;) {103/*104* (Step 4.1) out = out || Hash(tmp || in || [in2] || [in3])105* (where tmp = counter || num_bits_returned || [inbyte])106*/107if (!(EVP_DigestInit_ex(ctx, ossl_prov_digest_md(&hash->digest), NULL)108&& EVP_DigestUpdate(ctx, tmp, tmp_sz)109&& EVP_DigestUpdate(ctx, in, inlen)110&& (in2 == NULL || EVP_DigestUpdate(ctx, in2, in2len))111&& (in3 == NULL || EVP_DigestUpdate(ctx, in3, in3len))))112return 0;113114if (outlen < hash->blocklen) {115if (!EVP_DigestFinal(ctx, vtmp, NULL))116return 0;117memcpy(out, vtmp, outlen);118OPENSSL_cleanse(vtmp, hash->blocklen);119break;120} else if (!EVP_DigestFinal(ctx, out, NULL)) {121return 0;122}123124outlen -= hash->blocklen;125if (outlen == 0)126break;127/* (Step 4.2) counter++ */128tmp[0]++;129out += hash->blocklen;130}131return 1;132}133134/* Helper function that just passes 2 input parameters to hash_df() */135static int hash_df1(PROV_DRBG *drbg, unsigned char *out,136const unsigned char in_byte,137const unsigned char *in1, size_t in1len)138{139return hash_df(drbg, out, in_byte, in1, in1len, NULL, 0, NULL, 0);140}141142/*143* Add 2 byte buffers together. The first elements in each buffer are the top144* most bytes. The result is stored in the dst buffer.145* The final carry is ignored i.e: dst = (dst + in) mod (2^seedlen_bits).146* where dst size is drbg->seedlen, and inlen <= drbg->seedlen.147*/148static int add_bytes(PROV_DRBG *drbg, unsigned char *dst,149unsigned char *in, size_t inlen)150{151size_t i;152int result;153const unsigned char *add;154unsigned char carry = 0, *d;155156assert(drbg->seedlen >= 1 && inlen >= 1 && inlen <= drbg->seedlen);157158d = &dst[drbg->seedlen - 1];159add = &in[inlen - 1];160161for (i = inlen; i > 0; i--, d--, add--) {162result = *d + *add + carry;163carry = (unsigned char)(result >> 8);164*d = (unsigned char)(result & 0xff);165}166167if (carry != 0) {168/* Add the carry to the top of the dst if inlen is not the same size */169for (i = drbg->seedlen - inlen; i > 0; --i, d--) {170*d += 1; /* Carry can only be 1 */171if (*d != 0) /* exit if carry doesn't propagate to the next byte */172break;173}174}175return 1;176}177178/* V = (V + Hash(inbyte || V || [additional_input]) mod (2^seedlen) */179static int add_hash_to_v(PROV_DRBG *drbg, unsigned char inbyte,180const unsigned char *adin, size_t adinlen)181{182PROV_DRBG_HASH *hash = (PROV_DRBG_HASH *)drbg->data;183EVP_MD_CTX *ctx = hash->ctx;184185return EVP_DigestInit_ex(ctx, ossl_prov_digest_md(&hash->digest), NULL)186&& EVP_DigestUpdate(ctx, &inbyte, 1)187&& EVP_DigestUpdate(ctx, hash->V, drbg->seedlen)188&& (adin == NULL || EVP_DigestUpdate(ctx, adin, adinlen))189&& EVP_DigestFinal(ctx, hash->vtmp, NULL)190&& add_bytes(drbg, hash->V, hash->vtmp, hash->blocklen);191}192193/*194* The Hashgen() as listed in SP800-90Ar1 10.1.1.4 Hash_DRBG_Generate_Process.195*196* drbg contains the current value of V.197* outlen is the requested number of bytes.198* out is a buffer to return the generated bits.199*200* The algorithm to generate the bits is:201* data = V202* w = NULL203* for (i = 1 to m) {204* W = W || Hash(data)205* data = (data + 1) mod (2^seedlen)206* }207* out = Leftmost(W, outlen)208*209* Returns zero if an error occurs otherwise it returns 1.210*/211static int hash_gen(PROV_DRBG *drbg, unsigned char *out, size_t outlen)212{213PROV_DRBG_HASH *hash = (PROV_DRBG_HASH *)drbg->data;214unsigned char one = 1;215216if (outlen == 0)217return 1;218memcpy(hash->vtmp, hash->V, drbg->seedlen);219for (;;) {220if (!EVP_DigestInit_ex(hash->ctx, ossl_prov_digest_md(&hash->digest),221NULL)222|| !EVP_DigestUpdate(hash->ctx, hash->vtmp, drbg->seedlen))223return 0;224225if (outlen < hash->blocklen) {226if (!EVP_DigestFinal(hash->ctx, hash->vtmp, NULL))227return 0;228memcpy(out, hash->vtmp, outlen);229return 1;230} else {231if (!EVP_DigestFinal(hash->ctx, out, NULL))232return 0;233outlen -= hash->blocklen;234if (outlen == 0)235break;236out += hash->blocklen;237}238add_bytes(drbg, hash->vtmp, &one, 1);239}240return 1;241}242243/*244* SP800-90Ar1 10.1.1.2 Hash_DRBG_Instantiate_Process:245*246* ent is entropy input obtained from a randomness source of length ent_len.247* nonce is a string of bytes of length nonce_len.248* pstr is a personalization string received from an application. May be NULL.249*250* Returns zero if an error occurs otherwise it returns 1.251*/252static int drbg_hash_instantiate(PROV_DRBG *drbg,253const unsigned char *ent, size_t ent_len,254const unsigned char *nonce, size_t nonce_len,255const unsigned char *pstr, size_t pstr_len)256{257PROV_DRBG_HASH *hash = (PROV_DRBG_HASH *)drbg->data;258259EVP_MD_CTX_free(hash->ctx);260hash->ctx = EVP_MD_CTX_new();261262/* (Step 1-3) V = Hash_df(entropy||nonce||pers, seedlen) */263return hash->ctx != NULL264&& hash_df(drbg, hash->V, INBYTE_IGNORE,265ent, ent_len, nonce, nonce_len, pstr, pstr_len)266/* (Step 4) C = Hash_df(0x00||V, seedlen) */267&& hash_df1(drbg, hash->C, 0x00, hash->V, drbg->seedlen);268}269270static int drbg_hash_instantiate_wrapper(void *vdrbg, unsigned int strength,271int prediction_resistance,272const unsigned char *pstr,273size_t pstr_len,274const OSSL_PARAM params[])275{276PROV_DRBG *drbg = (PROV_DRBG *)vdrbg;277int ret = 0;278279if (drbg->lock != NULL && !CRYPTO_THREAD_write_lock(drbg->lock))280return 0;281282if (!ossl_prov_is_running()283|| !drbg_hash_set_ctx_params_locked(drbg, params))284goto err;285ret = ossl_prov_drbg_instantiate(drbg, strength, prediction_resistance,286pstr, pstr_len);287err:288if (drbg->lock != NULL)289CRYPTO_THREAD_unlock(drbg->lock);290return ret;291}292293/*294* SP800-90Ar1 10.1.1.3 Hash_DRBG_Reseed_Process:295*296* ent is entropy input bytes obtained from a randomness source.297* addin is additional input received from an application. May be NULL.298*299* Returns zero if an error occurs otherwise it returns 1.300*/301static int drbg_hash_reseed(PROV_DRBG *drbg,302const unsigned char *ent, size_t ent_len,303const unsigned char *adin, size_t adin_len)304{305PROV_DRBG_HASH *hash = (PROV_DRBG_HASH *)drbg->data;306307/* (Step 1-2) V = Hash_df(0x01 || V || entropy_input || additional_input) */308/* V about to be updated so use C as output instead */309if (!hash_df(drbg, hash->C, 0x01, hash->V, drbg->seedlen, ent, ent_len,310adin, adin_len))311return 0;312memcpy(hash->V, hash->C, drbg->seedlen);313/* (Step 4) C = Hash_df(0x00||V, seedlen) */314return hash_df1(drbg, hash->C, 0x00, hash->V, drbg->seedlen);315}316317static int drbg_hash_reseed_wrapper(void *vdrbg, int prediction_resistance,318const unsigned char *ent, size_t ent_len,319const unsigned char *adin, size_t adin_len)320{321PROV_DRBG *drbg = (PROV_DRBG *)vdrbg;322323return ossl_prov_drbg_reseed(drbg, prediction_resistance, ent, ent_len,324adin, adin_len);325}326327/*328* SP800-90Ar1 10.1.1.4 Hash_DRBG_Generate_Process:329*330* Generates pseudo random bytes using the drbg.331* out is a buffer to fill with outlen bytes of pseudo random data.332* addin is additional input received from an application. May be NULL.333*334* Returns zero if an error occurs otherwise it returns 1.335*/336static int drbg_hash_generate(PROV_DRBG *drbg,337unsigned char *out, size_t outlen,338const unsigned char *adin, size_t adin_len)339{340PROV_DRBG_HASH *hash = (PROV_DRBG_HASH *)drbg->data;341unsigned char counter[4];342int reseed_counter = drbg->generate_counter;343344counter[0] = (unsigned char)((reseed_counter >> 24) & 0xff);345counter[1] = (unsigned char)((reseed_counter >> 16) & 0xff);346counter[2] = (unsigned char)((reseed_counter >> 8) & 0xff);347counter[3] = (unsigned char)(reseed_counter & 0xff);348349return hash->ctx != NULL350&& (adin == NULL351/* (Step 2) if adin != NULL then V = V + Hash(0x02||V||adin) */352|| adin_len == 0353|| add_hash_to_v(drbg, 0x02, adin, adin_len))354/* (Step 3) Hashgen(outlen, V) */355&& hash_gen(drbg, out, outlen)356/* (Step 4/5) H = V = (V + Hash(0x03||V) mod (2^seedlen_bits) */357&& add_hash_to_v(drbg, 0x03, NULL, 0)358/* (Step 5) V = (V + H + C + reseed_counter) mod (2^seedlen_bits) */359/* V = (V + C) mod (2^seedlen_bits) */360&& add_bytes(drbg, hash->V, hash->C, drbg->seedlen)361/* V = (V + reseed_counter) mod (2^seedlen_bits) */362&& add_bytes(drbg, hash->V, counter, 4);363}364365static int drbg_hash_generate_wrapper366(void *vdrbg, unsigned char *out, size_t outlen, unsigned int strength,367int prediction_resistance, const unsigned char *adin, size_t adin_len)368{369PROV_DRBG *drbg = (PROV_DRBG *)vdrbg;370371return ossl_prov_drbg_generate(drbg, out, outlen, strength,372prediction_resistance, adin, adin_len);373}374375static int drbg_hash_uninstantiate(PROV_DRBG *drbg)376{377PROV_DRBG_HASH *hash = (PROV_DRBG_HASH *)drbg->data;378379OPENSSL_cleanse(hash->V, sizeof(hash->V));380OPENSSL_cleanse(hash->C, sizeof(hash->C));381OPENSSL_cleanse(hash->vtmp, sizeof(hash->vtmp));382return ossl_prov_drbg_uninstantiate(drbg);383}384385static int drbg_hash_uninstantiate_wrapper(void *vdrbg)386{387PROV_DRBG *drbg = (PROV_DRBG *)vdrbg;388int ret;389390if (drbg->lock != NULL && !CRYPTO_THREAD_write_lock(drbg->lock))391return 0;392393ret = drbg_hash_uninstantiate(drbg);394395if (drbg->lock != NULL)396CRYPTO_THREAD_unlock(drbg->lock);397398return ret;399}400401static int drbg_hash_verify_zeroization(void *vdrbg)402{403PROV_DRBG *drbg = (PROV_DRBG *)vdrbg;404PROV_DRBG_HASH *hash = (PROV_DRBG_HASH *)drbg->data;405int ret = 0;406407if (drbg->lock != NULL && !CRYPTO_THREAD_read_lock(drbg->lock))408return 0;409410PROV_DRBG_VERIFY_ZEROIZATION(hash->V);411PROV_DRBG_VERIFY_ZEROIZATION(hash->C);412PROV_DRBG_VERIFY_ZEROIZATION(hash->vtmp);413414ret = 1;415err:416if (drbg->lock != NULL)417CRYPTO_THREAD_unlock(drbg->lock);418return ret;419}420421static int drbg_hash_new(PROV_DRBG *ctx)422{423PROV_DRBG_HASH *hash;424425hash = OPENSSL_secure_zalloc(sizeof(*hash));426if (hash == NULL)427return 0;428429OSSL_FIPS_IND_INIT(ctx)430431ctx->data = hash;432ctx->seedlen = HASH_PRNG_MAX_SEEDLEN;433ctx->max_entropylen = DRBG_MAX_LENGTH;434ctx->max_noncelen = DRBG_MAX_LENGTH;435ctx->max_perslen = DRBG_MAX_LENGTH;436ctx->max_adinlen = DRBG_MAX_LENGTH;437438/* Maximum number of bits per request = 2^19 = 2^16 bytes */439ctx->max_request = 1 << 16;440return 1;441}442443static void *drbg_hash_new_wrapper(void *provctx, void *parent,444const OSSL_DISPATCH *parent_dispatch)445{446return ossl_rand_drbg_new(provctx, parent, parent_dispatch,447&drbg_hash_new, &drbg_hash_free,448&drbg_hash_instantiate, &drbg_hash_uninstantiate,449&drbg_hash_reseed, &drbg_hash_generate);450}451452static void drbg_hash_free(void *vdrbg)453{454PROV_DRBG *drbg = (PROV_DRBG *)vdrbg;455PROV_DRBG_HASH *hash;456457if (drbg != NULL && (hash = (PROV_DRBG_HASH *)drbg->data) != NULL) {458EVP_MD_CTX_free(hash->ctx);459ossl_prov_digest_reset(&hash->digest);460OPENSSL_secure_clear_free(hash, sizeof(*hash));461}462ossl_rand_drbg_free(drbg);463}464465static int drbg_hash_get_ctx_params(void *vdrbg, OSSL_PARAM params[])466{467PROV_DRBG *drbg = (PROV_DRBG *)vdrbg;468PROV_DRBG_HASH *hash = (PROV_DRBG_HASH *)drbg->data;469const EVP_MD *md;470OSSL_PARAM *p;471int ret = 0, complete = 0;472473if (!ossl_drbg_get_ctx_params_no_lock(drbg, params, &complete))474return 0;475476if (complete)477return 1;478479if (drbg->lock != NULL && !CRYPTO_THREAD_read_lock(drbg->lock))480return 0;481482p = OSSL_PARAM_locate(params, OSSL_DRBG_PARAM_DIGEST);483if (p != NULL) {484md = ossl_prov_digest_md(&hash->digest);485if (md == NULL || !OSSL_PARAM_set_utf8_string(p, EVP_MD_get0_name(md)))486goto err;487}488489ret = ossl_drbg_get_ctx_params(drbg, params);490err:491if (drbg->lock != NULL)492CRYPTO_THREAD_unlock(drbg->lock);493494return ret;495}496497static const OSSL_PARAM *drbg_hash_gettable_ctx_params(ossl_unused void *vctx,498ossl_unused void *p_ctx)499{500static const OSSL_PARAM known_gettable_ctx_params[] = {501OSSL_PARAM_utf8_string(OSSL_DRBG_PARAM_DIGEST, NULL, 0),502OSSL_PARAM_DRBG_GETTABLE_CTX_COMMON,503OSSL_FIPS_IND_GETTABLE_CTX_PARAM()504OSSL_PARAM_END505};506return known_gettable_ctx_params;507}508509static int drbg_fetch_digest_from_prov(const OSSL_PARAM params[],510OSSL_LIB_CTX *libctx,511EVP_MD **digest)512{513OSSL_PROVIDER *prov = NULL;514const OSSL_PARAM *p;515EVP_MD *md = NULL;516int ret = 0;517518if (digest == NULL)519return 0;520521if ((p = OSSL_PARAM_locate_const(params,522OSSL_PROV_PARAM_CORE_PROV_NAME)) == NULL)523return 0;524if (p->data_type != OSSL_PARAM_UTF8_STRING)525return 0;526if ((prov = ossl_provider_find(libctx, (const char *)p->data, 1)) == NULL)527return 0;528529p = OSSL_PARAM_locate_const(params, OSSL_ALG_PARAM_DIGEST);530if (p == NULL) {531ret = 1;532goto done;533}534535if (p->data_type != OSSL_PARAM_UTF8_STRING)536goto done;537538md = evp_digest_fetch_from_prov(prov, (const char *)p->data, NULL);539if (md) {540EVP_MD_free(*digest);541*digest = md;542ret = 1;543}544545done:546ossl_provider_free(prov);547return ret;548}549550static int drbg_hash_set_ctx_params_locked(void *vctx, const OSSL_PARAM params[])551{552PROV_DRBG *ctx = (PROV_DRBG *)vctx;553PROV_DRBG_HASH *hash = (PROV_DRBG_HASH *)ctx->data;554OSSL_LIB_CTX *libctx = PROV_LIBCTX_OF(ctx->provctx);555EVP_MD *prov_md = NULL;556const EVP_MD *md;557int md_size;558559if (!OSSL_FIPS_IND_SET_CTX_PARAM(ctx, OSSL_FIPS_IND_SETTABLE0, params,560OSSL_DRBG_PARAM_FIPS_DIGEST_CHECK))561return 0;562563/* try to fetch digest from provider */564(void)ERR_set_mark();565if (!drbg_fetch_digest_from_prov(params, libctx, &prov_md)) {566(void)ERR_pop_to_mark();567/* fall back to full implementation search */568if (!ossl_prov_digest_load_from_params(&hash->digest, params, libctx))569return 0;570} else {571(void)ERR_clear_last_mark();572if (prov_md)573ossl_prov_digest_set_md(&hash->digest, prov_md);574}575576md = ossl_prov_digest_md(&hash->digest);577if (md != NULL) {578if (!ossl_drbg_verify_digest(ctx, libctx, md))579return 0; /* Error already raised for us */580581/* These are taken from SP 800-90 10.1 Table 2 */582md_size = EVP_MD_get_size(md);583if (md_size <= 0)584return 0;585hash->blocklen = md_size;586/* See SP800-57 Part1 Rev4 5.6.1 Table 3 */587ctx->strength = 64 * (hash->blocklen >> 3);588if (ctx->strength > 256)589ctx->strength = 256;590if (hash->blocklen > MAX_BLOCKLEN_USING_SMALL_SEEDLEN)591ctx->seedlen = HASH_PRNG_MAX_SEEDLEN;592else593ctx->seedlen = HASH_PRNG_SMALL_SEEDLEN;594595ctx->min_entropylen = ctx->strength / 8;596ctx->min_noncelen = ctx->min_entropylen / 2;597}598599return ossl_drbg_set_ctx_params(ctx, params);600}601602static int drbg_hash_set_ctx_params(void *vctx, const OSSL_PARAM params[])603{604PROV_DRBG *drbg = (PROV_DRBG *)vctx;605int ret;606607if (drbg->lock != NULL && !CRYPTO_THREAD_write_lock(drbg->lock))608return 0;609610ret = drbg_hash_set_ctx_params_locked(vctx, params);611612if (drbg->lock != NULL)613CRYPTO_THREAD_unlock(drbg->lock);614615return ret;616}617618static const OSSL_PARAM *drbg_hash_settable_ctx_params(ossl_unused void *vctx,619ossl_unused void *p_ctx)620{621static const OSSL_PARAM known_settable_ctx_params[] = {622OSSL_PARAM_utf8_string(OSSL_DRBG_PARAM_PROPERTIES, NULL, 0),623OSSL_PARAM_utf8_string(OSSL_DRBG_PARAM_DIGEST, NULL, 0),624OSSL_PARAM_DRBG_SETTABLE_CTX_COMMON,625OSSL_FIPS_IND_SETTABLE_CTX_PARAM(OSSL_DRBG_PARAM_FIPS_DIGEST_CHECK)626OSSL_PARAM_END627};628return known_settable_ctx_params;629}630631const OSSL_DISPATCH ossl_drbg_hash_functions[] = {632{ OSSL_FUNC_RAND_NEWCTX, (void(*)(void))drbg_hash_new_wrapper },633{ OSSL_FUNC_RAND_FREECTX, (void(*)(void))drbg_hash_free },634{ OSSL_FUNC_RAND_INSTANTIATE,635(void(*)(void))drbg_hash_instantiate_wrapper },636{ OSSL_FUNC_RAND_UNINSTANTIATE,637(void(*)(void))drbg_hash_uninstantiate_wrapper },638{ OSSL_FUNC_RAND_GENERATE, (void(*)(void))drbg_hash_generate_wrapper },639{ OSSL_FUNC_RAND_RESEED, (void(*)(void))drbg_hash_reseed_wrapper },640{ OSSL_FUNC_RAND_ENABLE_LOCKING, (void(*)(void))ossl_drbg_enable_locking },641{ OSSL_FUNC_RAND_LOCK, (void(*)(void))ossl_drbg_lock },642{ OSSL_FUNC_RAND_UNLOCK, (void(*)(void))ossl_drbg_unlock },643{ OSSL_FUNC_RAND_SETTABLE_CTX_PARAMS,644(void(*)(void))drbg_hash_settable_ctx_params },645{ OSSL_FUNC_RAND_SET_CTX_PARAMS, (void(*)(void))drbg_hash_set_ctx_params },646{ OSSL_FUNC_RAND_GETTABLE_CTX_PARAMS,647(void(*)(void))drbg_hash_gettable_ctx_params },648{ OSSL_FUNC_RAND_GET_CTX_PARAMS, (void(*)(void))drbg_hash_get_ctx_params },649{ OSSL_FUNC_RAND_VERIFY_ZEROIZATION,650(void(*)(void))drbg_hash_verify_zeroization },651{ OSSL_FUNC_RAND_GET_SEED, (void(*)(void))ossl_drbg_get_seed },652{ OSSL_FUNC_RAND_CLEAR_SEED, (void(*)(void))ossl_drbg_clear_seed },653OSSL_DISPATCH_END654};655656657