aboutsummaryrefslogtreecommitdiff
path: root/crypto/rand/md_rand.c
diff options
context:
space:
mode:
authorBen Laurie <ben@openssl.org>2001-07-30 23:57:25 +0000
committerBen Laurie <ben@openssl.org>2001-07-30 23:57:25 +0000
commitdbad169019598981174ff46c7a9bf58373b0e53a (patch)
treece8ca1188d5614648f24b03967785543f1edc8f5 /crypto/rand/md_rand.c
parent3ba5d1cf2eb6ef28ac5f6d9f3d28020d00c5be50 (diff)
downloadopenssl-dbad169019598981174ff46c7a9bf58373b0e53a.zip
openssl-dbad169019598981174ff46c7a9bf58373b0e53a.tar.gz
openssl-dbad169019598981174ff46c7a9bf58373b0e53a.tar.bz2
Really add the EVP and all of the DES changes.
Diffstat (limited to 'crypto/rand/md_rand.c')
-rw-r--r--crypto/rand/md_rand.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/crypto/rand/md_rand.c b/crypto/rand/md_rand.c
index 6d7f37e..841631d 100644
--- a/crypto/rand/md_rand.c
+++ b/crypto/rand/md_rand.c
@@ -192,7 +192,7 @@ static void ssleay_rand_add(const void *buf, int num, double add)
int i,j,k,st_idx;
long md_c[2];
unsigned char local_md[MD_DIGEST_LENGTH];
- MD_CTX m;
+ EVP_MD_CTX m;
int do_not_lock;
/*
@@ -254,6 +254,7 @@ static void ssleay_rand_add(const void *buf, int num, double add)
if (!do_not_lock) CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
+ EVP_MD_CTX_init(&m);
for (i=0; i<num; i+=MD_DIGEST_LENGTH)
{
j=(num-i);
@@ -292,7 +293,7 @@ static void ssleay_rand_add(const void *buf, int num, double add)
st_idx=0;
}
}
- memset((char *)&m,0,sizeof(m));
+ EVP_MD_CTX_cleanup(&m);
if (!do_not_lock) CRYPTO_w_lock(CRYPTO_LOCK_RAND);
/* Don't just copy back local_md into md -- this could mean that
@@ -325,7 +326,7 @@ static int ssleay_rand_bytes(unsigned char *buf, int num)
int ok;
long md_c[2];
unsigned char local_md[MD_DIGEST_LENGTH];
- MD_CTX m;
+ EVP_MD_CTX m;
#ifndef GETPID_IS_MEANINGLESS
pid_t curr_pid = getpid();
#endif
@@ -344,7 +345,8 @@ static int ssleay_rand_bytes(unsigned char *buf, int num)
if (num <= 0)
return 1;
-
+
+ EVP_MD_CTX_init(&m);
/* round upwards to multiple of MD_DIGEST_LENGTH/2 */
num_ceil = (1 + (num-1)/(MD_DIGEST_LENGTH/2)) * (MD_DIGEST_LENGTH/2);
@@ -493,7 +495,7 @@ static int ssleay_rand_bytes(unsigned char *buf, int num)
MD_Final(&m,md);
CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
- memset(&m,0,sizeof(m));
+ EVP_MD_CTX_cleanup(&m);
if (ok)
return(1);
else