diff options
author | beck <> | 2002-05-15 02:29:21 +0000 |
---|---|---|
committer | beck <> | 2002-05-15 02:29:21 +0000 |
commit | b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9 (patch) | |
tree | fa27cf82a1250b64ed3bf5f4a18c7354d470bbcc /src/lib/libcrypto/rand/rand_lcl.h | |
parent | e471e1ea98d673597b182ea85f29e30c97cd08b5 (diff) | |
download | openbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.tar.gz openbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.tar.bz2 openbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.zip |
OpenSSL 0.9.7 stable 2002 05 08 merge
Diffstat (limited to 'src/lib/libcrypto/rand/rand_lcl.h')
-rw-r--r-- | src/lib/libcrypto/rand/rand_lcl.h | 60 |
1 files changed, 17 insertions, 43 deletions
diff --git a/src/lib/libcrypto/rand/rand_lcl.h b/src/lib/libcrypto/rand/rand_lcl.h index 120e9366d2..618a8ec899 100644 --- a/src/lib/libcrypto/rand/rand_lcl.h +++ b/src/lib/libcrypto/rand/rand_lcl.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* crypto/rand/md_rand.c */ | 1 | /* crypto/rand/rand_lcl.h */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -112,72 +112,46 @@ | |||
112 | #ifndef HEADER_RAND_LCL_H | 112 | #ifndef HEADER_RAND_LCL_H |
113 | #define HEADER_RAND_LCL_H | 113 | #define HEADER_RAND_LCL_H |
114 | 114 | ||
115 | #define ENTROPY_NEEDED 20 /* require 160 bits = 20 bytes of randomness */ | 115 | #define ENTROPY_NEEDED 32 /* require 256 bits = 32 bytes of randomness */ |
116 | 116 | ||
117 | 117 | ||
118 | #if !defined(USE_MD5_RAND) && !defined(USE_SHA1_RAND) && !defined(USE_MDC2_RAND) && !defined(USE_MD2_RAND) | 118 | #if !defined(USE_MD5_RAND) && !defined(USE_SHA1_RAND) && !defined(USE_MDC2_RAND) && !defined(USE_MD2_RAND) |
119 | #if !defined(NO_SHA) && !defined(NO_SHA1) | 119 | #if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1) |
120 | #define USE_SHA1_RAND | 120 | #define USE_SHA1_RAND |
121 | #elif !defined(NO_MD5) | 121 | #elif !defined(OPENSSL_NO_MD5) |
122 | #define USE_MD5_RAND | 122 | #define USE_MD5_RAND |
123 | #elif !defined(NO_MDC2) && !defined(NO_DES) | 123 | #elif !defined(OPENSSL_NO_MDC2) && !defined(OPENSSL_NO_DES) |
124 | #define USE_MDC2_RAND | 124 | #define USE_MDC2_RAND |
125 | #elif !defined(NO_MD2) | 125 | #elif !defined(OPENSSL_NO_MD2) |
126 | #define USE_MD2_RAND | 126 | #define USE_MD2_RAND |
127 | #else | 127 | #else |
128 | #error No message digest algorithm available | 128 | #error No message digest algorithm available |
129 | #endif | 129 | #endif |
130 | #endif | 130 | #endif |
131 | 131 | ||
132 | #include <openssl/evp.h> | ||
133 | #define MD_Update(a,b,c) EVP_DigestUpdate(a,b,c) | ||
134 | #define MD_Final(a,b) EVP_DigestFinal_ex(a,b,NULL) | ||
132 | #if defined(USE_MD5_RAND) | 135 | #if defined(USE_MD5_RAND) |
133 | #include <openssl/md5.h> | 136 | #include <openssl/md5.h> |
134 | #define MD_DIGEST_LENGTH MD5_DIGEST_LENGTH | 137 | #define MD_DIGEST_LENGTH MD5_DIGEST_LENGTH |
135 | #define MD(a,b,c) MD5(a,b,c) | 138 | #define MD_Init(a) EVP_DigestInit_ex(a,EVP_md5(), NULL) |
139 | #define MD(a,b,c) EVP_Digest(a,b,c,NULL,EVP_md5(), NULL) | ||
136 | #elif defined(USE_SHA1_RAND) | 140 | #elif defined(USE_SHA1_RAND) |
137 | #include <openssl/sha.h> | 141 | #include <openssl/sha.h> |
138 | #define MD_DIGEST_LENGTH SHA_DIGEST_LENGTH | 142 | #define MD_DIGEST_LENGTH SHA_DIGEST_LENGTH |
139 | #define MD(a,b,c) SHA1(a,b,c) | 143 | #define MD_Init(a) EVP_DigestInit_ex(a,EVP_sha1(), NULL) |
144 | #define MD(a,b,c) EVP_Digest(a,b,c,NULL,EVP_sha1(), NULL) | ||
140 | #elif defined(USE_MDC2_RAND) | 145 | #elif defined(USE_MDC2_RAND) |
141 | #include <openssl/mdc2.h> | 146 | #include <openssl/mdc2.h> |
142 | #define MD_DIGEST_LENGTH MDC2_DIGEST_LENGTH | 147 | #define MD_DIGEST_LENGTH MDC2_DIGEST_LENGTH |
143 | #define MD(a,b,c) MDC2(a,b,c) | 148 | #define MD_Init(a) EVP_DigestInit_ex(a,EVP_mdc2(), NULL) |
149 | #define MD(a,b,c) EVP_Digest(a,b,c,NULL,EVP_mdc2(), NULL) | ||
144 | #elif defined(USE_MD2_RAND) | 150 | #elif defined(USE_MD2_RAND) |
145 | #include <openssl/md2.h> | 151 | #include <openssl/md2.h> |
146 | #define MD_DIGEST_LENGTH MD2_DIGEST_LENGTH | 152 | #define MD_DIGEST_LENGTH MD2_DIGEST_LENGTH |
147 | #define MD(a,b,c) MD2(a,b,c) | 153 | #define MD_Init(a) EVP_DigestInit_ex(a,EVP_md2(), NULL) |
148 | #endif | 154 | #define MD(a,b,c) EVP_Digest(a,b,c,NULL,EVP_md2(), NULL) |
149 | #if defined(USE_MD5_RAND) | ||
150 | #include <openssl/md5.h> | ||
151 | #define MD_DIGEST_LENGTH MD5_DIGEST_LENGTH | ||
152 | #define MD_CTX MD5_CTX | ||
153 | #define MD_Init(a) MD5_Init(a) | ||
154 | #define MD_Update(a,b,c) MD5_Update(a,b,c) | ||
155 | #define MD_Final(a,b) MD5_Final(a,b) | ||
156 | #define MD(a,b,c) MD5(a,b,c) | ||
157 | #elif defined(USE_SHA1_RAND) | ||
158 | #include <openssl/sha.h> | ||
159 | #define MD_DIGEST_LENGTH SHA_DIGEST_LENGTH | ||
160 | #define MD_CTX SHA_CTX | ||
161 | #define MD_Init(a) SHA1_Init(a) | ||
162 | #define MD_Update(a,b,c) SHA1_Update(a,b,c) | ||
163 | #define MD_Final(a,b) SHA1_Final(a,b) | ||
164 | #define MD(a,b,c) SHA1(a,b,c) | ||
165 | #elif defined(USE_MDC2_RAND) | ||
166 | #include <openssl/mdc2.h> | ||
167 | #define MD_DIGEST_LENGTH MDC2_DIGEST_LENGTH | ||
168 | #define MD_CTX MDC2_CTX | ||
169 | #define MD_Init(a) MDC2_Init(a) | ||
170 | #define MD_Update(a,b,c) MDC2_Update(a,b,c) | ||
171 | #define MD_Final(a,b) MDC2_Final(a,b) | ||
172 | #define MD(a,b,c) MDC2(a,b,c) | ||
173 | #elif defined(USE_MD2_RAND) | ||
174 | #include <openssl/md2.h> | ||
175 | #define MD_DIGEST_LENGTH MD2_DIGEST_LENGTH | ||
176 | #define MD_CTX MD2_CTX | ||
177 | #define MD_Init(a) MD2_Init(a) | ||
178 | #define MD_Update(a,b,c) MD2_Update(a,b,c) | ||
179 | #define MD_Final(a,b) MD2_Final(a,b) | ||
180 | #define MD(a,b,c) MD2(a,b,c) | ||
181 | #endif | 155 | #endif |
182 | 156 | ||
183 | 157 | ||