Rich Salz | 846e33c | 2016-05-17 14:18:30 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. |
Ralf S. Engelschall | d02b48c | 1998-12-21 10:52:47 +0000 | [diff] [blame] | 3 | * |
Rich Salz | 846e33c | 2016-05-17 14:18:30 -0400 | [diff] [blame] | 4 | * Licensed under the OpenSSL license (the "License"). You may not use |
| 5 | * this file except in compliance with the License. You can obtain a copy |
| 6 | * in the file LICENSE in the source distribution or at |
| 7 | * https://www.openssl.org/source/license.html |
Ralf S. Engelschall | d02b48c | 1998-12-21 10:52:47 +0000 | [diff] [blame] | 8 | */ |
| 9 | |
Rich Salz | effaf4d | 2016-01-31 13:08:23 -0500 | [diff] [blame] | 10 | #include <openssl/opensslconf.h> |
| 11 | #ifdef OPENSSL_NO_DSA |
| 12 | NON_EMPTY_TRANSLATION_UNIT |
| 13 | #else |
| 14 | |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 15 | # include <stdio.h> |
| 16 | # include <stdlib.h> |
| 17 | # include <string.h> |
| 18 | # include <time.h> |
| 19 | # include "apps.h" |
| 20 | # include <openssl/bio.h> |
| 21 | # include <openssl/err.h> |
| 22 | # include <openssl/dsa.h> |
| 23 | # include <openssl/evp.h> |
| 24 | # include <openssl/x509.h> |
| 25 | # include <openssl/pem.h> |
| 26 | # include <openssl/bn.h> |
Ralf S. Engelschall | d02b48c | 1998-12-21 10:52:47 +0000 | [diff] [blame] | 27 | |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 28 | typedef enum OPTION_choice { |
| 29 | OPT_ERR = -1, OPT_EOF = 0, OPT_HELP, |
FdaSilvaYY | e7917e3 | 2016-08-05 00:19:36 +0200 | [diff] [blame] | 30 | OPT_INFORM, OPT_OUTFORM, OPT_IN, OPT_OUT, OPT_ENGINE, |
| 31 | /* Do not change the order here; see case statements below */ |
| 32 | OPT_PVK_NONE, OPT_PVK_WEAK, OPT_PVK_STRONG, |
| 33 | OPT_NOOUT, OPT_TEXT, OPT_MODULUS, OPT_PUBIN, |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 34 | OPT_PUBOUT, OPT_CIPHER, OPT_PASSIN, OPT_PASSOUT |
| 35 | } OPTION_CHOICE; |
Ralf S. Engelschall | d02b48c | 1998-12-21 10:52:47 +0000 | [diff] [blame] | 36 | |
FdaSilvaYY | 44c83eb | 2016-03-13 14:07:50 +0100 | [diff] [blame] | 37 | const OPTIONS dsa_options[] = { |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 38 | {"help", OPT_HELP, '-', "Display this summary"}, |
Dr. Stephen Henson | d18ba3c | 2016-05-10 15:19:56 +0100 | [diff] [blame] | 39 | {"inform", OPT_INFORM, 'f', "Input format, DER PEM PVK"}, |
Dr. Stephen Henson | b379598 | 2016-11-16 23:14:30 +0000 | [diff] [blame] | 40 | {"outform", OPT_OUTFORM, 'f', "Output format, DER PEM PVK"}, |
Dr. Stephen Henson | dd95897 | 2016-02-08 15:06:48 +0000 | [diff] [blame] | 41 | {"in", OPT_IN, 's', "Input key"}, |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 42 | {"out", OPT_OUT, '>', "Output file"}, |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 43 | {"noout", OPT_NOOUT, '-', "Don't print key out"}, |
| 44 | {"text", OPT_TEXT, '-', "Print the key in text"}, |
| 45 | {"modulus", OPT_MODULUS, '-', "Print the DSA public value"}, |
FdaSilvaYY | 16e1b28 | 2016-03-20 21:14:10 +0100 | [diff] [blame] | 46 | {"pubin", OPT_PUBIN, '-', "Expect a public key in input file"}, |
| 47 | {"pubout", OPT_PUBOUT, '-', "Output public key, not private"}, |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 48 | {"passin", OPT_PASSIN, 's', "Input file pass phrase source"}, |
| 49 | {"passout", OPT_PASSOUT, 's', "Output file pass phrase source"}, |
| 50 | {"", OPT_CIPHER, '-', "Any supported cipher"}, |
Rich Salz | 9c3bcfa | 2015-05-15 13:50:38 -0400 | [diff] [blame] | 51 | # ifndef OPENSSL_NO_RC4 |
FdaSilvaYY | e7917e3 | 2016-08-05 00:19:36 +0200 | [diff] [blame] | 52 | {"pvk-strong", OPT_PVK_STRONG, '-', "Enable 'Strong' PVK encoding level (default)"}, |
| 53 | {"pvk-weak", OPT_PVK_WEAK, '-', "Enable 'Weak' PVK encoding level"}, |
| 54 | {"pvk-none", OPT_PVK_NONE, '-', "Don't enforce PVK encoding"}, |
Rich Salz | 9c3bcfa | 2015-05-15 13:50:38 -0400 | [diff] [blame] | 55 | # endif |
| 56 | # ifndef OPENSSL_NO_ENGINE |
| 57 | {"engine", OPT_ENGINE, 's', "Use engine e, possibly a hardware device"}, |
| 58 | # endif |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 59 | {NULL} |
| 60 | }; |
Ralf S. Engelschall | d02b48c | 1998-12-21 10:52:47 +0000 | [diff] [blame] | 61 | |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 62 | int dsa_main(int argc, char **argv) |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 63 | { |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 64 | BIO *out = NULL; |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 65 | DSA *dsa = NULL; |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 66 | ENGINE *e = NULL; |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 67 | const EVP_CIPHER *enc = NULL; |
Rich Salz | 333b070 | 2015-04-25 15:41:29 -0400 | [diff] [blame] | 68 | char *infile = NULL, *outfile = NULL, *prog; |
| 69 | char *passin = NULL, *passout = NULL, *passinarg = NULL, *passoutarg = NULL; |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 70 | OPTION_CHOICE o; |
| 71 | int informat = FORMAT_PEM, outformat = FORMAT_PEM, text = 0, noout = 0; |
Ben Laurie | 9730043 | 2016-03-22 02:39:36 +0000 | [diff] [blame] | 72 | int i, modulus = 0, pubin = 0, pubout = 0, ret = 1; |
| 73 | # ifndef OPENSSL_NO_RC4 |
| 74 | int pvk_encr = 2; |
| 75 | # endif |
Rich Salz | 3b061a0 | 2015-05-02 10:01:33 -0400 | [diff] [blame] | 76 | int private = 0; |
Ralf S. Engelschall | d02b48c | 1998-12-21 10:52:47 +0000 | [diff] [blame] | 77 | |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 78 | prog = opt_init(argc, argv, dsa_options); |
| 79 | while ((o = opt_next()) != OPT_EOF) { |
| 80 | switch (o) { |
| 81 | case OPT_EOF: |
| 82 | case OPT_ERR: |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 83 | opthelp: |
| 84 | ret = 0; |
| 85 | BIO_printf(bio_err, "%s: Use -help for summary.\n", prog); |
| 86 | goto end; |
| 87 | case OPT_HELP: |
| 88 | opt_help(dsa_options); |
| 89 | ret = 0; |
| 90 | goto end; |
| 91 | case OPT_INFORM: |
Dr. Stephen Henson | dd95897 | 2016-02-08 15:06:48 +0000 | [diff] [blame] | 92 | if (!opt_format(opt_arg(), OPT_FMT_ANY, &informat)) |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 93 | goto opthelp; |
| 94 | break; |
| 95 | case OPT_IN: |
| 96 | infile = opt_arg(); |
| 97 | break; |
| 98 | case OPT_OUTFORM: |
Dr. Stephen Henson | b379598 | 2016-11-16 23:14:30 +0000 | [diff] [blame] | 99 | if (!opt_format(opt_arg(), OPT_FMT_ANY, &outformat)) |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 100 | goto opthelp; |
| 101 | break; |
| 102 | case OPT_OUT: |
| 103 | outfile = opt_arg(); |
| 104 | break; |
| 105 | case OPT_ENGINE: |
Rich Salz | 333b070 | 2015-04-25 15:41:29 -0400 | [diff] [blame] | 106 | e = setup_engine(opt_arg(), 0); |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 107 | break; |
| 108 | case OPT_PASSIN: |
| 109 | passinarg = opt_arg(); |
| 110 | break; |
| 111 | case OPT_PASSOUT: |
| 112 | passoutarg = opt_arg(); |
| 113 | break; |
FdaSilvaYY | e7917e3 | 2016-08-05 00:19:36 +0200 | [diff] [blame] | 114 | case OPT_PVK_STRONG: /* pvk_encr:= 2 */ |
| 115 | case OPT_PVK_WEAK: /* pvk_encr:= 1 */ |
| 116 | case OPT_PVK_NONE: /* pvk_encr:= 0 */ |
Dr. Stephen Henson | 3531376 | 2015-02-26 19:23:38 +0000 | [diff] [blame] | 117 | #ifndef OPENSSL_NO_RC4 |
FdaSilvaYY | e7917e3 | 2016-08-05 00:19:36 +0200 | [diff] [blame] | 118 | pvk_encr = (o - OPT_PVK_NONE); |
Dr. Stephen Henson | 3531376 | 2015-02-26 19:23:38 +0000 | [diff] [blame] | 119 | #endif |
FdaSilvaYY | e7917e3 | 2016-08-05 00:19:36 +0200 | [diff] [blame] | 120 | break; |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 121 | case OPT_NOOUT: |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 122 | noout = 1; |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 123 | break; |
| 124 | case OPT_TEXT: |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 125 | text = 1; |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 126 | break; |
| 127 | case OPT_MODULUS: |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 128 | modulus = 1; |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 129 | break; |
| 130 | case OPT_PUBIN: |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 131 | pubin = 1; |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 132 | break; |
| 133 | case OPT_PUBOUT: |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 134 | pubout = 1; |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 135 | break; |
| 136 | case OPT_CIPHER: |
| 137 | if (!opt_cipher(opt_unknown(), &enc)) |
| 138 | goto end; |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 139 | break; |
| 140 | } |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 141 | } |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 142 | argc = opt_num_rest(); |
Kurt Roeckx | 0335851 | 2016-02-14 20:45:02 +0100 | [diff] [blame] | 143 | if (argc != 0) |
| 144 | goto opthelp; |
| 145 | |
Rich Salz | 3b061a0 | 2015-05-02 10:01:33 -0400 | [diff] [blame] | 146 | private = pubin || pubout ? 0 : 1; |
Viktor Dukhovni | 7eff6aa | 2015-12-13 02:51:44 -0500 | [diff] [blame] | 147 | if (text && !pubin) |
Rich Salz | 3b061a0 | 2015-05-02 10:01:33 -0400 | [diff] [blame] | 148 | private = 1; |
Ralf S. Engelschall | d02b48c | 1998-12-21 10:52:47 +0000 | [diff] [blame] | 149 | |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 150 | if (!app_passwd(passinarg, passoutarg, &passin, &passout)) { |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 151 | BIO_printf(bio_err, "Error getting passwords\n"); |
| 152 | goto end; |
| 153 | } |
Dr. Stephen Henson | a3fe382 | 2000-02-16 23:16:01 +0000 | [diff] [blame] | 154 | |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 155 | BIO_printf(bio_err, "read DSA key\n"); |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 156 | { |
| 157 | EVP_PKEY *pkey; |
Dr. Stephen Henson | a0156a9 | 2005-08-31 16:37:54 +0000 | [diff] [blame] | 158 | |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 159 | if (pubin) |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 160 | pkey = load_pubkey(infile, informat, 1, passin, e, "Public Key"); |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 161 | else |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 162 | pkey = load_key(infile, informat, 1, passin, e, "Private Key"); |
Dr. Stephen Henson | a0156a9 | 2005-08-31 16:37:54 +0000 | [diff] [blame] | 163 | |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 164 | if (pkey) { |
| 165 | dsa = EVP_PKEY_get1_DSA(pkey); |
| 166 | EVP_PKEY_free(pkey); |
| 167 | } |
| 168 | } |
| 169 | if (dsa == NULL) { |
| 170 | BIO_printf(bio_err, "unable to load Key\n"); |
| 171 | ERR_print_errors(bio_err); |
| 172 | goto end; |
| 173 | } |
Ralf S. Engelschall | d02b48c | 1998-12-21 10:52:47 +0000 | [diff] [blame] | 174 | |
Richard Levitte | bdd58d9 | 2015-09-04 12:49:06 +0200 | [diff] [blame] | 175 | out = bio_open_owner(outfile, outformat, private); |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 176 | if (out == NULL) |
| 177 | goto end; |
Ralf S. Engelschall | d02b48c | 1998-12-21 10:52:47 +0000 | [diff] [blame] | 178 | |
Rich Salz | 3b061a0 | 2015-05-02 10:01:33 -0400 | [diff] [blame] | 179 | if (text) { |
Viktor Dukhovni | 7eff6aa | 2015-12-13 02:51:44 -0500 | [diff] [blame] | 180 | assert(pubin || private); |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 181 | if (!DSA_print(out, dsa, 0)) { |
| 182 | perror(outfile); |
| 183 | ERR_print_errors(bio_err); |
| 184 | goto end; |
| 185 | } |
Rich Salz | 3b061a0 | 2015-05-02 10:01:33 -0400 | [diff] [blame] | 186 | } |
Ralf S. Engelschall | d02b48c | 1998-12-21 10:52:47 +0000 | [diff] [blame] | 187 | |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 188 | if (modulus) { |
Richard Levitte | 2ac6115 | 2016-06-14 15:49:05 +0200 | [diff] [blame] | 189 | const BIGNUM *pub_key = NULL; |
Matt Caswell | 6e9fa57 | 2016-03-30 17:18:55 +0100 | [diff] [blame] | 190 | DSA_get0_key(dsa, &pub_key, NULL); |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 191 | BIO_printf(out, "Public Key="); |
Matt Caswell | 6e9fa57 | 2016-03-30 17:18:55 +0100 | [diff] [blame] | 192 | BN_print(out, pub_key); |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 193 | BIO_printf(out, "\n"); |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 194 | } |
Ralf S. Engelschall | d02b48c | 1998-12-21 10:52:47 +0000 | [diff] [blame] | 195 | |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 196 | if (noout) { |
| 197 | ret = 0; |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 198 | goto end; |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 199 | } |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 200 | BIO_printf(bio_err, "writing DSA key\n"); |
| 201 | if (outformat == FORMAT_ASN1) { |
| 202 | if (pubin || pubout) |
| 203 | i = i2d_DSA_PUBKEY_bio(out, dsa); |
Rich Salz | 3b061a0 | 2015-05-02 10:01:33 -0400 | [diff] [blame] | 204 | else { |
| 205 | assert(private); |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 206 | i = i2d_DSAPrivateKey_bio(out, dsa); |
Rich Salz | 3b061a0 | 2015-05-02 10:01:33 -0400 | [diff] [blame] | 207 | } |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 208 | } else if (outformat == FORMAT_PEM) { |
| 209 | if (pubin || pubout) |
| 210 | i = PEM_write_bio_DSA_PUBKEY(out, dsa); |
Rich Salz | 3b061a0 | 2015-05-02 10:01:33 -0400 | [diff] [blame] | 211 | else { |
| 212 | assert(private); |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 213 | i = PEM_write_bio_DSAPrivateKey(out, dsa, enc, |
| 214 | NULL, 0, NULL, passout); |
Rich Salz | 3b061a0 | 2015-05-02 10:01:33 -0400 | [diff] [blame] | 215 | } |
Dr. Stephen Henson | b6c6898 | 2016-11-17 13:17:28 +0000 | [diff] [blame] | 216 | # ifndef OPENSSL_NO_RSA |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 217 | } else if (outformat == FORMAT_MSBLOB || outformat == FORMAT_PVK) { |
| 218 | EVP_PKEY *pk; |
| 219 | pk = EVP_PKEY_new(); |
| 220 | EVP_PKEY_set1_DSA(pk, dsa); |
Rich Salz | 3b061a0 | 2015-05-02 10:01:33 -0400 | [diff] [blame] | 221 | if (outformat == FORMAT_PVK) { |
Viktor Dukhovni | 7eff6aa | 2015-12-13 02:51:44 -0500 | [diff] [blame] | 222 | if (pubin) { |
| 223 | BIO_printf(bio_err, "PVK form impossible with public key input\n"); |
| 224 | EVP_PKEY_free(pk); |
| 225 | goto end; |
| 226 | } |
Rich Salz | 3b061a0 | 2015-05-02 10:01:33 -0400 | [diff] [blame] | 227 | assert(private); |
Dr. Stephen Henson | b6c6898 | 2016-11-17 13:17:28 +0000 | [diff] [blame] | 228 | # ifdef OPENSSL_NO_RC4 |
| 229 | BIO_printf(bio_err, "PVK format not supported\n"); |
| 230 | EVP_PKEY_free(pk); |
| 231 | goto end; |
| 232 | # else |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 233 | i = i2b_PVK_bio(out, pk, pvk_encr, 0, passout); |
Dr. Stephen Henson | b6c6898 | 2016-11-17 13:17:28 +0000 | [diff] [blame] | 234 | # endif |
Rich Salz | 3b061a0 | 2015-05-02 10:01:33 -0400 | [diff] [blame] | 235 | } |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 236 | else if (pubin || pubout) |
| 237 | i = i2b_PublicKey_bio(out, pk); |
Rich Salz | 3b061a0 | 2015-05-02 10:01:33 -0400 | [diff] [blame] | 238 | else { |
| 239 | assert(private); |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 240 | i = i2b_PrivateKey_bio(out, pk); |
Rich Salz | 3b061a0 | 2015-05-02 10:01:33 -0400 | [diff] [blame] | 241 | } |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 242 | EVP_PKEY_free(pk); |
| 243 | # endif |
| 244 | } else { |
| 245 | BIO_printf(bio_err, "bad output format specified for outfile\n"); |
| 246 | goto end; |
| 247 | } |
| 248 | if (i <= 0) { |
| 249 | BIO_printf(bio_err, "unable to write private key\n"); |
| 250 | ERR_print_errors(bio_err); |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 251 | goto end; |
| 252 | } |
| 253 | ret = 0; |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 254 | end: |
Rich Salz | ca3a82c | 2015-03-25 11:31:18 -0400 | [diff] [blame] | 255 | BIO_free_all(out); |
Rich Salz | d640708 | 2015-03-24 10:17:37 -0400 | [diff] [blame] | 256 | DSA_free(dsa); |
Richard Levitte | dd1abd4 | 2016-09-28 23:39:18 +0200 | [diff] [blame] | 257 | release_engine(e); |
Rich Salz | b548a1f | 2015-05-01 10:02:07 -0400 | [diff] [blame] | 258 | OPENSSL_free(passin); |
| 259 | OPENSSL_free(passout); |
Rich Salz | 7e1b748 | 2015-04-24 15:26:15 -0400 | [diff] [blame] | 260 | return (ret); |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 261 | } |
Ulf Möller | f5d7a03 | 1999-04-27 01:14:46 +0000 | [diff] [blame] | 262 | #endif |