A local copy of OpenSSL from GitHub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.8 KiB

  1. /*
  2. * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the OpenSSL license (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. #ifndef HEADER_RAND_LCL_H
  10. # define HEADER_RAND_LCL_H
  11. # define ENTROPY_NEEDED 32 /* require 256 bits = 32 bytes of randomness */
  12. # if !defined(USE_MD5_RAND) && !defined(USE_SHA1_RAND) && !defined(USE_MDC2_RAND) && !defined(USE_MD2_RAND)
  13. # define USE_SHA1_RAND
  14. # endif
  15. # include <openssl/evp.h>
  16. # define MD_Update(a,b,c) EVP_DigestUpdate(a,b,c)
  17. # define MD_Final(a,b) EVP_DigestFinal_ex(a,b,NULL)
  18. # if defined(USE_MD5_RAND)
  19. # include <openssl/md5.h>
  20. # define MD_DIGEST_LENGTH MD5_DIGEST_LENGTH
  21. # define MD_Init(a) EVP_DigestInit_ex(a,EVP_md5(), NULL)
  22. # define MD(a,b,c) EVP_Digest(a,b,c,NULL,EVP_md5(), NULL)
  23. # elif defined(USE_SHA1_RAND)
  24. # include <openssl/sha.h>
  25. # define MD_DIGEST_LENGTH SHA_DIGEST_LENGTH
  26. # define MD_Init(a) EVP_DigestInit_ex(a,EVP_sha1(), NULL)
  27. # define MD(a,b,c) EVP_Digest(a,b,c,NULL,EVP_sha1(), NULL)
  28. # elif defined(USE_MDC2_RAND)
  29. # include <openssl/mdc2.h>
  30. # define MD_DIGEST_LENGTH MDC2_DIGEST_LENGTH
  31. # define MD_Init(a) EVP_DigestInit_ex(a,EVP_mdc2(), NULL)
  32. # define MD(a,b,c) EVP_Digest(a,b,c,NULL,EVP_mdc2(), NULL)
  33. # elif defined(USE_MD2_RAND)
  34. # include <openssl/md2.h>
  35. # define MD_DIGEST_LENGTH MD2_DIGEST_LENGTH
  36. # define MD_Init(a) EVP_DigestInit_ex(a,EVP_md2(), NULL)
  37. # define MD(a,b,c) EVP_Digest(a,b,c,NULL,EVP_md2(), NULL)
  38. # endif
  39. void rand_hw_xor(unsigned char *buf, size_t num);
  40. #endif