diff options
Diffstat (limited to '')
36 files changed, 132 insertions, 338 deletions
diff --git a/src/lib/libcrypto/asn1/a_bitstr.c b/src/lib/libcrypto/asn1/a_bitstr.c index d5d00c4d44..3d1e49c49a 100644 --- a/src/lib/libcrypto/asn1/a_bitstr.c +++ b/src/lib/libcrypto/asn1/a_bitstr.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: a_bitstr.c,v 1.43 2024/07/08 14:52:31 beck Exp $ */ | 1 | /* $OpenBSD: a_bitstr.c,v 1.44 2025/05/10 05:54:38 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 | * |
@@ -63,10 +63,10 @@ | |||
63 | #include <openssl/asn1.h> | 63 | #include <openssl/asn1.h> |
64 | #include <openssl/asn1t.h> | 64 | #include <openssl/asn1t.h> |
65 | #include <openssl/conf.h> | 65 | #include <openssl/conf.h> |
66 | #include <openssl/err.h> | ||
67 | #include <openssl/x509v3.h> | 66 | #include <openssl/x509v3.h> |
68 | 67 | ||
69 | #include "bytestring.h" | 68 | #include "bytestring.h" |
69 | #include "err_local.h" | ||
70 | 70 | ||
71 | const ASN1_ITEM ASN1_BIT_STRING_it = { | 71 | const ASN1_ITEM ASN1_BIT_STRING_it = { |
72 | .itype = ASN1_ITYPE_PRIMITIVE, | 72 | .itype = ASN1_ITYPE_PRIMITIVE, |
diff --git a/src/lib/libcrypto/asn1/a_enum.c b/src/lib/libcrypto/asn1/a_enum.c index 5d3a3dd0c7..ac5033ea8a 100644 --- a/src/lib/libcrypto/asn1/a_enum.c +++ b/src/lib/libcrypto/asn1/a_enum.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: a_enum.c,v 1.30 2024/07/08 14:52:31 beck Exp $ */ | 1 | /* $OpenBSD: a_enum.c,v 1.31 2025/05/10 05:54:38 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 | * |
@@ -63,10 +63,10 @@ | |||
63 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> |
64 | #include <openssl/bn.h> | 64 | #include <openssl/bn.h> |
65 | #include <openssl/buffer.h> | 65 | #include <openssl/buffer.h> |
66 | #include <openssl/err.h> | ||
67 | 66 | ||
68 | #include "asn1_local.h" | 67 | #include "asn1_local.h" |
69 | #include "bytestring.h" | 68 | #include "bytestring.h" |
69 | #include "err_local.h" | ||
70 | 70 | ||
71 | /* | 71 | /* |
72 | * Code for ENUMERATED type: identical to INTEGER apart from a different tag. | 72 | * Code for ENUMERATED type: identical to INTEGER apart from a different tag. |
diff --git a/src/lib/libcrypto/asn1/a_int.c b/src/lib/libcrypto/asn1/a_int.c index 0d9b6577d7..f171e330f6 100644 --- a/src/lib/libcrypto/asn1/a_int.c +++ b/src/lib/libcrypto/asn1/a_int.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: a_int.c,v 1.48 2024/07/08 14:52:31 beck Exp $ */ | 1 | /* $OpenBSD: a_int.c,v 1.49 2025/05/10 05:54:38 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 | * |
@@ -64,9 +64,9 @@ | |||
64 | #include <openssl/asn1t.h> | 64 | #include <openssl/asn1t.h> |
65 | #include <openssl/bn.h> | 65 | #include <openssl/bn.h> |
66 | #include <openssl/buffer.h> | 66 | #include <openssl/buffer.h> |
67 | #include <openssl/err.h> | ||
68 | 67 | ||
69 | #include "bytestring.h" | 68 | #include "bytestring.h" |
69 | #include "err_local.h" | ||
70 | 70 | ||
71 | const ASN1_ITEM ASN1_INTEGER_it = { | 71 | const ASN1_ITEM ASN1_INTEGER_it = { |
72 | .itype = ASN1_ITYPE_PRIMITIVE, | 72 | .itype = ASN1_ITYPE_PRIMITIVE, |
diff --git a/src/lib/libcrypto/asn1/a_mbstr.c b/src/lib/libcrypto/asn1/a_mbstr.c index f050f97539..38398ad1d1 100644 --- a/src/lib/libcrypto/asn1/a_mbstr.c +++ b/src/lib/libcrypto/asn1/a_mbstr.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: a_mbstr.c,v 1.27 2023/07/05 21:23:36 beck Exp $ */ | 1 | /* $OpenBSD: a_mbstr.c,v 1.28 2025/05/10 05:54:38 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 1999. | 3 | * project 1999. |
4 | */ | 4 | */ |
@@ -61,9 +61,9 @@ | |||
61 | #include <string.h> | 61 | #include <string.h> |
62 | 62 | ||
63 | #include <openssl/asn1.h> | 63 | #include <openssl/asn1.h> |
64 | #include <openssl/err.h> | ||
65 | 64 | ||
66 | #include "asn1_local.h" | 65 | #include "asn1_local.h" |
66 | #include "err_local.h" | ||
67 | 67 | ||
68 | static int traverse_string(const unsigned char *p, int len, int inform, | 68 | static int traverse_string(const unsigned char *p, int len, int inform, |
69 | int (*rfunc)(unsigned long value, void *in), void *arg); | 69 | int (*rfunc)(unsigned long value, void *in), void *arg); |
diff --git a/src/lib/libcrypto/asn1/a_object.c b/src/lib/libcrypto/asn1/a_object.c index 2f3ca1398f..333ac60348 100644 --- a/src/lib/libcrypto/asn1/a_object.c +++ b/src/lib/libcrypto/asn1/a_object.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: a_object.c,v 1.55 2024/07/08 14:52:31 beck Exp $ */ | 1 | /* $OpenBSD: a_object.c,v 1.56 2025/05/10 05:54:38 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 | * |
@@ -62,11 +62,11 @@ | |||
62 | 62 | ||
63 | #include <openssl/asn1.h> | 63 | #include <openssl/asn1.h> |
64 | #include <openssl/asn1t.h> | 64 | #include <openssl/asn1t.h> |
65 | #include <openssl/err.h> | ||
66 | #include <openssl/buffer.h> | 65 | #include <openssl/buffer.h> |
67 | #include <openssl/objects.h> | 66 | #include <openssl/objects.h> |
68 | 67 | ||
69 | #include "asn1_local.h" | 68 | #include "asn1_local.h" |
69 | #include "err_local.h" | ||
70 | 70 | ||
71 | const ASN1_ITEM ASN1_OBJECT_it = { | 71 | const ASN1_ITEM ASN1_OBJECT_it = { |
72 | .itype = ASN1_ITYPE_PRIMITIVE, | 72 | .itype = ASN1_ITYPE_PRIMITIVE, |
diff --git a/src/lib/libcrypto/asn1/a_pkey.c b/src/lib/libcrypto/asn1/a_pkey.c index a730728076..636b602377 100644 --- a/src/lib/libcrypto/asn1/a_pkey.c +++ b/src/lib/libcrypto/asn1/a_pkey.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: a_pkey.c,v 1.8 2024/04/09 13:52:41 beck Exp $ */ | 1 | /* $OpenBSD: a_pkey.c,v 1.9 2025/05/10 05:54:38 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 | * |
@@ -62,12 +62,12 @@ | |||
62 | 62 | ||
63 | #include <openssl/asn1.h> | 63 | #include <openssl/asn1.h> |
64 | #include <openssl/bn.h> | 64 | #include <openssl/bn.h> |
65 | #include <openssl/err.h> | ||
66 | #include <openssl/evp.h> | 65 | #include <openssl/evp.h> |
67 | #include <openssl/objects.h> | 66 | #include <openssl/objects.h> |
68 | #include <openssl/x509.h> | 67 | #include <openssl/x509.h> |
69 | 68 | ||
70 | #include "asn1_local.h" | 69 | #include "asn1_local.h" |
70 | #include "err_local.h" | ||
71 | #include "evp_local.h" | 71 | #include "evp_local.h" |
72 | 72 | ||
73 | EVP_PKEY * | 73 | EVP_PKEY * |
diff --git a/src/lib/libcrypto/asn1/a_pubkey.c b/src/lib/libcrypto/asn1/a_pubkey.c index 544f3d2cf0..f846b6cda5 100644 --- a/src/lib/libcrypto/asn1/a_pubkey.c +++ b/src/lib/libcrypto/asn1/a_pubkey.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: a_pubkey.c,v 1.7 2024/04/09 13:52:41 beck Exp $ */ | 1 | /* $OpenBSD: a_pubkey.c,v 1.8 2025/05/10 05:54:38 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 | * |
@@ -62,7 +62,6 @@ | |||
62 | 62 | ||
63 | #include <openssl/asn1.h> | 63 | #include <openssl/asn1.h> |
64 | #include <openssl/bn.h> | 64 | #include <openssl/bn.h> |
65 | #include <openssl/err.h> | ||
66 | #include <openssl/evp.h> | 65 | #include <openssl/evp.h> |
67 | #include <openssl/objects.h> | 66 | #include <openssl/objects.h> |
68 | 67 | ||
@@ -76,6 +75,7 @@ | |||
76 | #include <openssl/rsa.h> | 75 | #include <openssl/rsa.h> |
77 | #endif | 76 | #endif |
78 | 77 | ||
78 | #include "err_local.h" | ||
79 | #include "evp_local.h" | 79 | #include "evp_local.h" |
80 | 80 | ||
81 | EVP_PKEY * | 81 | EVP_PKEY * |
diff --git a/src/lib/libcrypto/asn1/a_strex.c b/src/lib/libcrypto/asn1/a_strex.c index 5523c22cc4..52e1b7db5d 100644 --- a/src/lib/libcrypto/asn1/a_strex.c +++ b/src/lib/libcrypto/asn1/a_strex.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: a_strex.c,v 1.37 2025/03/09 15:17:22 tb Exp $ */ | 1 | /* $OpenBSD: a_strex.c,v 1.38 2025/03/19 11:18:38 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2000. | 3 | * project 2000. |
4 | */ | 4 | */ |
@@ -565,31 +565,6 @@ do_name_ex(char_io *io_ch, void *arg, const X509_NAME *n, int indent, | |||
565 | return outlen; | 565 | return outlen; |
566 | } | 566 | } |
567 | 567 | ||
568 | /* NID with SN of 1-2 letters, which X509_NAME_print() historically included. */ | ||
569 | static int | ||
570 | x509_name_entry_include(const X509_NAME_ENTRY *ne) | ||
571 | { | ||
572 | int nid; | ||
573 | |||
574 | if ((nid = OBJ_obj2nid(ne->object)) == NID_undef) | ||
575 | return 0; | ||
576 | |||
577 | switch (nid) { | ||
578 | case NID_commonName: | ||
579 | case NID_surname: | ||
580 | case NID_countryName: | ||
581 | case NID_localityName: | ||
582 | case NID_stateOrProvinceName: | ||
583 | case NID_organizationName: | ||
584 | case NID_organizationalUnitName: | ||
585 | case NID_givenName: | ||
586 | case NID_domainComponent: /* XXX - doesn't really belong here */ | ||
587 | return 1; | ||
588 | } | ||
589 | |||
590 | return 0; | ||
591 | } | ||
592 | |||
593 | static int | 568 | static int |
594 | X509_NAME_print(BIO *bio, const X509_NAME *name, int obase) | 569 | X509_NAME_print(BIO *bio, const X509_NAME *name, int obase) |
595 | { | 570 | { |
@@ -607,9 +582,6 @@ X509_NAME_print(BIO *bio, const X509_NAME *name, int obase) | |||
607 | for (i = 0; i < sk_X509_NAME_ENTRY_num(name->entries); i++) { | 582 | for (i = 0; i < sk_X509_NAME_ENTRY_num(name->entries); i++) { |
608 | ne = sk_X509_NAME_ENTRY_value(name->entries, i); | 583 | ne = sk_X509_NAME_ENTRY_value(name->entries, i); |
609 | 584 | ||
610 | if (!x509_name_entry_include(ne)) | ||
611 | continue; | ||
612 | |||
613 | if (started) { | 585 | if (started) { |
614 | if (!CBB_add_u8(&cbb, ',')) | 586 | if (!CBB_add_u8(&cbb, ',')) |
615 | goto err; | 587 | goto err; |
diff --git a/src/lib/libcrypto/asn1/a_string.c b/src/lib/libcrypto/asn1/a_string.c index ec492e71f0..70e9c95f22 100644 --- a/src/lib/libcrypto/asn1/a_string.c +++ b/src/lib/libcrypto/asn1/a_string.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: a_string.c,v 1.17 2023/08/15 18:05:15 tb Exp $ */ | 1 | /* $OpenBSD: a_string.c,v 1.18 2025/05/10 05:54:38 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 | * |
@@ -61,9 +61,9 @@ | |||
61 | #include <string.h> | 61 | #include <string.h> |
62 | 62 | ||
63 | #include <openssl/asn1.h> | 63 | #include <openssl/asn1.h> |
64 | #include <openssl/err.h> | ||
65 | 64 | ||
66 | #include "asn1_local.h" | 65 | #include "asn1_local.h" |
66 | #include "err_local.h" | ||
67 | 67 | ||
68 | ASN1_STRING * | 68 | ASN1_STRING * |
69 | ASN1_STRING_new(void) | 69 | ASN1_STRING_new(void) |
diff --git a/src/lib/libcrypto/asn1/a_strnid.c b/src/lib/libcrypto/asn1/a_strnid.c index 5fa60b9ce7..3519d6725d 100644 --- a/src/lib/libcrypto/asn1/a_strnid.c +++ b/src/lib/libcrypto/asn1/a_strnid.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: a_strnid.c,v 1.31 2024/03/02 08:54:02 tb Exp $ */ | 1 | /* $OpenBSD: a_strnid.c,v 1.32 2025/05/10 05:54:38 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 1999. | 3 | * project 1999. |
4 | */ | 4 | */ |
@@ -62,7 +62,6 @@ | |||
62 | #include <string.h> | 62 | #include <string.h> |
63 | 63 | ||
64 | #include <openssl/asn1.h> | 64 | #include <openssl/asn1.h> |
65 | #include <openssl/err.h> | ||
66 | #include <openssl/objects.h> | 65 | #include <openssl/objects.h> |
67 | 66 | ||
68 | /* | 67 | /* |
diff --git a/src/lib/libcrypto/asn1/a_time.c b/src/lib/libcrypto/asn1/a_time.c index 15ac1af5c4..3deff56eda 100644 --- a/src/lib/libcrypto/asn1/a_time.c +++ b/src/lib/libcrypto/asn1/a_time.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: a_time.c,v 1.38 2024/07/08 14:52:31 beck Exp $ */ | 1 | /* $OpenBSD: a_time.c,v 1.39 2025/05/10 05:54:38 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -65,7 +65,6 @@ | |||
65 | #include <time.h> | 65 | #include <time.h> |
66 | 66 | ||
67 | #include <openssl/asn1t.h> | 67 | #include <openssl/asn1t.h> |
68 | #include <openssl/err.h> | ||
69 | 68 | ||
70 | #include "asn1_local.h" | 69 | #include "asn1_local.h" |
71 | 70 | ||
diff --git a/src/lib/libcrypto/asn1/a_time_tm.c b/src/lib/libcrypto/asn1/a_time_tm.c index a1f329be96..dd2893167f 100644 --- a/src/lib/libcrypto/asn1/a_time_tm.c +++ b/src/lib/libcrypto/asn1/a_time_tm.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: a_time_tm.c,v 1.42 2024/05/03 18:33:27 tb Exp $ */ | 1 | /* $OpenBSD: a_time_tm.c,v 1.43 2025/05/10 05:54:38 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2015 Bob Beck <beck@openbsd.org> | 3 | * Copyright (c) 2015 Bob Beck <beck@openbsd.org> |
4 | * | 4 | * |
@@ -22,10 +22,10 @@ | |||
22 | #include <time.h> | 22 | #include <time.h> |
23 | 23 | ||
24 | #include <openssl/asn1t.h> | 24 | #include <openssl/asn1t.h> |
25 | #include <openssl/err.h> | ||
26 | 25 | ||
27 | #include "bytestring.h" | ||
28 | #include "asn1_local.h" | 26 | #include "asn1_local.h" |
27 | #include "bytestring.h" | ||
28 | #include "err_local.h" | ||
29 | 29 | ||
30 | #define RFC5280 0 | 30 | #define RFC5280 0 |
31 | #define GENTIME_LENGTH 15 | 31 | #define GENTIME_LENGTH 15 |
diff --git a/src/lib/libcrypto/asn1/a_type.c b/src/lib/libcrypto/asn1/a_type.c index ef0a76e810..502db42a73 100644 --- a/src/lib/libcrypto/asn1/a_type.c +++ b/src/lib/libcrypto/asn1/a_type.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: a_type.c,v 1.27 2023/07/28 10:00:10 tb Exp $ */ | 1 | /* $OpenBSD: a_type.c,v 1.28 2025/05/10 05:54:38 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 | * |
@@ -59,10 +59,10 @@ | |||
59 | #include <string.h> | 59 | #include <string.h> |
60 | 60 | ||
61 | #include <openssl/asn1t.h> | 61 | #include <openssl/asn1t.h> |
62 | #include <openssl/err.h> | ||
63 | #include <openssl/objects.h> | 62 | #include <openssl/objects.h> |
64 | 63 | ||
65 | #include "asn1_local.h" | 64 | #include "asn1_local.h" |
65 | #include "err_local.h" | ||
66 | 66 | ||
67 | typedef struct { | 67 | typedef struct { |
68 | ASN1_INTEGER *num; | 68 | ASN1_INTEGER *num; |
diff --git a/src/lib/libcrypto/asn1/asn1_gen.c b/src/lib/libcrypto/asn1/asn1_gen.c index edd6743993..b409e83c7d 100644 --- a/src/lib/libcrypto/asn1/asn1_gen.c +++ b/src/lib/libcrypto/asn1/asn1_gen.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: asn1_gen.c,v 1.27 2025/03/06 07:25:01 tb Exp $ */ | 1 | /* $OpenBSD: asn1_gen.c,v 1.28 2025/05/10 05:54:38 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2002. | 3 | * project 2002. |
4 | */ | 4 | */ |
@@ -59,11 +59,11 @@ | |||
59 | #include <string.h> | 59 | #include <string.h> |
60 | 60 | ||
61 | #include <openssl/asn1.h> | 61 | #include <openssl/asn1.h> |
62 | #include <openssl/err.h> | ||
63 | #include <openssl/x509v3.h> | 62 | #include <openssl/x509v3.h> |
64 | 63 | ||
65 | #include "asn1_local.h" | 64 | #include "asn1_local.h" |
66 | #include "conf_local.h" | 65 | #include "conf_local.h" |
66 | #include "err_local.h" | ||
67 | #include "x509_local.h" | 67 | #include "x509_local.h" |
68 | 68 | ||
69 | #define ASN1_GEN_FLAG 0x10000 | 69 | #define ASN1_GEN_FLAG 0x10000 |
diff --git a/src/lib/libcrypto/asn1/asn1_item.c b/src/lib/libcrypto/asn1/asn1_item.c index 86c800e3ad..621d65711b 100644 --- a/src/lib/libcrypto/asn1/asn1_item.c +++ b/src/lib/libcrypto/asn1/asn1_item.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: asn1_item.c,v 1.21 2024/04/09 13:55:02 beck Exp $ */ | 1 | /* $OpenBSD: asn1_item.c,v 1.22 2025/05/10 05:54:38 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 | * |
@@ -112,11 +112,11 @@ | |||
112 | #include <limits.h> | 112 | #include <limits.h> |
113 | 113 | ||
114 | #include <openssl/buffer.h> | 114 | #include <openssl/buffer.h> |
115 | #include <openssl/err.h> | ||
116 | #include <openssl/evp.h> | 115 | #include <openssl/evp.h> |
117 | #include <openssl/x509.h> | 116 | #include <openssl/x509.h> |
118 | 117 | ||
119 | #include "asn1_local.h" | 118 | #include "asn1_local.h" |
119 | #include "err_local.h" | ||
120 | #include "evp_local.h" | 120 | #include "evp_local.h" |
121 | #include "x509_local.h" | 121 | #include "x509_local.h" |
122 | 122 | ||
diff --git a/src/lib/libcrypto/asn1/asn1_old.c b/src/lib/libcrypto/asn1/asn1_old.c index 7992fccdef..c47ea8e74a 100644 --- a/src/lib/libcrypto/asn1/asn1_old.c +++ b/src/lib/libcrypto/asn1/asn1_old.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: asn1_old.c,v 1.6 2024/04/10 14:55:12 beck Exp $ */ | 1 | /* $OpenBSD: asn1_old.c,v 1.7 2025/05/10 05:54:38 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 | * |
@@ -61,9 +61,9 @@ | |||
61 | 61 | ||
62 | #include <openssl/asn1.h> | 62 | #include <openssl/asn1.h> |
63 | #include <openssl/buffer.h> | 63 | #include <openssl/buffer.h> |
64 | #include <openssl/err.h> | ||
65 | 64 | ||
66 | #include "asn1_local.h" | 65 | #include "asn1_local.h" |
66 | #include "err_local.h" | ||
67 | 67 | ||
68 | #ifndef NO_OLD_ASN1 | 68 | #ifndef NO_OLD_ASN1 |
69 | 69 | ||
diff --git a/src/lib/libcrypto/asn1/asn1_old_lib.c b/src/lib/libcrypto/asn1/asn1_old_lib.c index 80362ae689..541ac7b615 100644 --- a/src/lib/libcrypto/asn1/asn1_old_lib.c +++ b/src/lib/libcrypto/asn1/asn1_old_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: asn1_old_lib.c,v 1.6 2023/07/05 21:23:36 beck Exp $ */ | 1 | /* $OpenBSD: asn1_old_lib.c,v 1.7 2025/05/10 05:54:38 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 | * |
@@ -61,9 +61,9 @@ | |||
61 | #include <string.h> | 61 | #include <string.h> |
62 | 62 | ||
63 | #include <openssl/asn1.h> | 63 | #include <openssl/asn1.h> |
64 | #include <openssl/err.h> | ||
65 | 64 | ||
66 | #include "asn1_local.h" | 65 | #include "asn1_local.h" |
66 | #include "err_local.h" | ||
67 | 67 | ||
68 | static void asn1_put_length(unsigned char **pp, int length); | 68 | static void asn1_put_length(unsigned char **pp, int length); |
69 | 69 | ||
diff --git a/src/lib/libcrypto/asn1/asn_mime.c b/src/lib/libcrypto/asn1/asn_mime.c index 3995fc547c..d42dd8663e 100644 --- a/src/lib/libcrypto/asn1/asn_mime.c +++ b/src/lib/libcrypto/asn1/asn_mime.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: asn_mime.c,v 1.35 2025/01/17 05:02:18 tb Exp $ */ | 1 | /* $OpenBSD: asn_mime.c,v 1.37 2025/06/02 12:18:21 jsg Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project. | 3 | * project. |
4 | */ | 4 | */ |
@@ -59,10 +59,10 @@ | |||
59 | 59 | ||
60 | #include <openssl/asn1.h> | 60 | #include <openssl/asn1.h> |
61 | #include <openssl/asn1t.h> | 61 | #include <openssl/asn1t.h> |
62 | #include <openssl/err.h> | ||
63 | #include <openssl/x509.h> | 62 | #include <openssl/x509.h> |
64 | 63 | ||
65 | #include "asn1_local.h" | 64 | #include "asn1_local.h" |
65 | #include "err_local.h" | ||
66 | #include "evp_local.h" | 66 | #include "evp_local.h" |
67 | 67 | ||
68 | /* Generalised MIME like utilities for streaming ASN1. Although many | 68 | /* Generalised MIME like utilities for streaming ASN1. Although many |
@@ -507,8 +507,9 @@ SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it) | |||
507 | *bcont = sk_BIO_value(parts, 0); | 507 | *bcont = sk_BIO_value(parts, 0); |
508 | BIO_free(asnin); | 508 | BIO_free(asnin); |
509 | sk_BIO_free(parts); | 509 | sk_BIO_free(parts); |
510 | } else sk_BIO_pop_free(parts, BIO_vfree); | 510 | } else |
511 | return val; | 511 | sk_BIO_pop_free(parts, BIO_vfree); |
512 | return val; | ||
512 | } | 513 | } |
513 | 514 | ||
514 | /* OK, if not multipart/signed try opaque signature */ | 515 | /* OK, if not multipart/signed try opaque signature */ |
diff --git a/src/lib/libcrypto/asn1/asn_moid.c b/src/lib/libcrypto/asn1/asn_moid.c index e3c7d09446..a9a752cc38 100644 --- a/src/lib/libcrypto/asn1/asn_moid.c +++ b/src/lib/libcrypto/asn1/asn_moid.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: asn_moid.c,v 1.18 2024/08/31 09:26:18 tb Exp $ */ | 1 | /* $OpenBSD: asn_moid.c,v 1.20 2025/05/10 11:51:01 tb Exp $ */ |
2 | /* Written by Stephen Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Stephen Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2001. | 3 | * project 2001. |
4 | */ | 4 | */ |
@@ -60,13 +60,13 @@ | |||
60 | #include <stdio.h> | 60 | #include <stdio.h> |
61 | #include <string.h> | 61 | #include <string.h> |
62 | 62 | ||
63 | #include <openssl/err.h> | ||
64 | #include <openssl/conf.h> | 63 | #include <openssl/conf.h> |
65 | #include <openssl/crypto.h> | 64 | #include <openssl/crypto.h> |
66 | #include <openssl/x509.h> | 65 | #include <openssl/x509.h> |
67 | 66 | ||
68 | #include "asn1_local.h" | 67 | #include "asn1_local.h" |
69 | #include "conf_local.h" | 68 | #include "conf_local.h" |
69 | #include "err_local.h" | ||
70 | 70 | ||
71 | /* Simple ASN1 OID module: add all objects in a given section */ | 71 | /* Simple ASN1 OID module: add all objects in a given section */ |
72 | 72 | ||
diff --git a/src/lib/libcrypto/asn1/bio_ndef.c b/src/lib/libcrypto/asn1/bio_ndef.c index 98bb1cd197..d001ffb0ae 100644 --- a/src/lib/libcrypto/asn1/bio_ndef.c +++ b/src/lib/libcrypto/asn1/bio_ndef.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bio_ndef.c,v 1.24 2023/07/28 09:58:30 tb Exp $ */ | 1 | /* $OpenBSD: bio_ndef.c,v 1.25 2025/05/10 05:54:38 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project. | 3 | * project. |
4 | */ | 4 | */ |
@@ -57,9 +57,9 @@ | |||
57 | #include <openssl/asn1.h> | 57 | #include <openssl/asn1.h> |
58 | #include <openssl/asn1t.h> | 58 | #include <openssl/asn1t.h> |
59 | #include <openssl/bio.h> | 59 | #include <openssl/bio.h> |
60 | #include <openssl/err.h> | ||
61 | 60 | ||
62 | #include "asn1_local.h" | 61 | #include "asn1_local.h" |
62 | #include "err_local.h" | ||
63 | 63 | ||
64 | int BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix, asn1_ps_func *prefix_free); | 64 | int BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix, asn1_ps_func *prefix_free); |
65 | int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix, asn1_ps_func *suffix_free); | 65 | int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix, asn1_ps_func *suffix_free); |
diff --git a/src/lib/libcrypto/asn1/p5_pbe.c b/src/lib/libcrypto/asn1/p5_pbe.c index 582d2d9a9b..668bf5d7c1 100644 --- a/src/lib/libcrypto/asn1/p5_pbe.c +++ b/src/lib/libcrypto/asn1/p5_pbe.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: p5_pbe.c,v 1.28 2024/07/08 14:48:49 beck Exp $ */ | 1 | /* $OpenBSD: p5_pbe.c,v 1.30 2025/05/24 02:57:14 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 1999. | 3 | * project 1999. |
4 | */ | 4 | */ |
@@ -61,11 +61,14 @@ | |||
61 | #include <string.h> | 61 | #include <string.h> |
62 | 62 | ||
63 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> |
64 | #include <openssl/err.h> | ||
65 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
66 | 65 | ||
66 | #include "err_local.h" | ||
67 | #include "x509_local.h" | 67 | #include "x509_local.h" |
68 | 68 | ||
69 | /* RFC 8018, section 6.1 specifies an eight-octet salt for PBES1. */ | ||
70 | #define PKCS5_PBE1_SALT_LEN 8 | ||
71 | |||
69 | /* PKCS#5 password based encryption structure */ | 72 | /* PKCS#5 password based encryption structure */ |
70 | 73 | ||
71 | static const ASN1_TEMPLATE PBEPARAM_seq_tt[] = { | 74 | static const ASN1_TEMPLATE PBEPARAM_seq_tt[] = { |
@@ -139,7 +142,7 @@ PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter, | |||
139 | goto err; | 142 | goto err; |
140 | } | 143 | } |
141 | if (!saltlen) | 144 | if (!saltlen) |
142 | saltlen = PKCS5_SALT_LEN; | 145 | saltlen = PKCS5_PBE1_SALT_LEN; |
143 | if (!ASN1_STRING_set(pbe->salt, NULL, saltlen)) { | 146 | if (!ASN1_STRING_set(pbe->salt, NULL, saltlen)) { |
144 | ASN1error(ERR_R_MALLOC_FAILURE); | 147 | ASN1error(ERR_R_MALLOC_FAILURE); |
145 | goto err; | 148 | goto err; |
diff --git a/src/lib/libcrypto/asn1/p5_pbev2.c b/src/lib/libcrypto/asn1/p5_pbev2.c index 76872a8dec..64924d9b38 100644 --- a/src/lib/libcrypto/asn1/p5_pbev2.c +++ b/src/lib/libcrypto/asn1/p5_pbev2.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: p5_pbev2.c,v 1.35 2024/03/26 07:03:10 tb Exp $ */ | 1 | /* $OpenBSD: p5_pbev2.c,v 1.38 2025/05/24 02:57:14 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 1999-2004. | 3 | * project 1999-2004. |
4 | */ | 4 | */ |
@@ -61,12 +61,18 @@ | |||
61 | #include <string.h> | 61 | #include <string.h> |
62 | 62 | ||
63 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> |
64 | #include <openssl/err.h> | ||
65 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
66 | 65 | ||
66 | #include "err_local.h" | ||
67 | #include "evp_local.h" | 67 | #include "evp_local.h" |
68 | #include "x509_local.h" | 68 | #include "x509_local.h" |
69 | 69 | ||
70 | /* | ||
71 | * RFC 8018, sections 6.2 and 4 specify at least 64 bits for PBES2, apparently | ||
72 | * FIPS will require at least 128 bits in the future, OpenSSL does that. | ||
73 | */ | ||
74 | #define PKCS5_PBE2_SALT_LEN 16 | ||
75 | |||
70 | /* PKCS#5 v2.0 password based encryption structures */ | 76 | /* PKCS#5 v2.0 password based encryption structures */ |
71 | 77 | ||
72 | static const ASN1_TEMPLATE PBE2PARAM_seq_tt[] = { | 78 | static const ASN1_TEMPLATE PBE2PARAM_seq_tt[] = { |
@@ -187,7 +193,7 @@ PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, unsigned char *salt, | |||
187 | int saltlen) | 193 | int saltlen) |
188 | { | 194 | { |
189 | X509_ALGOR *scheme = NULL, *kalg = NULL, *ret = NULL; | 195 | X509_ALGOR *scheme = NULL, *kalg = NULL, *ret = NULL; |
190 | int prf_nid = NID_hmacWithSHA1; | 196 | int prf_nid = NID_hmacWithSHA256; |
191 | int alg_nid, keylen; | 197 | int alg_nid, keylen; |
192 | EVP_CIPHER_CTX ctx; | 198 | EVP_CIPHER_CTX ctx; |
193 | unsigned char iv[EVP_MAX_IV_LENGTH]; | 199 | unsigned char iv[EVP_MAX_IV_LENGTH]; |
@@ -292,7 +298,7 @@ PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen, int prf_nid, | |||
292 | kdf->salt->type = V_ASN1_OCTET_STRING; | 298 | kdf->salt->type = V_ASN1_OCTET_STRING; |
293 | 299 | ||
294 | if (!saltlen) | 300 | if (!saltlen) |
295 | saltlen = PKCS5_SALT_LEN; | 301 | saltlen = PKCS5_PBE2_SALT_LEN; |
296 | if (!(osalt->data = malloc (saltlen))) | 302 | if (!(osalt->data = malloc (saltlen))) |
297 | goto merr; | 303 | goto merr; |
298 | 304 | ||
diff --git a/src/lib/libcrypto/asn1/t_crl.c b/src/lib/libcrypto/asn1/t_crl.c index 6449e7f199..295ab6c050 100644 --- a/src/lib/libcrypto/asn1/t_crl.c +++ b/src/lib/libcrypto/asn1/t_crl.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: t_crl.c,v 1.26 2024/05/03 02:52:00 tb Exp $ */ | 1 | /* $OpenBSD: t_crl.c,v 1.27 2025/05/10 05:54:38 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 1999. | 3 | * project 1999. |
4 | */ | 4 | */ |
@@ -61,11 +61,11 @@ | |||
61 | 61 | ||
62 | #include <openssl/bn.h> | 62 | #include <openssl/bn.h> |
63 | #include <openssl/buffer.h> | 63 | #include <openssl/buffer.h> |
64 | #include <openssl/err.h> | ||
65 | #include <openssl/objects.h> | 64 | #include <openssl/objects.h> |
66 | #include <openssl/x509.h> | 65 | #include <openssl/x509.h> |
67 | #include <openssl/x509v3.h> | 66 | #include <openssl/x509v3.h> |
68 | 67 | ||
68 | #include "err_local.h" | ||
69 | #include "x509_local.h" | 69 | #include "x509_local.h" |
70 | 70 | ||
71 | int | 71 | int |
diff --git a/src/lib/libcrypto/asn1/t_req.c b/src/lib/libcrypto/asn1/t_req.c index 1d4be9865d..51e4b4f651 100644 --- a/src/lib/libcrypto/asn1/t_req.c +++ b/src/lib/libcrypto/asn1/t_req.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: t_req.c,v 1.28 2024/05/03 02:52:00 tb Exp $ */ | 1 | /* $OpenBSD: t_req.c,v 1.29 2025/05/10 05:54:38 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 | * |
@@ -62,7 +62,6 @@ | |||
62 | 62 | ||
63 | #include <openssl/bn.h> | 63 | #include <openssl/bn.h> |
64 | #include <openssl/buffer.h> | 64 | #include <openssl/buffer.h> |
65 | #include <openssl/err.h> | ||
66 | #include <openssl/objects.h> | 65 | #include <openssl/objects.h> |
67 | #include <openssl/x509.h> | 66 | #include <openssl/x509.h> |
68 | #include <openssl/x509v3.h> | 67 | #include <openssl/x509v3.h> |
@@ -74,6 +73,7 @@ | |||
74 | #include <openssl/rsa.h> | 73 | #include <openssl/rsa.h> |
75 | #endif | 74 | #endif |
76 | 75 | ||
76 | #include "err_local.h" | ||
77 | #include "x509_local.h" | 77 | #include "x509_local.h" |
78 | 78 | ||
79 | int | 79 | int |
diff --git a/src/lib/libcrypto/asn1/t_x509.c b/src/lib/libcrypto/asn1/t_x509.c index 7cf4557314..71f97a8214 100644 --- a/src/lib/libcrypto/asn1/t_x509.c +++ b/src/lib/libcrypto/asn1/t_x509.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: t_x509.c,v 1.51 2025/02/08 03:41:36 tb Exp $ */ | 1 | /* $OpenBSD: t_x509.c,v 1.54 2025/07/01 06:46:39 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 | * |
@@ -65,13 +65,13 @@ | |||
65 | 65 | ||
66 | #include <openssl/asn1.h> | 66 | #include <openssl/asn1.h> |
67 | #include <openssl/bio.h> | 67 | #include <openssl/bio.h> |
68 | #include <openssl/err.h> | ||
69 | #include <openssl/evp.h> | 68 | #include <openssl/evp.h> |
70 | #include <openssl/objects.h> | 69 | #include <openssl/objects.h> |
71 | #include <openssl/sha.h> | 70 | #include <openssl/sha.h> |
72 | #include <openssl/x509.h> | 71 | #include <openssl/x509.h> |
73 | #include <openssl/x509v3.h> | 72 | #include <openssl/x509v3.h> |
74 | 73 | ||
74 | #include "err_local.h" | ||
75 | #include "evp_local.h" | 75 | #include "evp_local.h" |
76 | #include "x509_local.h" | 76 | #include "x509_local.h" |
77 | 77 | ||
@@ -106,6 +106,28 @@ X509_print(BIO *bp, X509 *x) | |||
106 | } | 106 | } |
107 | LCRYPTO_ALIAS(X509_print); | 107 | LCRYPTO_ALIAS(X509_print); |
108 | 108 | ||
109 | static int | ||
110 | x509_print_uids(BIO *bp, const X509 *x, int indent) | ||
111 | { | ||
112 | const ASN1_BIT_STRING *issuerUID = NULL, *subjectUID = NULL; | ||
113 | |||
114 | X509_get0_uids(x, &issuerUID, &subjectUID); | ||
115 | if (issuerUID != NULL) { | ||
116 | if (BIO_printf(bp, "%*sIssuer Unique ID: ", indent, "") <= 0) | ||
117 | return 0; | ||
118 | if (!X509_signature_dump(bp, issuerUID, indent + 4)) | ||
119 | return 0; | ||
120 | } | ||
121 | if (subjectUID != NULL) { | ||
122 | if (BIO_printf(bp, "%*sSubject Unique ID: ", indent, "") <= 0) | ||
123 | return 0; | ||
124 | if (!X509_signature_dump(bp, subjectUID, indent + 4)) | ||
125 | return 0; | ||
126 | } | ||
127 | |||
128 | return 1; | ||
129 | } | ||
130 | |||
109 | int | 131 | int |
110 | X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag) | 132 | X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag) |
111 | { | 133 | { |
@@ -127,9 +149,9 @@ X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag) | |||
127 | 149 | ||
128 | ci = x->cert_info; | 150 | ci = x->cert_info; |
129 | if (!(cflag & X509_FLAG_NO_HEADER)) { | 151 | if (!(cflag & X509_FLAG_NO_HEADER)) { |
130 | if (BIO_write(bp, "Certificate:\n", 13) <= 0) | 152 | if (BIO_printf(bp, "Certificate:\n") <= 0) |
131 | goto err; | 153 | goto err; |
132 | if (BIO_write(bp, " Data:\n", 10) <= 0) | 154 | if (BIO_printf(bp, " Data:\n") <= 0) |
133 | goto err; | 155 | goto err; |
134 | } | 156 | } |
135 | if (!(cflag & X509_FLAG_NO_VERSION)) { | 157 | if (!(cflag & X509_FLAG_NO_VERSION)) { |
@@ -145,7 +167,7 @@ X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag) | |||
145 | } | 167 | } |
146 | } | 168 | } |
147 | if (!(cflag & X509_FLAG_NO_SERIAL)) { | 169 | if (!(cflag & X509_FLAG_NO_SERIAL)) { |
148 | if (BIO_write(bp, " Serial Number:", 22) <= 0) | 170 | if (BIO_printf(bp, " Serial Number:") <= 0) |
149 | goto err; | 171 | goto err; |
150 | 172 | ||
151 | bs = X509_get_serialNumber(x); | 173 | bs = X509_get_serialNumber(x); |
@@ -196,21 +218,21 @@ X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag) | |||
196 | if (X509_NAME_print_ex(bp, X509_get_issuer_name(x), | 218 | if (X509_NAME_print_ex(bp, X509_get_issuer_name(x), |
197 | nmindent, nmflags) < (nmflags == X509_FLAG_COMPAT ? 1 : 0)) | 219 | nmindent, nmflags) < (nmflags == X509_FLAG_COMPAT ? 1 : 0)) |
198 | goto err; | 220 | goto err; |
199 | if (BIO_write(bp, "\n", 1) <= 0) | 221 | if (BIO_printf(bp, "\n") <= 0) |
200 | goto err; | 222 | goto err; |
201 | } | 223 | } |
202 | if (!(cflag & X509_FLAG_NO_VALIDITY)) { | 224 | if (!(cflag & X509_FLAG_NO_VALIDITY)) { |
203 | if (BIO_write(bp, " Validity\n", 17) <= 0) | 225 | if (BIO_printf(bp, " Validity\n") <= 0) |
204 | goto err; | 226 | goto err; |
205 | if (BIO_write(bp, " Not Before: ", 24) <= 0) | 227 | if (BIO_printf(bp, " Not Before: ") <= 0) |
206 | goto err; | 228 | goto err; |
207 | if (!ASN1_TIME_print(bp, X509_get_notBefore(x))) | 229 | if (!ASN1_TIME_print(bp, X509_get_notBefore(x))) |
208 | goto err; | 230 | goto err; |
209 | if (BIO_write(bp, "\n Not After : ", 25) <= 0) | 231 | if (BIO_printf(bp, "\n Not After : ") <= 0) |
210 | goto err; | 232 | goto err; |
211 | if (!ASN1_TIME_print(bp, X509_get_notAfter(x))) | 233 | if (!ASN1_TIME_print(bp, X509_get_notAfter(x))) |
212 | goto err; | 234 | goto err; |
213 | if (BIO_write(bp, "\n", 1) <= 0) | 235 | if (BIO_printf(bp, "\n") <= 0) |
214 | goto err; | 236 | goto err; |
215 | } | 237 | } |
216 | if (!(cflag & X509_FLAG_NO_SUBJECT)) { | 238 | if (!(cflag & X509_FLAG_NO_SUBJECT)) { |
@@ -219,12 +241,11 @@ X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag) | |||
219 | if (X509_NAME_print_ex(bp, X509_get_subject_name(x), | 241 | if (X509_NAME_print_ex(bp, X509_get_subject_name(x), |
220 | nmindent, nmflags) < (nmflags == X509_FLAG_COMPAT ? 1 : 0)) | 242 | nmindent, nmflags) < (nmflags == X509_FLAG_COMPAT ? 1 : 0)) |
221 | goto err; | 243 | goto err; |
222 | if (BIO_write(bp, "\n", 1) <= 0) | 244 | if (BIO_printf(bp, "\n") <= 0) |
223 | goto err; | 245 | goto err; |
224 | } | 246 | } |
225 | if (!(cflag & X509_FLAG_NO_PUBKEY)) { | 247 | if (!(cflag & X509_FLAG_NO_PUBKEY)) { |
226 | if (BIO_write(bp, " Subject Public Key Info:\n", | 248 | if (BIO_printf(bp, " Subject Public Key Info:\n") <= 0) |
227 | 33) <= 0) | ||
228 | goto err; | 249 | goto err; |
229 | if (BIO_printf(bp, "%12sPublic Key Algorithm: ", "") <= 0) | 250 | if (BIO_printf(bp, "%12sPublic Key Algorithm: ", "") <= 0) |
230 | goto err; | 251 | goto err; |
@@ -243,6 +264,11 @@ X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag) | |||
243 | } | 264 | } |
244 | } | 265 | } |
245 | 266 | ||
267 | if (!(cflag & X509_FLAG_NO_IDS)) { | ||
268 | if (!x509_print_uids(bp, x, 8)) | ||
269 | goto err; | ||
270 | } | ||
271 | |||
246 | if (!(cflag & X509_FLAG_NO_EXTENSIONS)) | 272 | if (!(cflag & X509_FLAG_NO_EXTENSIONS)) |
247 | X509V3_extensions_print(bp, "X509v3 extensions", | 273 | X509V3_extensions_print(bp, "X509v3 extensions", |
248 | ci->extensions, cflag, 8); | 274 | ci->extensions, cflag, 8); |
@@ -325,7 +351,7 @@ X509_signature_dump(BIO *bp, const ASN1_STRING *sig, int indent) | |||
325 | s = sig->data; | 351 | s = sig->data; |
326 | for (i = 0; i < n; i++) { | 352 | for (i = 0; i < n; i++) { |
327 | if ((i % 18) == 0) { | 353 | if ((i % 18) == 0) { |
328 | if (BIO_write(bp, "\n", 1) <= 0) | 354 | if (BIO_printf(bp, "\n") <= 0) |
329 | return 0; | 355 | return 0; |
330 | if (BIO_indent(bp, indent, indent) <= 0) | 356 | if (BIO_indent(bp, indent, indent) <= 0) |
331 | return 0; | 357 | return 0; |
@@ -334,7 +360,7 @@ X509_signature_dump(BIO *bp, const ASN1_STRING *sig, int indent) | |||
334 | ((i + 1) == n) ? "" : ":") <= 0) | 360 | ((i + 1) == n) ? "" : ":") <= 0) |
335 | return 0; | 361 | return 0; |
336 | } | 362 | } |
337 | if (BIO_write(bp, "\n", 1) != 1) | 363 | if (BIO_printf(bp, "\n") != 1) |
338 | return 0; | 364 | return 0; |
339 | 365 | ||
340 | return 1; | 366 | return 1; |
@@ -375,7 +401,7 @@ ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm) | |||
375 | return ASN1_UTCTIME_print(bp, tm); | 401 | return ASN1_UTCTIME_print(bp, tm); |
376 | if (tm->type == V_ASN1_GENERALIZEDTIME) | 402 | if (tm->type == V_ASN1_GENERALIZEDTIME) |
377 | return ASN1_GENERALIZEDTIME_print(bp, tm); | 403 | return ASN1_GENERALIZEDTIME_print(bp, tm); |
378 | BIO_write(bp, "Bad time value", 14); | 404 | BIO_printf(bp, "Bad time value"); |
379 | return (0); | 405 | return (0); |
380 | } | 406 | } |
381 | LCRYPTO_ALIAS(ASN1_TIME_print); | 407 | LCRYPTO_ALIAS(ASN1_TIME_print); |
@@ -435,7 +461,7 @@ ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) | |||
435 | return (1); | 461 | return (1); |
436 | 462 | ||
437 | err: | 463 | err: |
438 | BIO_write(bp, "Bad time value", 14); | 464 | BIO_printf(bp, "Bad time value"); |
439 | return (0); | 465 | return (0); |
440 | } | 466 | } |
441 | LCRYPTO_ALIAS(ASN1_GENERALIZEDTIME_print); | 467 | LCRYPTO_ALIAS(ASN1_GENERALIZEDTIME_print); |
@@ -479,7 +505,7 @@ ASN1_UTCTIME_print(BIO *bp, const ASN1_UTCTIME *tm) | |||
479 | return (1); | 505 | return (1); |
480 | 506 | ||
481 | err: | 507 | err: |
482 | BIO_write(bp, "Bad time value", 14); | 508 | BIO_printf(bp, "Bad time value"); |
483 | return (0); | 509 | return (0); |
484 | } | 510 | } |
485 | LCRYPTO_ALIAS(ASN1_UTCTIME_print); | 511 | LCRYPTO_ALIAS(ASN1_UTCTIME_print); |
diff --git a/src/lib/libcrypto/asn1/tasn_dec.c b/src/lib/libcrypto/asn1/tasn_dec.c index 31b9efee54..1bffae8a94 100644 --- a/src/lib/libcrypto/asn1/tasn_dec.c +++ b/src/lib/libcrypto/asn1/tasn_dec.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tasn_dec.c,v 1.88 2023/07/28 10:00:10 tb Exp $ */ | 1 | /* $OpenBSD: tasn_dec.c,v 1.89 2025/05/10 05:54:38 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2000. | 3 | * project 2000. |
4 | */ | 4 | */ |
@@ -63,11 +63,11 @@ | |||
63 | #include <openssl/asn1.h> | 63 | #include <openssl/asn1.h> |
64 | #include <openssl/asn1t.h> | 64 | #include <openssl/asn1t.h> |
65 | #include <openssl/buffer.h> | 65 | #include <openssl/buffer.h> |
66 | #include <openssl/err.h> | ||
67 | #include <openssl/objects.h> | 66 | #include <openssl/objects.h> |
68 | 67 | ||
69 | #include "asn1_local.h" | 68 | #include "asn1_local.h" |
70 | #include "bytestring.h" | 69 | #include "bytestring.h" |
70 | #include "err_local.h" | ||
71 | 71 | ||
72 | /* | 72 | /* |
73 | * Constructed types with a recursive definition (such as can be found in PKCS7) | 73 | * Constructed types with a recursive definition (such as can be found in PKCS7) |
diff --git a/src/lib/libcrypto/asn1/tasn_enc.c b/src/lib/libcrypto/asn1/tasn_enc.c index b71993a139..a65fb5b7e7 100644 --- a/src/lib/libcrypto/asn1/tasn_enc.c +++ b/src/lib/libcrypto/asn1/tasn_enc.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tasn_enc.c,v 1.33 2023/07/28 10:00:10 tb Exp $ */ | 1 | /* $OpenBSD: tasn_enc.c,v 1.34 2025/05/10 05:54:38 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2000. | 3 | * project 2000. |
4 | */ | 4 | */ |
@@ -61,10 +61,10 @@ | |||
61 | 61 | ||
62 | #include <openssl/asn1.h> | 62 | #include <openssl/asn1.h> |
63 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> |
64 | #include <openssl/err.h> | ||
65 | #include <openssl/objects.h> | 64 | #include <openssl/objects.h> |
66 | 65 | ||
67 | #include "asn1_local.h" | 66 | #include "asn1_local.h" |
67 | #include "err_local.h" | ||
68 | 68 | ||
69 | static int asn1_i2d_ex_primitive(ASN1_VALUE **pval, unsigned char **out, | 69 | static int asn1_i2d_ex_primitive(ASN1_VALUE **pval, unsigned char **out, |
70 | const ASN1_ITEM *it, int tag, int aclass); | 70 | const ASN1_ITEM *it, int tag, int aclass); |
diff --git a/src/lib/libcrypto/asn1/tasn_new.c b/src/lib/libcrypto/asn1/tasn_new.c index 10c1137dbf..e17810b832 100644 --- a/src/lib/libcrypto/asn1/tasn_new.c +++ b/src/lib/libcrypto/asn1/tasn_new.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tasn_new.c,v 1.25 2023/07/28 10:00:10 tb Exp $ */ | 1 | /* $OpenBSD: tasn_new.c,v 1.26 2025/05/10 05:54:38 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2000. | 3 | * project 2000. |
4 | */ | 4 | */ |
@@ -60,11 +60,11 @@ | |||
60 | #include <stddef.h> | 60 | #include <stddef.h> |
61 | #include <openssl/asn1.h> | 61 | #include <openssl/asn1.h> |
62 | #include <openssl/objects.h> | 62 | #include <openssl/objects.h> |
63 | #include <openssl/err.h> | ||
64 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> |
65 | #include <string.h> | 64 | #include <string.h> |
66 | 65 | ||
67 | #include "asn1_local.h" | 66 | #include "asn1_local.h" |
67 | #include "err_local.h" | ||
68 | 68 | ||
69 | static int asn1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it); | 69 | static int asn1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it); |
70 | static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it); | 70 | static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it); |
diff --git a/src/lib/libcrypto/asn1/tasn_prn.c b/src/lib/libcrypto/asn1/tasn_prn.c index 07764fc091..4db6d61111 100644 --- a/src/lib/libcrypto/asn1/tasn_prn.c +++ b/src/lib/libcrypto/asn1/tasn_prn.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tasn_prn.c,v 1.27 2024/03/02 09:04:07 tb Exp $ */ | 1 | /* $OpenBSD: tasn_prn.c,v 1.29 2025/06/07 09:28:00 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2000. | 3 | * project 2000. |
4 | */ | 4 | */ |
@@ -61,7 +61,6 @@ | |||
61 | #include <openssl/asn1.h> | 61 | #include <openssl/asn1.h> |
62 | #include <openssl/asn1t.h> | 62 | #include <openssl/asn1t.h> |
63 | #include <openssl/buffer.h> | 63 | #include <openssl/buffer.h> |
64 | #include <openssl/err.h> | ||
65 | #include <openssl/objects.h> | 64 | #include <openssl/objects.h> |
66 | #include <openssl/x509v3.h> | 65 | #include <openssl/x509v3.h> |
67 | 66 | ||
@@ -411,7 +410,7 @@ asn1_primitive_print(BIO *out, ASN1_VALUE **fld, const ASN1_ITEM *it, | |||
411 | if (!asn1_print_fsname(out, indent, fname, sname, pctx)) | 410 | if (!asn1_print_fsname(out, indent, fname, sname, pctx)) |
412 | return 0; | 411 | return 0; |
413 | 412 | ||
414 | if (it != NULL && it->funcs != NULL) { | 413 | if (it->funcs != NULL) { |
415 | const ASN1_PRIMITIVE_FUNCS *pf = it->funcs; | 414 | const ASN1_PRIMITIVE_FUNCS *pf = it->funcs; |
416 | 415 | ||
417 | if (pf->prim_print == NULL) | 416 | if (pf->prim_print == NULL) |
diff --git a/src/lib/libcrypto/asn1/tasn_utl.c b/src/lib/libcrypto/asn1/tasn_utl.c index ae546edd4b..178a364c89 100644 --- a/src/lib/libcrypto/asn1/tasn_utl.c +++ b/src/lib/libcrypto/asn1/tasn_utl.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tasn_utl.c,v 1.18 2022/12/26 07:18:51 jmc Exp $ */ | 1 | /* $OpenBSD: tasn_utl.c,v 1.19 2025/05/10 05:54:38 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2000. | 3 | * project 2000. |
4 | */ | 4 | */ |
@@ -63,9 +63,9 @@ | |||
63 | #include <openssl/asn1.h> | 63 | #include <openssl/asn1.h> |
64 | #include <openssl/asn1t.h> | 64 | #include <openssl/asn1t.h> |
65 | #include <openssl/objects.h> | 65 | #include <openssl/objects.h> |
66 | #include <openssl/err.h> | ||
67 | 66 | ||
68 | #include "bytestring.h" | 67 | #include "bytestring.h" |
68 | #include "err_local.h" | ||
69 | 69 | ||
70 | /* Utility functions for manipulating fields and offsets */ | 70 | /* Utility functions for manipulating fields and offsets */ |
71 | 71 | ||
diff --git a/src/lib/libcrypto/asn1/x_crl.c b/src/lib/libcrypto/asn1/x_crl.c index 7ad8350f3d..19caf56cec 100644 --- a/src/lib/libcrypto/asn1/x_crl.c +++ b/src/lib/libcrypto/asn1/x_crl.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x_crl.c,v 1.48 2025/02/27 20:13:41 tb Exp $ */ | 1 | /* $OpenBSD: x_crl.c,v 1.50 2025/07/10 18:48:31 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 | * |
@@ -61,11 +61,11 @@ | |||
61 | #include <openssl/opensslconf.h> | 61 | #include <openssl/opensslconf.h> |
62 | 62 | ||
63 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> |
64 | #include <openssl/err.h> | ||
65 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
66 | #include <openssl/x509v3.h> | 65 | #include <openssl/x509v3.h> |
67 | 66 | ||
68 | #include "asn1_local.h" | 67 | #include "asn1_local.h" |
68 | #include "err_local.h" | ||
69 | #include "x509_local.h" | 69 | #include "x509_local.h" |
70 | 70 | ||
71 | static void setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp); | 71 | static void setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp); |
@@ -540,6 +540,12 @@ LCRYPTO_ALIAS(X509_CRL_add0_revoked); | |||
540 | int | 540 | int |
541 | X509_CRL_verify(X509_CRL *crl, EVP_PKEY *pkey) | 541 | X509_CRL_verify(X509_CRL *crl, EVP_PKEY *pkey) |
542 | { | 542 | { |
543 | /* | ||
544 | * The CertificateList's signature AlgorithmIdentifier must match | ||
545 | * the one inside the TBSCertList, see RFC 5280, 5.1.1.2, 5.1.2.2. | ||
546 | */ | ||
547 | if (X509_ALGOR_cmp(crl->sig_alg, crl->crl->sig_alg) != 0) | ||
548 | return 0; | ||
543 | return ASN1_item_verify(&X509_CRL_INFO_it, crl->sig_alg, crl->signature, | 549 | return ASN1_item_verify(&X509_CRL_INFO_it, crl->sig_alg, crl->signature, |
544 | crl->crl, pkey); | 550 | crl->crl, pkey); |
545 | } | 551 | } |
diff --git a/src/lib/libcrypto/asn1/x_info.c b/src/lib/libcrypto/asn1/x_info.c deleted file mode 100644 index d2c4bcfe7a..0000000000 --- a/src/lib/libcrypto/asn1/x_info.c +++ /dev/null | |||
@@ -1,96 +0,0 @@ | |||
1 | /* $OpenBSD: x_info.c,v 1.22 2024/12/11 10:28:03 tb Exp $ */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | |||
61 | #include <openssl/asn1.h> | ||
62 | #include <openssl/err.h> | ||
63 | #include <openssl/x509.h> | ||
64 | |||
65 | X509_INFO * | ||
66 | X509_INFO_new(void) | ||
67 | { | ||
68 | X509_INFO *ret; | ||
69 | |||
70 | if ((ret = calloc(1, sizeof(X509_INFO))) == NULL) { | ||
71 | ASN1error(ERR_R_MALLOC_FAILURE); | ||
72 | return NULL; | ||
73 | } | ||
74 | ret->references = 1; | ||
75 | |||
76 | return ret; | ||
77 | } | ||
78 | LCRYPTO_ALIAS(X509_INFO_new); | ||
79 | |||
80 | void | ||
81 | X509_INFO_free(X509_INFO *x) | ||
82 | { | ||
83 | if (x == NULL) | ||
84 | return; | ||
85 | |||
86 | if (CRYPTO_add(&x->references, -1, CRYPTO_LOCK_X509_INFO) > 0) | ||
87 | return; | ||
88 | |||
89 | X509_free(x->x509); | ||
90 | X509_CRL_free(x->crl); | ||
91 | X509_PKEY_free(x->x_pkey); | ||
92 | free(x->enc_data); | ||
93 | |||
94 | free(x); | ||
95 | } | ||
96 | LCRYPTO_ALIAS(X509_INFO_free); | ||
diff --git a/src/lib/libcrypto/asn1/x_long.c b/src/lib/libcrypto/asn1/x_long.c index 5e673f4521..a72411f30c 100644 --- a/src/lib/libcrypto/asn1/x_long.c +++ b/src/lib/libcrypto/asn1/x_long.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x_long.c,v 1.21 2024/07/08 16:24:22 beck Exp $ */ | 1 | /* $OpenBSD: x_long.c,v 1.22 2025/05/10 05:54:38 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2000. | 3 | * project 2000. |
4 | */ | 4 | */ |
@@ -61,9 +61,9 @@ | |||
61 | 61 | ||
62 | #include <openssl/asn1t.h> | 62 | #include <openssl/asn1t.h> |
63 | #include <openssl/bn.h> | 63 | #include <openssl/bn.h> |
64 | #include <openssl/err.h> | ||
65 | 64 | ||
66 | #include "asn1_local.h" | 65 | #include "asn1_local.h" |
66 | #include "err_local.h" | ||
67 | 67 | ||
68 | /* | 68 | /* |
69 | * Custom primitive type for long handling. This converts between an | 69 | * Custom primitive type for long handling. This converts between an |
diff --git a/src/lib/libcrypto/asn1/x_name.c b/src/lib/libcrypto/asn1/x_name.c index 7bacd83340..09536666fc 100644 --- a/src/lib/libcrypto/asn1/x_name.c +++ b/src/lib/libcrypto/asn1/x_name.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x_name.c,v 1.44 2024/07/08 14:48:49 beck Exp $ */ | 1 | /* $OpenBSD: x_name.c,v 1.46 2025/05/10 05:54:38 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 | * |
@@ -61,10 +61,10 @@ | |||
61 | #include <string.h> | 61 | #include <string.h> |
62 | 62 | ||
63 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> |
64 | #include <openssl/err.h> | ||
65 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
66 | 65 | ||
67 | #include "asn1_local.h" | 66 | #include "asn1_local.h" |
67 | #include "err_local.h" | ||
68 | #include "x509_local.h" | 68 | #include "x509_local.h" |
69 | 69 | ||
70 | typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; | 70 | typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; |
@@ -414,8 +414,10 @@ x509_name_encode(X509_NAME *a) | |||
414 | if (!entries) | 414 | if (!entries) |
415 | goto memerr; | 415 | goto memerr; |
416 | if (!sk_STACK_OF_X509_NAME_ENTRY_push(intname.s, | 416 | if (!sk_STACK_OF_X509_NAME_ENTRY_push(intname.s, |
417 | entries)) | 417 | entries)) { |
418 | sk_X509_NAME_ENTRY_free(entries); | ||
418 | goto memerr; | 419 | goto memerr; |
420 | } | ||
419 | set = entry->set; | 421 | set = entry->set; |
420 | } | 422 | } |
421 | if (entries == NULL /* if entry->set is bogusly -1 */ || | 423 | if (entries == NULL /* if entry->set is bogusly -1 */ || |
diff --git a/src/lib/libcrypto/asn1/x_pkey.c b/src/lib/libcrypto/asn1/x_pkey.c deleted file mode 100644 index 5c96c13ab9..0000000000 --- a/src/lib/libcrypto/asn1/x_pkey.c +++ /dev/null | |||
@@ -1,123 +0,0 @@ | |||
1 | /* $OpenBSD: x_pkey.c,v 1.24 2024/04/09 13:55:02 beck Exp $ */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include <string.h> | ||
61 | |||
62 | #include <openssl/err.h> | ||
63 | #include <openssl/evp.h> | ||
64 | #include <openssl/objects.h> | ||
65 | #include <openssl/x509.h> | ||
66 | |||
67 | X509_PKEY * | ||
68 | X509_PKEY_new(void) | ||
69 | { | ||
70 | X509_PKEY *ret = NULL; | ||
71 | |||
72 | if ((ret = malloc(sizeof(X509_PKEY))) == NULL) { | ||
73 | ASN1error(ERR_R_MALLOC_FAILURE); | ||
74 | goto err; | ||
75 | } | ||
76 | ret->version = 0; | ||
77 | if ((ret->enc_algor = X509_ALGOR_new()) == NULL) { | ||
78 | ASN1error(ERR_R_MALLOC_FAILURE); | ||
79 | goto err; | ||
80 | } | ||
81 | if ((ret->enc_pkey = ASN1_OCTET_STRING_new()) == NULL) { | ||
82 | ASN1error(ERR_R_MALLOC_FAILURE); | ||
83 | goto err; | ||
84 | } | ||
85 | ret->dec_pkey = NULL; | ||
86 | ret->key_length = 0; | ||
87 | ret->key_data = NULL; | ||
88 | ret->key_free = 0; | ||
89 | ret->cipher.cipher = NULL; | ||
90 | memset(ret->cipher.iv, 0, EVP_MAX_IV_LENGTH); | ||
91 | ret->references = 1; | ||
92 | return (ret); | ||
93 | |||
94 | err: | ||
95 | if (ret) { | ||
96 | X509_ALGOR_free(ret->enc_algor); | ||
97 | free(ret); | ||
98 | } | ||
99 | return NULL; | ||
100 | } | ||
101 | LCRYPTO_ALIAS(X509_PKEY_new); | ||
102 | |||
103 | void | ||
104 | X509_PKEY_free(X509_PKEY *x) | ||
105 | { | ||
106 | int i; | ||
107 | |||
108 | if (x == NULL) | ||
109 | return; | ||
110 | |||
111 | i = CRYPTO_add(&x->references, -1, CRYPTO_LOCK_X509_PKEY); | ||
112 | if (i > 0) | ||
113 | return; | ||
114 | |||
115 | if (x->enc_algor != NULL) | ||
116 | X509_ALGOR_free(x->enc_algor); | ||
117 | ASN1_OCTET_STRING_free(x->enc_pkey); | ||
118 | EVP_PKEY_free(x->dec_pkey); | ||
119 | if ((x->key_data != NULL) && (x->key_free)) | ||
120 | free(x->key_data); | ||
121 | free(x); | ||
122 | } | ||
123 | LCRYPTO_ALIAS(X509_PKEY_free); | ||
diff --git a/src/lib/libcrypto/asn1/x_pubkey.c b/src/lib/libcrypto/asn1/x_pubkey.c index 1e772a3458..ec847861ea 100644 --- a/src/lib/libcrypto/asn1/x_pubkey.c +++ b/src/lib/libcrypto/asn1/x_pubkey.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x_pubkey.c,v 1.37 2024/07/08 14:48:49 beck Exp $ */ | 1 | /* $OpenBSD: x_pubkey.c,v 1.38 2025/05/10 05:54:38 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 | * |
@@ -61,7 +61,6 @@ | |||
61 | #include <openssl/opensslconf.h> | 61 | #include <openssl/opensslconf.h> |
62 | 62 | ||
63 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> |
64 | #include <openssl/err.h> | ||
65 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
66 | 65 | ||
67 | #ifndef OPENSSL_NO_DSA | 66 | #ifndef OPENSSL_NO_DSA |
@@ -72,6 +71,7 @@ | |||
72 | #endif | 71 | #endif |
73 | 72 | ||
74 | #include "asn1_local.h" | 73 | #include "asn1_local.h" |
74 | #include "err_local.h" | ||
75 | #include "evp_local.h" | 75 | #include "evp_local.h" |
76 | #include "x509_local.h" | 76 | #include "x509_local.h" |
77 | 77 | ||