2016-05-18 02:52:22 +08:00
|
|
|
/*
|
|
|
|
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
2000-07-20 05:43:23 +08:00
|
|
|
*
|
2016-05-18 02:52:22 +08: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-20 05:43:23 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HEADER_RAND_LCL_H
|
2015-01-22 11:40:55 +08:00
|
|
|
# define HEADER_RAND_LCL_H
|
2000-07-20 05:43:23 +08:00
|
|
|
|
2015-01-22 11:40:55 +08:00
|
|
|
# define ENTROPY_NEEDED 32 /* require 256 bits = 32 bytes of randomness */
|
2000-07-20 05:43:23 +08:00
|
|
|
|
2015-01-22 11:40:55 +08:00
|
|
|
# if !defined(USE_MD5_RAND) && !defined(USE_SHA1_RAND) && !defined(USE_MDC2_RAND) && !defined(USE_MD2_RAND)
|
2015-01-28 01:34:45 +08:00
|
|
|
# define USE_SHA1_RAND
|
2015-01-22 11:40:55 +08:00
|
|
|
# endif
|
2000-07-20 05:43:23 +08:00
|
|
|
|
2015-01-22 11:40:55 +08: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-20 05:43:23 +08:00
|
|
|
|
2013-12-25 23:00:39 +08:00
|
|
|
void rand_hw_xor(unsigned char *buf, size_t num);
|
2000-07-20 05:43:23 +08:00
|
|
|
|
|
|
|
#endif
|