diff options
Diffstat (limited to 'src/usr.bin/openssl/x509.c')
| -rw-r--r-- | src/usr.bin/openssl/x509.c | 92 |
1 files changed, 2 insertions, 90 deletions
diff --git a/src/usr.bin/openssl/x509.c b/src/usr.bin/openssl/x509.c index fc8a0daeb3..e67e6fa54d 100644 --- a/src/usr.bin/openssl/x509.c +++ b/src/usr.bin/openssl/x509.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509.c,v 1.40 2024/12/04 08:14:34 tb Exp $ */ | 1 | /* $OpenBSD: x509.c,v 1.41 2025/01/19 10:24:17 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -93,7 +93,6 @@ static struct { | |||
| 93 | char *alias; | 93 | char *alias; |
| 94 | int aliasout; | 94 | int aliasout; |
| 95 | int badops; | 95 | int badops; |
| 96 | int C; | ||
| 97 | int CA_createserial; | 96 | int CA_createserial; |
| 98 | int CA_flag; | 97 | int CA_flag; |
| 99 | char *CAfile; | 98 | char *CAfile; |
| @@ -328,13 +327,6 @@ x509_opt_utf8(void) | |||
| 328 | 327 | ||
| 329 | static const struct option x509_options[] = { | 328 | static const struct option x509_options[] = { |
| 330 | { | 329 | { |
| 331 | .name = "C", | ||
| 332 | .desc = "Convert the certificate into C code", | ||
| 333 | .type = OPTION_ORDER, | ||
| 334 | .opt.order = &cfg.C, | ||
| 335 | .order = &cfg.num, | ||
| 336 | }, | ||
| 337 | { | ||
| 338 | .name = "addreject", | 330 | .name = "addreject", |
| 339 | .argname = "arg", | 331 | .argname = "arg", |
| 340 | .desc = "Reject certificate for a given purpose", | 332 | .desc = "Reject certificate for a given purpose", |
| @@ -763,7 +755,7 @@ static void | |||
| 763 | x509_usage(void) | 755 | x509_usage(void) |
| 764 | { | 756 | { |
| 765 | fprintf(stderr, "usage: x509 " | 757 | fprintf(stderr, "usage: x509 " |
| 766 | "[-C] [-addreject arg] [-addtrust arg] [-alias] [-CA file]\n" | 758 | " [-addreject arg] [-addtrust arg] [-alias] [-CA file]\n" |
| 767 | " [-CAcreateserial] [-CAform der | pem] [-CAkey file]\n" | 759 | " [-CAcreateserial] [-CAform der | pem] [-CAkey file]\n" |
| 768 | " [-CAkeyform der | pem] [-CAserial file] [-certopt option]\n" | 760 | " [-CAkeyform der | pem] [-CAserial file] [-certopt option]\n" |
| 769 | " [-checkend arg] [-clrext] [-clrreject] [-clrtrust] [-dates]\n" | 761 | " [-checkend arg] [-clrext] [-clrreject] [-clrtrust] [-dates]\n" |
| @@ -798,7 +790,6 @@ x509_main(int argc, char **argv) | |||
| 798 | BIO *STDout = NULL; | 790 | BIO *STDout = NULL; |
| 799 | X509_STORE *ctx = NULL; | 791 | X509_STORE *ctx = NULL; |
| 800 | X509_REQ *rq = NULL; | 792 | X509_REQ *rq = NULL; |
| 801 | char buf[256]; | ||
| 802 | CONF *extconf = NULL; | 793 | CONF *extconf = NULL; |
| 803 | char *passin = NULL; | 794 | char *passin = NULL; |
| 804 | 795 | ||
| @@ -1178,85 +1169,6 @@ x509_main(int argc, char **argv) | |||
| 1178 | goto end; | 1169 | goto end; |
| 1179 | } | 1170 | } |
| 1180 | PEM_write_bio_PUBKEY(STDout, pubkey); | 1171 | PEM_write_bio_PUBKEY(STDout, pubkey); |
| 1181 | } else if (cfg.C == i) { | ||
| 1182 | unsigned char *d; | ||
| 1183 | char *m; | ||
| 1184 | int y, z; | ||
| 1185 | |||
| 1186 | m = X509_NAME_oneline(X509_get_subject_name(x), | ||
| 1187 | buf, sizeof buf); | ||
| 1188 | if (m == NULL) | ||
| 1189 | goto end; | ||
| 1190 | BIO_printf(STDout, "/* subject:%s */\n", buf); | ||
| 1191 | m = X509_NAME_oneline(X509_get_issuer_name(x), | ||
| 1192 | buf, sizeof buf); | ||
| 1193 | if (m == NULL) | ||
| 1194 | goto end; | ||
| 1195 | BIO_printf(STDout, "/* issuer :%s */\n", buf); | ||
| 1196 | |||
| 1197 | z = i2d_X509(x, NULL); | ||
| 1198 | if (z < 0) | ||
| 1199 | goto end; | ||
| 1200 | |||
| 1201 | m = malloc(z); | ||
| 1202 | if (m == NULL) { | ||
| 1203 | BIO_printf(bio_err, "out of mem\n"); | ||
| 1204 | goto end; | ||
| 1205 | } | ||
| 1206 | |||
| 1207 | d = (unsigned char *) m; | ||
| 1208 | z = i2d_X509_NAME(X509_get_subject_name(x), &d); | ||
| 1209 | if (z < 0) { | ||
| 1210 | free(m); | ||
| 1211 | goto end; | ||
| 1212 | } | ||
| 1213 | BIO_printf(STDout, | ||
| 1214 | "unsigned char XXX_subject_name[%d]={\n", z); | ||
| 1215 | d = (unsigned char *) m; | ||
| 1216 | for (y = 0; y < z; y++) { | ||
| 1217 | BIO_printf(STDout, "0x%02X,", d[y]); | ||
| 1218 | if ((y & 0x0f) == 0x0f) | ||
| 1219 | BIO_printf(STDout, "\n"); | ||
| 1220 | } | ||
| 1221 | if (y % 16 != 0) | ||
| 1222 | BIO_printf(STDout, "\n"); | ||
| 1223 | BIO_printf(STDout, "};\n"); | ||
| 1224 | |||
| 1225 | z = i2d_X509_PUBKEY(X509_get_X509_PUBKEY(x), &d); | ||
| 1226 | if (z < 0) { | ||
| 1227 | free(m); | ||
| 1228 | goto end; | ||
| 1229 | } | ||
| 1230 | BIO_printf(STDout, | ||
| 1231 | "unsigned char XXX_public_key[%d]={\n", z); | ||
| 1232 | d = (unsigned char *) m; | ||
| 1233 | for (y = 0; y < z; y++) { | ||
| 1234 | BIO_printf(STDout, "0x%02X,", d[y]); | ||
| 1235 | if ((y & 0x0f) == 0x0f) | ||
| 1236 | BIO_printf(STDout, "\n"); | ||
| 1237 | } | ||
| 1238 | if (y % 16 != 0) | ||
| 1239 | BIO_printf(STDout, "\n"); | ||
| 1240 | BIO_printf(STDout, "};\n"); | ||
| 1241 | |||
| 1242 | z = i2d_X509(x, &d); | ||
| 1243 | if (z < 0) { | ||
| 1244 | free(m); | ||
| 1245 | goto end; | ||
| 1246 | } | ||
| 1247 | BIO_printf(STDout, | ||
| 1248 | "unsigned char XXX_certificate[%d]={\n", z); | ||
| 1249 | d = (unsigned char *) m; | ||
| 1250 | for (y = 0; y < z; y++) { | ||
| 1251 | BIO_printf(STDout, "0x%02X,", d[y]); | ||
| 1252 | if ((y & 0x0f) == 0x0f) | ||
| 1253 | BIO_printf(STDout, "\n"); | ||
| 1254 | } | ||
| 1255 | if (y % 16 != 0) | ||
| 1256 | BIO_printf(STDout, "\n"); | ||
| 1257 | BIO_printf(STDout, "};\n"); | ||
| 1258 | |||
| 1259 | free(m); | ||
| 1260 | } else if (cfg.text == i) { | 1172 | } else if (cfg.text == i) { |
| 1261 | if(!X509_print_ex(STDout, x, cfg.nmflag, | 1173 | if(!X509_print_ex(STDout, x, cfg.nmflag, |
| 1262 | cfg.certflag)) | 1174 | cfg.certflag)) |
