From d02f751ce1d13183a0c0e5528ec89f76587ed989 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ulf=20M=C3=B6ller?= Date: Tue, 27 Apr 1999 04:18:53 +0000 Subject: [PATCH] Message digest stuff. --- crypto/dsa/dsa_gen.c | 3 ++- crypto/dsa/dsa_key.c | 3 ++- crypto/evp/e_cbc_3d.c | 2 ++ crypto/evp/e_cbc_d.c | 2 ++ crypto/evp/e_cfb_3d.c | 2 ++ crypto/evp/e_cfb_d.c | 2 ++ crypto/evp/e_ecb_3d.c | 2 ++ crypto/evp/e_ecb_d.c | 2 ++ crypto/evp/e_ofb_3d.c | 2 ++ crypto/evp/e_ofb_d.c | 2 ++ crypto/evp/e_xcbc_d.c | 2 ++ crypto/evp/evp_key.c | 2 +- crypto/evp/m_dss.c | 3 ++- crypto/evp/m_dss1.c | 2 ++ crypto/evp/m_md2.c | 3 ++- crypto/evp/m_md5.c | 2 ++ crypto/evp/m_mdc2.c | 2 ++ crypto/evp/m_sha.c | 3 ++- crypto/evp/m_sha1.c | 2 ++ crypto/rand/Makefile.ssl | 4 ++-- crypto/rand/md_rand.c | 10 +++++----- crypto/rsa/rsa_oaep.c | 2 +- crypto/sha/sha.h | 8 ++++---- crypto/sha/sha1_one.c | 2 +- crypto/sha/sha1dgst.c | 2 +- crypto/sha/sha_dgst.c | 3 ++- crypto/sha/sha_one.c | 2 +- ssl/s2_lib.c | 1 + ssl/s3_clnt.c | 2 ++ ssl/s3_enc.c | 2 ++ ssl/s3_lib.c | 2 ++ ssl/s3_srvr.c | 2 ++ ssl/ssl_algs.c | 4 ++-- ssl/t1_enc.c | 2 ++ 34 files changed, 67 insertions(+), 24 deletions(-) diff --git a/crypto/dsa/dsa_gen.c b/crypto/dsa/dsa_gen.c index 9ea53d4420..c2661c1d0c 100644 --- a/crypto/dsa/dsa_gen.c +++ b/crypto/dsa/dsa_gen.c @@ -64,6 +64,7 @@ #define HASH SHA1 #endif +#ifndef NO_SHA #include #include #include "cryptlib.h" @@ -328,4 +329,4 @@ err: return(ok); } - +#endif diff --git a/crypto/dsa/dsa_key.c b/crypto/dsa/dsa_key.c index e974861c5c..ab7f38fc7c 100644 --- a/crypto/dsa/dsa_key.c +++ b/crypto/dsa/dsa_key.c @@ -56,6 +56,7 @@ * [including the GNU Public Licence.] */ +#ifndef NO_SHA #include #include #include "cryptlib.h" @@ -108,4 +109,4 @@ err: if (ctx != NULL) BN_CTX_free(ctx); return(ok); } - +#endif diff --git a/crypto/evp/e_cbc_3d.c b/crypto/evp/e_cbc_3d.c index 58a2276cb1..9b95554413 100644 --- a/crypto/evp/e_cbc_3d.c +++ b/crypto/evp/e_cbc_3d.c @@ -56,6 +56,7 @@ * [including the GNU Public Licence.] */ +#ifndef NO_DES #include #include "cryptlib.h" #include @@ -143,3 +144,4 @@ static void des_cbc_ede_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, &(ctx->iv[0]), ctx->encrypt); } +#endif diff --git a/crypto/evp/e_cbc_d.c b/crypto/evp/e_cbc_d.c index a20497a088..1507dbb68a 100644 --- a/crypto/evp/e_cbc_d.c +++ b/crypto/evp/e_cbc_d.c @@ -56,6 +56,7 @@ * [including the GNU Public Licence.] */ +#ifndef NO_DES #include #include "cryptlib.h" #include @@ -98,3 +99,4 @@ static void des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, { des_ncbc_encrypt(in,out,inl,ctx->c.des_ks,&(ctx->iv[0]),ctx->encrypt); } +#endif diff --git a/crypto/evp/e_cfb_3d.c b/crypto/evp/e_cfb_3d.c index 803bb47b15..7a6a65b29c 100644 --- a/crypto/evp/e_cfb_3d.c +++ b/crypto/evp/e_cfb_3d.c @@ -56,6 +56,7 @@ * [including the GNU Public Licence.] */ +#ifndef NO_DES #include #include "cryptlib.h" #include @@ -146,3 +147,4 @@ static void des_ede_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, ctx->c.des_ede.ks3, &(ctx->iv[0]),&ctx->num,ctx->encrypt); } +#endif diff --git a/crypto/evp/e_cfb_d.c b/crypto/evp/e_cfb_d.c index 59ae819ff7..8b77430157 100644 --- a/crypto/evp/e_cfb_d.c +++ b/crypto/evp/e_cfb_d.c @@ -61,6 +61,7 @@ #include #include +#ifndef NO_DES static void des_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void des_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, @@ -104,3 +105,4 @@ static void des_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, &(ctx->iv[0]), &ctx->num,ctx->encrypt); } +#endif diff --git a/crypto/evp/e_ecb_3d.c b/crypto/evp/e_ecb_3d.c index a6db81539d..7bceceeb6c 100644 --- a/crypto/evp/e_ecb_3d.c +++ b/crypto/evp/e_ecb_3d.c @@ -56,6 +56,7 @@ * [including the GNU Public Licence.] */ +#ifndef NO_DES #include #include "cryptlib.h" #include @@ -142,3 +143,4 @@ static void des_ede_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, ctx->encrypt); } } +#endif diff --git a/crypto/evp/e_ecb_d.c b/crypto/evp/e_ecb_d.c index 2c9f8e384f..3496ca5180 100644 --- a/crypto/evp/e_ecb_d.c +++ b/crypto/evp/e_ecb_d.c @@ -56,6 +56,7 @@ * [including the GNU Public Licence.] */ +#ifndef NO_DES #include #include "cryptlib.h" #include @@ -102,3 +103,4 @@ static void des_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, des_ecb_encrypt(&(in[i]),&(out[i]),ctx->c.des_ks,ctx->encrypt); } } +#endif diff --git a/crypto/evp/e_ofb_3d.c b/crypto/evp/e_ofb_3d.c index e0ea647d21..dba58c118a 100644 --- a/crypto/evp/e_ofb_3d.c +++ b/crypto/evp/e_ofb_3d.c @@ -56,6 +56,7 @@ * [including the GNU Public Licence.] */ +#ifndef NO_DES #include #include "cryptlib.h" #include @@ -144,3 +145,4 @@ static void des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, ctx->c.des_ede.ks2, ctx->c.des_ede.ks3, &(ctx->iv[0]),&ctx->num); } +#endif diff --git a/crypto/evp/e_ofb_d.c b/crypto/evp/e_ofb_d.c index f91e93e8e3..fd75b7344d 100644 --- a/crypto/evp/e_ofb_d.c +++ b/crypto/evp/e_ofb_d.c @@ -56,6 +56,7 @@ * [including the GNU Public Licence.] */ +#ifndef NO_DES #include #include "cryptlib.h" #include @@ -100,3 +101,4 @@ static void des_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, { des_ofb64_encrypt(in,out,inl,ctx->c.des_ks,&(ctx->iv[0]),&ctx->num); } +#endif diff --git a/crypto/evp/e_xcbc_d.c b/crypto/evp/e_xcbc_d.c index 01e15ae0ee..3238de021d 100644 --- a/crypto/evp/e_xcbc_d.c +++ b/crypto/evp/e_xcbc_d.c @@ -56,6 +56,7 @@ * [including the GNU Public Licence.] */ +#ifndef NO_DES #include #include "cryptlib.h" #include @@ -106,3 +107,4 @@ static void desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, &(ctx->c.desx_cbc.outw[0]), ctx->encrypt); } +#endif diff --git a/crypto/evp/evp_key.c b/crypto/evp/evp_key.c index 28398bcba4..21eda418bc 100644 --- a/crypto/evp/evp_key.c +++ b/crypto/evp/evp_key.c @@ -82,7 +82,7 @@ char *EVP_get_pw_prompt(void) } #ifdef NO_DES -int des_read_pw_string(char *buf,int len,char *prompt,int verify); +int des_read_pw_string(char *buf,int len,const char *prompt,int verify); #endif int EVP_read_pw_string(char *buf, int len, const char *prompt, int verify) diff --git a/crypto/evp/m_dss.c b/crypto/evp/m_dss.c index 356b936a1c..8ea826868e 100644 --- a/crypto/evp/m_dss.c +++ b/crypto/evp/m_dss.c @@ -62,6 +62,7 @@ #include #include +#ifndef NO_SHA static EVP_MD dsa_md= { NID_dsaWithSHA, @@ -79,4 +80,4 @@ EVP_MD *EVP_dss(void) { return(&dsa_md); } - +#endif diff --git a/crypto/evp/m_dss1.c b/crypto/evp/m_dss1.c index 4315086abe..9d8d1ce23e 100644 --- a/crypto/evp/m_dss1.c +++ b/crypto/evp/m_dss1.c @@ -56,6 +56,7 @@ * [including the GNU Public Licence.] */ +#ifndef NO_SHA #include #include "cryptlib.h" #include @@ -79,3 +80,4 @@ EVP_MD *EVP_dss1(void) { return(&dss1_md); } +#endif diff --git a/crypto/evp/m_md2.c b/crypto/evp/m_md2.c index 4b84238283..3281e91809 100644 --- a/crypto/evp/m_md2.c +++ b/crypto/evp/m_md2.c @@ -56,6 +56,7 @@ * [including the GNU Public Licence.] */ +#ifndef NO_MD2 #include #include "cryptlib.h" #include @@ -79,4 +80,4 @@ EVP_MD *EVP_md2(void) { return(&md2_md); } - +#endif diff --git a/crypto/evp/m_md5.c b/crypto/evp/m_md5.c index 18531b67a0..9fc9530127 100644 --- a/crypto/evp/m_md5.c +++ b/crypto/evp/m_md5.c @@ -56,6 +56,7 @@ * [including the GNU Public Licence.] */ +#ifndef NO_MD5 #include #include "cryptlib.h" #include @@ -79,3 +80,4 @@ EVP_MD *EVP_md5(void) { return(&md5_md); } +#endif diff --git a/crypto/evp/m_mdc2.c b/crypto/evp/m_mdc2.c index 2e5962860e..2c7f1ae515 100644 --- a/crypto/evp/m_mdc2.c +++ b/crypto/evp/m_mdc2.c @@ -56,6 +56,7 @@ * [including the GNU Public Licence.] */ +#ifndef NO_MDC2 #include #include "cryptlib.h" #include @@ -79,3 +80,4 @@ EVP_MD *EVP_mdc2(void) { return(&mdc2_md); } +#endif diff --git a/crypto/evp/m_sha.c b/crypto/evp/m_sha.c index 8213c36480..6d35b71b85 100644 --- a/crypto/evp/m_sha.c +++ b/crypto/evp/m_sha.c @@ -56,6 +56,7 @@ * [including the GNU Public Licence.] */ +#ifndef NO_SHA #include #include "cryptlib.h" #include @@ -79,4 +80,4 @@ EVP_MD *EVP_sha(void) { return(&sha_md); } - +#endif diff --git a/crypto/evp/m_sha1.c b/crypto/evp/m_sha1.c index 5d5480659d..57a1ab0cce 100644 --- a/crypto/evp/m_sha1.c +++ b/crypto/evp/m_sha1.c @@ -56,6 +56,7 @@ * [including the GNU Public Licence.] */ +#ifndef NO_SHA #include #include "cryptlib.h" #include @@ -79,3 +80,4 @@ EVP_MD *EVP_sha1(void) { return(&sha1_md); } +#endif diff --git a/crypto/rand/Makefile.ssl b/crypto/rand/Makefile.ssl index 17591e0bb8..e78d5850df 100644 --- a/crypto/rand/Makefile.ssl +++ b/crypto/rand/Makefile.ssl @@ -77,7 +77,7 @@ clean: # DO NOT DELETE THIS LINE -- make depend depends on it. md_rand.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h -md_rand.o: ../../include/openssl/md5.h ../../include/openssl/opensslv.h -md_rand.o: ../../include/openssl/rand.h ../../include/openssl/stack.h +md_rand.o: ../../include/openssl/opensslv.h ../../include/openssl/rand.h +md_rand.o: ../../include/openssl/sha.h ../../include/openssl/stack.h rand_lib.o: ../../include/openssl/rand.h randfile.o: ../../include/openssl/e_os.h ../../include/openssl/rand.h diff --git a/crypto/rand/md_rand.c b/crypto/rand/md_rand.c index ab7e41c8ec..8ab86080ad 100644 --- a/crypto/rand/md_rand.c +++ b/crypto/rand/md_rand.c @@ -64,16 +64,16 @@ #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 diff --git a/crypto/rsa/rsa_oaep.c b/crypto/rsa/rsa_oaep.c index e3c7444ac4..5637a31ce8 100644 --- a/crypto/rsa/rsa_oaep.c +++ b/crypto/rsa/rsa_oaep.c @@ -4,7 +4,7 @@ /* EME_OAEP as defined in RFC 2437 (PKCS #1 v2.0) */ -#ifndef NO_SHA +#if !defined(NO_SHA) && !defined(NO_SHA1) #include #include "cryptlib.h" #include diff --git a/crypto/sha/sha.h b/crypto/sha/sha.h index 105d4c8575..ba40aafc13 100644 --- a/crypto/sha/sha.h +++ b/crypto/sha/sha.h @@ -90,16 +90,16 @@ typedef struct SHAstate_st #ifndef NO_SHA0 void SHA_Init(SHA_CTX *c); -void SHA_Update(SHA_CTX *c, unsigned char *data, unsigned long len); +void SHA_Update(SHA_CTX *c, const unsigned char *data, unsigned long len); void SHA_Final(unsigned char *md, SHA_CTX *c); -unsigned char *SHA(unsigned char *d, unsigned long n,unsigned char *md); +unsigned char *SHA(const unsigned char *d, unsigned long n,unsigned char *md); void SHA_Transform(SHA_CTX *c, unsigned char *data); #endif #ifndef NO_SHA1 void SHA1_Init(SHA_CTX *c); -void SHA1_Update(SHA_CTX *c, unsigned char *data, unsigned long len); +void SHA1_Update(SHA_CTX *c, const unsigned char *data, unsigned long len); void SHA1_Final(unsigned char *md, SHA_CTX *c); -unsigned char *SHA1(unsigned char *d, unsigned long n,unsigned char *md); +unsigned char *SHA1(const unsigned char *d, unsigned long n,unsigned char *md); void SHA1_Transform(SHA_CTX *c, unsigned char *data); #endif #ifdef __cplusplus diff --git a/crypto/sha/sha1_one.c b/crypto/sha/sha1_one.c index 864e2a89cb..861752eaa7 100644 --- a/crypto/sha/sha1_one.c +++ b/crypto/sha/sha1_one.c @@ -61,7 +61,7 @@ #include #ifndef NO_SHA1 -unsigned char *SHA1(unsigned char *d, unsigned long n, unsigned char *md) +unsigned char *SHA1(const unsigned char *d, unsigned long n, unsigned char *md) { SHA_CTX c; static unsigned char m[SHA_DIGEST_LENGTH]; diff --git a/crypto/sha/sha1dgst.c b/crypto/sha/sha1dgst.c index 532f53baa4..f4a47f3768 100644 --- a/crypto/sha/sha1dgst.c +++ b/crypto/sha/sha1dgst.c @@ -114,7 +114,7 @@ void SHA1_Init(SHA_CTX *c) c->num=0; } -void SHA1_Update(SHA_CTX *c, register unsigned char *data, +void SHA1_Update(SHA_CTX *c, const register unsigned char *data, unsigned long len) { register SHA_LONG *p; diff --git a/crypto/sha/sha_dgst.c b/crypto/sha/sha_dgst.c index e75c66c220..5827c73cea 100644 --- a/crypto/sha/sha_dgst.c +++ b/crypto/sha/sha_dgst.c @@ -100,7 +100,8 @@ void SHA_Init(SHA_CTX *c) c->num=0; } -void SHA_Update(SHA_CTX *c, register unsigned char *data, unsigned long len) +void SHA_Update(SHA_CTX *c, const register unsigned char *data, + unsigned long len) { register SHA_LONG *p; int ew,ec,sw,sc; diff --git a/crypto/sha/sha_one.c b/crypto/sha/sha_one.c index 6ef3f06a37..2d955de162 100644 --- a/crypto/sha/sha_one.c +++ b/crypto/sha/sha_one.c @@ -61,7 +61,7 @@ #include #ifndef NO_SHA0 -unsigned char *SHA(unsigned char *d, unsigned long n, unsigned char *md) +unsigned char *SHA(const unsigned char *d, unsigned long n, unsigned char *md) { SHA_CTX c; static unsigned char m[SHA_DIGEST_LENGTH]; diff --git a/ssl/s2_lib.c b/ssl/s2_lib.c index e56901bacf..39ab1b6c75 100644 --- a/ssl/s2_lib.c +++ b/ssl/s2_lib.c @@ -60,6 +60,7 @@ #include #include #include +#include #include "ssl_locl.h" static long ssl2_default_timeout(void ); diff --git a/ssl/s3_clnt.c b/ssl/s3_clnt.c index 327c4dd134..e0871c47ef 100644 --- a/ssl/s3_clnt.c +++ b/ssl/s3_clnt.c @@ -60,6 +60,8 @@ #include #include #include +#include +#include #include #include "ssl_locl.h" diff --git a/ssl/s3_enc.c b/ssl/s3_enc.c index 2113ff3250..3ef8676c34 100644 --- a/ssl/s3_enc.c +++ b/ssl/s3_enc.c @@ -57,6 +57,8 @@ */ #include +#include +#include #include #include "ssl_locl.h" diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c index d21772ec93..c41e2548bd 100644 --- a/ssl/s3_lib.c +++ b/ssl/s3_lib.c @@ -57,6 +57,8 @@ */ #include +#include +#include #include #include "ssl_locl.h" diff --git a/ssl/s3_srvr.c b/ssl/s3_srvr.c index 0379cc58c5..154b6ada34 100644 --- a/ssl/s3_srvr.c +++ b/ssl/s3_srvr.c @@ -62,6 +62,8 @@ #include #include #include +#include +#include #include #include #include "ssl_locl.h" diff --git a/ssl/ssl_algs.c b/ssl/ssl_algs.c index 6e198ecac5..726289ab74 100644 --- a/ssl/ssl_algs.c +++ b/ssl/ssl_algs.c @@ -85,11 +85,11 @@ int SSL_library_init(void) EVP_add_digest_alias(SN_md5,"ssl2-md5"); EVP_add_digest_alias(SN_md5,"ssl3-md5"); #endif -#ifndef NO_SHA1 +#ifndef NO_SHA EVP_add_digest(EVP_sha1()); /* RSA with sha1 */ EVP_add_digest_alias(SN_sha1,"ssl3-sha1"); #endif -#if !defined(NO_SHA1) && !defined(NO_DSA) +#if !defined(NO_SHA) && !defined(NO_DSA) EVP_add_digest(EVP_dss1()); /* DSA with sha1 */ #endif diff --git a/ssl/t1_enc.c b/ssl/t1_enc.c index 05a3382af9..914b743498 100644 --- a/ssl/t1_enc.c +++ b/ssl/t1_enc.c @@ -58,6 +58,8 @@ #include #include +#include +#include #include #include #include "ssl_locl.h" -- 2.25.1