1*b077aed3SPierre Pronchery /* 2*b077aed3SPierre Pronchery * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. 3*b077aed3SPierre Pronchery * 4*b077aed3SPierre Pronchery * Licensed under the Apache License 2.0 (the "License"). You may not use 5*b077aed3SPierre Pronchery * this file except in compliance with the License. You can obtain a copy 6*b077aed3SPierre Pronchery * in the file LICENSE in the source distribution or at 7*b077aed3SPierre Pronchery * https://www.openssl.org/source/license.html 8*b077aed3SPierre Pronchery */ 9*b077aed3SPierre Pronchery 10*b077aed3SPierre Pronchery #include "prov/provider_ctx.h" 11*b077aed3SPierre Pronchery #include "crypto/rand_pool.h" 12*b077aed3SPierre Pronchery 13*b077aed3SPierre Pronchery /* Hardware-based seeding functions. */ 14*b077aed3SPierre Pronchery size_t ossl_prov_acquire_entropy_from_tsc(RAND_POOL *pool); 15*b077aed3SPierre Pronchery size_t ossl_prov_acquire_entropy_from_cpu(RAND_POOL *pool); 16*b077aed3SPierre Pronchery 17*b077aed3SPierre Pronchery /* 18*b077aed3SPierre Pronchery * Add some platform specific additional data 19*b077aed3SPierre Pronchery * 20*b077aed3SPierre Pronchery * This function is platform specific and adds some random noise to the 21*b077aed3SPierre Pronchery * additional data used for generating random bytes and for reseeding 22*b077aed3SPierre Pronchery * the drbg. 23*b077aed3SPierre Pronchery * 24*b077aed3SPierre Pronchery * Returns 1 on success and 0 on failure. 25*b077aed3SPierre Pronchery */ 26*b077aed3SPierre Pronchery int ossl_rand_pool_add_additional_data(RAND_POOL *pool); 27*b077aed3SPierre Pronchery 28*b077aed3SPierre Pronchery /* 29*b077aed3SPierre Pronchery * External seeding functions from the core dispatch table. 30*b077aed3SPierre Pronchery */ 31*b077aed3SPierre Pronchery int ossl_prov_seeding_from_dispatch(const OSSL_DISPATCH *fns); 32*b077aed3SPierre Pronchery 33*b077aed3SPierre Pronchery size_t ossl_prov_get_entropy(PROV_CTX *prov_ctx, unsigned char **pout, 34*b077aed3SPierre Pronchery int entropy, size_t min_len, size_t max_len); 35*b077aed3SPierre Pronchery void ossl_prov_cleanup_entropy(PROV_CTX *prov_ctx, unsigned char *buf, 36*b077aed3SPierre Pronchery size_t len); 37*b077aed3SPierre Pronchery size_t ossl_prov_get_nonce(PROV_CTX *prov_ctx, unsigned char **pout, 38*b077aed3SPierre Pronchery size_t min_len, size_t max_len, 39*b077aed3SPierre Pronchery const void *salt, size_t salt_len); 40*b077aed3SPierre Pronchery void ossl_prov_cleanup_nonce(PROV_CTX *prov_ctx, unsigned char *buf, 41*b077aed3SPierre Pronchery size_t len); 42