2020-05-11 10:06:37 +08:00
|
|
|
/*
|
|
|
|
* Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
|
|
|
* this file except in compliance with the License. You can obtain a copy
|
|
|
|
* in the file LICENSE in the source distribution or at
|
|
|
|
* https://www.openssl.org/source/license.html
|
|
|
|
*/
|
|
|
|
|
2020-10-30 13:54:03 +08:00
|
|
|
#include "prov/provider_ctx.h"
|
|
|
|
#include "crypto/rand_pool.h"
|
2020-05-11 10:06:37 +08:00
|
|
|
|
|
|
|
/* Hardware-based seeding functions. */
|
|
|
|
size_t prov_acquire_entropy_from_tsc(RAND_POOL *pool);
|
|
|
|
size_t prov_acquire_entropy_from_cpu(RAND_POOL *pool);
|
|
|
|
|
|
|
|
/* DRBG entropy callbacks. */
|
|
|
|
size_t prov_drbg_get_additional_data(RAND_POOL *pool, unsigned char **pout);
|
|
|
|
|
|
|
|
void prov_drbg_cleanup_additional_data(RAND_POOL *pool, unsigned char *out);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Add some platform specific additional data
|
|
|
|
*
|
|
|
|
* This function is platform specific and adds some random noise to the
|
|
|
|
* additional data used for generating random bytes and for reseeding
|
|
|
|
* the drbg.
|
|
|
|
*
|
|
|
|
* Returns 1 on success and 0 on failure.
|
|
|
|
*/
|
|
|
|
int rand_pool_add_additional_data(RAND_POOL *pool);
|
|
|
|
|
2020-10-30 13:54:03 +08:00
|
|
|
/*
|
|
|
|
* External seeding functions from the core dispatch table.
|
|
|
|
*/
|
|
|
|
int ossl_prov_seeding_from_dispatch(const OSSL_DISPATCH *fns);
|
|
|
|
|
|
|
|
size_t ossl_prov_get_entropy(PROV_CTX *prov_ctx, unsigned char **pout,
|
|
|
|
int entropy, size_t min_len, size_t max_len);
|
|
|
|
void ossl_prov_cleanup_entropy(PROV_CTX *prov_ctx, unsigned char *buf,
|
|
|
|
size_t len);
|
|
|
|
size_t ossl_prov_get_nonce(PROV_CTX *prov_ctx, unsigned char **pout,
|
|
|
|
size_t min_len, size_t max_len,
|
|
|
|
const void *salt, size_t salt_len);
|
|
|
|
void ossl_prov_cleanup_nonce(PROV_CTX *prov_ctx, unsigned char *buf,
|
|
|
|
size_t len);
|