X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Frand%2Fmd_rand.c;h=8ab86080adcb347bb0431678a8ef99eee69e908e;hb=d575d2924cf2ba202ccc0378ba646eec8fc8b5a0;hp=c52d89babb0a95914aa7d2c3568b043885f2e843;hpb=a224de3f5d017526c06bf869a5b8208c7768a80c;p=oweals%2Fopenssl.git diff --git a/crypto/rand/md_rand.c b/crypto/rand/md_rand.c index c52d89babb..8ab86080ad 100644 --- a/crypto/rand/md_rand.c +++ b/crypto/rand/md_rand.c @@ -60,20 +60,20 @@ #include #include #include -#include "e_os.h" -#include "crypto.h" +#include +#include #if !defined(USE_MD5_RAND) && !defined(USE_SHA1_RAND) && !defined(USE_MDC2_RAND) && !defined(USE_MD2_RAND) -#ifndef NO_MD5 -#define USE_MD5_RAND -#elif !defined(NO_SHA1) +#if !defined(NO_SHA) && !defined(NO_SHA1) #define USE_SHA1_RAND -#elif !defined(NO_MDC2) +#elif !defined(NO_MD5) +#define USE_MD5_RAND +#elif !defined(NO_MDC2) && !defined(NO_DES) #define USE_MDC2_RAND #elif !defined(NO_MD2) #define USE_MD2_RAND #else -We need a message digest of some type +#error No message digest algorithm available #endif #endif @@ -84,7 +84,7 @@ We need a message digest of some type */ #if defined(USE_MD5_RAND) -#include "md5.h" +#include #define MD_DIGEST_LENGTH MD5_DIGEST_LENGTH #define MD_CTX MD5_CTX #define MD_Init(a) MD5_Init(a) @@ -92,7 +92,7 @@ We need a message digest of some type #define MD_Final(a,b) MD5_Final(a,b) #define MD(a,b,c) MD5(a,b,c) #elif defined(USE_SHA1_RAND) -#include "sha.h" +#include #define MD_DIGEST_LENGTH SHA_DIGEST_LENGTH #define MD_CTX SHA_CTX #define MD_Init(a) SHA1_Init(a) @@ -100,7 +100,7 @@ We need a message digest of some type #define MD_Final(a,b) SHA1_Final(a,b) #define MD(a,b,c) SHA1(a,b,c) #elif defined(USE_MDC2_RAND) -#include "mdc2.h" +#include #define MD_DIGEST_LENGTH MDC2_DIGEST_LENGTH #define MD_CTX MDC2_CTX #define MD_Init(a) MDC2_Init(a) @@ -108,7 +108,7 @@ We need a message digest of some type #define MD_Final(a,b) MDC2_Final(a,b) #define MD(a,b,c) MDC2(a,b,c) #elif defined(USE_MD2_RAND) -#include "md2.h" +#include #define MD_DIGEST_LENGTH MD2_DIGEST_LENGTH #define MD_CTX MD2_CTX #define MD_Init(a) MD2_Init(a) @@ -117,7 +117,7 @@ We need a message digest of some type #define MD(a,b,c) MD2(a,b,c) #endif -#include "rand.h" +#include /* #define NORAND 1 */ /* #define PREDICT 1 */ @@ -128,10 +128,10 @@ static unsigned char state[STATE_SIZE+MD_DIGEST_LENGTH]; static unsigned char md[MD_DIGEST_LENGTH]; static long md_count[2]={0,0}; -char *RAND_version="RAND part of OpenSSL 0.9.2 31-Dec-1998"; +const char *RAND_version="RAND" OPENSSL_VERSION_PTEXT; static void ssleay_rand_cleanup(void); -static void ssleay_rand_seed(unsigned char *buf, int num); +static void ssleay_rand_seed(const void *buf, int num); static void ssleay_rand_bytes(unsigned char *buf, int num); RAND_METHOD rand_ssleay_meth={ @@ -140,12 +140,12 @@ RAND_METHOD rand_ssleay_meth={ ssleay_rand_cleanup, }; -RAND_METHOD *RAND_SSLeay() +RAND_METHOD *RAND_SSLeay(void) { return(&rand_ssleay_meth); } -static void ssleay_rand_cleanup() +static void ssleay_rand_cleanup(void) { memset(state,0,sizeof(state)); state_num=0; @@ -155,9 +155,7 @@ static void ssleay_rand_cleanup() md_count[1]=0; } -static void ssleay_rand_seed(buf,num) -unsigned char *buf; -int num; +static void ssleay_rand_seed(const void *buf, int num) { int i,j,k,st_idx,st_num; MD_CTX m; @@ -204,7 +202,7 @@ int num; MD_Final(md,&m); md_count[1]++; - buf+=j; + buf=(const char *)buf + j; for (k=0; k -#include +#include /***************************************************************************** * Initialisation function for the SSL random generator. Takes the contents @@ -346,13 +342,13 @@ int num; * ; * the original copyright message is: * -// (C) Copyright Microsoft Corp. 1993. All rights reserved. -// -// You have a royalty-free right to use, modify, reproduce and -// distribute the Sample Files (and/or any modified version) in -// any way you find useful, provided that you agree that -// Microsoft has no warranty obligations or liability for any -// Sample Application Files which are modified. + * (C) Copyright Microsoft Corp. 1993. All rights reserved. + * + * You have a royalty-free right to use, modify, reproduce and + * distribute the Sample Files (and/or any modified version) in + * any way you find useful, provided that you agree that + * Microsoft has no warranty obligations or liability for any + * Sample Application Files which are modified. */ /* * I have modified the loading of bytes via RAND_seed() mechanism since