1*e5fae9e6Stb /* $OpenBSD: evptest.c,v 1.15 2024/03/30 09:49:59 tb Exp $ */
23c6bd008Smiod /* Written by Ben Laurie, 2001 */
33c6bd008Smiod /*
43c6bd008Smiod * Copyright (c) 2001 The OpenSSL Project. All rights reserved.
53c6bd008Smiod *
63c6bd008Smiod * Redistribution and use in source and binary forms, with or without
73c6bd008Smiod * modification, are permitted provided that the following conditions
83c6bd008Smiod * are met:
93c6bd008Smiod *
103c6bd008Smiod * 1. Redistributions of source code must retain the above copyright
113c6bd008Smiod * notice, this list of conditions and the following disclaimer.
123c6bd008Smiod *
133c6bd008Smiod * 2. Redistributions in binary form must reproduce the above copyright
143c6bd008Smiod * notice, this list of conditions and the following disclaimer in
153c6bd008Smiod * the documentation and/or other materials provided with the
163c6bd008Smiod * distribution.
173c6bd008Smiod *
183c6bd008Smiod * 3. All advertising materials mentioning features or use of this
193c6bd008Smiod * software must display the following acknowledgment:
203c6bd008Smiod * "This product includes software developed by the OpenSSL Project
213c6bd008Smiod * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
223c6bd008Smiod *
233c6bd008Smiod * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
243c6bd008Smiod * endorse or promote products derived from this software without
253c6bd008Smiod * prior written permission. For written permission, please contact
263c6bd008Smiod * openssl-core@openssl.org.
273c6bd008Smiod *
283c6bd008Smiod * 5. Products derived from this software may not be called "OpenSSL"
293c6bd008Smiod * nor may "OpenSSL" appear in their names without prior written
303c6bd008Smiod * permission of the OpenSSL Project.
313c6bd008Smiod *
323c6bd008Smiod * 6. Redistributions of any form whatsoever must retain the following
333c6bd008Smiod * acknowledgment:
343c6bd008Smiod * "This product includes software developed by the OpenSSL Project
353c6bd008Smiod * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
363c6bd008Smiod *
373c6bd008Smiod * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
383c6bd008Smiod * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
393c6bd008Smiod * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
403c6bd008Smiod * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
413c6bd008Smiod * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
423c6bd008Smiod * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
433c6bd008Smiod * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
443c6bd008Smiod * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
453c6bd008Smiod * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
463c6bd008Smiod * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
473c6bd008Smiod * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
483c6bd008Smiod * OF THE POSSIBILITY OF SUCH DAMAGE.
493c6bd008Smiod */
503c6bd008Smiod
513c6bd008Smiod #include <stdio.h>
52*e5fae9e6Stb #include <stdlib.h>
533c6bd008Smiod #include <string.h>
543c6bd008Smiod
553c6bd008Smiod #include <openssl/opensslconf.h>
563c6bd008Smiod #include <openssl/evp.h>
573c6bd008Smiod #include <openssl/err.h>
583c6bd008Smiod #include <openssl/conf.h>
593c6bd008Smiod
60dd04dea9Stb int verbose;
61dd04dea9Stb
62cdfac08eSjsing static void
hexdump(FILE * f,const char * title,const unsigned char * s,int l)63cdfac08eSjsing hexdump(FILE *f, const char *title, const unsigned char *s, int l)
643c6bd008Smiod {
653c6bd008Smiod int n = 0;
663c6bd008Smiod
673c6bd008Smiod fprintf(f, "%s",title);
68cdfac08eSjsing for (; n < l; ++n) {
693c6bd008Smiod if ((n % 16) == 0)
703c6bd008Smiod fprintf(f, "\n%04x",n);
713c6bd008Smiod fprintf(f, " %02x",s[n]);
723c6bd008Smiod }
733c6bd008Smiod fprintf(f, "\n");
743c6bd008Smiod }
753c6bd008Smiod
76cdfac08eSjsing static int
convert(unsigned char * s)77cdfac08eSjsing convert(unsigned char *s)
783c6bd008Smiod {
793c6bd008Smiod unsigned char *d;
803c6bd008Smiod
81cdfac08eSjsing for (d = s; *s; s += 2,++d) {
823c6bd008Smiod unsigned int n;
833c6bd008Smiod
84cdfac08eSjsing if (!s[1]) {
850041c37eSbcook fprintf(stderr, "Odd number of hex digits!\n");
863c6bd008Smiod exit(4);
873c6bd008Smiod }
880041c37eSbcook if (sscanf((char *)s, "%2x", &n) != 1) {
890041c37eSbcook fprintf(stderr, "Invalid hex value at %s\n", s);
900041c37eSbcook exit(4);
910041c37eSbcook }
920041c37eSbcook
933c6bd008Smiod *d = (unsigned char)n;
943c6bd008Smiod }
953c6bd008Smiod return s - d;
963c6bd008Smiod }
973c6bd008Smiod
98cdfac08eSjsing static char *
sstrsep(char ** string,const char * delim)99cdfac08eSjsing sstrsep(char **string, const char *delim)
1003c6bd008Smiod {
1013c6bd008Smiod char isdelim[256];
1023c6bd008Smiod char *token = *string;
1033c6bd008Smiod
1043c6bd008Smiod if (**string == 0)
1053c6bd008Smiod return NULL;
1063c6bd008Smiod
1073c6bd008Smiod memset(isdelim, 0, 256);
1083c6bd008Smiod isdelim[0] = 1;
1093c6bd008Smiod
110cdfac08eSjsing while (*delim) {
1113c6bd008Smiod isdelim[(unsigned char)(*delim)] = 1;
1123c6bd008Smiod delim++;
1133c6bd008Smiod }
1143c6bd008Smiod
115cdfac08eSjsing while (!isdelim[(unsigned char)(**string)]) {
1163c6bd008Smiod (*string)++;
1173c6bd008Smiod }
1183c6bd008Smiod
119cdfac08eSjsing if (**string) {
1203c6bd008Smiod **string = 0;
1213c6bd008Smiod (*string)++;
1223c6bd008Smiod }
1233c6bd008Smiod
1243c6bd008Smiod return token;
1253c6bd008Smiod }
1263c6bd008Smiod
127cdfac08eSjsing static unsigned char *
ustrsep(char ** p,const char * sep)128cdfac08eSjsing ustrsep(char **p, const char *sep)
129cdfac08eSjsing {
130cdfac08eSjsing return (unsigned char *)sstrsep(p, sep);
131cdfac08eSjsing }
1323c6bd008Smiod
133cdfac08eSjsing static void
test1(const EVP_CIPHER * c,const unsigned char * key,int kn,const unsigned char * iv,int in,const unsigned char * plaintext,int pn,const unsigned char * ciphertext,int cn,int encdec)134cdfac08eSjsing test1(const EVP_CIPHER *c, const unsigned char *key, int kn,
135cdfac08eSjsing const unsigned char *iv, int in, const unsigned char *plaintext, int pn,
136cdfac08eSjsing const unsigned char *ciphertext, int cn, int encdec)
1373c6bd008Smiod {
1380f19def3Stb EVP_CIPHER_CTX *ctx;
1393c6bd008Smiod unsigned char out[4096];
140990bad0aStb const unsigned char *eiv;
1413c6bd008Smiod int outl, outl2;
1423c6bd008Smiod
143dd04dea9Stb if (verbose) {
1443c6bd008Smiod printf("Testing cipher %s%s\n", EVP_CIPHER_name(c),
1453c6bd008Smiod (encdec == 1 ? "(encrypt)" : (encdec == 0 ? "(decrypt)" : "(encrypt/decrypt)")));
1463c6bd008Smiod hexdump(stdout, "Key",key,kn);
1473c6bd008Smiod if (in)
1483c6bd008Smiod hexdump(stdout, "IV",iv,in);
1493c6bd008Smiod hexdump(stdout, "Plaintext",plaintext,pn);
1503c6bd008Smiod hexdump(stdout, "Ciphertext",ciphertext,cn);
151dd04dea9Stb }
1523c6bd008Smiod
1530f19def3Stb if (kn != EVP_CIPHER_key_length(c)) {
1543c6bd008Smiod fprintf(stderr, "Key length doesn't match, got %d expected %lu\n",kn,
1550f19def3Stb (unsigned long)EVP_CIPHER_key_length(c));
156*e5fae9e6Stb exit(5);
1573c6bd008Smiod }
1580f19def3Stb if ((ctx = EVP_CIPHER_CTX_new()) == NULL) {
1590f19def3Stb fprintf(stderr, "EVP_CIPHER_CTX_new failed\n");
1600f19def3Stb ERR_print_errors_fp(stderr);
161*e5fae9e6Stb exit(12);
1620f19def3Stb }
1630f19def3Stb EVP_CIPHER_CTX_set_flags(ctx, EVP_CIPHER_CTX_FLAG_WRAP_ALLOW);
164cdfac08eSjsing if (encdec != 0) {
165990bad0aStb eiv = iv;
166990bad0aStb if (EVP_CIPHER_mode(c) == EVP_CIPH_WRAP_MODE && in == 0)
167990bad0aStb eiv = NULL;
1680f19def3Stb if (!EVP_EncryptInit_ex(ctx, c, NULL, key, eiv)) {
1693c6bd008Smiod fprintf(stderr, "EncryptInit failed\n");
1703c6bd008Smiod ERR_print_errors_fp(stderr);
171*e5fae9e6Stb exit(10);
1723c6bd008Smiod }
1730f19def3Stb EVP_CIPHER_CTX_set_padding(ctx, 0);
1743c6bd008Smiod
1750f19def3Stb if (!EVP_EncryptUpdate(ctx, out, &outl, plaintext, pn)) {
1763c6bd008Smiod fprintf(stderr, "Encrypt failed\n");
1773c6bd008Smiod ERR_print_errors_fp(stderr);
178*e5fae9e6Stb exit(6);
1793c6bd008Smiod }
1800f19def3Stb if (!EVP_EncryptFinal_ex(ctx, out + outl, &outl2)) {
1813c6bd008Smiod fprintf(stderr, "EncryptFinal failed\n");
1823c6bd008Smiod ERR_print_errors_fp(stderr);
183*e5fae9e6Stb exit(7);
1843c6bd008Smiod }
1853c6bd008Smiod
186cdfac08eSjsing if (outl + outl2 != cn) {
1873c6bd008Smiod fprintf(stderr, "Ciphertext length mismatch got %d expected %d\n",
1883c6bd008Smiod outl + outl2, cn);
189*e5fae9e6Stb exit(8);
1903c6bd008Smiod }
1913c6bd008Smiod
192cdfac08eSjsing if (memcmp(out, ciphertext, cn)) {
1933c6bd008Smiod fprintf(stderr, "Ciphertext mismatch\n");
1943c6bd008Smiod hexdump(stderr, "Got",out,cn);
1953c6bd008Smiod hexdump(stderr, "Expected",ciphertext,cn);
196*e5fae9e6Stb exit(9);
1973c6bd008Smiod }
1983c6bd008Smiod }
1993c6bd008Smiod
200cdfac08eSjsing if (encdec <= 0) {
201990bad0aStb eiv = iv;
202990bad0aStb if (EVP_CIPHER_mode(c) == EVP_CIPH_WRAP_MODE && in == 0)
203990bad0aStb eiv = NULL;
2040f19def3Stb if (!EVP_DecryptInit_ex(ctx, c,NULL, key, eiv)) {
2053c6bd008Smiod fprintf(stderr, "DecryptInit failed\n");
2063c6bd008Smiod ERR_print_errors_fp(stderr);
207*e5fae9e6Stb exit(11);
2083c6bd008Smiod }
2090f19def3Stb EVP_CIPHER_CTX_set_padding(ctx, 0);
2103c6bd008Smiod
2110f19def3Stb if (!EVP_DecryptUpdate(ctx, out, &outl, ciphertext, cn)) {
2123c6bd008Smiod fprintf(stderr, "Decrypt failed\n");
2133c6bd008Smiod ERR_print_errors_fp(stderr);
214*e5fae9e6Stb exit(6);
2153c6bd008Smiod }
2160f19def3Stb if (!EVP_DecryptFinal_ex(ctx, out + outl, &outl2)) {
2173c6bd008Smiod fprintf(stderr, "DecryptFinal failed\n");
2183c6bd008Smiod ERR_print_errors_fp(stderr);
219*e5fae9e6Stb exit(7);
2203c6bd008Smiod }
2213c6bd008Smiod
222cdfac08eSjsing if (outl + outl2 != pn) {
2233c6bd008Smiod fprintf(stderr, "Plaintext length mismatch got %d expected %d\n",
2243c6bd008Smiod outl + outl2, pn);
225*e5fae9e6Stb exit(8);
2263c6bd008Smiod }
2273c6bd008Smiod
228cdfac08eSjsing if (memcmp(out, plaintext, pn)) {
2293c6bd008Smiod fprintf(stderr, "Plaintext mismatch\n");
2303c6bd008Smiod hexdump(stderr, "Got",out,pn);
2313c6bd008Smiod hexdump(stderr, "Expected",plaintext,pn);
232*e5fae9e6Stb exit(9);
2333c6bd008Smiod }
2343c6bd008Smiod }
2353c6bd008Smiod
2360f19def3Stb EVP_CIPHER_CTX_free(ctx);
2373c6bd008Smiod
238dd04dea9Stb if (verbose)
2393c6bd008Smiod printf("\n");
2403c6bd008Smiod }
2413c6bd008Smiod
242cdfac08eSjsing static int
test_cipher(const char * cipher,const unsigned char * key,int kn,const unsigned char * iv,int in,const unsigned char * plaintext,int pn,const unsigned char * ciphertext,int cn,int encdec)243cdfac08eSjsing test_cipher(const char *cipher, const unsigned char *key, int kn,
244cdfac08eSjsing const unsigned char *iv, int in, const unsigned char *plaintext, int pn,
245cdfac08eSjsing const unsigned char *ciphertext, int cn, int encdec)
2463c6bd008Smiod {
2473c6bd008Smiod const EVP_CIPHER *c;
2483c6bd008Smiod
2493c6bd008Smiod c = EVP_get_cipherbyname(cipher);
2503c6bd008Smiod if (!c)
2513c6bd008Smiod return 0;
2523c6bd008Smiod
2533c6bd008Smiod test1(c, key, kn, iv, in, plaintext, pn, ciphertext, cn, encdec);
2543c6bd008Smiod
2553c6bd008Smiod return 1;
2563c6bd008Smiod }
2573c6bd008Smiod
258cdfac08eSjsing static int
test_digest(const char * digest,const unsigned char * plaintext,int pn,const unsigned char * ciphertext,unsigned int cn)259cdfac08eSjsing test_digest(const char *digest, const unsigned char *plaintext, int pn,
2603c6bd008Smiod const unsigned char *ciphertext, unsigned int cn)
2613c6bd008Smiod {
2623c6bd008Smiod const EVP_MD *d;
2630f19def3Stb EVP_MD_CTX *ctx;
2643c6bd008Smiod unsigned char md[EVP_MAX_MD_SIZE];
2653c6bd008Smiod unsigned int mdn;
2663c6bd008Smiod
2673c6bd008Smiod d = EVP_get_digestbyname(digest);
2683c6bd008Smiod if (!d)
2693c6bd008Smiod return 0;
2703c6bd008Smiod
271dd04dea9Stb if (verbose) {
2723c6bd008Smiod printf("Testing digest %s\n",EVP_MD_name(d));
2733c6bd008Smiod hexdump(stdout, "Plaintext",plaintext,pn);
2743c6bd008Smiod hexdump(stdout, "Digest",ciphertext,cn);
275dd04dea9Stb }
2763c6bd008Smiod
2770f19def3Stb if ((ctx = EVP_MD_CTX_new()) == NULL) {
2780f19def3Stb fprintf(stderr, "EVP_CIPHER_CTX_new failed\n");
2790f19def3Stb ERR_print_errors_fp(stderr);
280*e5fae9e6Stb exit(104);
2810f19def3Stb }
2820f19def3Stb if (!EVP_DigestInit_ex(ctx, d, NULL)) {
2833c6bd008Smiod fprintf(stderr, "DigestInit failed\n");
2843c6bd008Smiod ERR_print_errors_fp(stderr);
2853c6bd008Smiod exit(100);
2863c6bd008Smiod }
2870f19def3Stb if (!EVP_DigestUpdate(ctx, plaintext, pn)) {
2883c6bd008Smiod fprintf(stderr, "DigestUpdate failed\n");
2893c6bd008Smiod ERR_print_errors_fp(stderr);
2903c6bd008Smiod exit(101);
2913c6bd008Smiod }
2920f19def3Stb if (!EVP_DigestFinal_ex(ctx, md, &mdn)) {
2933c6bd008Smiod fprintf(stderr, "DigestFinal failed\n");
2943c6bd008Smiod ERR_print_errors_fp(stderr);
2953c6bd008Smiod exit(101);
2963c6bd008Smiod }
2972ccc93c9Stb EVP_MD_CTX_free(ctx);
2982ccc93c9Stb ctx = NULL;
2993c6bd008Smiod
300cdfac08eSjsing if (mdn != cn) {
3013c6bd008Smiod fprintf(stderr, "Digest length mismatch, got %d expected %d\n",mdn,cn);
3023c6bd008Smiod exit(102);
3033c6bd008Smiod }
3043c6bd008Smiod
305cdfac08eSjsing if (memcmp(md, ciphertext, cn)) {
3063c6bd008Smiod fprintf(stderr, "Digest mismatch\n");
3073c6bd008Smiod hexdump(stderr, "Got",md,cn);
3083c6bd008Smiod hexdump(stderr, "Expected",ciphertext,cn);
3093c6bd008Smiod exit(103);
3103c6bd008Smiod }
311dd04dea9Stb if (verbose)
3123c6bd008Smiod printf("\n");
3133c6bd008Smiod
3143c6bd008Smiod return 1;
3153c6bd008Smiod }
3163c6bd008Smiod
317cdfac08eSjsing int
main(int argc,char ** argv)318cdfac08eSjsing main(int argc, char **argv)
3193c6bd008Smiod {
3203c6bd008Smiod const char *szTestFile;
3213c6bd008Smiod FILE *f;
3223c6bd008Smiod
323dd04dea9Stb if (argc != 2 && argc != 3) {
3243c6bd008Smiod fprintf(stderr, "%s <test file>\n",argv[0]);
3253c6bd008Smiod exit(1);
3263c6bd008Smiod }
327dd04dea9Stb if (argc == 3 && strcmp(argv[1], "-v") == 0) {
328dd04dea9Stb verbose = 1;
329dd04dea9Stb argv++;
330dd04dea9Stb argc--;
331dd04dea9Stb }
3323c6bd008Smiod
3333c6bd008Smiod szTestFile = argv[1];
3343c6bd008Smiod
3353c6bd008Smiod f=fopen(szTestFile, "r");
336cdfac08eSjsing if (!f) {
3373c6bd008Smiod perror(szTestFile);
3383c6bd008Smiod exit(2);
3393c6bd008Smiod }
3403c6bd008Smiod
3413c6bd008Smiod /* Load up the software EVP_CIPHER and EVP_MD definitions */
3423c6bd008Smiod OpenSSL_add_all_ciphers();
3433c6bd008Smiod OpenSSL_add_all_digests();
3443c6bd008Smiod
345cdfac08eSjsing for (;;) {
346e0564105Stb char line[8 * 1024];
3473c6bd008Smiod char *p;
3483c6bd008Smiod char *cipher;
3493c6bd008Smiod unsigned char *iv, *key, *plaintext, *ciphertext;
3503c6bd008Smiod int encdec;
3513c6bd008Smiod int kn, in, pn, cn;
3523c6bd008Smiod
3533c6bd008Smiod if (!fgets((char *)line, sizeof line, f))
3543c6bd008Smiod break;
3553c6bd008Smiod if (line[0] == '#' || line[0] == '\n')
3563c6bd008Smiod continue;
3573c6bd008Smiod p = line;
3583c6bd008Smiod cipher=sstrsep(&p, ":");
3593c6bd008Smiod key=ustrsep(&p, ":");
3603c6bd008Smiod iv=ustrsep(&p, ":");
3613c6bd008Smiod plaintext=ustrsep(&p, ":");
3623c6bd008Smiod ciphertext=ustrsep(&p, ":");
3633c6bd008Smiod if (p[-1] == '\n') {
3643c6bd008Smiod p[-1] = '\0';
3653c6bd008Smiod encdec = -1;
3663c6bd008Smiod } else {
3673c6bd008Smiod encdec = atoi(sstrsep(&p, "\n"));
3683c6bd008Smiod }
3693c6bd008Smiod
3703c6bd008Smiod
3713c6bd008Smiod kn = convert(key);
3723c6bd008Smiod in = convert(iv);
3733c6bd008Smiod pn = convert(plaintext);
3743c6bd008Smiod cn = convert(ciphertext);
3753c6bd008Smiod
376cdfac08eSjsing if (!test_cipher(cipher, key, kn, iv, in, plaintext, pn, ciphertext, cn, encdec) &&
377cdfac08eSjsing !test_digest(cipher, plaintext, pn, ciphertext, cn)) {
3783c6bd008Smiod #ifdef OPENSSL_NO_AES
379dd04dea9Stb if (strstr(cipher, "AES") == cipher && verbose) {
380dd04dea9Stb if (verbose)
3813c6bd008Smiod fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
3823c6bd008Smiod continue;
3833c6bd008Smiod }
3843c6bd008Smiod #endif
3853c6bd008Smiod #ifdef OPENSSL_NO_DES
386dd04dea9Stb if (strstr(cipher, "DES") == cipher && verbose) {
387dd04dea9Stb if (verbose)
3883c6bd008Smiod fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
3893c6bd008Smiod continue;
3903c6bd008Smiod }
3913c6bd008Smiod #endif
3923c6bd008Smiod #ifdef OPENSSL_NO_RC4
393dd04dea9Stb if (strstr(cipher, "RC4") == cipher && verbose) {
394dd04dea9Stb if (verbose)
3953c6bd008Smiod fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
3963c6bd008Smiod continue;
3973c6bd008Smiod }
3983c6bd008Smiod #endif
3993c6bd008Smiod #ifdef OPENSSL_NO_CAMELLIA
400dd04dea9Stb if (strstr(cipher, "CAMELLIA") == cipher && verbose) {
401dd04dea9Stb if (verbose)
4023c6bd008Smiod fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
4033c6bd008Smiod continue;
4043c6bd008Smiod }
4053c6bd008Smiod #endif
4063c6bd008Smiod #ifdef OPENSSL_NO_SEED
407cdfac08eSjsing if (strstr(cipher, "SEED") == cipher) {
408dd04dea9Stb if (verbose)
4093c6bd008Smiod fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
4103c6bd008Smiod continue;
4113c6bd008Smiod }
4123c6bd008Smiod #endif
41342e84a6dSjsing #ifdef OPENSSL_NO_CHACHA
414cdfac08eSjsing if (strstr(cipher, "ChaCha") == cipher) {
415dd04dea9Stb if (verbose)
41642e84a6dSjsing fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
41742e84a6dSjsing continue;
41842e84a6dSjsing }
41942e84a6dSjsing #endif
420a15fdda0Smiod #ifdef OPENSSL_NO_GOST
421a15fdda0Smiod if (strstr(cipher, "md_gost") == cipher ||
422a15fdda0Smiod strstr(cipher, "streebog") == cipher) {
423dd04dea9Stb if (verbose)
424a15fdda0Smiod fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
425a15fdda0Smiod continue;
426a15fdda0Smiod }
427a15fdda0Smiod #endif
4283c6bd008Smiod fprintf(stderr, "Can't find %s\n",cipher);
4293c6bd008Smiod exit(3);
4303c6bd008Smiod }
4313c6bd008Smiod }
4323c6bd008Smiod fclose(f);
4333c6bd008Smiod
4343c6bd008Smiod EVP_cleanup();
4353c6bd008Smiod CRYPTO_cleanup_all_ex_data();
4363c6bd008Smiod ERR_remove_thread_state(NULL);
4373c6bd008Smiod ERR_free_strings();
4383c6bd008Smiod
4393c6bd008Smiod return 0;
4403c6bd008Smiod }
441