Message digest stuff.
authorUlf Möller <ulf@openssl.org>
Tue, 27 Apr 1999 04:18:53 +0000 (04:18 +0000)
committerUlf Möller <ulf@openssl.org>
Tue, 27 Apr 1999 04:18:53 +0000 (04:18 +0000)
34 files changed:
crypto/dsa/dsa_gen.c
crypto/dsa/dsa_key.c
crypto/evp/e_cbc_3d.c
crypto/evp/e_cbc_d.c
crypto/evp/e_cfb_3d.c
crypto/evp/e_cfb_d.c
crypto/evp/e_ecb_3d.c
crypto/evp/e_ecb_d.c
crypto/evp/e_ofb_3d.c
crypto/evp/e_ofb_d.c
crypto/evp/e_xcbc_d.c
crypto/evp/evp_key.c
crypto/evp/m_dss.c
crypto/evp/m_dss1.c
crypto/evp/m_md2.c
crypto/evp/m_md5.c
crypto/evp/m_mdc2.c
crypto/evp/m_sha.c
crypto/evp/m_sha1.c
crypto/rand/Makefile.ssl
crypto/rand/md_rand.c
crypto/rsa/rsa_oaep.c
crypto/sha/sha.h
crypto/sha/sha1_one.c
crypto/sha/sha1dgst.c
crypto/sha/sha_dgst.c
crypto/sha/sha_one.c
ssl/s2_lib.c
ssl/s3_clnt.c
ssl/s3_enc.c
ssl/s3_lib.c
ssl/s3_srvr.c
ssl/ssl_algs.c
ssl/t1_enc.c

index 9ea53d4420b9738109428ce1082634ee2f0a0793..c2661c1d0c19cf2dff16d054dad836c326c3dc5f 100644 (file)
@@ -64,6 +64,7 @@
 #define HASH    SHA1
 #endif 
 
+#ifndef NO_SHA
 #include <stdio.h>
 #include <time.h>
 #include "cryptlib.h"
@@ -328,4 +329,4 @@ err:
        
        return(ok);
        }
-
+#endif
index e974861c5c638bfe0caf1e78d1efebe7d8052b68..ab7f38fc7c6c0d211af12600bb2989743e02360c 100644 (file)
@@ -56,6 +56,7 @@
  * [including the GNU Public Licence.]
  */
 
+#ifndef NO_SHA
 #include <stdio.h>
 #include <time.h>
 #include "cryptlib.h"
@@ -108,4 +109,4 @@ err:
        if (ctx != NULL) BN_CTX_free(ctx);
        return(ok);
        }
-
+#endif
index 58a2276cb1d8f9b8aab1a10a83628f1e8435cee8..9b95554413cebd173229becb9ab3683c17231ca5 100644 (file)
@@ -56,6 +56,7 @@
  * [including the GNU Public Licence.]
  */
 
+#ifndef NO_DES
 #include <stdio.h>
 #include "cryptlib.h"
 #include <openssl/evp.h>
@@ -143,3 +144,4 @@ static void des_cbc_ede_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
                &(ctx->iv[0]),
                ctx->encrypt);
        }
+#endif
index a20497a088661b214f0d70a1af556c49fdffe77f..1507dbb68a157de71af4d4434b63778fbd2aacab 100644 (file)
@@ -56,6 +56,7 @@
  * [including the GNU Public Licence.]
  */
 
+#ifndef NO_DES
 #include <stdio.h>
 #include "cryptlib.h"
 #include <openssl/evp.h>
@@ -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
index 803bb47b154e3ccefa8531ba9eac8d5cfe1b0406..7a6a65b29c5cc546000db1188ee18812ff017f38 100644 (file)
@@ -56,6 +56,7 @@
  * [including the GNU Public Licence.]
  */
 
+#ifndef NO_DES
 #include <stdio.h>
 #include "cryptlib.h"
 #include <openssl/evp.h>
@@ -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
index 59ae819ff7b4904a983c798ed6791f1e6a11a7b4..8b774301577931ce834d7794e8ad5f63b1ee9dce 100644 (file)
@@ -61,6 +61,7 @@
 #include <openssl/evp.h>
 #include <openssl/objects.h>
 
+#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
index a6db81539dd805e1c128aaf21d4d84ab76091bf5..7bceceeb6c2f4e8a9003f7c918ce54cd28f0a55f 100644 (file)
@@ -56,6 +56,7 @@
  * [including the GNU Public Licence.]
  */
 
+#ifndef NO_DES
 #include <stdio.h>
 #include "cryptlib.h"
 #include <openssl/evp.h>
@@ -142,3 +143,4 @@ static void des_ede_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
                        ctx->encrypt);
                }
        }
+#endif
index 2c9f8e384f3949de4768f1a6f871a1b84f4cde63..3496ca5180dbeba641aa9449db53eae64479c334 100644 (file)
@@ -56,6 +56,7 @@
  * [including the GNU Public Licence.]
  */
 
