Harmonise use of EVP_CTRL_GET_TAG/EVP_CTRL_SET_TAG/EVP_CTRL_SET_IVLEN
[oweals/openssl.git] / crypto / evp / evp_test.c
1 /* Written by Ben Laurie, 2001 */
2 /*
3  * Copyright (c) 2001 The OpenSSL Project.  All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  *
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in
14  *    the documentation and/or other materials provided with the
15  *    distribution.
16  *
17  * 3. All advertising materials mentioning features or use of this
18  *    software must display the following acknowledgment:
19  *    "This product includes software developed by the OpenSSL Project
20  *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
21  *
22  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
23  *    endorse or promote products derived from this software without
24  *    prior written permission. For written permission, please contact
25  *    openssl-core@openssl.org.
26  *
27  * 5. Products derived from this software may not be called "OpenSSL"
28  *    nor may "OpenSSL" appear in their names without prior written
29  *    permission of the OpenSSL Project.
30  *
31  * 6. Redistributions of any form whatsoever must retain the following
32  *    acknowledgment:
33  *    "This product includes software developed by the OpenSSL Project
34  *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
35  *
36  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
37  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
40  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47  * OF THE POSSIBILITY OF SUCH DAMAGE.
48  */
49
50 #include <stdio.h>
51 #include <string.h>
52
53 #include "../e_os.h"
54
55 #include <openssl/opensslconf.h>
56 #include <openssl/evp.h>
57 #ifndef OPENSSL_NO_ENGINE
58 # include <openssl/engine.h>
59 #endif
60 #include <openssl/err.h>
61 #include <openssl/conf.h>
62
63 static void hexdump(FILE *f, const char *title, const unsigned char *s, int l)
64 {
65     int n = 0;
66
67     fprintf(f, "%s", title);
68     for (; n < l; ++n) {
69         if ((n % 16) == 0)
70             fprintf(f, "\n%04x", n);
71         fprintf(f, " %02x", s[n]);
72     }
73     fprintf(f, "\n");
74 }
75
76 static int convert(unsigned char *s)
77 {
78     unsigned char *d;
79
80     for (d = s; *s; s += 2, ++d) {
81         unsigned int n;
82
83         if (!s[1]) {
84             fprintf(stderr, "Odd number of hex digits!");
85             EXIT(4);
86         }
87         sscanf((char *)s, "%2x", &n);
88         *d = (unsigned char)n;
89     }
90     return s - d;
91 }
92
93 static char *sstrsep(char **string, const char *delim)
94 {
95     char isdelim[256];
96     char *token = *string;
97
98     if (**string == 0)
99         return NULL;
100
101     memset(isdelim, 0, 256);
102     isdelim[0] = 1;
103
104     while (*delim) {
105         isdelim[(unsigned char)(*delim)] = 1;
106         delim++;
107     }
108
109     while (!isdelim[(unsigned char)(**string)]) {
110         (*string)++;
111     }
112
113     if (**string) {
114         **string = 0;
115         (*string)++;
116     }
117
118     return token;
119 }
120
121 static unsigned char *ustrsep(char **p, const char *sep)
122 {
123     return (unsigned char *)sstrsep(p, sep);
124 }
125
126 static int test1_exit(int ec)
127 {
128     EXIT(ec);
129     return (0);                 /* To keep some compilers quiet */
130 }
131
132 /* Test copying of contexts */
133 static void test_ctx_replace(EVP_CIPHER_CTX **pctx)
134 {
135     /* Make copy of context and replace original */
136     EVP_CIPHER_CTX *ctx_copy;
137     ctx_copy = EVP_CIPHER_CTX_new();
138     EVP_CIPHER_CTX_copy(ctx_copy, *pctx);
139     EVP_CIPHER_CTX_free(*pctx);
140     *pctx = ctx_copy;
141 }
142
143 static void test1(const EVP_CIPHER *c, const unsigned char *key, int kn,
144                   const unsigned char *iv, int in,
145                   const unsigned char *plaintext, int pn,
146                   const unsigned char *ciphertext, int cn,
147                   const unsigned char *aad, int an,
148                   const unsigned char *tag, int tn, int encdec)
149 {
150     EVP_CIPHER_CTX *ctx = NULL;
151     unsigned char out[4096];
152     int outl, outl2, mode;
153
154     printf("Testing cipher %s%s\n", EVP_CIPHER_name(c),
155            (encdec ==
156             1 ? "(encrypt)" : (encdec ==
157                                0 ? "(decrypt)" : "(encrypt/decrypt)")));
158     hexdump(stdout, "Key", key, kn);
159     if (in)
160         hexdump(stdout, "IV", iv, in);
161     hexdump(stdout, "Plaintext", plaintext, pn);
162     hexdump(stdout, "Ciphertext", ciphertext, cn);
163     if (an)
164         hexdump(stdout, "AAD", aad, an);
165     if (tn)
166         hexdump(stdout, "Tag", tag, tn);
167     mode = EVP_CIPHER_mode(c);
168     if (kn != EVP_CIPHER_key_length(c)) {
169         fprintf(stderr, "Key length doesn't match, got %d expected %lu\n", kn,
170                 (unsigned long)EVP_CIPHER_key_length(c));
171         test1_exit(5);
172     }
173     ctx = EVP_CIPHER_CTX_new();
174     EVP_CIPHER_CTX_set_flags(ctx, EVP_CIPHER_CTX_FLAG_WRAP_ALLOW);
175     if (encdec != 0) {
176         if ((mode == EVP_CIPH_GCM_MODE) || (mode == EVP_CIPH_OCB_MODE)) {
177             if (!EVP_EncryptInit_ex(ctx, c, NULL, NULL, NULL)) {
178                 fprintf(stderr, "EncryptInit failed\n");
179                 ERR_print_errors_fp(stderr);
180                 test1_exit(10);
181             }
182             if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN, in, NULL)) {
183                 fprintf(stderr, "IV length set failed\n");
184                 ERR_print_errors_fp(stderr);
185                 test1_exit(11);
186             }
187             if ((mode == EVP_CIPH_OCB_MODE) &&
188                 !EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, tn, NULL)) {
189                 fprintf(stderr, "Tag length set failed\n");
190                 ERR_print_errors_fp(stderr);
191                 test1_exit(15);
192             }
193             if (!EVP_EncryptInit_ex(ctx, NULL, NULL, key, iv)) {
194                 fprintf(stderr, "Key/IV set failed\n");
195                 ERR_print_errors_fp(stderr);
196                 test1_exit(12);
197             }
198             if (an && !EVP_EncryptUpdate(ctx, NULL, &outl, aad, an)) {
199                 fprintf(stderr, "AAD set failed\n");
200                 ERR_print_errors_fp(stderr);
201                 test1_exit(13);
202             }
203         } else if (mode == EVP_CIPH_CCM_MODE) {
204             if (!EVP_EncryptInit_ex(ctx, c, NULL, NULL, NULL)) {
205                 fprintf(stderr, "EncryptInit failed\n");
206                 ERR_print_errors_fp(stderr);
207                 test1_exit(10);
208             }
209             if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_SET_IVLEN, in, NULL)) {
210                 fprintf(stderr, "IV length set failed\n");
211                 ERR_print_errors_fp(stderr);
212                 test1_exit(11);
213             }
214             if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_SET_TAG, tn, NULL)) {
215                 fprintf(stderr, "Tag length set failed\n");
216                 ERR_print_errors_fp(stderr);
217                 test1_exit(11);
218             }
219             if (!EVP_EncryptInit_ex(ctx, NULL, NULL, key, iv)) {
220                 fprintf(stderr, "Key/IV set failed\n");
221                 ERR_print_errors_fp(stderr);
222                 test1_exit(12);
223             }
224             if (!EVP_EncryptUpdate(ctx, NULL, &outl, NULL, pn)) {
225                 fprintf(stderr, "Plaintext length set failed\n");
226                 ERR_print_errors_fp(stderr);
227                 test1_exit(12);
228             }
229             if (an && !EVP_EncryptUpdate(ctx, NULL, &outl, aad, an)) {
230                 fprintf(stderr, "AAD set failed\n");
231                 ERR_print_errors_fp(stderr);
232                 test1_exit(13);
233             }
234         } else if (mode == EVP_CIPH_WRAP_MODE) {
235             if (!EVP_EncryptInit_ex(ctx, c, NULL, key, in ? iv : NULL)) {
236                 fprintf(stderr, "EncryptInit failed\n");
237                 ERR_print_errors_fp(stderr);
238                 test1_exit(10);
239             }
240         } else if (!EVP_EncryptInit_ex(ctx, c, NULL, key, iv)) {
241             fprintf(stderr, "EncryptInit failed\n");
242             ERR_print_errors_fp(stderr);
243             test1_exit(10);
244         }
245         EVP_CIPHER_CTX_set_padding(ctx, 0);
246
247         test_ctx_replace(&ctx);
248
249         if (!EVP_EncryptUpdate(ctx, out, &outl, plaintext, pn)) {
250             fprintf(stderr, "Encrypt failed\n");
251             ERR_print_errors_fp(stderr);
252             test1_exit(6);
253         }
254         if (!EVP_EncryptFinal_ex(ctx, out + outl, &outl2)) {
255             fprintf(stderr, "EncryptFinal failed\n");
256             ERR_print_errors_fp(stderr);
257             test1_exit(7);
258         }
259
260         if (outl + outl2 != cn) {
261             fprintf(stderr, "Ciphertext length mismatch got %d expected %d\n",
262                     outl + outl2, cn);
263             test1_exit(8);
264         }
265
266         if (memcmp(out, ciphertext, cn)) {
267             fprintf(stderr, "Ciphertext mismatch\n");
268             hexdump(stderr, "Got", out, cn);
269             hexdump(stderr, "Expected", ciphertext, cn);
270             test1_exit(9);
271         }
272         if ((mode == EVP_CIPH_GCM_MODE) || (mode == EVP_CIPH_OCB_MODE)
273             || (mode == EVP_CIPH_CCM_MODE)) {
274             unsigned char rtag[16];
275
276             if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, tn, rtag)) {
277                 fprintf(stderr, "Get tag failed\n");
278                 ERR_print_errors_fp(stderr);
279                 test1_exit(14);
280             }
281             if (memcmp(rtag, tag, tn)) {
282                 fprintf(stderr, "Tag mismatch\n");
283                 hexdump(stderr, "Got", rtag, tn);
284                 hexdump(stderr, "Expected", tag, tn);
285                 test1_exit(9);
286             }
287         }
288     }
289
290     if (encdec <= 0) {
291         if ((mode == EVP_CIPH_GCM_MODE) || (mode == EVP_CIPH_OCB_MODE)) {
292             if (!EVP_DecryptInit_ex(ctx, c, NULL, NULL, NULL)) {
293                 fprintf(stderr, "DecryptInit failed\n");
294                 ERR_print_errors_fp(stderr);
295                 test1_exit(10);
296             }
297             if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN, in, NULL)) {
298                 fprintf(stderr, "IV length set failed\n");
299                 ERR_print_errors_fp(stderr);
300                 test1_exit(11);
301             }
302             if ((mode == EVP_CIPH_OCB_MODE) &&
303                 !EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, tn, NULL)) {
304                 fprintf(stderr, "Tag length set failed\n");
305                 ERR_print_errors_fp(stderr);
306                 test1_exit(15);
307             }
308             if (!EVP_DecryptInit_ex(ctx, NULL, NULL, key, iv)) {
309                 fprintf(stderr, "Key/IV set failed\n");
310                 ERR_print_errors_fp(stderr);
311                 test1_exit(12);
312             }
313             if (!EVP_CIPHER_CTX_ctrl
314                 (ctx, EVP_CTRL_AEAD_SET_TAG, tn, (void *)tag)) {
315                 fprintf(stderr, "Set tag failed\n");
316                 ERR_print_errors_fp(stderr);
317                 test1_exit(14);
318             }
319             if (an && !EVP_DecryptUpdate(ctx, NULL, &outl, aad, an)) {
320                 fprintf(stderr, "AAD set failed\n");
321                 ERR_print_errors_fp(stderr);
322                 test1_exit(13);
323             }
324         } else if (mode == EVP_CIPH_CCM_MODE) {
325             if (!EVP_DecryptInit_ex(ctx, c, NULL, NULL, NULL)) {
326                 fprintf(stderr, "DecryptInit failed\n");
327                 ERR_print_errors_fp(stderr);
328                 test1_exit(10);
329             }
330             if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN, in, NULL)) {
331                 fprintf(stderr, "IV length set failed\n");
332                 ERR_print_errors_fp(stderr);
333                 test1_exit(11);
334             }
335             if (!EVP_CIPHER_CTX_ctrl
336                 (ctx, EVP_CTRL_AEAD_SET_TAG, tn, (void *)tag)) {
337                 fprintf(stderr, "Tag length set failed\n");
338                 ERR_print_errors_fp(stderr);
339                 test1_exit(11);
340             }
341             if (!EVP_DecryptInit_ex(ctx, NULL, NULL, key, iv)) {
342                 fprintf(stderr, "Key/Nonce set failed\n");
343                 ERR_print_errors_fp(stderr);
344                 test1_exit(12);
345             }
346             if (!EVP_DecryptUpdate(ctx, NULL, &outl, NULL, pn)) {
347                 fprintf(stderr, "Plaintext length set failed\n");
348                 ERR_print_errors_fp(stderr);
349                 test1_exit(12);
350             }
351             if (an && !EVP_EncryptUpdate(ctx, NULL, &outl, aad, an)) {
352                 fprintf(stderr, "AAD set failed\n");
353                 ERR_print_errors_fp(stderr);
354                 test1_exit(13);
355             }
356         } else if (mode == EVP_CIPH_WRAP_MODE) {
357             if (!EVP_DecryptInit_ex(ctx, c, NULL, key, in ? iv : NULL)) {
358                 fprintf(stderr, "EncryptInit failed\n");
359                 ERR_print_errors_fp(stderr);
360                 test1_exit(10);
361             }
362         } else if (!EVP_DecryptInit_ex(ctx, c, NULL, key, iv)) {
363             fprintf(stderr, "DecryptInit failed\n");
364             ERR_print_errors_fp(stderr);
365             test1_exit(11);
366         }
367         EVP_CIPHER_CTX_set_padding(ctx, 0);
368
369         test_ctx_replace(&ctx);
370
371         if (!EVP_DecryptUpdate(ctx, out, &outl, ciphertext, cn)) {
372             fprintf(stderr, "Decrypt failed\n");
373             ERR_print_errors_fp(stderr);
374             test1_exit(6);
375         }
376         if (mode != EVP_CIPH_CCM_MODE
377             && !EVP_DecryptFinal_ex(ctx, out + outl, &outl2)) {
378             fprintf(stderr, "DecryptFinal failed\n");
379             ERR_print_errors_fp(stderr);
380             test1_exit(7);
381         }
382
383         if (outl + outl2 != pn) {
384             fprintf(stderr, "Plaintext length mismatch got %d expected %d\n",
385                     outl + outl2, pn);
386             test1_exit(8);
387         }
388
389         if (memcmp(out, plaintext, pn)) {
390             fprintf(stderr, "Plaintext mismatch\n");
391             hexdump(stderr, "Got", out, pn);
392             hexdump(stderr, "Expected", plaintext, pn);
393             test1_exit(9);
394         }
395     }
396
397     EVP_CIPHER_CTX_free(ctx);
398
399     printf("\n");
400 }
401
402 static int test_cipher(const char *cipher, const unsigned char *key, int kn,
403                        const unsigned char *iv, int in,
404                        const unsigned char *plaintext, int pn,
405                        const unsigned char *ciphertext, int cn,
406                        const unsigned char *aad, int an,
407                        const unsigned char *tag, int tn, int encdec)
408 {
409     const EVP_CIPHER *c;
410
411 #ifdef OPENSSL_NO_OCB
412     if (strstr(cipher, "ocb") != NULL)
413         return 1;
414 #endif
415     c = EVP_get_cipherbyname(cipher);
416     if (!c)
417         return 0;
418
419     test1(c, key, kn, iv, in, plaintext, pn, ciphertext, cn, aad, an, tag, tn,
420           encdec);
421
422     return 1;
423 }
424
425 static int test_digest(const char *digest,
426                        const unsigned char *plaintext, int pn,
427                        const unsigned char *ciphertext, unsigned int cn)
428 {
429     const EVP_MD *d;
430     EVP_MD_CTX ctx;
431     unsigned char md[EVP_MAX_MD_SIZE];
432     unsigned int mdn;
433
434     d = EVP_get_digestbyname(digest);
435     if (!d)
436         return 0;
437
438     printf("Testing digest %s\n", EVP_MD_name(d));
439     hexdump(stdout, "Plaintext", plaintext, pn);
440     hexdump(stdout, "Digest", ciphertext, cn);
441
442     EVP_MD_CTX_init(&ctx);
443     if (!EVP_DigestInit_ex(&ctx, d, NULL)) {
444         fprintf(stderr, "DigestInit failed\n");
445         ERR_print_errors_fp(stderr);
446         EXIT(100);
447     }
448     if (!EVP_DigestUpdate(&ctx, plaintext, pn)) {
449         fprintf(stderr, "DigestUpdate failed\n");
450         ERR_print_errors_fp(stderr);
451         EXIT(101);
452     }
453     if (!EVP_DigestFinal_ex(&ctx, md, &mdn)) {
454         fprintf(stderr, "DigestFinal failed\n");
455         ERR_print_errors_fp(stderr);
456         EXIT(101);
457     }
458     EVP_MD_CTX_cleanup(&ctx);
459
460     if (mdn != cn) {
461         fprintf(stderr, "Digest length mismatch, got %d expected %d\n", mdn,
462                 cn);
463         EXIT(102);
464     }
465
466     if (memcmp(md, ciphertext, cn)) {
467         fprintf(stderr, "Digest mismatch\n");
468         hexdump(stderr, "Got", md, cn);
469         hexdump(stderr, "Expected", ciphertext, cn);
470         EXIT(103);
471     }
472
473     printf("\n");
474
475     EVP_MD_CTX_cleanup(&ctx);
476
477     return 1;
478 }
479
480 int main(int argc, char **argv)
481 {
482     const char *szTestFile;
483     FILE *f;
484
485     if (argc != 2) {
486         fprintf(stderr, "%s <test file>\n", argv[0]);
487         EXIT(1);
488     }
489     CRYPTO_malloc_debug_init();
490     CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
491     CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
492
493     szTestFile = argv[1];
494
495     f = fopen(szTestFile, "r");
496     if (!f) {
497         perror(szTestFile);
498         EXIT(2);
499     }
500     ERR_load_crypto_strings();
501     /* Load up the software EVP_CIPHER and EVP_MD definitions */
502     OpenSSL_add_all_ciphers();
503     OpenSSL_add_all_digests();
504 #ifndef OPENSSL_NO_ENGINE
505     /* Load all compiled-in ENGINEs */
506     ENGINE_load_builtin_engines();
507 #endif
508 #if 0
509     OPENSSL_config();
510 #endif
511 #ifndef OPENSSL_NO_ENGINE
512     /*
513      * Register all available ENGINE implementations of ciphers and digests.
514      * This could perhaps be changed to "ENGINE_register_all_complete()"?
515      */
516     ENGINE_register_all_ciphers();
517     ENGINE_register_all_digests();
518     /*
519      * If we add command-line options, this statement should be switchable.
520      * It'll prevent ENGINEs being ENGINE_init()ialised for cipher/digest use
521      * if they weren't already initialised.
522      */
523     /* ENGINE_set_cipher_flags(ENGINE_CIPHER_FLAG_NOINIT); */
524 #endif
525
526     for (;;) {
527         char line[4096];
528         char *p;
529         char *cipher;
530         unsigned char *iv, *key, *plaintext, *ciphertext, *aad, *tag;
531         int encdec;
532         int kn, in, pn, cn;
533         int an = 0;
534         int tn = 0;
535
536         if (!fgets((char *)line, sizeof line, f))
537             break;
538         if (line[0] == '#' || line[0] == '\n')
539             continue;
540         p = line;
541         cipher = sstrsep(&p, ":");
542         key = ustrsep(&p, ":");
543         iv = ustrsep(&p, ":");
544         plaintext = ustrsep(&p, ":");
545         ciphertext = ustrsep(&p, ":");
546         if (p[-1] == '\n') {
547             encdec = -1;
548             p[-1] = '\0';
549             tag = aad = NULL;
550             an = tn = 0;
551         } else {
552             aad = ustrsep(&p, ":");
553             tag = ustrsep(&p, ":");
554             if (tag == NULL) {
555                 p = (char *)aad;
556                 tag = aad = NULL;
557                 an = tn = 0;
558             }
559             if (p[-1] == '\n') {
560                 encdec = -1;
561                 p[-1] = '\0';
562             } else
563                 encdec = atoi(sstrsep(&p, "\n"));
564         }
565
566         kn = convert(key);
567         in = convert(iv);
568         pn = convert(plaintext);
569         cn = convert(ciphertext);
570         if (aad) {
571             an = convert(aad);
572             tn = convert(tag);
573         }
574
575         if (!test_cipher
576             (cipher, key, kn, iv, in, plaintext, pn, ciphertext, cn, aad, an,
577              tag, tn, encdec)
578             && !test_digest(cipher, plaintext, pn, ciphertext, cn)) {
579 #ifdef OPENSSL_NO_AES
580             if (strstr(cipher, "AES") == cipher) {
581                 fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
582                 continue;
583             }
584 #endif
585 #ifdef OPENSSL_NO_DES
586             if (strstr(cipher, "DES") == cipher) {
587                 fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
588                 continue;
589             }
590 #endif
591 #ifdef OPENSSL_NO_RC4
592             if (strstr(cipher, "RC4") == cipher) {
593                 fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
594                 continue;
595             }
596 #endif
597 #ifdef OPENSSL_NO_CAMELLIA
598             if (strstr(cipher, "CAMELLIA") == cipher) {
599                 fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
600                 continue;
601             }
602 #endif
603 #ifdef OPENSSL_NO_SEED
604             if (strstr(cipher, "SEED") == cipher) {
605                 fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
606                 continue;
607             }
608 #endif
609             fprintf(stderr, "Can't find %s\n", cipher);
610             EXIT(3);
611         }
612     }
613     fclose(f);
614
615 #ifndef OPENSSL_NO_ENGINE
616     ENGINE_cleanup();
617 #endif
618     EVP_cleanup();
619     CRYPTO_cleanup_all_ex_data();
620     ERR_remove_thread_state(NULL);
621     ERR_free_strings();
622     CRYPTO_mem_leaks_fp(stderr);
623
624     return 0;
625 }