seeding.h 1.5 KB

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