+#ifndef NO_DES
 #include <stdio.h>
 #include "cryptlib.h"
 #include <openssl/evp.h>
@@ -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
index e0ea647d21c74bf5ddd338deec7066fcee7f3ac6..dba58c118af77815f2ae7f405ca5d3aa804b4b22 100644 (file)
@@ -56,6 +56,7 @@
  * [including the GNU Public Licence.]
  */
 
+#ifndef NO_DES
 #include <stdio.h>
 #include "cryptlib.h"
 #include <openssl/evp.h>
@@ -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
index f91e93e8e320813a29f6f231e9259691c7ac4293..fd75b7344d92fd8ef4ef6ac186b700cfeb9364d5 100644 (file)
@@ -56,6 +56,7 @@
  * [including the GNU Public Licence.]
  */
 
+#ifndef NO_DES
 #include <stdio.h>
 #include "cryptlib.h"
 #include <openssl/evp.h>
@@ -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
index 01e15ae0eee8346dcf64b3092b8ea198ca2513a4..3238de021d7c9ef5892550a08083733f66ce6dec 100644 (file)
@@ -56,6 +56,7 @@
  * [including the GNU Public Licence.]
  */
 
+#ifndef NO_DES
 #include <stdio.h>
 #include "cryptlib.h"
 #include <openssl/evp.h>
@@ -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
index 28398bcba46ba1c912b7ff4b3017535a64b595cf..21eda418bc9d1c2b71d661896c4f7c7ae44d7ac1 100644 (file)
@@ -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)
index 356b936a1c9c1815e3cb97afb710631b7aef811f..8ea826868eab319343872ee9d5cdb406fcd6a5d8 100644 (file)
@@ -62,6 +62,7 @@
 #include <openssl/objects.h>
 #include <openssl/x509.h>
 
