diff options
author | markus <> | 2003-05-12 02:18:40 +0000 |
---|---|---|
committer | markus <> | 2003-05-12 02:18:40 +0000 |
commit | d4fcd82bb7f6d603bd61e19a81ba97337b89dfca (patch) | |
tree | d52e3a0f1f08f65ad283027e560e17ed0d720462 /src/lib/libcrypto/hmac | |
parent | 582bbd139cd2afd58d10dc051c5b0b989b441074 (diff) | |
download | openbsd-d4fcd82bb7f6d603bd61e19a81ba97337b89dfca.tar.gz openbsd-d4fcd82bb7f6d603bd61e19a81ba97337b89dfca.tar.bz2 openbsd-d4fcd82bb7f6d603bd61e19a81ba97337b89dfca.zip |
merge 0.9.7b with local changes; crank majors for libssl/libcrypto
Diffstat (limited to 'src/lib/libcrypto/hmac')
-rw-r--r-- | src/lib/libcrypto/hmac/Makefile.ssl | 36 | ||||
-rw-r--r-- | src/lib/libcrypto/hmac/hmac.c | 3 | ||||
-rw-r--r-- | src/lib/libcrypto/hmac/hmactest.c | 21 |
3 files changed, 40 insertions, 20 deletions
diff --git a/src/lib/libcrypto/hmac/Makefile.ssl b/src/lib/libcrypto/hmac/Makefile.ssl index 2bb3264f0e..f1c07322c4 100644 --- a/src/lib/libcrypto/hmac/Makefile.ssl +++ b/src/lib/libcrypto/hmac/Makefile.ssl | |||
@@ -68,7 +68,7 @@ lint: | |||
68 | lint -DLINT $(INCLUDES) $(SRC)>fluff | 68 | lint -DLINT $(INCLUDES) $(SRC)>fluff |
69 | 69 | ||
70 | depend: | 70 | depend: |
71 | $(MAKEDEPEND) $(CFLAG) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC) | 71 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) |
72 | 72 | ||
73 | dclean: | 73 | dclean: |
74 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | 74 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new |
@@ -79,21 +79,23 @@ clean: | |||
79 | 79 | ||
80 | # DO NOT DELETE THIS LINE -- make depend depends on it. | 80 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
81 | 81 | ||
82 | hmac.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | 82 | hmac.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h |
83 | hmac.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | 83 | hmac.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h |
84 | hmac.o: ../../include/openssl/bn.h ../../include/openssl/cast.h | 84 | hmac.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h |
85 | hmac.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | 85 | hmac.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h |
86 | hmac.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | 86 | hmac.o: ../../include/openssl/des.h ../../include/openssl/des_old.h |
87 | hmac.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | 87 | hmac.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h |
88 | hmac.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
88 | hmac.o: ../../include/openssl/evp.h ../../include/openssl/hmac.h | 89 | hmac.o: ../../include/openssl/evp.h ../../include/openssl/hmac.h |
89 | hmac.o: ../../include/openssl/idea.h ../../include/openssl/md2.h | 90 | hmac.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h |
90 | hmac.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | 91 | hmac.o: ../../include/openssl/md2.h ../../include/openssl/md4.h |
91 | hmac.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | 92 | hmac.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h |
92 | hmac.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 93 | hmac.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
93 | hmac.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 94 | hmac.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
94 | hmac.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | 95 | hmac.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h |
95 | hmac.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | 96 | hmac.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h |
96 | hmac.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | 97 | hmac.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h |
97 | hmac.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 98 | hmac.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
98 | hmac.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | 99 | hmac.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
99 | hmac.o: ../../include/openssl/ui_compat.h hmac.c | 100 | hmac.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h |
101 | hmac.o: ../cryptlib.h hmac.c | ||
diff --git a/src/lib/libcrypto/hmac/hmac.c b/src/lib/libcrypto/hmac/hmac.c index da363b7950..4c91f919d5 100644 --- a/src/lib/libcrypto/hmac/hmac.c +++ b/src/lib/libcrypto/hmac/hmac.c | |||
@@ -59,6 +59,7 @@ | |||
59 | #include <stdlib.h> | 59 | #include <stdlib.h> |
60 | #include <string.h> | 60 | #include <string.h> |
61 | #include <openssl/hmac.h> | 61 | #include <openssl/hmac.h> |
62 | #include "cryptlib.h" | ||
62 | 63 | ||
63 | void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, | 64 | void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, |
64 | const EVP_MD *md, ENGINE *impl) | 65 | const EVP_MD *md, ENGINE *impl) |
@@ -78,6 +79,7 @@ void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, | |||
78 | { | 79 | { |
79 | reset=1; | 80 | reset=1; |
80 | j=EVP_MD_block_size(md); | 81 | j=EVP_MD_block_size(md); |
82 | OPENSSL_assert(j <= sizeof ctx->key); | ||
81 | if (j < len) | 83 | if (j < len) |
82 | { | 84 | { |
83 | EVP_DigestInit_ex(&ctx->md_ctx,md, impl); | 85 | EVP_DigestInit_ex(&ctx->md_ctx,md, impl); |
@@ -87,6 +89,7 @@ void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, | |||
87 | } | 89 | } |
88 | else | 90 | else |
89 | { | 91 | { |
92 | OPENSSL_assert(len <= sizeof ctx->key); | ||
90 | memcpy(ctx->key,key,len); | 93 | memcpy(ctx->key,key,len); |
91 | ctx->key_length=len; | 94 | ctx->key_length=len; |
92 | } | 95 | } |
diff --git a/src/lib/libcrypto/hmac/hmactest.c b/src/lib/libcrypto/hmac/hmactest.c index 96d3beb8e6..1b906b81af 100644 --- a/src/lib/libcrypto/hmac/hmactest.c +++ b/src/lib/libcrypto/hmac/hmactest.c | |||
@@ -60,6 +60,8 @@ | |||
60 | #include <string.h> | 60 | #include <string.h> |
61 | #include <stdlib.h> | 61 | #include <stdlib.h> |
62 | 62 | ||
63 | #include "../e_os.h" | ||
64 | |||
63 | #ifdef OPENSSL_NO_HMAC | 65 | #ifdef OPENSSL_NO_HMAC |
64 | int main(int argc, char *argv[]) | 66 | int main(int argc, char *argv[]) |
65 | { | 67 | { |
@@ -68,12 +70,15 @@ int main(int argc, char *argv[]) | |||
68 | } | 70 | } |
69 | #else | 71 | #else |
70 | #include <openssl/hmac.h> | 72 | #include <openssl/hmac.h> |
73 | #ifndef OPENSSL_NO_MD5 | ||
71 | #include <openssl/md5.h> | 74 | #include <openssl/md5.h> |
75 | #endif | ||
72 | 76 | ||
73 | #ifdef CHARSET_EBCDIC | 77 | #ifdef CHARSET_EBCDIC |
74 | #include <openssl/ebcdic.h> | 78 | #include <openssl/ebcdic.h> |
75 | #endif | 79 | #endif |
76 | 80 | ||
81 | #ifndef OPENSSL_NO_MD5 | ||
77 | static struct test_st | 82 | static struct test_st |
78 | { | 83 | { |
79 | unsigned char key[16]; | 84 | unsigned char key[16]; |
@@ -113,13 +118,20 @@ static struct test_st | |||
113 | (unsigned char *)"56be34521d144c88dbb8c733f0e8b3f6", | 118 | (unsigned char *)"56be34521d144c88dbb8c733f0e8b3f6", |
114 | }, | 119 | }, |
115 | }; | 120 | }; |
116 | 121 | #endif | |
117 | 122 | ||
118 | static char *pt(unsigned char *md); | 123 | static char *pt(unsigned char *md); |
119 | int main(int argc, char *argv[]) | 124 | int main(int argc, char *argv[]) |
120 | { | 125 | { |
121 | int i,err=0; | 126 | #ifndef OPENSSL_NO_MD5 |
127 | int i; | ||
122 | char *p; | 128 | char *p; |
129 | #endif | ||
130 | int err=0; | ||
131 | |||
132 | #ifdef OPENSSL_NO_MD5 | ||
133 | printf("test skipped: MD5 disabled\n"); | ||
134 | #else | ||
123 | 135 | ||
124 | #ifdef CHARSET_EBCDIC | 136 | #ifdef CHARSET_EBCDIC |
125 | ebcdic2ascii(test[0].data, test[0].data, test[0].data_len); | 137 | ebcdic2ascii(test[0].data, test[0].data, test[0].data_len); |
@@ -144,10 +156,12 @@ int main(int argc, char *argv[]) | |||
144 | else | 156 | else |
145 | printf("test %d ok\n",i); | 157 | printf("test %d ok\n",i); |
146 | } | 158 | } |
147 | exit(err); | 159 | #endif /* OPENSSL_NO_MD5 */ |
160 | EXIT(err); | ||
148 | return(0); | 161 | return(0); |
149 | } | 162 | } |
150 | 163 | ||
164 | #ifndef OPENSSL_NO_MD5 | ||
151 | static char *pt(unsigned char *md) | 165 | static char *pt(unsigned char *md) |
152 | { | 166 | { |
153 | int i; | 167 | int i; |
@@ -158,3 +172,4 @@ static char *pt(unsigned char *md) | |||
158 | return(buf); | 172 | return(buf); |
159 | } | 173 | } |
160 | #endif | 174 | #endif |
175 | #endif | ||