diff options
author | markus <> | 2002-09-03 22:05:59 +0000 |
---|---|---|
committer | markus <> | 2002-09-03 22:05:59 +0000 |
commit | 9482ba4a58b16aebf5b63997d4f5c683914c694f (patch) | |
tree | 5832f9ffd55cceb354b32588afb660444ec4f444 | |
parent | e4fd57152b3c9ab190f2b7a12404e78bdbbefb77 (diff) | |
download | openbsd-9482ba4a58b16aebf5b63997d4f5c683914c694f.tar.gz openbsd-9482ba4a58b16aebf5b63997d4f5c683914c694f.tar.bz2 openbsd-9482ba4a58b16aebf5b63997d4f5c683914c694f.zip |
sync tests with 0.9.7-beta1
-rw-r--r-- | src/lib/libssl/src/test/enginetest.c | 45 | ||||
-rw-r--r-- | src/lib/libssl/src/test/md4test.c | 7 | ||||
-rw-r--r-- | src/lib/libssl/src/test/rsa_test.c | 14 | ||||
-rw-r--r-- | src/lib/libssl/src/test/testgen | 16 | ||||
-rw-r--r-- | src/lib/libssl/src/test/treq | 5 | ||||
-rw-r--r-- | src/lib/libssl/src/test/trsa | 5 | ||||
-rw-r--r-- | src/lib/libssl/test/enginetest.c | 45 | ||||
-rw-r--r-- | src/lib/libssl/test/md4test.c | 7 | ||||
-rw-r--r-- | src/lib/libssl/test/rsa_test.c | 14 | ||||
-rw-r--r-- | src/lib/libssl/test/testgen | 16 | ||||
-rw-r--r-- | src/lib/libssl/test/treq | 5 | ||||
-rw-r--r-- | src/lib/libssl/test/trsa | 5 |
12 files changed, 138 insertions, 46 deletions
diff --git a/src/lib/libssl/src/test/enginetest.c b/src/lib/libssl/src/test/enginetest.c index a5a3c47fcb..87fa8c57b7 100644 --- a/src/lib/libssl/src/test/enginetest.c +++ b/src/lib/libssl/src/test/enginetest.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * project 2000. | 3 | * project 2000. |
4 | */ | 4 | */ |
5 | /* ==================================================================== | 5 | /* ==================================================================== |
6 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 6 | * Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved. |
7 | * | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions |
@@ -56,8 +56,11 @@ | |||
56 | * | 56 | * |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #include <openssl/e_os2.h> | ||
59 | #include <stdio.h> | 60 | #include <stdio.h> |
60 | #include <string.h> | 61 | #include <string.h> |
62 | #include <openssl/buffer.h> | ||
63 | #include <openssl/crypto.h> | ||
61 | #include <openssl/engine.h> | 64 | #include <openssl/engine.h> |
62 | #include <openssl/err.h> | 65 | #include <openssl/err.h> |
63 | 66 | ||
@@ -76,6 +79,9 @@ static void display_engine_list() | |||
76 | h = ENGINE_get_next(h); | 79 | h = ENGINE_get_next(h); |
77 | } | 80 | } |
78 | printf("end of list\n"); | 81 | printf("end of list\n"); |
82 | /* ENGINE_get_first() increases the struct_ref counter, so we | ||
83 | must call ENGINE_free() to decrease it again */ | ||
84 | ENGINE_free(h); | ||
79 | } | 85 | } |
80 | 86 | ||
81 | int main(int argc, char *argv[]) | 87 | int main(int argc, char *argv[]) |
@@ -91,6 +97,18 @@ int main(int argc, char *argv[]) | |||
91 | ENGINE *new_h3 = NULL; | 97 | ENGINE *new_h3 = NULL; |
92 | ENGINE *new_h4 = NULL; | 98 | ENGINE *new_h4 = NULL; |
93 | 99 | ||
100 | /* enable memory leak checking unless explicitly disabled */ | ||
101 | if (!((getenv("OPENSSL_DEBUG_MEMORY") != NULL) && (0 == strcmp(getenv("OPENSSL_DEBUG_MEMORY"), "off")))) | ||
102 | { | ||
103 | CRYPTO_malloc_debug_init(); | ||
104 | CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL); | ||
105 | } | ||
106 | else | ||
107 | { | ||
108 | /* OPENSSL_DEBUG_MEMORY=off */ | ||
109 | CRYPTO_set_mem_debug_functions(0, 0, 0, 0, 0); | ||
110 | } | ||
111 | CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); | ||
94 | ERR_load_crypto_strings(); | 112 | ERR_load_crypto_strings(); |
95 | 113 | ||
96 | memset(block, 0, 512 * sizeof(ENGINE *)); | 114 | memset(block, 0, 512 * sizeof(ENGINE *)); |
@@ -124,6 +142,8 @@ int main(int argc, char *argv[]) | |||
124 | printf("Remove failed!\n"); | 142 | printf("Remove failed!\n"); |
125 | goto end; | 143 | goto end; |
126 | } | 144 | } |
145 | if (ptr) | ||
146 | ENGINE_free(ptr); | ||
127 | display_engine_list(); | 147 | display_engine_list(); |
128 | if(!ENGINE_add(new_h3) || !ENGINE_add(new_h2)) | 148 | if(!ENGINE_add(new_h3) || !ENGINE_add(new_h2)) |
129 | { | 149 | { |
@@ -158,12 +178,7 @@ int main(int argc, char *argv[]) | |||
158 | } | 178 | } |
159 | else | 179 | else |
160 | printf("Remove that should fail did.\n"); | 180 | printf("Remove that should fail did.\n"); |
161 | if(!ENGINE_remove(new_h1)) | 181 | ERR_clear_error(); |
162 | { | ||
163 | printf("Remove failed!\n"); | ||
164 | goto end; | ||
165 | } | ||
166 | display_engine_list(); | ||
167 | if(!ENGINE_remove(new_h3)) | 182 | if(!ENGINE_remove(new_h3)) |
168 | { | 183 | { |
169 | printf("Remove failed!\n"); | 184 | printf("Remove failed!\n"); |
@@ -183,6 +198,8 @@ int main(int argc, char *argv[]) | |||
183 | if(!ENGINE_remove(ptr)) | 198 | if(!ENGINE_remove(ptr)) |
184 | printf("Remove failed!i - probably no hardware " | 199 | printf("Remove failed!i - probably no hardware " |
185 | "support present.\n"); | 200 | "support present.\n"); |
201 | if (ptr) | ||
202 | ENGINE_free(ptr); | ||
186 | display_engine_list(); | 203 | display_engine_list(); |
187 | if(!ENGINE_add(new_h1) || !ENGINE_remove(new_h1)) | 204 | if(!ENGINE_add(new_h1) || !ENGINE_remove(new_h1)) |
188 | { | 205 | { |
@@ -195,9 +212,9 @@ int main(int argc, char *argv[]) | |||
195 | for(loop = 0; loop < 512; loop++) | 212 | for(loop = 0; loop < 512; loop++) |
196 | { | 213 | { |
197 | sprintf(buf, "id%i", loop); | 214 | sprintf(buf, "id%i", loop); |
198 | id = strdup(buf); | 215 | id = BUF_strdup(buf); |
199 | sprintf(buf, "Fake engine type %i", loop); | 216 | sprintf(buf, "Fake engine type %i", loop); |
200 | name = strdup(buf); | 217 | name = BUF_strdup(buf); |
201 | if(((block[loop] = ENGINE_new()) == NULL) || | 218 | if(((block[loop] = ENGINE_new()) == NULL) || |
202 | !ENGINE_set_id(block[loop], id) || | 219 | !ENGINE_set_id(block[loop], id) || |
203 | !ENGINE_set_name(block[loop], name)) | 220 | !ENGINE_set_name(block[loop], name)) |
@@ -228,12 +245,13 @@ cleanup_loop: | |||
228 | printf("\nRemove failed!\n"); | 245 | printf("\nRemove failed!\n"); |
229 | goto end; | 246 | goto end; |
230 | } | 247 | } |
248 | ENGINE_free(ptr); | ||
231 | printf("."); fflush(stdout); | 249 | printf("."); fflush(stdout); |
232 | } | 250 | } |
233 | for(loop = 0; loop < 512; loop++) | 251 | for(loop = 0; loop < 512; loop++) |
234 | { | 252 | { |
235 | free((char *)(ENGINE_get_id(block[loop]))); | 253 | OPENSSL_free((void *)ENGINE_get_id(block[loop])); |
236 | free((char *)(ENGINE_get_name(block[loop]))); | 254 | OPENSSL_free((void *)ENGINE_get_name(block[loop])); |
237 | } | 255 | } |
238 | printf("\nTests completed happily\n"); | 256 | printf("\nTests completed happily\n"); |
239 | to_return = 0; | 257 | to_return = 0; |
@@ -247,5 +265,10 @@ end: | |||
247 | for(loop = 0; loop < 512; loop++) | 265 | for(loop = 0; loop < 512; loop++) |
248 | if(block[loop]) | 266 | if(block[loop]) |
249 | ENGINE_free(block[loop]); | 267 | ENGINE_free(block[loop]); |
268 | ENGINE_cleanup(); | ||
269 | CRYPTO_cleanup_all_ex_data(); | ||
270 | ERR_free_strings(); | ||
271 | ERR_remove_state(0); | ||
272 | CRYPTO_mem_leaks_fp(stderr); | ||
250 | return to_return; | 273 | return to_return; |
251 | } | 274 | } |
diff --git a/src/lib/libssl/src/test/md4test.c b/src/lib/libssl/src/test/md4test.c index 97e6e21efd..e0fdc42282 100644 --- a/src/lib/libssl/src/test/md4test.c +++ b/src/lib/libssl/src/test/md4test.c | |||
@@ -60,13 +60,14 @@ | |||
60 | #include <string.h> | 60 | #include <string.h> |
61 | #include <stdlib.h> | 61 | #include <stdlib.h> |
62 | 62 | ||
63 | #ifdef NO_MD4 | 63 | #ifdef OPENSSL_NO_MD4 |
64 | int main(int argc, char *argv[]) | 64 | int main(int argc, char *argv[]) |
65 | { | 65 | { |
66 | printf("No MD4 support\n"); | 66 | printf("No MD4 support\n"); |
67 | return(0); | 67 | return(0); |
68 | } | 68 | } |
69 | #else | 69 | #else |
70 | #include <openssl/evp.h> | ||
70 | #include <openssl/md4.h> | 71 | #include <openssl/md4.h> |
71 | 72 | ||
72 | static char *test[]={ | 73 | static char *test[]={ |
@@ -96,13 +97,15 @@ int main(int argc, char *argv[]) | |||
96 | int i,err=0; | 97 | int i,err=0; |
97 | unsigned char **P,**R; | 98 | unsigned char **P,**R; |
98 | char *p; | 99 | char *p; |
100 | unsigned char md[MD4_DIGEST_LENGTH]; | ||
99 | 101 | ||
100 | P=(unsigned char **)test; | 102 | P=(unsigned char **)test; |
101 | R=(unsigned char **)ret; | 103 | R=(unsigned char **)ret; |
102 | i=1; | 104 | i=1; |
103 | while (*P != NULL) | 105 | while (*P != NULL) |
104 | { | 106 | { |
105 | p=pt(MD4(&(P[0][0]),(unsigned long)strlen((char *)*P),NULL)); | 107 | EVP_Digest(&(P[0][0]),(unsigned long)strlen((char *)*P),md,NULL,EVP_md4(), NULL); |
108 | p=pt(md); | ||
106 | if (strcmp(p,(char *)*R) != 0) | 109 | if (strcmp(p,(char *)*R) != 0) |
107 | { | 110 | { |
108 | printf("error calculating MD4 on '%s'\n",*P); | 111 | printf("error calculating MD4 on '%s'\n",*P); |
diff --git a/src/lib/libssl/src/test/rsa_test.c b/src/lib/libssl/src/test/rsa_test.c index e5ae0c1f69..b8b462d33b 100644 --- a/src/lib/libssl/src/test/rsa_test.c +++ b/src/lib/libssl/src/test/rsa_test.c | |||
@@ -3,12 +3,12 @@ | |||
3 | #include <stdio.h> | 3 | #include <stdio.h> |
4 | #include <string.h> | 4 | #include <string.h> |
5 | 5 | ||
6 | #include "openssl/e_os.h" | 6 | #include "e_os.h" |
7 | 7 | ||
8 | #include <openssl/crypto.h> | 8 | #include <openssl/crypto.h> |
9 | #include <openssl/err.h> | 9 | #include <openssl/err.h> |
10 | #include <openssl/rand.h> | 10 | #include <openssl/rand.h> |
11 | #ifdef NO_RSA | 11 | #ifdef OPENSSL_NO_RSA |
12 | int main(int argc, char *argv[]) | 12 | int main(int argc, char *argv[]) |
13 | { | 13 | { |
14 | printf("No RSA support\n"); | 14 | printf("No RSA support\n"); |
@@ -16,6 +16,7 @@ int main(int argc, char *argv[]) | |||
16 | } | 16 | } |
17 | #else | 17 | #else |
18 | #include <openssl/rsa.h> | 18 | #include <openssl/rsa.h> |
19 | #include <openssl/engine.h> | ||
19 | 20 | ||
20 | #define SetKey \ | 21 | #define SetKey \ |
21 | key->n = BN_bin2bn(n, sizeof(n)-1, key->n); \ | 22 | key->n = BN_bin2bn(n, sizeof(n)-1, key->n); \ |
@@ -219,10 +220,12 @@ int main(int argc, char *argv[]) | |||
219 | int clen = 0; | 220 | int clen = 0; |
220 | int num; | 221 | int num; |
221 | 222 | ||
223 | CRYPTO_malloc_debug_init(); | ||
224 | CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL); | ||
225 | CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); | ||
226 | |||
222 | RAND_seed(rnd_seed, sizeof rnd_seed); /* or OAEP may fail */ | 227 | RAND_seed(rnd_seed, sizeof rnd_seed); /* or OAEP may fail */ |
223 | 228 | ||
224 | CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); | ||
225 | |||
226 | plen = sizeof(ptext_ex) - 1; | 229 | plen = sizeof(ptext_ex) - 1; |
227 | 230 | ||
228 | for (v = 0; v < 3; v++) | 231 | for (v = 0; v < 3; v++) |
@@ -305,9 +308,10 @@ int main(int argc, char *argv[]) | |||
305 | RSA_free(key); | 308 | RSA_free(key); |
306 | } | 309 | } |
307 | 310 | ||
311 | CRYPTO_cleanup_all_ex_data(); | ||
308 | ERR_remove_state(0); | 312 | ERR_remove_state(0); |
309 | 313 | ||
310 | CRYPTO_mem_leaks_fp(stdout); | 314 | CRYPTO_mem_leaks_fp(stderr); |
311 | 315 | ||
312 | return err; | 316 | return err; |
313 | } | 317 | } |
diff --git a/src/lib/libssl/src/test/testgen b/src/lib/libssl/src/test/testgen index c5f61b582b..6a4b6b9221 100644 --- a/src/lib/libssl/src/test/testgen +++ b/src/lib/libssl/src/test/testgen | |||
@@ -11,13 +11,19 @@ export PATH | |||
11 | 11 | ||
12 | echo "generating certificate request" | 12 | echo "generating certificate request" |
13 | 13 | ||
14 | echo "There should be a 2 sequences of .'s and some +'s." | ||
15 | echo "There should not be more that at most 80 per line" | ||
16 | echo "This could take some time." | ||
17 | |||
18 | echo "string to make the random number generator think it has entropy" >> ./.rnd | 14 | echo "string to make the random number generator think it has entropy" >> ./.rnd |
19 | 15 | ||
20 | ../apps/openssl req -config test.cnf -new -out testreq.pem | 16 | if ../apps/openssl no-rsa; then |
17 | req_new='-newkey dsa:../apps/dsa512.pem' | ||
18 | else | ||
19 | req_new='-new' | ||
20 | echo "There should be a 2 sequences of .'s and some +'s." | ||
21 | echo "There should not be more that at most 80 per line" | ||
22 | fi | ||
23 | |||
24 | echo "This could take some time." | ||
25 | |||
26 | ../apps/openssl req -config test.cnf $req_new -out testreq.pem | ||
21 | if [ $? != 0 ]; then | 27 | if [ $? != 0 ]; then |
22 | echo problems creating request | 28 | echo problems creating request |
23 | exit 1 | 29 | exit 1 |
diff --git a/src/lib/libssl/src/test/treq b/src/lib/libssl/src/test/treq index 0464c9d902..9f5eb7eea5 100644 --- a/src/lib/libssl/src/test/treq +++ b/src/lib/libssl/src/test/treq | |||
@@ -11,6 +11,11 @@ else | |||
11 | t=testreq.pem | 11 | t=testreq.pem |
12 | fi | 12 | fi |
13 | 13 | ||
14 | if $cmd -in $t -inform p -noout -text | fgrep 'Unknown Public Key'; then | ||
15 | echo "skipping req conversion test for $t" | ||
16 | exit 0 | ||
17 | fi | ||
18 | |||
14 | echo testing req conversions | 19 | echo testing req conversions |
15 | cp $t fff.p | 20 | cp $t fff.p |
16 | 21 | ||
diff --git a/src/lib/libssl/src/test/trsa b/src/lib/libssl/src/test/trsa index d6a4dd826d..bd6c07650a 100644 --- a/src/lib/libssl/src/test/trsa +++ b/src/lib/libssl/src/test/trsa | |||
@@ -3,6 +3,11 @@ | |||
3 | PATH=../apps:$PATH | 3 | PATH=../apps:$PATH |
4 | export PATH | 4 | export PATH |
5 | 5 | ||
6 | if ../apps/openssl no-rsa; then | ||
7 | echo skipping rsa conversion test | ||
8 | exit 0 | ||
9 | fi | ||
10 | |||
6 | cmd='../apps/openssl rsa' | 11 | cmd='../apps/openssl rsa' |
7 | 12 | ||
8 | if [ "$1"x != "x" ]; then | 13 | if [ "$1"x != "x" ]; then |
diff --git a/src/lib/libssl/test/enginetest.c b/src/lib/libssl/test/enginetest.c index a5a3c47fcb..87fa8c57b7 100644 --- a/src/lib/libssl/test/enginetest.c +++ b/src/lib/libssl/test/enginetest.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * project 2000. | 3 | * project 2000. |
4 | */ | 4 | */ |
5 | /* ==================================================================== | 5 | /* ==================================================================== |
6 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 6 | * Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved. |
7 | * | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions |
@@ -56,8 +56,11 @@ | |||
56 | * | 56 | * |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #include <openssl/e_os2.h> | ||
59 | #include <stdio.h> | 60 | #include <stdio.h> |
60 | #include <string.h> | 61 | #include <string.h> |
62 | #include <openssl/buffer.h> | ||
63 | #include <openssl/crypto.h> | ||
61 | #include <openssl/engine.h> | 64 | #include <openssl/engine.h> |
62 | #include <openssl/err.h> | 65 | #include <openssl/err.h> |
63 | 66 | ||
@@ -76,6 +79,9 @@ static void display_engine_list() | |||
76 | h = ENGINE_get_next(h); | 79 | h = ENGINE_get_next(h); |
77 | } | 80 | } |
78 | printf("end of list\n"); | 81 | printf("end of list\n"); |
82 | /* ENGINE_get_first() increases the struct_ref counter, so we | ||
83 | must call ENGINE_free() to decrease it again */ | ||
84 | ENGINE_free(h); | ||
79 | } | 85 | } |
80 | 86 | ||
81 | int main(int argc, char *argv[]) | 87 | int main(int argc, char *argv[]) |
@@ -91,6 +97,18 @@ int main(int argc, char *argv[]) | |||
91 | ENGINE *new_h3 = NULL; | 97 | ENGINE *new_h3 = NULL; |
92 | ENGINE *new_h4 = NULL; | 98 | ENGINE *new_h4 = NULL; |
93 | 99 | ||
100 | /* enable memory leak checking unless explicitly disabled */ | ||
101 | if (!((getenv("OPENSSL_DEBUG_MEMORY") != NULL) && (0 == strcmp(getenv("OPENSSL_DEBUG_MEMORY"), "off")))) | ||
102 | { | ||
103 | CRYPTO_malloc_debug_init(); | ||
104 | CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL); | ||
105 | } | ||
106 | else | ||
107 | { | ||
108 | /* OPENSSL_DEBUG_MEMORY=off */ | ||
109 | CRYPTO_set_mem_debug_functions(0, 0, 0, 0, 0); | ||
110 | } | ||
111 | CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); | ||
94 | ERR_load_crypto_strings(); | 112 | ERR_load_crypto_strings(); |
95 | 113 | ||
96 | memset(block, 0, 512 * sizeof(ENGINE *)); | 114 | memset(block, 0, 512 * sizeof(ENGINE *)); |
@@ -124,6 +142,8 @@ int main(int argc, char *argv[]) | |||
124 | printf("Remove failed!\n"); | 142 | printf("Remove failed!\n"); |
125 | goto end; | 143 | goto end; |
126 | } | 144 | } |
145 | if (ptr) | ||
146 | ENGINE_free(ptr); | ||
127 | display_engine_list(); | 147 | display_engine_list(); |
128 | if(!ENGINE_add(new_h3) || !ENGINE_add(new_h2)) | 148 | if(!ENGINE_add(new_h3) || !ENGINE_add(new_h2)) |
129 | { | 149 | { |
@@ -158,12 +178,7 @@ int main(int argc, char *argv[]) | |||
158 | } | 178 | } |
159 | else | 179 | else |
160 | printf("Remove that should fail did.\n"); | 180 | printf("Remove that should fail did.\n"); |
161 | if(!ENGINE_remove(new_h1)) | 181 | ERR_clear_error(); |
162 | { | ||
163 | printf("Remove failed!\n"); | ||
164 | goto end; | ||
165 | } | ||
166 | display_engine_list(); | ||
167 | if(!ENGINE_remove(new_h3)) | 182 | if(!ENGINE_remove(new_h3)) |
168 | { | 183 | { |
169 | printf("Remove failed!\n"); | 184 | printf("Remove failed!\n"); |
@@ -183,6 +198,8 @@ int main(int argc, char *argv[]) | |||
183 | if(!ENGINE_remove(ptr)) | 198 | if(!ENGINE_remove(ptr)) |
184 | printf("Remove failed!i - probably no hardware " | 199 | printf("Remove failed!i - probably no hardware " |
185 | "support present.\n"); | 200 | "support present.\n"); |
201 | if (ptr) | ||
202 | ENGINE_free(ptr); | ||
186 | display_engine_list(); | 203 | display_engine_list(); |
187 | if(!ENGINE_add(new_h1) || !ENGINE_remove(new_h1)) | 204 | if(!ENGINE_add(new_h1) || !ENGINE_remove(new_h1)) |
188 | { | 205 | { |
@@ -195,9 +212,9 @@ int main(int argc, char *argv[]) | |||
195 | for(loop = 0; loop < 512; loop++) | 212 | for(loop = 0; loop < 512; loop++) |
196 | { | 213 | { |
197 | sprintf(buf, "id%i", loop); | 214 | sprintf(buf, "id%i", loop); |
198 | id = strdup(buf); | 215 | id = BUF_strdup(buf); |
199 | sprintf(buf, "Fake engine type %i", loop); | 216 | sprintf(buf, "Fake engine type %i", loop); |
200 | name = strdup(buf); | 217 | name = BUF_strdup(buf); |
201 | if(((block[loop] = ENGINE_new()) == NULL) || | 218 | if(((block[loop] = ENGINE_new()) == NULL) || |
202 | !ENGINE_set_id(block[loop], id) || | 219 | !ENGINE_set_id(block[loop], id) || |
203 | !ENGINE_set_name(block[loop], name)) | 220 | !ENGINE_set_name(block[loop], name)) |
@@ -228,12 +245,13 @@ cleanup_loop: | |||
228 | printf("\nRemove failed!\n"); | 245 | printf("\nRemove failed!\n"); |
229 | goto end; | 246 | goto end; |
230 | } | 247 | } |
248 | ENGINE_free(ptr); | ||
231 | printf("."); fflush(stdout); | 249 | printf("."); fflush(stdout); |
232 | } | 250 | } |
233 | for(loop = 0; loop < 512; loop++) | 251 | for(loop = 0; loop < 512; loop++) |
234 | { | 252 | { |
235 | free((char *)(ENGINE_get_id(block[loop]))); | 253 | OPENSSL_free((void *)ENGINE_get_id(block[loop])); |
236 | free((char *)(ENGINE_get_name(block[loop]))); | 254 | OPENSSL_free((void *)ENGINE_get_name(block[loop])); |
237 | } | 255 | } |
238 | printf("\nTests completed happily\n"); | 256 | printf("\nTests completed happily\n"); |
239 | to_return = 0; | 257 | to_return = 0; |
@@ -247,5 +265,10 @@ end: | |||
247 | for(loop = 0; loop < 512; loop++) | 265 | for(loop = 0; loop < 512; loop++) |
248 | if(block[loop]) | 266 | if(block[loop]) |
249 | ENGINE_free(block[loop]); | 267 | ENGINE_free(block[loop]); |
268 | ENGINE_cleanup(); | ||
269 | CRYPTO_cleanup_all_ex_data(); | ||
270 | ERR_free_strings(); | ||
271 | ERR_remove_state(0); | ||
272 | CRYPTO_mem_leaks_fp(stderr); | ||
250 | return to_return; | 273 | return to_return; |
251 | } | 274 | } |
diff --git a/src/lib/libssl/test/md4test.c b/src/lib/libssl/test/md4test.c index 97e6e21efd..e0fdc42282 100644 --- a/src/lib/libssl/test/md4test.c +++ b/src/lib/libssl/test/md4test.c | |||
@@ -60,13 +60,14 @@ | |||
60 | #include <string.h> | 60 | #include <string.h> |
61 | #include <stdlib.h> | 61 | #include <stdlib.h> |
62 | 62 | ||
63 | #ifdef NO_MD4 | 63 | #ifdef OPENSSL_NO_MD4 |
64 | int main(int argc, char *argv[]) | 64 | int main(int argc, char *argv[]) |
65 | { | 65 | { |
66 | printf("No MD4 support\n"); | 66 | printf("No MD4 support\n"); |
67 | return(0); | 67 | return(0); |
68 | } | 68 | } |
69 | #else | 69 | #else |
70 | #include <openssl/evp.h> | ||
70 | #include <openssl/md4.h> | 71 | #include <openssl/md4.h> |
71 | 72 | ||
72 | static char *test[]={ | 73 | static char *test[]={ |
@@ -96,13 +97,15 @@ int main(int argc, char *argv[]) | |||
96 | int i,err=0; | 97 | int i,err=0; |
97 | unsigned char **P,**R; | 98 | unsigned char **P,**R; |
98 | char *p; | 99 | char *p; |
100 | unsigned char md[MD4_DIGEST_LENGTH]; | ||
99 | 101 | ||
100 | P=(unsigned char **)test; | 102 | P=(unsigned char **)test; |
101 | R=(unsigned char **)ret; | 103 | R=(unsigned char **)ret; |
102 | i=1; | 104 | i=1; |
103 | while (*P != NULL) | 105 | while (*P != NULL) |
104 | { | 106 | { |
105 | p=pt(MD4(&(P[0][0]),(unsigned long)strlen((char *)*P),NULL)); | 107 | EVP_Digest(&(P[0][0]),(unsigned long)strlen((char *)*P),md,NULL,EVP_md4(), NULL); |
108 | p=pt(md); | ||
106 | if (strcmp(p,(char *)*R) != 0) | 109 | if (strcmp(p,(char *)*R) != 0) |
107 | { | 110 | { |
108 | printf("error calculating MD4 on '%s'\n",*P); | 111 | printf("error calculating MD4 on '%s'\n",*P); |
diff --git a/src/lib/libssl/test/rsa_test.c b/src/lib/libssl/test/rsa_test.c index e5ae0c1f69..b8b462d33b 100644 --- a/src/lib/libssl/test/rsa_test.c +++ b/src/lib/libssl/test/rsa_test.c | |||
@@ -3,12 +3,12 @@ | |||
3 | #include <stdio.h> | 3 | #include <stdio.h> |
4 | #include <string.h> | 4 | #include <string.h> |
5 | 5 | ||
6 | #include "openssl/e_os.h" | 6 | #include "e_os.h" |
7 | 7 | ||
8 | #include <openssl/crypto.h> | 8 | #include <openssl/crypto.h> |
9 | #include <openssl/err.h> | 9 | #include <openssl/err.h> |
10 | #include <openssl/rand.h> | 10 | #include <openssl/rand.h> |
11 | #ifdef NO_RSA | 11 | #ifdef OPENSSL_NO_RSA |
12 | int main(int argc, char *argv[]) | 12 | int main(int argc, char *argv[]) |
13 | { | 13 | { |
14 | printf("No RSA support\n"); | 14 | printf("No RSA support\n"); |
@@ -16,6 +16,7 @@ int main(int argc, char *argv[]) | |||
16 | } | 16 | } |
17 | #else | 17 | #else |
18 | #include <openssl/rsa.h> | 18 | #include <openssl/rsa.h> |
19 | #include <openssl/engine.h> | ||
19 | 20 | ||
20 | #define SetKey \ | 21 | #define SetKey \ |
21 | key->n = BN_bin2bn(n, sizeof(n)-1, key->n); \ | 22 | key->n = BN_bin2bn(n, sizeof(n)-1, key->n); \ |
@@ -219,10 +220,12 @@ int main(int argc, char *argv[]) | |||
219 | int clen = 0; | 220 | int clen = 0; |
220 | int num; | 221 | int num; |
221 | 222 | ||
223 | CRYPTO_malloc_debug_init(); | ||
224 | CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL); | ||
225 | CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); | ||
226 | |||
222 | RAND_seed(rnd_seed, sizeof rnd_seed); /* or OAEP may fail */ | 227 | RAND_seed(rnd_seed, sizeof rnd_seed); /* or OAEP may fail */ |
223 | 228 | ||
224 | CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); | ||
225 | |||
226 | plen = sizeof(ptext_ex) - 1; | 229 | plen = sizeof(ptext_ex) - 1; |
227 | 230 | ||
228 | for (v = 0; v < 3; v++) | 231 | for (v = 0; v < 3; v++) |
@@ -305,9 +308,10 @@ int main(int argc, char *argv[]) | |||
305 | RSA_free(key); | 308 | RSA_free(key); |
306 | } | 309 | } |
307 | 310 | ||
311 | CRYPTO_cleanup_all_ex_data(); | ||
308 | ERR_remove_state(0); | 312 | ERR_remove_state(0); |
309 | 313 | ||
310 | CRYPTO_mem_leaks_fp(stdout); | 314 | CRYPTO_mem_leaks_fp(stderr); |
311 | 315 | ||
312 | return err; | 316 | return err; |
313 | } | 317 | } |
diff --git a/src/lib/libssl/test/testgen b/src/lib/libssl/test/testgen index c5f61b582b..6a4b6b9221 100644 --- a/src/lib/libssl/test/testgen +++ b/src/lib/libssl/test/testgen | |||
@@ -11,13 +11,19 @@ export PATH | |||
11 | 11 | ||
12 | echo "generating certificate request" | 12 | echo "generating certificate request" |
13 | 13 | ||
14 | echo "There should be a 2 sequences of .'s and some +'s." | ||
15 | echo "There should not be more that at most 80 per line" | ||
16 | echo "This could take some time." | ||
17 | |||
18 | echo "string to make the random number generator think it has entropy" >> ./.rnd | 14 | echo "string to make the random number generator think it has entropy" >> ./.rnd |
19 | 15 | ||
20 | ../apps/openssl req -config test.cnf -new -out testreq.pem | 16 | if ../apps/openssl no-rsa; then |
17 | req_new='-newkey dsa:../apps/dsa512.pem' | ||
18 | else | ||
19 | req_new='-new' | ||
20 | echo "There should be a 2 sequences of .'s and some +'s." | ||
21 | echo "There should not be more that at most 80 per line" | ||
22 | fi | ||
23 | |||
24 | echo "This could take some time." | ||
25 | |||
26 | ../apps/openssl req -config test.cnf $req_new -out testreq.pem | ||
21 | if [ $? != 0 ]; then | 27 | if [ $? != 0 ]; then |
22 | echo problems creating request | 28 | echo problems creating request |
23 | exit 1 | 29 | exit 1 |
diff --git a/src/lib/libssl/test/treq b/src/lib/libssl/test/treq index 0464c9d902..9f5eb7eea5 100644 --- a/src/lib/libssl/test/treq +++ b/src/lib/libssl/test/treq | |||
@@ -11,6 +11,11 @@ else | |||
11 | t=testreq.pem | 11 | t=testreq.pem |
12 | fi | 12 | fi |
13 | 13 | ||
14 | if $cmd -in $t -inform p -noout -text | fgrep 'Unknown Public Key'; then | ||
15 | echo "skipping req conversion test for $t" | ||
16 | exit 0 | ||
17 | fi | ||
18 | |||
14 | echo testing req conversions | 19 | echo testing req conversions |
15 | cp $t fff.p | 20 | cp $t fff.p |
16 | 21 | ||
diff --git a/src/lib/libssl/test/trsa b/src/lib/libssl/test/trsa index d6a4dd826d..bd6c07650a 100644 --- a/src/lib/libssl/test/trsa +++ b/src/lib/libssl/test/trsa | |||
@@ -3,6 +3,11 @@ | |||
3 | PATH=../apps:$PATH | 3 | PATH=../apps:$PATH |
4 | export PATH | 4 | export PATH |
5 | 5 | ||
6 | if ../apps/openssl no-rsa; then | ||
7 | echo skipping rsa conversion test | ||
8 | exit 0 | ||
9 | fi | ||
10 | |||
6 | cmd='../apps/openssl rsa' | 11 | cmd='../apps/openssl rsa' |
7 | 12 | ||
8 | if [ "$1"x != "x" ]; then | 13 | if [ "$1"x != "x" ]; then |