+#ifndef NO_SHA
 static EVP_MD dsa_md=
        {
        NID_dsaWithSHA,
@@ -79,4 +80,4 @@ EVP_MD *EVP_dss(void)
        {
        return(&dsa_md);
        }
-
+#endif
index 4315086abe4d661294cc76abf8150d2bc18fe6ec..9d8d1ce23e3ef10f97e05d6b8b1131b974324610 100644 (file)
@@ -56,6 +56,7 @@
  * [including the GNU Public Licence.]
  */
 
+#ifndef NO_SHA
 #include <stdio.h>
 #include "cryptlib.h"
 #include <openssl/evp.h>
@@ -79,3 +80,4 @@ EVP_MD *EVP_dss1(void)
        {
        return(&dss1_md);
        }
+#endif
index 4b842382838b9a933c0dd2dc434d2693b2d2cfe7..3281e91809f41f75fcaf6f00263dd898e1478838 100644 (file)
@@ -56,6 +56,7 @@
  * [including the GNU Public Licence.]
  */
 
+#ifndef NO_MD2
 #include <stdio.h>
 #include "cryptlib.h"
 #include <openssl/evp.h>
@@ -79,4 +80,4 @@ EVP_MD *EVP_md2(void)
        {
        return(&md2_md);
        }
-
+#endif
index 18531b67a05485066fb57178dd1ae468827cb56e..9fc953012740774ba3dc02697661828b23b8158c 100644 (file)
@@ -56,6 +56,7 @@
  * [including the GNU Public Licence.]
  */
 
+#ifndef NO_MD5
 #include <stdio.h>
 #include "cryptlib.h"
 #include <openssl/evp.h>
@@ -79,3 +80,4 @@ EVP_MD *EVP_md5(void)
        {
        return(&md5_md);
        }
+#endif
index 2e5962860e35f89457ed770c65d4f0dc5509f7bb..2c7f1ae515a809051a000f85759b2c2c5851e8df 100644 (file)
@@ -56,6 +56,7 @@
  * [including the GNU Public Licence.]
  */
 
+#ifndef NO_MDC2
 #include <stdio.h>
 #include "cryptlib.h"
 #include <openssl/evp.h>
@@ -79,3 +80,4 @@ EVP_MD *EVP_mdc2(void)
        {
        return(&mdc2_md);
        }
+#endif
index 8213c36480ee83268ed154885c2e0dc91b199450..6d35b71b8506346419d09d80263c03936ad75a42 100644 (file)
@@ -56,6 +56,7 @@
  * [including the GNU Public Licence.]
  */
 
+#ifndef NO_SHA
 #include <stdio.h>
 #include "cryptlib.h"
 #include <openssl/evp.h>
@@ -79,4 +80,4 @@ EVP_MD *EVP_sha(void)
        {
        return(&sha_md);
        }
-
+#endif
index 5d5480659dcc0317590849f8fc480e9704581130..57a1ab0cceca5ab85d4f155d63689386c29bdeb4 100644 (file)
@@ -56,6 +56,7 @@
  * [including the GNU Public Licence.]
  */
 
+#ifndef NO_SHA
 #include <stdio.h>
 #include "cryptlib.h"
 #include <openssl/evp.h>
@@ -79,3 +80,4 @@ EVP_MD *EVP_sha1(void)
        {
        return(&sha1_md);
        }
+#endif
index 17591e0bb89490c4181c6d712de58a52e801b937..e78d5850df4f9f4169e10a8c3df2555f675817cb 100644 (file)
@@ -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
index ab7e41c8ec37ef285c4bbf122415e8fe8958ecc7..8ab86080adcb347bb0431678a8ef99eee69e908e 100644 (file)
 #include <openssl/crypto.h>
 
 #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
 
index e3c7444ac44b3ca1d8289252bd87715237c94e64..5637a31ce86ede3bee9799b2db4d4ce2cec1bc77 100644 (file)
@@ -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 <stdio.h>
 #include "cryptlib.h"
 #include <openssl/bn.h>
index 105d4c8575c12d62395fceda6b48249e33698f31..ba40aafc135b58368913c88a05b13fff17430c5b 100644 (file)
@@ -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
index 864e2a89cbd2af6a113cd94cd33322a2cc7d5887..861752eaa7ea5cd44dac52a434da44bd9c80b155 100644 (file)
@@ -61,7 +61,7 @@
 #include <openssl/sha.h>
 
 #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];
index 532f53baa4dab26fc5c52db14ff4bc6134344d96..f4a47f3768b860d54c78b260a357148a63ee5024 100644 (file)
@@ -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;
index e75c66c22045544999434a888c43e5aa623ff61c..5827c73ceab6ba53f156c01a8f530dd6ecb50c01 100644 (file)
@@ -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;
index 6ef3f06a37948d8d4bbb0864150adc9b004d218f..2d955de16286cef00bd576d1af11583c94050107 100644 (file)
@@ -61,7 +61,7 @@
 #include <openssl/sha.h>
 
 #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];
index e56901bacf14d59b04fa598461d4d87fa2db4533..39ab1b6c753220627d7a6eaafd56bbf29ea804a9 100644 (file)
@@ -60,6 +60,7 @@
 #include <stdio.h>
 #include <openssl/rsa.h>
 #include <openssl/objects.h>
+#include <openssl/md5.h>
 #include "ssl_locl.h"
 
 static long ssl2_default_timeout(void );
index 327c4dd134bbad7944abeef275bd273ceb7d538e..e0871c47ef0e186334cc55695e6923f034c4f2f5 100644 (file)
@@ -60,6 +60,8 @@
 #include <openssl/buffer.h>
 #include <openssl/rand.h>
 #include <openssl/objects.h>
+#include <openssl/md5.h>
+#include <openssl/sha.h>
 #include <openssl/evp.h>
 #include "ssl_locl.h"
 
index 2113ff32504212e1f2c112183d5299f255b0e77a..3ef8676c34cee8cd5e0bb37ec95a3e7753e48fa0 100644 (file)
@@ -57,6 +57,8 @@
  */
 
 #include <stdio.h>
+#include <openssl/md5.h>
+#include <openssl/sha.h>
 #include <openssl/evp.h>
 #include "ssl_locl.h"
 
index d21772ec93f332e984b033a8044764ec881f83d3..c41e2548bdbd89ead141e7da579db38e8ba4d42b 100644 (file)
@@ -57,6 +57,8 @@
  */
 
 #include <stdio.h>
+#include <openssl/md5.h>
+#include <openssl/sha.h>
 #include <openssl/objects.h>
 #include "ssl_locl.h"
 
index 0379cc58c5dfcdcceb0f1118342888d82738c423..154b6ada3473e4861ddb700d069bd71bef4a3888 100644 (file)
@@ -62,6 +62,8 @@
 #include <openssl/buffer.h>
 #include <openssl/rand.h>
 #include <openssl/objects.h>
+#include <openssl/md5.h>
+#include <openssl/sha.h>
 #include <openssl/evp.h>
 #include <openssl/x509.h>
 #include "ssl_locl.h"
index 6e198ecac5c4dbe4a64522df4e199b919584dc71..726289ab74c62d9ca136d1302bd1f96bb2ed8fdf 100644 (file)
@@ -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
 
index 05a3382af9fecc2ba9d2e0a0996a32554fec1efe..914b7434987fc286e3f29086cd5c6b99160148ef 100644 (file)
@@ -58,6 +58,8 @@
 
 #include <stdio.h>
 #include <openssl/comp.h>
+#include <openssl/md5.h>
+#include <openssl/sha.h>
 #include <openssl/evp.h>
 #include <openssl/hmac.h>
 #include "ssl_locl.h"