2016-05-17 18:52:22 +00:00
|
|
|
/*
|
|
|
|
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
2000-07-19 21:43:23 +00:00
|
|
|
*
|
2016-05-17 18:52:22 +00:00
|
|
|
* Licensed under the OpenSSL license (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
|
2000-07-19 21:43:23 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HEADER_RAND_LCL_H
|
2015-01-22 03:40:55 +00:00
|
|
|
# define HEADER_RAND_LCL_H
|
2000-07-19 21:43:23 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
# define ENTROPY_NEEDED 32 /* require 256 bits = 32 bytes of randomness */
|
2000-07-19 21:43:23 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
# if !defined(USE_MD5_RAND) && !defined(USE_SHA1_RAND) && !defined(USE_MDC2_RAND) && !defined(USE_MD2_RAND)
|
2015-01-27 17:34:45 +00:00
|
|
|
# define USE_SHA1_RAND
|
2015-01-22 03:40:55 +00:00
|
|
|
# endif
|
2000-07-19 21:43:23 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
# include <openssl/evp.h>
|
|
|
|
# define MD_Update(a,b,c) EVP_DigestUpdate(a,b,c)
|
|
|
|
# define MD_Final(a,b) EVP_DigestFinal_ex(a,b,NULL)
|
|
|
|
# if defined(USE_MD5_RAND)
|
|
|
|
# include <openssl/md5.h>
|
|
|
|
# define MD_DIGEST_LENGTH MD5_DIGEST_LENGTH
|
|
|
|
# define MD_Init(a) EVP_DigestInit_ex(a,EVP_md5(), NULL)
|
|
|
|
# define MD(a,b,c) EVP_Digest(a,b,c,NULL,EVP_md5(), NULL)
|
|
|
|
# elif defined(USE_SHA1_RAND)
|
|
|
|
# include <openssl/sha.h>
|
|
|
|
# define MD_DIGEST_LENGTH SHA_DIGEST_LENGTH
|
|
|
|
# define MD_Init(a) EVP_DigestInit_ex(a,EVP_sha1(), NULL)
|
|
|
|
# define MD(a,b,c) EVP_Digest(a,b,c,NULL,EVP_sha1(), NULL)
|
|
|
|
# elif defined(USE_MDC2_RAND)
|
|
|
|
# include <openssl/mdc2.h>
|
|
|
|
# define MD_DIGEST_LENGTH MDC2_DIGEST_LENGTH
|
|
|
|
# define MD_Init(a) EVP_DigestInit_ex(a,EVP_mdc2(), NULL)
|
|
|
|
# define MD(a,b,c) EVP_Digest(a,b,c,NULL,EVP_mdc2(), NULL)
|
|
|
|
# elif defined(USE_MD2_RAND)
|
|
|
|
# include <openssl/md2.h>
|
|
|
|
# define MD_DIGEST_LENGTH MD2_DIGEST_LENGTH
|
|
|
|
# define MD_Init(a) EVP_DigestInit_ex(a,EVP_md2(), NULL)
|
|
|
|
# define MD(a,b,c) EVP_Digest(a,b,c,NULL,EVP_md2(), NULL)
|
|
|
|
# endif
|
2000-07-19 21:43:23 +00:00
|
|
|
|
2013-12-25 15:00:39 +00:00
|
|
|
void rand_hw_xor(unsigned char *buf, size_t num);
|
2000-07-19 21:43:23 +00:00
|
|
|
|
|
|
|
#endif
|