summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libc/include/namespace.h6
-rw-r--r--src/lib/libc/net/getnameinfo.38
-rw-r--r--src/lib/libc/stdlib/hcreate.346
-rw-r--r--src/lib/libc/stdlib/hcreate.c3
-rw-r--r--src/lib/libc/stdlib/icdb_new.36
-rw-r--r--src/lib/libc/stdlib/malloc.374
-rw-r--r--src/lib/libc/string/memmem.c10
-rw-r--r--src/lib/libc/string/strlen.c4
-rw-r--r--src/lib/libc/string/strstr.c12
-rw-r--r--src/lib/libc/string/wcslen.c4
-rw-r--r--src/lib/libcrypto/aes/aes.c5
-rw-r--r--src/lib/libcrypto/aes/asm/aes-586.pl2
-rw-r--r--src/lib/libcrypto/arch/aarch64/crypto_cpu_caps.c82
-rw-r--r--src/lib/libcrypto/asn1/a_int.c3
-rw-r--r--src/lib/libcrypto/asn1/a_mbstr.c23
-rw-r--r--src/lib/libcrypto/asn1/a_time_posix.c3
-rw-r--r--src/lib/libcrypto/asn1/a_time_tm.c3
-rw-r--r--src/lib/libcrypto/asn1/a_type.c3
-rw-r--r--src/lib/libcrypto/asn1/asn1_gen.c70
-rw-r--r--src/lib/libcrypto/asn1/asn1_lib.c3
-rw-r--r--src/lib/libcrypto/asn1/asn1_local.h4
-rw-r--r--src/lib/libcrypto/asn1/asn1_types.c4
-rw-r--r--src/lib/libcrypto/asn1/bio_asn1.c3
-rw-r--r--src/lib/libcrypto/asn1/tasn_prn.c4
-rw-r--r--src/lib/libcrypto/asn1/tasn_typ.c4
-rw-r--r--src/lib/libcrypto/asn1/tasn_utl.c3
-rw-r--r--src/lib/libcrypto/asn1/x_crl.c4
-rw-r--r--src/lib/libcrypto/bio/bio_meth.c18
-rw-r--r--src/lib/libcrypto/bn/bn_const.c4
-rw-r--r--src/lib/libcrypto/buffer/buffer.c23
-rw-r--r--src/lib/libcrypto/cert.pem1535
-rw-r--r--src/lib/libcrypto/cms/cms_kari.c11
-rw-r--r--src/lib/libcrypto/cms/cms_pwri.c10
-rw-r--r--src/lib/libcrypto/conf/conf_api.c27
-rw-r--r--src/lib/libcrypto/conf/conf_mod.c3
-rw-r--r--src/lib/libcrypto/conf/ssleay.cnf78
-rw-r--r--src/lib/libcrypto/crypto.h5
-rw-r--r--src/lib/libcrypto/crypto_assembly.h45
-rw-r--r--src/lib/libcrypto/crypto_ex_data.c15
-rw-r--r--src/lib/libcrypto/crypto_init.c4
-rw-r--r--src/lib/libcrypto/crypto_internal.h3
-rw-r--r--src/lib/libcrypto/ct/ct_x509v3.c3
-rw-r--r--src/lib/libcrypto/ec/ec_ameth.c3
-rw-r--r--src/lib/libcrypto/ec/ec_convert.c6
-rw-r--r--src/lib/libcrypto/ec/ec_lib.c4
-rw-r--r--src/lib/libcrypto/ecdh/ecdh.c11
-rw-r--r--src/lib/libcrypto/err/err.c5
-rw-r--r--src/lib/libcrypto/evp/bio_b64.c4
-rw-r--r--src/lib/libcrypto/man/ASN1_STRING_length.341
-rw-r--r--src/lib/libcrypto/man/ASN1_parse_dump.310
-rw-r--r--src/lib/libcrypto/man/BIO_dump.310
-rw-r--r--src/lib/libcrypto/man/BN_generate_prime.36
-rw-r--r--src/lib/libcrypto/man/CRYPTO_set_ex_data.329
-rw-r--r--src/lib/libcrypto/man/EC_GROUP_check.36
-rw-r--r--src/lib/libcrypto/man/MD5.36
-rw-r--r--src/lib/libcrypto/man/OBJ_create.353
-rw-r--r--src/lib/libcrypto/man/OPENSSL_init_crypto.335
-rw-r--r--src/lib/libcrypto/man/X509_STORE_CTX_get_error.38
-rw-r--r--src/lib/libcrypto/man/X509v3_addr_add_inherit.35
-rw-r--r--src/lib/libcrypto/man/d2i_X509_SIG.36
-rw-r--r--src/lib/libcrypto/man/s2i_ASN1_INTEGER.38
-rw-r--r--src/lib/libcrypto/md5/md5_amd64_generic.S6
-rw-r--r--src/lib/libcrypto/mlkem/mlkem_internal.c3
-rw-r--r--src/lib/libcrypto/objects/obj_mac.num5
-rw-r--r--src/lib/libcrypto/objects/objects.txt5
-rw-r--r--src/lib/libcrypto/pem/pem_info.c6
-rw-r--r--src/lib/libcrypto/pkcs12/p12_decr.c3
-rw-r--r--src/lib/libcrypto/pkcs12/p12_npas.c6
-rw-r--r--src/lib/libcrypto/pkcs12/pkcs12_local.h4
-rw-r--r--src/lib/libcrypto/pkcs7/pk7_doit.c109
-rw-r--r--src/lib/libcrypto/pkcs7/pk7_lib.c20
-rw-r--r--src/lib/libcrypto/pkcs7/pk7_smime.c14
-rw-r--r--src/lib/libcrypto/ripemd/ripemd.h9
-rw-r--r--src/lib/libcrypto/rsa/rsa_ameth.c4
-rw-r--r--src/lib/libcrypto/rsa/rsa_eay.c26
-rw-r--r--src/lib/libcrypto/rsa/rsa_x931.c3
-rw-r--r--src/lib/libcrypto/sha/sha1_aarch64.c8
-rw-r--r--src/lib/libcrypto/sha/sha1_aarch64_ce.S44
-rw-r--r--src/lib/libcrypto/sha/sha1_amd64_generic.S78
-rw-r--r--src/lib/libcrypto/sha/sha1_amd64_shani.S37
-rw-r--r--src/lib/libcrypto/sha/sha256.c347
-rw-r--r--src/lib/libcrypto/sha/sha256_aarch64_ce.S37
-rw-r--r--src/lib/libcrypto/sha/sha256_amd64_generic.S121
-rw-r--r--src/lib/libcrypto/sha/sha256_amd64_shani.S50
-rw-r--r--src/lib/libcrypto/sha/sha3.c318
-rw-r--r--src/lib/libcrypto/sha/sha512_aarch64_ce.S50
-rw-r--r--src/lib/libcrypto/sha/sha512_amd64_generic.S121
-rw-r--r--src/lib/libcrypto/ui/ui_lib.c95
-rw-r--r--src/lib/libcrypto/ui/ui_local.h39
-rw-r--r--src/lib/libcrypto/x509/x509_addr.c37
-rw-r--r--src/lib/libcrypto/x509/x509_constraints.c111
-rw-r--r--src/lib/libcrypto/x509/x509_ia5.c3
-rw-r--r--src/lib/libcrypto/x509/x509_info.c3
-rw-r--r--src/lib/libcrypto/x509/x509_int.c4
-rw-r--r--src/lib/libcrypto/x509/x509_lib.c4
-rw-r--r--src/lib/libcrypto/x509/x509_local.h3
-rw-r--r--src/lib/libcrypto/x509/x509_ocsp.c3
-rw-r--r--src/lib/libcrypto/x509/x509_pku.c4
-rw-r--r--src/lib/libcrypto/x509/x509_policy.c4
-rw-r--r--src/lib/libcrypto/x509/x509_prn.c59
-rw-r--r--src/lib/libcrypto/x509/x509_purp.c10
-rw-r--r--src/lib/libcrypto/x509/x509_utl.c3
-rw-r--r--src/lib/libcrypto/x509/x509_verify.c20
-rw-r--r--src/lib/libcrypto/x509/x509_vfy.c39
-rw-r--r--src/lib/libssl/Makefile3
-rw-r--r--src/lib/libssl/d1_both.c438
-rw-r--r--src/lib/libssl/d1_lib.c9
-rw-r--r--src/lib/libssl/dtls12_handshake_msg.c231
-rw-r--r--src/lib/libssl/dtls12_internal.h46
-rw-r--r--src/lib/libssl/dtls_local.h21
-rw-r--r--src/lib/libssl/man/Makefile3
-rw-r--r--src/lib/libssl/man/SSL_CTX_sess_set_get_cb.36
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_cert_verify_callback.36
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_keylog_callback.36
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_num_tickets.36
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_options.398
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_quiet_shutdown.36
-rw-r--r--src/lib/libssl/man/SSL_alert_type_string.375
-rw-r--r--src/lib/libssl/man/SSL_do_handshake.36
-rw-r--r--src/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.36
-rw-r--r--src/lib/libssl/man/SSL_get_finished.310
-rw-r--r--src/lib/libssl/man/SSL_read_early_data.312
-rw-r--r--src/lib/libssl/s3_lib.c27
-rw-r--r--src/lib/libssl/ssl.h5
-rw-r--r--src/lib/libssl/ssl_clnt.c163
-rw-r--r--src/lib/libssl/ssl_kex.c28
-rw-r--r--src/lib/libssl/ssl_lib.c16
-rw-r--r--src/lib/libssl/ssl_local.h40
-rw-r--r--src/lib/libssl/ssl_sigalgs.c19
-rw-r--r--src/lib/libssl/ssl_sigalgs.h9
-rw-r--r--src/lib/libssl/ssl_srvr.c160
-rw-r--r--src/lib/libssl/ssl_tlsext.c100
-rw-r--r--src/lib/libssl/ssl_tlsext.h4
-rw-r--r--src/lib/libssl/ssl_versions.c19
-rw-r--r--src/lib/libssl/t1_lib.c27
-rw-r--r--src/lib/libssl/tls1.h12
-rw-r--r--src/lib/libssl/tls13_client.c42
-rw-r--r--src/lib/libssl/tls13_handshake.c4
-rw-r--r--src/lib/libssl/tls13_internal.h6
-rw-r--r--src/lib/libssl/tls13_key_schedule.c12
-rw-r--r--src/lib/libssl/tls13_legacy.c48
-rw-r--r--src/lib/libssl/tls13_lib.c16
-rw-r--r--src/lib/libssl/tls13_record.c21
-rw-r--r--src/lib/libssl/tls13_record.h6
-rw-r--r--src/lib/libssl/tls13_record_layer.c30
-rw-r--r--src/lib/libssl/tls13_server.c18
-rw-r--r--src/lib/libssl/tls_key_share.c31
-rw-r--r--src/lib/libtls/man/tls_config_set_protocols.38
-rw-r--r--src/lib/libtls/man/tls_conn_version.35
-rw-r--r--src/lib/libtls/tls_internal.h4
-rw-r--r--src/lib/libtls/tls_verify.c5
-rw-r--r--src/regress/lib/libc/Makefile8
-rw-r--r--src/regress/lib/libc/asr/bin/Makefile.inc3
-rw-r--r--src/regress/lib/libc/asr/bin/threads.c8
-rw-r--r--src/regress/lib/libc/asr/regress.sh4
-rw-r--r--src/regress/lib/libc/asr/regress.subr3
-rw-r--r--src/regress/lib/libc/freeaddrinfo/Makefile5
-rw-r--r--src/regress/lib/libc/freeaddrinfo/freeaddrinfo.c22
-rw-r--r--src/regress/lib/libc/getaddrinfo/gaitest.c15
-rw-r--r--src/regress/lib/libc/getexecpath/Makefile8
-rw-r--r--src/regress/lib/libc/getexecpath/getexecpath.c24
-rw-r--r--src/regress/lib/libc/illumos/oclo/Makefile4
-rw-r--r--src/regress/lib/libc/open_wmemstream/Makefile5
-rw-r--r--src/regress/lib/libc/open_wmemstream/open_wmemstreamtest.c189
-rw-r--r--src/regress/lib/libc/strlcpy/Makefile4
-rw-r--r--src/regress/lib/libc/sys/Makefile3
-rw-r--r--src/regress/lib/libc/time/time_conversion/timetest.c34
-rw-r--r--src/regress/lib/libc/timingsafe/timingsafe.c4
-rw-r--r--src/regress/lib/libcrypto/bn/bn_mul_div.c4
-rw-r--r--src/regress/lib/libcrypto/c2sp/Makefile4
-rw-r--r--src/regress/lib/libcrypto/certs/README6
-rw-r--r--src/regress/lib/libcrypto/dsa/dsatest.c7
-rw-r--r--src/regress/lib/libcrypto/ec/ectest.c5
-rw-r--r--src/regress/lib/libcrypto/ecdsa/ecdsatest.c5
-rw-r--r--src/regress/lib/libcrypto/evp/evptest.c6
-rw-r--r--src/regress/lib/libcrypto/exdata/exdata_test.c5
-rw-r--r--src/regress/lib/libcrypto/free/freenull.awk22
-rw-r--r--src/regress/lib/libcrypto/pbkdf2/pbkdf2.c6
-rw-r--r--src/regress/lib/libcrypto/pkcs7/pkcs7test.c169
-rw-r--r--src/regress/lib/libcrypto/rsa/rsa_padding_test.c6
-rw-r--r--src/regress/lib/libcrypto/wycheproof/Makefile7
-rw-r--r--src/regress/lib/libcrypto/wycheproof/wycheproof.go14
-rw-r--r--src/regress/lib/libcrypto/x509/Makefile4
-rw-r--r--src/regress/lib/libcrypto/x509/bettertls/verify.c4
-rw-r--r--src/regress/lib/libcrypto/x509/callback.c37
-rw-r--r--src/regress/lib/libcrypto/x509/callbackfailures.c21
-rw-r--r--src/regress/lib/libcrypto/x509/constraints.c69
-rw-r--r--src/regress/lib/libcrypto/x509/rfc3779/rfc3779.c198
-rw-r--r--src/regress/lib/libcrypto/x509/verify.c121
-rw-r--r--src/regress/lib/libcrypto/x509/x509_crl.c362
-rw-r--r--src/regress/lib/libssl/dtls/Makefile19
-rw-r--r--src/regress/lib/libssl/dtls/dtls_handshake_msg_test.c369
-rw-r--r--src/regress/lib/libssl/dtls/dtls_wire_test.c376
-rw-r--r--src/regress/lib/libssl/handshake/handshake_table.c4
-rw-r--r--src/regress/lib/libssl/openssl-ruby/Makefile6
-rw-r--r--src/regress/lib/libssl/renegotiation/Makefile5
-rw-r--r--src/regress/lib/libssl/renegotiation/renegotiation_test.c124
-rw-r--r--src/regress/lib/libssl/ssl/ssltest.c8
-rw-r--r--src/regress/lib/libssl/tlsext/tlsexttest.c25
-rw-r--r--src/regress/lib/libssl/tlsfuzzer/tlsfuzzer.py53
-rw-r--r--src/regress/lib/libssl/unit/Makefile3
-rw-r--r--src/regress/lib/libssl/unit/ssl_kex.c212
-rw-r--r--src/regress/lib/libtls/verify/verifytest.c15
-rw-r--r--src/usr.bin/openssl/apps.c4
-rw-r--r--src/usr.bin/openssl/ca.c8
-rw-r--r--src/usr.bin/openssl/crl.c9
-rw-r--r--src/usr.bin/openssl/ecparam.c7
-rw-r--r--src/usr.bin/openssl/openssl.16
-rw-r--r--src/usr.bin/openssl/openssl.c9
-rw-r--r--src/usr.bin/openssl/s_cb.c10
-rw-r--r--src/usr.bin/openssl/s_client.c8
-rw-r--r--src/usr.bin/openssl/s_server.c4
-rw-r--r--src/usr.bin/openssl/s_socket.c11
-rw-r--r--src/usr.bin/openssl/speed.c259
-rw-r--r--src/usr.sbin/ocspcheck/ocspcheck.c5
215 files changed, 5334 insertions, 3834 deletions
diff --git a/src/lib/libc/include/namespace.h b/src/lib/libc/include/namespace.h
index cc83735b90..9058230429 100644
--- a/src/lib/libc/include/namespace.h
+++ b/src/lib/libc/include/namespace.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: namespace.h,v 1.17 2025/10/23 19:06:10 miod Exp $ */ 1/* $OpenBSD: namespace.h,v 1.18 2026/06/30 19:18:53 kettenis Exp $ */
2 2
3#ifndef _LIBC_NAMESPACE_H_ 3#ifndef _LIBC_NAMESPACE_H_
4#define _LIBC_NAMESPACE_H_ 4#define _LIBC_NAMESPACE_H_
@@ -85,11 +85,15 @@
85BUILTIN void *memmove(void *, const void *, __size_t); 85BUILTIN void *memmove(void *, const void *, __size_t);
86BUILTIN void *memcpy(void *__restrict, const void *__restrict, __size_t); 86BUILTIN void *memcpy(void *__restrict, const void *__restrict, __size_t);
87BUILTIN void *memset(void *, int, __size_t); 87BUILTIN void *memset(void *, int, __size_t);
88BUILTIN __size_t strlen(const char *);
89BUILTIN __size_t wcslen(const __wchar_t *);
88BUILTIN void __stack_smash_handler(const char [], int __unused); 90BUILTIN void __stack_smash_handler(const char [], int __unused);
89#if !defined(__clang__) 91#if !defined(__clang__)
90PROTO_NORMAL(memmove); 92PROTO_NORMAL(memmove);
91PROTO_NORMAL(memcpy); 93PROTO_NORMAL(memcpy);
92PROTO_NORMAL(memset); 94PROTO_NORMAL(memset);
95PROTO_NORMAL(strlen);
96PROTO_NORMAL(wcslen);
93PROTO_NORMAL(__stack_smash_handler); 97PROTO_NORMAL(__stack_smash_handler);
94#endif 98#endif
95#undef BUILTIN 99#undef BUILTIN
diff --git a/src/lib/libc/net/getnameinfo.3 b/src/lib/libc/net/getnameinfo.3
index 4e97b5d07b..d71df07ddd 100644
--- a/src/lib/libc/net/getnameinfo.3
+++ b/src/lib/libc/net/getnameinfo.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: getnameinfo.3,v 1.49 2022/09/11 06:38:10 jmc Exp $ 1.\" $OpenBSD: getnameinfo.3,v 1.50 2026/08/05 08:23:13 claudio Exp $
2.\" $KAME: getnameinfo.3,v 1.37 2005/01/05 03:23:05 itojun Exp $ 2.\" $KAME: getnameinfo.3,v 1.37 2005/01/05 03:23:05 itojun Exp $
3.\" 3.\"
4.\" Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") 4.\" Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
@@ -16,7 +16,7 @@
16.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17.\" PERFORMANCE OF THIS SOFTWARE. 17.\" PERFORMANCE OF THIS SOFTWARE.
18.\" 18.\"
19.Dd $Mdocdate: September 11 2022 $ 19.Dd $Mdocdate: August 5 2026 $
20.Dt GETNAMEINFO 3 20.Dt GETNAMEINFO 3
21.Os 21.Os
22.Sh NAME 22.Sh NAME
@@ -99,9 +99,9 @@ If the host name cannot be found in DNS and this flag is set,
99a non-zero error code is returned. 99a non-zero error code is returned.
100If the host name is not found and the flag is not set, the 100If the host name is not found and the flag is not set, the
101address is returned in numeric form. 101address is returned in numeric form.
102.It NI_NUMERICSERV 102.It Dv NI_NUMERICSERV
103The service name is returned as a digit string representing the port number. 103The service name is returned as a digit string representing the port number.
104.It NI_DGRAM 104.It Dv NI_DGRAM
105Specifies that the service being looked up is a datagram 105Specifies that the service being looked up is a datagram
106service, and causes 106service, and causes
107.Xr getservbyport 3 107.Xr getservbyport 3
diff --git a/src/lib/libc/stdlib/hcreate.3 b/src/lib/libc/stdlib/hcreate.3
index 90bde1995f..48dffd4ff8 100644
--- a/src/lib/libc/stdlib/hcreate.3
+++ b/src/lib/libc/stdlib/hcreate.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: hcreate.3,v 1.8 2018/01/30 11:37:58 jmc Exp $ 1.\" $OpenBSD: hcreate.3,v 1.9 2026/08/10 22:02:41 daniel Exp $
2.\" $NetBSD: hcreate.3,v 1.8 2010/05/01 06:18:03 jruoho Exp $ 2.\" $NetBSD: hcreate.3,v 1.8 2010/05/01 06:18:03 jruoho Exp $
3.\" 3.\"
4.\" Copyright (c) 1999 The NetBSD Foundation, Inc. 4.\" Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
28.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29.\" POSSIBILITY OF SUCH DAMAGE. 29.\" POSSIBILITY OF SUCH DAMAGE.
30.\" 30.\"
31.Dd $Mdocdate: January 30 2018 $ 31.Dd $Mdocdate: August 10 2026 $
32.Dt HCREATE 3 32.Dt HCREATE 3
33.Os 33.Os
34.Sh NAME 34.Sh NAME
@@ -127,30 +127,6 @@ key must not be modified during the lifetime of the hash table.
127Search the hash table without inserting 127Search the hash table without inserting
128.Fa item . 128.Fa item .
129.El 129.El
130.Pp
131Note that the comparison
132.Fa key
133must be allocated using
134.Xr malloc 3
135or
136.Xr calloc 3
137if action is
138.Dv ENTER
139and
140.Fn hdestroy
141will be called.
142This is because
143.Fn hdestroy
144will call
145.Xr free 3
146for each comparison
147.Fa key
148(but not
149.Fa data ) .
150Typically the comparison
151.Fa key
152is allocated by using
153.Xr strdup 3 .
154.Sh RETURN VALUES 130.Sh RETURN VALUES
155If successful, the 131If successful, the
156.Fn hcreate 132.Fn hcreate
@@ -189,7 +165,6 @@ Insufficient memory is available.
189.Sh SEE ALSO 165.Sh SEE ALSO
190.Xr bsearch 3 , 166.Xr bsearch 3 ,
191.Xr lsearch 3 , 167.Xr lsearch 3 ,
192.Xr malloc 3 ,
193.Xr strcmp 3 168.Xr strcmp 3
194.Sh STANDARDS 169.Sh STANDARDS
195The 170The
@@ -214,21 +189,4 @@ At least the following limitations can be mentioned:
214The interface permits the use of only one hash table at a time. 189The interface permits the use of only one hash table at a time.
215.It 190.It
216Individual hash table entries can be added, but not deleted. 191Individual hash table entries can be added, but not deleted.
217.It
218The standard is indecipherable about the
219internal memory usage of the functions,
220mentioning only that
221.Do
222.Fn hcreate
223and
224.Fn hsearch
225functions may use
226.Fn malloc
227to allocate space
228.Dc .
229This limits the portability of the functions,
230given that other implementations may not
231.Xr free 3
232the buffer pointed by
233.Fa key .
234.El 192.El
diff --git a/src/lib/libc/stdlib/hcreate.c b/src/lib/libc/stdlib/hcreate.c
index b31108a90e..ca6d8d16c4 100644
--- a/src/lib/libc/stdlib/hcreate.c
+++ b/src/lib/libc/stdlib/hcreate.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: hcreate.c,v 1.7 2016/05/29 20:47:49 guenther Exp $ */ 1/* $OpenBSD: hcreate.c,v 1.8 2026/08/10 22:02:41 daniel Exp $ */
2/* $NetBSD: hcreate.c,v 1.5 2004/04/23 02:48:12 simonb Exp $ */ 2/* $NetBSD: hcreate.c,v 1.5 2004/04/23 02:48:12 simonb Exp $ */
3 3
4/* 4/*
@@ -142,7 +142,6 @@ hdestroy(void)
142 while (!SLIST_EMPTY(&htable[idx])) { 142 while (!SLIST_EMPTY(&htable[idx])) {
143 ie = SLIST_FIRST(&htable[idx]); 143 ie = SLIST_FIRST(&htable[idx]);
144 SLIST_REMOVE_HEAD(&htable[idx], link); 144 SLIST_REMOVE_HEAD(&htable[idx], link);
145 free(ie->ent.key);
146 free(ie); 145 free(ie);
147 } 146 }
148 } 147 }
diff --git a/src/lib/libc/stdlib/icdb_new.3 b/src/lib/libc/stdlib/icdb_new.3
index 9fc07bda80..d8627fe802 100644
--- a/src/lib/libc/stdlib/icdb_new.3
+++ b/src/lib/libc/stdlib/icdb_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: icdb_new.3,v 1.2 2016/09/04 19:05:09 jmc Exp $ 1.\" $OpenBSD: icdb_new.3,v 1.3 2026/08/25 05:47:52 jsg Exp $
2.\" 2.\"
3.\" Copyright (c) Ted Unangst 3.\" Copyright (c) Ted Unangst
4.\" 4.\"
@@ -15,8 +15,8 @@
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.\" 17.\"
18.Dd $Mdocdate: September 4 2016 $ 18.Dd $Mdocdate: August 25 2026 $
19.Dt ICBB_NEW 3 19.Dt ICDB_NEW 3
20.Os 20.Os
21.Sh NAME 21.Sh NAME
22.Nm icdb_new , 22.Nm icdb_new ,
diff --git a/src/lib/libc/stdlib/malloc.3 b/src/lib/libc/stdlib/malloc.3
index ee13b01bd4..f66bd1cbb6 100644
--- a/src/lib/libc/stdlib/malloc.3
+++ b/src/lib/libc/stdlib/malloc.3
@@ -30,9 +30,9 @@
30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31.\" SUCH DAMAGE. 31.\" SUCH DAMAGE.
32.\" 32.\"
33.\" $OpenBSD: malloc.3,v 1.147 2025/06/04 00:38:01 yasuoka Exp $ 33.\" $OpenBSD: malloc.3,v 1.148 2026/08/22 12:22:16 schwarze Exp $
34.\" 34.\"
35.Dd $Mdocdate: June 4 2025 $ 35.Dd $Mdocdate: August 22 2026 $
36.Dt MALLOC 3 36.Dt MALLOC 3
37.Os 37.Os
38.Sh NAME 38.Sh NAME
@@ -315,6 +315,76 @@ or
315to record deeper call stacks. 315to record deeper call stacks.
316These malloc options imply 316These malloc options imply
317.Cm D . 317.Cm D .
318.Pp
319The report begins with a header line showing the following integer variables:
320.Pp
321.Bl -tag -width Ds -compact
322.It M
323the number of pools used
324.It I
325internal
326.Fn recallocarray
327and
328.Fn freezero
329used (0 or 1)
330.It F
331whether the
332.Cm F Dq freecheck
333option is used (0 or 1)
334.It U
335whether the
336.Cm U Dq free unmap
337option is used (0 or 1)
338.It J
339the number of
340.Cm J Dq junking
341options used (0, 1, or 2)
342.It R
343whether the
344.Cm R Dq realloc
345option is used (0 or 1)
346.It X
347whether the
348.Cm X Dq xmalloc
349option is used (0 or 1)
350.It C
351whether the
352.Cm C Dq canaries
353option is used (0 or 1)
354.It cache
355the cache size in pages
356.It G
357the size of guard pages in bytes (0 or
358.Dv MALLOC_PAGESIZE )
359.El
360.Pp
361The leak report consists of five columns:
362.Pp
363.Bl -bullet -compact
364.It
365the address from where the allocation function was called
366.It
367the total number of bytes leaked from that location
368.It
369the number of allocations leaked from that location
370.It
371the average size in bytes per leak from that location,
372i.e. the quotient of the two preceding columns
373.It
374an
375.Xr addr2line 1
376invocation using the pathname of the object file calling
377the allocation function and the offset from where it is called
378to find the source file name and line number of the call site
379.El
380.Pp
381With malloc options
382.Cm 2 ,
383.Cm 3 ,
384or
385.Cm 4 ,
386each line of the leak report is followed by 1, 2, or 3 additional lines,
387respectively, giving the addresses, pathnames and offsets of indirect callers.
318.It Cm F 388.It Cm F
319.Dq Freecheck . 389.Dq Freecheck .
320Enable more extensive double free and write after free detection. 390Enable more extensive double free and write after free detection.
diff --git a/src/lib/libc/string/memmem.c b/src/lib/libc/string/memmem.c
index 3b180b4a62..e87c7be37a 100644
--- a/src/lib/libc/string/memmem.c
+++ b/src/lib/libc/string/memmem.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: memmem.c,v 1.5 2020/04/16 12:39:28 claudio Exp $ */ 1/* $OpenBSD: memmem.c,v 1.6 2026/06/23 13:09:11 tim Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2005-2020 Rich Felker, et al. 4 * Copyright (c) 2005-2020 Rich Felker, et al.
@@ -38,8 +38,8 @@ twobyte_memmem(const unsigned char *h, size_t k, const unsigned char *n)
38static char * 38static char *
39threebyte_memmem(const unsigned char *h, size_t k, const unsigned char *n) 39threebyte_memmem(const unsigned char *h, size_t k, const unsigned char *n)
40{ 40{
41 uint32_t nw = n[0]<<24 | n[1]<<16 | n[2]<<8; 41 uint32_t nw = (uint32_t)n[0]<<24 | n[1]<<16 | n[2]<<8;
42 uint32_t hw = h[0]<<24 | h[1]<<16 | h[2]<<8; 42 uint32_t hw = (uint32_t)h[0]<<24 | h[1]<<16 | h[2]<<8;
43 for (h+=3, k-=3; k; k--, hw = (hw|*h++)<<8) 43 for (h+=3, k-=3; k; k--, hw = (hw|*h++)<<8)
44 if (hw == nw) return (char *)h-3; 44 if (hw == nw) return (char *)h-3;
45 return hw == nw ? (char *)h-3 : 0; 45 return hw == nw ? (char *)h-3 : 0;
@@ -48,8 +48,8 @@ threebyte_memmem(const unsigned char *h, size_t k, const unsigned char *n)
48static char * 48static char *
49fourbyte_memmem(const unsigned char *h, size_t k, const unsigned char *n) 49fourbyte_memmem(const unsigned char *h, size_t k, const unsigned char *n)
50{ 50{
51 uint32_t nw = n[0]<<24 | n[1]<<16 | n[2]<<8 | n[3]; 51 uint32_t nw = (uint32_t)n[0]<<24 | n[1]<<16 | n[2]<<8 | n[3];
52 uint32_t hw = h[0]<<24 | h[1]<<16 | h[2]<<8 | h[3]; 52 uint32_t hw = (uint32_t)h[0]<<24 | h[1]<<16 | h[2]<<8 | h[3];
53 for (h+=4, k-=4; k; k--, hw = hw<<8 | *h++) 53 for (h+=4, k-=4; k; k--, hw = hw<<8 | *h++)
54 if (hw == nw) return (char *)h-4; 54 if (hw == nw) return (char *)h-4;
55 return hw == nw ? (char *)h-4 : 0; 55 return hw == nw ? (char *)h-4 : 0;
diff --git a/src/lib/libc/string/strlen.c b/src/lib/libc/string/strlen.c
index a5721d3e7f..cf3cd8cf86 100644
--- a/src/lib/libc/string/strlen.c
+++ b/src/lib/libc/string/strlen.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strlen.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */ 1/* $OpenBSD: strlen.c,v 1.10 2026/06/30 19:18:54 kettenis Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1990, 1993 4 * Copyright (c) 1990, 1993
@@ -41,4 +41,4 @@ strlen(const char *str)
41 return (s - str); 41 return (s - str);
42} 42}
43 43
44DEF_STRONG(strlen); 44DEF_BUILTIN(strlen);
diff --git a/src/lib/libc/string/strstr.c b/src/lib/libc/string/strstr.c
index 241a080e7a..f5f460a251 100644
--- a/src/lib/libc/string/strstr.c
+++ b/src/lib/libc/string/strstr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strstr.c,v 1.9 2020/04/16 12:37:52 claudio Exp $ */ 1/* $OpenBSD: strstr.c,v 1.11 2026/06/23 13:10:40 tim Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2005-2018 Rich Felker 4 * Copyright (c) 2005-2018 Rich Felker
@@ -37,8 +37,8 @@ twobyte_strstr(const unsigned char *h, const unsigned char *n)
37static char * 37static char *
38threebyte_strstr(const unsigned char *h, const unsigned char *n) 38threebyte_strstr(const unsigned char *h, const unsigned char *n)
39{ 39{
40 uint32_t nw = n[0]<<24 | n[1]<<16 | n[2]<<8; 40 uint32_t nw = (uint32_t)n[0]<<24 | n[1]<<16 | n[2]<<8;
41 uint32_t hw = h[0]<<24 | h[1]<<16 | h[2]<<8; 41 uint32_t hw = (uint32_t)h[0]<<24 | h[1]<<16 | h[2]<<8;
42 for (h+=2; *h && hw != nw; hw = (hw|*++h)<<8); 42 for (h+=2; *h && hw != nw; hw = (hw|*++h)<<8);
43 return *h ? (char *)h-2 : 0; 43 return *h ? (char *)h-2 : 0;
44} 44}
@@ -46,8 +46,8 @@ threebyte_strstr(const unsigned char *h, const unsigned char *n)
46static char * 46static char *
47fourbyte_strstr(const unsigned char *h, const unsigned char *n) 47fourbyte_strstr(const unsigned char *h, const unsigned char *n)
48{ 48{
49 uint32_t nw = n[0]<<24 | n[1]<<16 | n[2]<<8 | n[3]; 49 uint32_t nw = (uint32_t)n[0]<<24 | n[1]<<16 | n[2]<<8 | n[3];
50 uint32_t hw = h[0]<<24 | h[1]<<16 | h[2]<<8 | h[3]; 50 uint32_t hw = (uint32_t)h[0]<<24 | h[1]<<16 | h[2]<<8 | h[3];
51 for (h+=3; *h && hw != nw; hw = hw<<8 | *++h); 51 for (h+=3; *h && hw != nw; hw = hw<<8 | *++h);
52 return *h ? (char *)h-3 : 0; 52 return *h ? (char *)h-3 : 0;
53} 53}
@@ -129,7 +129,7 @@ twoway_strstr(const unsigned char *h, const unsigned char *n)
129 for (;;) { 129 for (;;) {
130 /* Update incremental end-of-haystack pointer */ 130 /* Update incremental end-of-haystack pointer */
131 if (z-h < l) { 131 if (z-h < l) {
132 /* Fast estimate for MIN(l,63) */ 132 /* Fast estimate for MAX(l,63) */
133 size_t grow = l | 63; 133 size_t grow = l | 63;
134 const unsigned char *z2 = memchr(z, 0, grow); 134 const unsigned char *z2 = memchr(z, 0, grow);
135 if (z2) { 135 if (z2) {
diff --git a/src/lib/libc/string/wcslen.c b/src/lib/libc/string/wcslen.c
index 16d4bba128..937d352e31 100644
--- a/src/lib/libc/string/wcslen.c
+++ b/src/lib/libc/string/wcslen.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: wcslen.c,v 1.4 2015/09/12 16:23:14 guenther Exp $ */ 1/* $OpenBSD: wcslen.c,v 1.5 2026/06/30 19:18:54 kettenis Exp $ */
2/* $NetBSD: wcslen.c,v 1.2 2001/01/03 14:29:36 lukem Exp $ */ 2/* $NetBSD: wcslen.c,v 1.2 2001/01/03 14:29:36 lukem Exp $ */
3 3
4/*- 4/*-
@@ -42,4 +42,4 @@ wcslen(const wchar_t *s)
42 42
43 return p - s; 43 return p - s;
44} 44}
45DEF_STRONG(wcslen); 45DEF_BUILTIN(wcslen);
diff --git a/src/lib/libcrypto/aes/aes.c b/src/lib/libcrypto/aes/aes.c
index 9cffe6b7cd..db693d2dd8 100644
--- a/src/lib/libcrypto/aes/aes.c
+++ b/src/lib/libcrypto/aes/aes.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: aes.c,v 1.17 2025/09/15 07:36:12 tb Exp $ */ 1/* $OpenBSD: aes.c,v 1.19 2026/07/31 03:59:50 kenjiro Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2002-2006 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2002-2006 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -55,6 +55,7 @@
55#include <openssl/crypto.h> 55#include <openssl/crypto.h>
56#include <openssl/modes.h> 56#include <openssl/modes.h>
57 57
58#include "aes_local.h"
58#include "crypto_arch.h" 59#include "crypto_arch.h"
59#include "crypto_internal.h" 60#include "crypto_internal.h"
60#include "modes_local.h" 61#include "modes_local.h"
@@ -135,7 +136,7 @@ aes_encrypt_block128(const unsigned char *in, unsigned char *out, const void *ke
135 aes_encrypt_internal(in, out, key); 136 aes_encrypt_internal(in, out, key);
136} 137}
137 138
138void 139static void
139aes_decrypt_block128(const unsigned char *in, unsigned char *out, const void *key) 140aes_decrypt_block128(const unsigned char *in, unsigned char *out, const void *key)
140{ 141{
141 aes_decrypt_internal(in, out, key); 142 aes_decrypt_internal(in, out, key);
diff --git a/src/lib/libcrypto/aes/asm/aes-586.pl b/src/lib/libcrypto/aes/asm/aes-586.pl
index 402a1a3c46..cd565896fe 100644
--- a/src/lib/libcrypto/aes/asm/aes-586.pl
+++ b/src/lib/libcrypto/aes/asm/aes-586.pl
@@ -166,7 +166,7 @@
166# effectively slow down the operation by several *orders* of magnitute, 166# effectively slow down the operation by several *orders* of magnitute,
167# by ratio of time slice to duration of handful of AES rounds, which 167# by ratio of time slice to duration of handful of AES rounds, which
168# unlikely to remain unnoticed. Not to mention that this also means 168# unlikely to remain unnoticed. Not to mention that this also means
169# that he would spend correspondigly more time to collect enough 169# that he would spend correspondingly more time to collect enough
170# statistical data to mount the attack. It's probably appropriate to 170# statistical data to mount the attack. It's probably appropriate to
171# say that if adeversary reckons that this attack is beneficial and 171# say that if adeversary reckons that this attack is beneficial and
172# risks to be noticed, you probably have larger problems having him 172# risks to be noticed, you probably have larger problems having him
diff --git a/src/lib/libcrypto/arch/aarch64/crypto_cpu_caps.c b/src/lib/libcrypto/arch/aarch64/crypto_cpu_caps.c
index b31a50ef75..5022bed262 100644
--- a/src/lib/libcrypto/arch/aarch64/crypto_cpu_caps.c
+++ b/src/lib/libcrypto/arch/aarch64/crypto_cpu_caps.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: crypto_cpu_caps.c,v 1.2 2024/11/12 13:52:31 jsing Exp $ */ 1/* $OpenBSD: crypto_cpu_caps.c,v 1.5 2026/08/08 21:37:19 naddy Exp $ */
2/* 2/*
3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -15,10 +15,7 @@
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */ 16 */
17 17
18#include <sys/types.h> 18#include <sys/auxv.h>
19#include <sys/sysctl.h>
20
21#include <machine/cpu.h>
22 19
23#include <stddef.h> 20#include <stddef.h>
24#include <stdio.h> 21#include <stdio.h>
@@ -28,70 +25,29 @@
28/* Machine dependent CPU capabilities. */ 25/* Machine dependent CPU capabilities. */
29uint64_t crypto_cpu_caps_aarch64; 26uint64_t crypto_cpu_caps_aarch64;
30 27
31static inline uint64_t 28void
32extract_bits(uint64_t val, int start, int end) 29crypto_cpu_caps_init(void)
33{
34 return (val >> end) & (1ULL << (1 + start - end)) - 1;
35}
36
37static uint64_t
38parse_isar0(uint64_t isar0)
39{ 30{
40 uint64_t caps = 0; 31 unsigned long hwcap;
41 uint64_t feature;
42
43 /* AES - bits [7:4] */
44 feature = extract_bits(isar0, 7, 4);
45 if (feature >= 1)
46 caps |= CRYPTO_CPU_CAPS_AARCH64_AES;
47 if (feature >= 2)
48 caps |= CRYPTO_CPU_CAPS_AARCH64_PMULL;
49
50 /* SHA1 - bits [11:8] */
51 feature = extract_bits(isar0, 11, 8);
52 if (feature >= 1)
53 caps |= CRYPTO_CPU_CAPS_AARCH64_SHA1;
54
55 /* SHA2 - bits [15:12] */
56 feature = extract_bits(isar0, 15, 12);
57 if (feature >= 1)
58 caps |= CRYPTO_CPU_CAPS_AARCH64_SHA2;
59 if (feature >= 2)
60 caps |= CRYPTO_CPU_CAPS_AARCH64_SHA512;
61
62 /* SHA3 - bits [35:32] */
63 feature = extract_bits(isar0, 35, 32);
64 if (feature >= 1)
65 caps |= CRYPTO_CPU_CAPS_AARCH64_SHA3;
66 32
67 return caps; 33 if (elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap)) != 0)
68} 34 return;
69 35
70static int 36 if (hwcap & HWCAP_AES)
71read_isar0(uint64_t *isar0) 37 crypto_cpu_caps_aarch64 |= CRYPTO_CPU_CAPS_AARCH64_AES;
72{
73 uint64_t isar;
74 int mib[2];
75 size_t len;
76 38
77 mib[0] = CTL_MACHDEP; 39 if (hwcap & HWCAP_PMULL)
78 mib[1] = CPU_ID_AA64ISAR0; 40 crypto_cpu_caps_aarch64 |= CRYPTO_CPU_CAPS_AARCH64_PMULL;
79 len = sizeof(isar);
80 if (sysctl(mib, 2, &isar, &len, NULL, 0) == -1)
81 return 0;
82 41
83 *isar0 = isar; 42 if (hwcap & HWCAP_SHA1)
43 crypto_cpu_caps_aarch64 |= CRYPTO_CPU_CAPS_AARCH64_SHA1;
84 44
85 return 1; 45 if (hwcap & HWCAP_SHA2)
86} 46 crypto_cpu_caps_aarch64 |= CRYPTO_CPU_CAPS_AARCH64_SHA2;
87 47
88void 48 if (hwcap & HWCAP_SHA512)
89crypto_cpu_caps_init(void) 49 crypto_cpu_caps_aarch64 |= CRYPTO_CPU_CAPS_AARCH64_SHA512;
90{
91 uint64_t isar = 0;
92
93 if (!read_isar0(&isar))
94 return;
95 50
96 crypto_cpu_caps_aarch64 = parse_isar0(isar); 51 if (hwcap & HWCAP_SHA3)
52 crypto_cpu_caps_aarch64 |= CRYPTO_CPU_CAPS_AARCH64_SHA3;
97} 53}
diff --git a/src/lib/libcrypto/asn1/a_int.c b/src/lib/libcrypto/asn1/a_int.c
index f171e330f6..5d05c2022c 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.49 2025/05/10 05:54:38 tb Exp $ */ 1/* $OpenBSD: a_int.c,v 1.50 2026/07/31 00:50:52 kenjiro 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,6 +65,7 @@
65#include <openssl/bn.h> 65#include <openssl/bn.h>
66#include <openssl/buffer.h> 66#include <openssl/buffer.h>
67 67
68#include "asn1_local.h"
68#include "bytestring.h" 69#include "bytestring.h"
69#include "err_local.h" 70#include "err_local.h"
70 71
diff --git a/src/lib/libcrypto/asn1/a_mbstr.c b/src/lib/libcrypto/asn1/a_mbstr.c
index 38398ad1d1..21368543ce 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.28 2025/05/10 05:54:38 tb Exp $ */ 1/* $OpenBSD: a_mbstr.c,v 1.29 2026/06/09 12:29:47 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 */
@@ -57,6 +57,7 @@
57 */ 57 */
58 58
59#include <ctype.h> 59#include <ctype.h>
60#include <limits.h>
60#include <stdio.h> 61#include <stdio.h>
61#include <string.h> 62#include <string.h>
62 63
@@ -105,8 +106,16 @@ ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
105 int nchar; 106 int nchar;
106 int (*cpyfunc)(unsigned long, void *) = NULL; 107 int (*cpyfunc)(unsigned long, void *) = NULL;
107 108
108 if (len < 0) 109 if (len < 0) {
109 len = strlen((const char *)in); 110 size_t length;
111
112 if ((length = strlen((const char *)in)) >= INT_MAX) {
113 ASN1error(ASN1_R_STRING_TOO_LONG);
114 return -1;
115 }
116 len = length;
117 }
118
110 if (!mask) 119 if (!mask)
111 mask = DIRSTRING_TYPE; 120 mask = DIRSTRING_TYPE;
112 121
@@ -221,11 +230,19 @@ ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
221 break; 230 break;
222 231
223 case MBSTRING_BMP: 232 case MBSTRING_BMP:
233 if (nchar > INT_MAX / 2) {
234 ASN1error(ASN1_R_STRING_TOO_LONG);
235 goto err;
236 }
224 outlen = nchar << 1; 237 outlen = nchar << 1;
225 cpyfunc = cpy_bmp; 238 cpyfunc = cpy_bmp;
226 break; 239 break;
227 240
228 case MBSTRING_UNIV: 241 case MBSTRING_UNIV:
242 if (nchar > INT_MAX / 4) {
243 ASN1error(ASN1_R_STRING_TOO_LONG);
244 goto err;
245 }
229 outlen = nchar << 2; 246 outlen = nchar << 2;
230 cpyfunc = cpy_univ; 247 cpyfunc = cpy_univ;
231 break; 248 break;
diff --git a/src/lib/libcrypto/asn1/a_time_posix.c b/src/lib/libcrypto/asn1/a_time_posix.c
index d4439b4701..da21ae7cbc 100644
--- a/src/lib/libcrypto/asn1/a_time_posix.c
+++ b/src/lib/libcrypto/asn1/a_time_posix.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: a_time_posix.c,v 1.5 2024/02/18 16:28:38 tb Exp $ */ 1/* $OpenBSD: a_time_posix.c,v 1.6 2026/07/31 00:50:52 kenjiro Exp $ */
2/* 2/*
3 * Copyright (c) 2022, Google Inc. 3 * Copyright (c) 2022, Google Inc.
4 * Copyright (c) 2022, Bob Beck <beck@obtuse.com> 4 * Copyright (c) 2022, Bob Beck <beck@obtuse.com>
@@ -30,6 +30,7 @@
30#include <openssl/asn1.h> 30#include <openssl/asn1.h>
31#include <openssl/posix_time.h> 31#include <openssl/posix_time.h>
32 32
33#include "asn1_local.h"
33#include "crypto_internal.h" 34#include "crypto_internal.h"
34 35
35#define SECS_PER_HOUR (int64_t)(60 * 60) 36#define SECS_PER_HOUR (int64_t)(60 * 60)
diff --git a/src/lib/libcrypto/asn1/a_time_tm.c b/src/lib/libcrypto/asn1/a_time_tm.c
index dd2893167f..b5210641a6 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.43 2025/05/10 05:54:38 tb Exp $ */ 1/* $OpenBSD: a_time_tm.c,v 1.44 2026/07/31 00:50:52 kenjiro Exp $ */
2/* 2/*
3 * Copyright (c) 2015 Bob Beck <beck@openbsd.org> 3 * Copyright (c) 2015 Bob Beck <beck@openbsd.org>
4 * 4 *
@@ -26,6 +26,7 @@
26#include "asn1_local.h" 26#include "asn1_local.h"
27#include "bytestring.h" 27#include "bytestring.h"
28#include "err_local.h" 28#include "err_local.h"
29#include "x509_internal.h"
29 30
30#define RFC5280 0 31#define RFC5280 0
31#define GENTIME_LENGTH 15 32#define GENTIME_LENGTH 15
diff --git a/src/lib/libcrypto/asn1/a_type.c b/src/lib/libcrypto/asn1/a_type.c
index 0615de1ccb..3f9157de4a 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.29 2025/12/05 14:19:27 tb Exp $ */ 1/* $OpenBSD: a_type.c,v 1.30 2026/09/02 07:01:54 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 *
@@ -119,6 +119,7 @@ ASN1_TYPE_get(const ASN1_TYPE *a)
119} 119}
120LCRYPTO_ALIAS(ASN1_TYPE_get); 120LCRYPTO_ALIAS(ASN1_TYPE_get);
121 121
122/* XXX - add ASN1_TYPE_set0() for internal use? */
122void 123void
123ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value) 124ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value)
124{ 125{
diff --git a/src/lib/libcrypto/asn1/asn1_gen.c b/src/lib/libcrypto/asn1/asn1_gen.c
index b409e83c7d..bb58843bbf 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.28 2025/05/10 05:54:38 tb Exp $ */ 1/* $OpenBSD: asn1_gen.c,v 1.35 2026/09/02 07:15:01 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 */
@@ -436,57 +436,63 @@ parse_tagging(const char *vstart, int vlen, int *ptag, int *pclass)
436static ASN1_TYPE * 436static ASN1_TYPE *
437asn1_multi(int utype, const char *section, X509V3_CTX *cnf) 437asn1_multi(int utype, const char *section, X509V3_CTX *cnf)
438{ 438{
439 ASN1_TYPE *ret = NULL;
440 STACK_OF(ASN1_TYPE) *sk = NULL; 439 STACK_OF(ASN1_TYPE) *sk = NULL;
441 STACK_OF(CONF_VALUE) *sect = NULL; 440 STACK_OF(CONF_VALUE) *sect = NULL;
441 ASN1_TYPE *ret = NULL, *typ = NULL;
442 ASN1_STRING *astr = NULL;
442 unsigned char *der = NULL; 443 unsigned char *der = NULL;
443 int derlen; 444 int derlen;
444 int i; 445 int i;
445 sk = sk_ASN1_TYPE_new_null(); 446
446 if (!sk) 447 if ((sk = sk_ASN1_TYPE_new_null()) == NULL)
447 goto bad; 448 goto err;
448 if (section) { 449
449 if (!cnf) 450 if (section != NULL) {
450 goto bad; 451 if (cnf == NULL)
451 sect = X509V3_get0_section(cnf, section); 452 goto err;
452 if (!sect) 453
453 goto bad; 454 if ((sect = X509V3_get0_section(cnf, section)) == NULL)
455 goto err;
456
454 for (i = 0; i < sk_CONF_VALUE_num(sect); i++) { 457 for (i = 0; i < sk_CONF_VALUE_num(sect); i++) {
455 ASN1_TYPE *typ = ASN1_generate_v3( 458 CONF_VALUE *val = sk_CONF_VALUE_value(sect, i);
456 sk_CONF_VALUE_value(sect, i)->value, cnf); 459
457 if (!typ) 460 if ((typ = ASN1_generate_v3(val->value, cnf)) == NULL)
458 goto bad; 461 goto err;
459 if (!sk_ASN1_TYPE_push(sk, typ)) 462 if (sk_ASN1_TYPE_push(sk, typ) <= 0)
460 goto bad; 463 goto err;
464 typ = NULL;
461 } 465 }
462 } 466 }
463 467
464 /* Now we has a STACK of the components, convert to the correct form */ 468 /* DER encode the stack as a SET or a SEQUENCE per utype. */
465
466 if (utype == V_ASN1_SET) 469 if (utype == V_ASN1_SET)
467 derlen = i2d_ASN1_SET_ANY(sk, &der); 470 derlen = i2d_ASN1_SET_ANY(sk, &der);
468 else 471 else
469 derlen = i2d_ASN1_SEQUENCE_ANY(sk, &der); 472 derlen = i2d_ASN1_SEQUENCE_ANY(sk, &der);
470 473
471 if (derlen < 0) 474 if (derlen < 0)
472 goto bad; 475 goto err;
473
474 if (!(ret = ASN1_TYPE_new()))
475 goto bad;
476 476
477 if (!(ret->value.asn1_string = ASN1_STRING_type_new(utype))) 477 if ((astr = ASN1_STRING_type_new(utype)) == NULL)
478 goto bad; 478 goto err;
479 ASN1_STRING_set0(astr, der, derlen);
480 der = NULL;
481 derlen = 0;
479 482
480 ret->type = utype; 483 if ((typ = ASN1_TYPE_new()) == NULL)
484 goto err;
485 ASN1_TYPE_set(typ, utype, astr);
486 astr = NULL;
481 487
482 ret->value.asn1_string->data = der; 488 ret = typ;
483 ret->value.asn1_string->length = derlen; 489 typ = NULL;
484 490
485 der = NULL; 491 err:
486
487 bad:
488 free(der);
489 sk_ASN1_TYPE_pop_free(sk, ASN1_TYPE_free); 492 sk_ASN1_TYPE_pop_free(sk, ASN1_TYPE_free);
493 ASN1_TYPE_free(typ);
494 ASN1_STRING_free(astr);
495 free(der);
490 496
491 return ret; 497 return ret;
492} 498}
diff --git a/src/lib/libcrypto/asn1/asn1_lib.c b/src/lib/libcrypto/asn1/asn1_lib.c
index ac8da0e61d..6d65dc9d68 100644
--- a/src/lib/libcrypto/asn1/asn1_lib.c
+++ b/src/lib/libcrypto/asn1/asn1_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn1_lib.c,v 1.54 2022/05/05 19:18:56 jsing Exp $ */ 1/* $OpenBSD: asn1_lib.c,v 1.55 2026/07/31 00:50:52 kenjiro Exp $ */
2/* 2/*
3 * Copyright (c) 2021 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2021 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -18,6 +18,7 @@
18#include <limits.h> 18#include <limits.h>
19#include <stdlib.h> 19#include <stdlib.h>
20 20
21#include "asn1_local.h"
21#include "bytestring.h" 22#include "bytestring.h"
22 23
23int 24int
diff --git a/src/lib/libcrypto/asn1/asn1_local.h b/src/lib/libcrypto/asn1/asn1_local.h
index d61cfaa7b9..723c6574df 100644
--- a/src/lib/libcrypto/asn1/asn1_local.h
+++ b/src/lib/libcrypto/asn1/asn1_local.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn1_local.h,v 1.11 2025/11/26 10:19:57 tb Exp $ */ 1/* $OpenBSD: asn1_local.h,v 1.12 2026/07/31 00:50:52 kenjiro 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 2006. 3 * project 2006.
4 */ 4 */
@@ -59,6 +59,8 @@
59#ifndef HEADER_ASN1_LOCAL_H 59#ifndef HEADER_ASN1_LOCAL_H
60#define HEADER_ASN1_LOCAL_H 60#define HEADER_ASN1_LOCAL_H
61 61
62#include <openssl/asn1.h>
63
62#include "bytestring.h" 64#include "bytestring.h"
63 65
64__BEGIN_HIDDEN_DECLS 66__BEGIN_HIDDEN_DECLS
diff --git a/src/lib/libcrypto/asn1/asn1_types.c b/src/lib/libcrypto/asn1/asn1_types.c
index 5f9644a718..712c2297fb 100644
--- a/src/lib/libcrypto/asn1/asn1_types.c
+++ b/src/lib/libcrypto/asn1/asn1_types.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn1_types.c,v 1.3 2023/07/05 21:23:36 beck Exp $ */ 1/* $OpenBSD: asn1_types.c,v 1.4 2026/07/31 00:50:52 kenjiro Exp $ */
2/* 2/*
3 * Copyright (c) 2021 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2021 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -19,6 +19,8 @@
19 19
20#include <openssl/asn1.h> 20#include <openssl/asn1.h>
21 21
22#include "asn1_local.h"
23
22#define ASN1_ENCODING_CONSTRUCTED_ONLY 1 24#define ASN1_ENCODING_CONSTRUCTED_ONLY 1
23#define ASN1_ENCODING_PRIMITIVE_ONLY 2 25#define ASN1_ENCODING_PRIMITIVE_ONLY 2
24 26
diff --git a/src/lib/libcrypto/asn1/bio_asn1.c b/src/lib/libcrypto/asn1/bio_asn1.c
index b9f54cd4ef..acd0f4f146 100644
--- a/src/lib/libcrypto/asn1/bio_asn1.c
+++ b/src/lib/libcrypto/asn1/bio_asn1.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bio_asn1.c,v 1.23 2023/07/28 09:58:30 tb Exp $ */ 1/* $OpenBSD: bio_asn1.c,v 1.24 2026/07/31 00:50:52 kenjiro 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 */
@@ -67,6 +67,7 @@
67#include <openssl/bio.h> 67#include <openssl/bio.h>
68#include <openssl/asn1.h> 68#include <openssl/asn1.h>
69 69
70#include "asn1_local.h"
70#include "bio_local.h" 71#include "bio_local.h"
71 72
72#define BIO_C_SET_PREFIX 149 73#define BIO_C_SET_PREFIX 149
diff --git a/src/lib/libcrypto/asn1/tasn_prn.c b/src/lib/libcrypto/asn1/tasn_prn.c
index 4db6d61111..61b11dd542 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.29 2025/06/07 09:28:00 tb Exp $ */ 1/* $OpenBSD: tasn_prn.c,v 1.30 2026/05/16 07:06:35 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 */
@@ -392,7 +392,7 @@ asn1_print_obstring_ctx(BIO *out, ASN1_STRING *str, int indent,
392 } else if (BIO_puts(out, "\n") <= 0) 392 } else if (BIO_puts(out, "\n") <= 0)
393 return 0; 393 return 0;
394 if ((str->length > 0) && 394 if ((str->length > 0) &&
395 BIO_dump_indent(out, (char *)str->data, str->length, 395 BIO_dump_indent(out, (const char *)str->data, str->length,
396 indent + 2) <= 0) 396 indent + 2) <= 0)
397 return 0; 397 return 0;
398 return 1; 398 return 1;
diff --git a/src/lib/libcrypto/asn1/tasn_typ.c b/src/lib/libcrypto/asn1/tasn_typ.c
index 64faad7240..a30a06918d 100644
--- a/src/lib/libcrypto/asn1/tasn_typ.c
+++ b/src/lib/libcrypto/asn1/tasn_typ.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tasn_typ.c,v 1.21 2025/08/22 14:07:34 tb Exp $ */ 1/* $OpenBSD: tasn_typ.c,v 1.22 2026/07/31 00:50:52 kenjiro 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 */
@@ -59,6 +59,8 @@
59#include <openssl/asn1.h> 59#include <openssl/asn1.h>
60#include <openssl/asn1t.h> 60#include <openssl/asn1t.h>
61 61
62#include "asn1_local.h"
63
62/* Declarations for string types */ 64/* Declarations for string types */
63 65
64const ASN1_ITEM ASN1_NULL_it = { 66const ASN1_ITEM ASN1_NULL_it = {
diff --git a/src/lib/libcrypto/asn1/tasn_utl.c b/src/lib/libcrypto/asn1/tasn_utl.c
index 178a364c89..69b2187357 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.19 2025/05/10 05:54:38 tb Exp $ */ 1/* $OpenBSD: tasn_utl.c,v 1.20 2026/07/31 00:50:52 kenjiro 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 */
@@ -64,6 +64,7 @@
64#include <openssl/asn1t.h> 64#include <openssl/asn1t.h>
65#include <openssl/objects.h> 65#include <openssl/objects.h>
66 66
67#include "asn1_local.h"
67#include "bytestring.h" 68#include "bytestring.h"
68#include "err_local.h" 69#include "err_local.h"
69 70
diff --git a/src/lib/libcrypto/asn1/x_crl.c b/src/lib/libcrypto/asn1/x_crl.c
index d95b044a89..0b8631e65d 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.52 2026/04/07 12:52:19 tb Exp $ */ 1/* $OpenBSD: x_crl.c,v 1.53 2026/06/23 08:28:06 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 *
@@ -326,7 +326,7 @@ crl_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg)
326 if (nid == NID_issuing_distribution_point || 326 if (nid == NID_issuing_distribution_point ||
327 nid == NID_authority_key_identifier || 327 nid == NID_authority_key_identifier ||
328 nid == NID_delta_crl) 328 nid == NID_delta_crl)
329 break; 329 continue;
330 crl->flags |= EXFLAG_CRITICAL; 330 crl->flags |= EXFLAG_CRITICAL;
331 break; 331 break;
332 } 332 }
diff --git a/src/lib/libcrypto/bio/bio_meth.c b/src/lib/libcrypto/bio/bio_meth.c
index 37f866a0c4..8c3435d9e1 100644
--- a/src/lib/libcrypto/bio/bio_meth.c
+++ b/src/lib/libcrypto/bio/bio_meth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bio_meth.c,v 1.9 2023/07/05 21:23:37 beck Exp $ */ 1/* $OpenBSD: bio_meth.c,v 1.10 2026/06/22 09:25:17 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> 3 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org>
4 * 4 *
@@ -51,9 +51,9 @@ int
51LCRYPTO_ALIAS(BIO_meth_get_write); 51LCRYPTO_ALIAS(BIO_meth_get_write);
52 52
53int 53int
54BIO_meth_set_write(BIO_METHOD *biom, int (*write)(BIO *, const char *, int)) 54BIO_meth_set_write(BIO_METHOD *biom, int (*bwrite)(BIO *, const char *, int))
55{ 55{
56 biom->bwrite = write; 56 biom->bwrite = bwrite;
57 return 1; 57 return 1;
58} 58}
59LCRYPTO_ALIAS(BIO_meth_set_write); 59LCRYPTO_ALIAS(BIO_meth_set_write);
@@ -66,9 +66,9 @@ int
66LCRYPTO_ALIAS(BIO_meth_get_read); 66LCRYPTO_ALIAS(BIO_meth_get_read);
67 67
68int 68int
69BIO_meth_set_read(BIO_METHOD *biom, int (*read)(BIO *, char *, int)) 69BIO_meth_set_read(BIO_METHOD *biom, int (*bread)(BIO *, char *, int))
70{ 70{
71 biom->bread = read; 71 biom->bread = bread;
72 return 1; 72 return 1;
73} 73}
74LCRYPTO_ALIAS(BIO_meth_set_read); 74LCRYPTO_ALIAS(BIO_meth_set_read);
@@ -81,9 +81,9 @@ int
81LCRYPTO_ALIAS(BIO_meth_get_puts); 81LCRYPTO_ALIAS(BIO_meth_get_puts);
82 82
83int 83int
84BIO_meth_set_puts(BIO_METHOD *biom, int (*puts)(BIO *, const char *)) 84BIO_meth_set_puts(BIO_METHOD *biom, int (*bputs)(BIO *, const char *))
85{ 85{
86 biom->bputs = puts; 86 biom->bputs = bputs;
87 return 1; 87 return 1;
88} 88}
89LCRYPTO_ALIAS(BIO_meth_set_puts); 89LCRYPTO_ALIAS(BIO_meth_set_puts);
@@ -96,9 +96,9 @@ int
96LCRYPTO_ALIAS(BIO_meth_get_gets); 96LCRYPTO_ALIAS(BIO_meth_get_gets);
97 97
98int 98int
99BIO_meth_set_gets(BIO_METHOD *biom, int (*gets)(BIO *, char *, int)) 99BIO_meth_set_gets(BIO_METHOD *biom, int (*bgets)(BIO *, char *, int))
100{ 100{
101 biom->bgets = gets; 101 biom->bgets = bgets;
102 return 1; 102 return 1;
103} 103}
104LCRYPTO_ALIAS(BIO_meth_set_gets); 104LCRYPTO_ALIAS(BIO_meth_set_gets);
diff --git a/src/lib/libcrypto/bn/bn_const.c b/src/lib/libcrypto/bn/bn_const.c
index 389e95ca15..746e1f269a 100644
--- a/src/lib/libcrypto/bn/bn_const.c
+++ b/src/lib/libcrypto/bn/bn_const.c
@@ -1,8 +1,10 @@
1/* $OpenBSD: bn_const.c,v 1.9 2026/01/23 08:29:04 tb Exp $ */ 1/* $OpenBSD: bn_const.c,v 1.10 2026/07/31 00:50:52 kenjiro Exp $ */
2/* Insert boilerplate */ 2/* Insert boilerplate */
3 3
4#include <openssl/bn.h> 4#include <openssl/bn.h>
5 5
6#include "bn_local.h"
7
6/* 8/*
7 * "First Oakley Default Group" from RFC2409, section 6.1. 9 * "First Oakley Default Group" from RFC2409, section 6.1.
8 * 10 *
diff --git a/src/lib/libcrypto/buffer/buffer.c b/src/lib/libcrypto/buffer/buffer.c
index 4a0c17c598..d6e3fa7f7f 100644
--- a/src/lib/libcrypto/buffer/buffer.c
+++ b/src/lib/libcrypto/buffer/buffer.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: buffer.c,v 1.29 2025/05/10 05:54:38 tb Exp $ */ 1/* $OpenBSD: buffer.c,v 1.30 2026/07/31 01:05:27 kenjiro 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 *
@@ -133,24 +133,3 @@ BUF_MEM_grow_clean(BUF_MEM *str, size_t len)
133 return (len); 133 return (len);
134} 134}
135LCRYPTO_ALIAS(BUF_MEM_grow_clean); 135LCRYPTO_ALIAS(BUF_MEM_grow_clean);
136
137void
138BUF_reverse(unsigned char *out, const unsigned char *in, size_t size)
139{
140 size_t i;
141
142 if (in) {
143 out += size - 1;
144 for (i = 0; i < size; i++)
145 *out-- = *in++;
146 } else {
147 unsigned char *q;
148 char c;
149 q = out + size - 1;
150 for (i = 0; i < size / 2; i++) {
151 c = *q;
152 *q-- = *out;
153 *out++ = c;
154 }
155 }
156}
diff --git a/src/lib/libcrypto/cert.pem b/src/lib/libcrypto/cert.pem
index c086041e28..dc75965828 100644
--- a/src/lib/libcrypto/cert.pem
+++ b/src/lib/libcrypto/cert.pem
@@ -1,4 +1,4 @@
1# $OpenBSD: cert.pem,v 1.34 2026/03/18 21:50:06 sthen Exp $ 1# $OpenBSD: cert.pem,v 1.36 2026/08/20 16:22:21 sthen Exp $
2### /C=ES/CN=Autoridad de Certificacion Firmaprofesional CIF A62634068 2### /C=ES/CN=Autoridad de Certificacion Firmaprofesional CIF A62634068
3 3
4=== /C=ES/CN=Autoridad de Certificacion Firmaprofesional CIF A62634068 4=== /C=ES/CN=Autoridad de Certificacion Firmaprofesional CIF A62634068
@@ -265,169 +265,6 @@ LysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9vwGYT7JZVEc+NHt4bVaT
265LnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg== 265LnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg==
266-----END CERTIFICATE----- 266-----END CERTIFICATE-----
267 267
268### AffirmTrust
269
270=== /C=US/O=AffirmTrust/CN=AffirmTrust Commercial
271Certificate:
272 Data:
273 Version: 3 (0x2)
274 Serial Number: 8608355977964138876 (0x7777062726a9b17c)
275 Signature Algorithm: sha256WithRSAEncryption
276 Validity
277 Not Before: Jan 29 14:06:06 2010 GMT
278 Not After : Dec 31 14:06:06 2030 GMT
279 Subject: C=US, O=AffirmTrust, CN=AffirmTrust Commercial
280 X509v3 extensions:
281 X509v3 Subject Key Identifier:
282 9D:93:C6:53:8B:5E:CA:AF:3F:9F:1E:0F:E5:99:95:BC:24:F6:94:8F
283 X509v3 Basic Constraints: critical
284 CA:TRUE
285 X509v3 Key Usage: critical
286 Certificate Sign, CRL Sign
287SHA1 Fingerprint=F9:B5:B6:32:45:5F:9C:BE:EC:57:5F:80:DC:E9:6E:2C:C7:B2:78:B7
288SHA256 Fingerprint=03:76:AB:1D:54:C5:F9:80:3C:E4:B2:E2:01:A0:EE:7E:EF:7B:57:B6:36:E8:A9:3C:9B:8D:48:60:C9:6F:5F:A7
289-----BEGIN CERTIFICATE-----
290MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UE
291BhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVz
292dCBDb21tZXJjaWFsMB4XDTEwMDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDEL
293MAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZp
294cm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC
295AQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6EqdbDuKP
296Hx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yr
297ba0F8PrVC8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPAL
298MeIrJmqbTFeurCA+ukV6BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1
299yHp52UKqK39c/s4mT6NmgTWvRLpUHhwwMmWd5jyTXlBOeuM61G7MGvv50jeuJCqr
300VwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNVHQ4EFgQUnZPGU4teyq8/
301nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwDQYJ
302KoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYG
303XUPGhi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNj
304vbz4YYCanrHOQnDiqX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivt
305Z8SOyUOyXGsViQK8YvxO8rUzqrJv0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9g
306N53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0khsUlHRUe072o0EclNmsxZt9YC
307nlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8=
308-----END CERTIFICATE-----
309=== /C=US/O=AffirmTrust/CN=AffirmTrust Networking
310Certificate:
311 Data:
312 Version: 3 (0x2)
313 Serial Number: 8957382827206547757 (0x7c4f04391cd4992d)
314 Signature Algorithm: sha1WithRSAEncryption
315 Validity
316 Not Before: Jan 29 14:08:24 2010 GMT
317 Not After : Dec 31 14:08:24 2030 GMT
318 Subject: C=US, O=AffirmTrust, CN=AffirmTrust Networking
319 X509v3 extensions:
320 X509v3 Subject Key Identifier:
321 07:1F:D2:E7:9C:DA:C2:6E:A2:40:B4:B0:7A:50:10:50:74:C4:C8:BD
322 X509v3 Basic Constraints: critical
323 CA:TRUE
324 X509v3 Key Usage: critical
325 Certificate Sign, CRL Sign
326SHA1 Fingerprint=29:36:21:02:8B:20:ED:02:F5:66:C5:32:D1:D6:ED:90:9F:45:00:2F
327SHA256 Fingerprint=0A:81:EC:5A:92:97:77:F1:45:90:4A:F3:8D:5D:50:9F:66:B5:E2:C5:8F:CD:B5:31:05:8B:0E:17:F3:F0:B4:1B
328-----BEGIN CERTIFICATE-----
329MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UE
330BhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVz
331dCBOZXR3b3JraW5nMB4XDTEwMDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDEL
332MAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZp
333cm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC
334AQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SEHi3y
335YJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbua
336kCNrmreIdIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRL
337QESxG9fhwoXA3hA/Pe24/PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp
3386zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gbh+0t+nvujArjqWaJGctB+d1ENmHP4ndG
339yH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNVHQ4EFgQUBx/S55zawm6i
340QLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwDQYJ
341KoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfO
342tDIuUFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzu
343QY0x2+c06lkh1QF612S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZ
344Lgo/bNjR9eUJtGxUAArgFU2HdW23WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4u
345olu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9/ZFvgrG+CJPbFEfxojfHRZ48
346x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s=
347-----END CERTIFICATE-----
348=== /C=US/O=AffirmTrust/CN=AffirmTrust Premium
349Certificate:
350 Data:
351 Version: 3 (0x2)
352 Serial Number: 7893706540734352110 (0x6d8c1446b1a60aee)
353 Signature Algorithm: sha384WithRSAEncryption
354 Validity
355 Not Before: Jan 29 14:10:36 2010 GMT
356 Not After : Dec 31 14:10:36 2040 GMT
357 Subject: C=US, O=AffirmTrust, CN=AffirmTrust Premium
358 X509v3 extensions:
359 X509v3 Subject Key Identifier:
360 9D:C0:67:A6:0C:22:D9:26:F5:45:AB:A6:65:52:11:27:D8:45:AC:63
361 X509v3 Basic Constraints: critical
362 CA:TRUE
363 X509v3 Key Usage: critical
364 Certificate Sign, CRL Sign
365SHA1 Fingerprint=D8:A6:33:2C:E0:03:6F:B1:85:F6:63:4F:7D:6A:06:65:26:32:28:27
366SHA256 Fingerprint=70:A7:3F:7F:37:6B:60:07:42:48:90:45:34:B1:14:82:D5:BF:0E:69:8E:CC:49:8D:F5:25:77:EB:F2:E9:3B:9A
367-----BEGIN CERTIFICATE-----
368MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UE
369BhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVz
370dCBQcmVtaXVtMB4XDTEwMDEyOTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkG
371A1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1U
372cnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAxBLf
373qV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtnBKAQ
374JG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ
375+jjeRFcV5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrS
376s8PhaJyJ+HoAVt70VZVs+7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5
377HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmdGPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d7
37870O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5Rp9EixAqnOEhss/n/fauG
379V+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NIS+LI+H+S
380qHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S
3815u046uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4Ia
382C1nEWTJ3s7xgaVY5/bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TX
383OwF0lkLgAOIua+rF7nKsu7/+6qqo+Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYE
384FJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/
385BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByvMiPIs0laUZx2
386KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg
387Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B
3888OWycvpEgjNC6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQ
389MKSOyARiqcTtNd56l+0OOF6SL5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc
3900jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK+4w1IX2COPKpVJEZNZOUbWo6xbLQ
391u4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmVBtWVyuEklut89pMF
392u+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFgIxpH
393YoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8
394GKa1qF60g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaO
395RtGdFNrHF+QFlozEJLUbzxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6e
396KeC2uAloGRwYQw==
397-----END CERTIFICATE-----
398=== /C=US/O=AffirmTrust/CN=AffirmTrust Premium ECC
399Certificate:
400 Data:
401 Version: 3 (0x2)
402 Serial Number: 8401224907861490260 (0x7497258ac73f7a54)
403 Signature Algorithm: ecdsa-with-SHA384
404 Validity
405 Not Before: Jan 29 14:20:24 2010 GMT
406 Not After : Dec 31 14:20:24 2040 GMT
407 Subject: C=US, O=AffirmTrust, CN=AffirmTrust Premium ECC
408 X509v3 extensions:
409 X509v3 Subject Key Identifier:
410 9A:AF:29:7A:C0:11:35:35:26:51:30:00:C3:6A:FE:40:D5:AE:D6:3C
411 X509v3 Basic Constraints: critical
412 CA:TRUE
413 X509v3 Key Usage: critical
414 Certificate Sign, CRL Sign
415SHA1 Fingerprint=B8:23:6B:00:2F:1D:16:86:53:01:55:6C:11:A4:37:CA:EB:FF:C3:BB
416SHA256 Fingerprint=BD:71:FD:F6:DA:97:E4:CF:62:D1:64:7A:DD:25:81:B0:7D:79:AD:F8:39:7E:B4:EC:BA:9C:5E:84:88:82:14:23
417-----BEGIN CERTIFICATE-----
418MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMC
419VVMxFDASBgNVBAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQ
420cmVtaXVtIEVDQzAeFw0xMDAxMjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJ
421BgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1UcnVzdDEgMB4GA1UEAwwXQWZmaXJt
422VHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQNMF4bFZ0D
4230KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQN8O9
424ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0G
425A1UdDgQWBBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4G
426A1UdDwEB/wQEAwIBBjAKBggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/Vs
427aobgxCd05DhT1wV/GzTjxi+zygk8N53X57hG8f2h4nECMEJZh0PUUd+60wkyWs6I
428flc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKMeQ==
429-----END CERTIFICATE-----
430
431### Agence Nationale de Certification Electronique 268### Agence Nationale de Certification Electronique
432 269
433=== /C=TN/O=Agence Nationale de Certification Electronique/CN=TunTrust Root CA 270=== /C=TN/O=Agence Nationale de Certification Electronique/CN=TunTrust Root CA
@@ -739,52 +576,6 @@ E2Efv4WstK2tBZQIgx51F9NxO5NQI1mg7TyRVJ12AMXDuDjb
739 576
740### Atos 577### Atos
741 578
742=== /CN=Atos TrustedRoot 2011/O=Atos/C=DE
743Certificate:
744 Data:
745 Version: 3 (0x2)
746 Serial Number: 6643877497813316402 (0x5c33cb622c5fb332)
747 Signature Algorithm: sha256WithRSAEncryption
748 Validity
749 Not Before: Jul 7 14:58:30 2011 GMT
750 Not After : Dec 31 23:59:59 2030 GMT
751 Subject: CN=Atos TrustedRoot 2011, O=Atos, C=DE
752 X509v3 extensions:
753 X509v3 Subject Key Identifier:
754 A7:A5:06:B1:2C:A6:09:60:EE:D1:97:E9:70:AE:BC:3B:19:6C:DB:21
755 X509v3 Basic Constraints: critical
756 CA:TRUE
757 X509v3 Authority Key Identifier:
758 keyid:A7:A5:06:B1:2C:A6:09:60:EE:D1:97:E9:70:AE:BC:3B:19:6C:DB:21
759
760 X509v3 Certificate Policies:
761 Policy: 1.3.6.1.4.1.6189.3.4.1.1
762
763 X509v3 Key Usage: critical
764 Digital Signature, Certificate Sign, CRL Sign
765SHA1 Fingerprint=2B:B1:F5:3E:55:0C:1D:C5:F1:D4:E6:B7:6A:46:4B:55:06:02:AC:21
766SHA256 Fingerprint=F3:56:BE:A2:44:B7:A9:1E:B3:5D:53:CA:9A:D7:86:4A:CE:01:8E:2D:35:D5:F8:F9:6D:DF:68:A6:F4:1A:A4:74
767-----BEGIN CERTIFICATE-----
768MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UE
769AwwVQXRvcyBUcnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQG
770EwJERTAeFw0xMTA3MDcxNDU4MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMM
771FUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsGA1UECgwEQXRvczELMAkGA1UEBhMC
772REUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCVhTuXbyo7LjvPpvMp
773Nb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr54rM
774VD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+
775SZFhyBH+DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ
7764J7sVaE3IqKHBAUsR320HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0L
777cp2AMBYHlT8oDv3FdU9T1nSatCQujgKRz3bFmx5VdJx4IbHwLfELn8LVlhgf8FQi
778eowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7Rl+lwrrw7GWzbITAPBgNV
779HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZbNshMBgG
780A1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3
781DQEBCwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8j
782vZfza1zv7v1Apt+hk6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kP
783DpFrdRbhIfzYJsdHt6bPWHJxfrrhTZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pc
784maHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a961qn8FYiqTxlVMYVqL2Gns2D
785lmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G3mB/ufNPRJLv
786KrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed
787-----END CERTIFICATE-----
788=== /CN=Atos TrustedRoot Root CA ECC TLS 2021/O=Atos/C=DE 579=== /CN=Atos TrustedRoot Root CA ECC TLS 2021/O=Atos/C=DE
789Certificate: 580Certificate:
790 Data: 581 Data:
@@ -1119,56 +910,6 @@ QRBdJ3NghVdJIgc=
1119 910
1120### COMODO CA Limited 911### COMODO CA Limited
1121 912
1122=== /C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO Certification Authority
1123Certificate:
1124 Data:
1125 Version: 3 (0x2)
1126 Serial Number:
1127 4e:81:2d:8a:82:65:e0:0b:02:ee:3e:35:02:46:e5:3d
1128 Signature Algorithm: sha1WithRSAEncryption
1129 Validity
1130 Not Before: Dec 1 00:00:00 2006 GMT
1131 Not After : Dec 31 23:59:59 2029 GMT
1132 Subject: C=GB, ST=Greater Manchester, L=Salford, O=COMODO CA Limited, CN=COMODO Certification Authority
1133 X509v3 extensions:
1134 X509v3 Subject Key Identifier:
1135 0B:58:E5:8B:C6:4C:15:37:A4:40:A9:30:A9:21:BE:47:36:5A:56:FF
1136 X509v3 Key Usage: critical
1137 Certificate Sign, CRL Sign
1138 X509v3 Basic Constraints: critical
1139 CA:TRUE
1140 X509v3 CRL Distribution Points:
1141
1142 Full Name:
1143 URI:http://crl.comodoca.com/COMODOCertificationAuthority.crl
1144
1145SHA1 Fingerprint=66:31:BF:9E:F7:4F:9E:B6:C9:D5:A6:0C:BA:6A:BE:D1:F7:BD:EF:7B
1146SHA256 Fingerprint=0C:2C:D6:3D:F7:80:6F:A3:99:ED:E8:09:11:6B:57:5B:F8:79:89:F0:65:18:F9:80:8C:86:05:03:17:8B:AF:66
1147-----BEGIN CERTIFICATE-----
1148MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCB
1149gTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G
1150A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNV
1151BAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjEyMDEwMDAw
1152MDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEbMBkGA1UECBMSR3Jl
1153YXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFDT01P
1154RE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0
1155aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3
1156UcEbVASY06m/weaKXTuH+7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI
11572GqGd0S7WWaXUF601CxwRM/aN5VCaTwwxHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8
1158Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV4EajcNxo2f8ESIl33rXp
1159+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA1KGzqSX+
1160DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5O
1161nKVIrLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW
1162/zAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6g
1163PKA6hjhodHRwOi8vY3JsLmNvbW9kb2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9u
1164QXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOCAQEAPpiem/Yb6dc5t3iuHXIY
1165SdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CPOGEIqB6BCsAv
1166IC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/
1167RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4
1168zJVSk/BwJVmcIGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5dd
1169BA6+C4OmF4O5MBKgxTMVBbkN+8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IB
1170ZQ==
1171-----END CERTIFICATE-----
1172=== /C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO ECC Certification Authority 913=== /C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO ECC Certification Authority
1173Certificate: 914Certificate:
1174 Data: 915 Data:
@@ -1457,104 +1198,9 @@ kkVbbiVghUbN0aqwdmaTd5a+g744tiROJgvM7XpWGuDpWsZkrUx6AEhEL7lAuxM+
1457vhV4nYWBSipX3tUZQ9rbyltHhoMLP7YNdnhzeSJesYAfz77RP1YQmCuVh6EfnWQU 1198vhV4nYWBSipX3tUZQ9rbyltHhoMLP7YNdnhzeSJesYAfz77RP1YQmCuVh6EfnWQU
1458YDksswBVLuT1sw5XxJFBAJw/6KXf6vb/yPCtbVKoF6ubYfwSUTXkJf2vqmqGOQ== 1199YDksswBVLuT1sw5XxJFBAJw/6KXf6vb/yPCtbVKoF6ubYfwSUTXkJf2vqmqGOQ==
1459-----END CERTIFICATE----- 1200-----END CERTIFICATE-----
1460=== /C=TW/O=Chunghwa Telecom Co., Ltd./OU=ePKI Root Certification Authority
1461Certificate:
1462 Data:
1463 Version: 3 (0x2)
1464 Serial Number:
1465 15:c8:bd:65:47:5c:af:b8:97:00:5e:e4:06:d2:bc:9d
1466 Signature Algorithm: sha1WithRSAEncryption
1467 Validity
1468 Not Before: Dec 20 02:31:27 2004 GMT
1469 Not After : Dec 20 02:31:27 2034 GMT
1470 Subject: C=TW, O=Chunghwa Telecom Co., Ltd., OU=ePKI Root Certification Authority
1471 X509v3 extensions:
1472 X509v3 Subject Key Identifier:
1473 1E:0C:F7:B6:67:F2:E1:92:26:09:45:C0:55:39:2E:77:3F:42:4A:A2
1474 X509v3 Basic Constraints:
1475 CA:TRUE
1476 setCext-hashedRoot:
1477 0/0-...0...+......0...g*.....E...
1478V|.[x....S.....
1479SHA1 Fingerprint=67:65:0D:F1:7E:8E:7E:5B:82:40:A4:F4:56:4B:CF:E2:3D:69:C6:F0
1480SHA256 Fingerprint=C0:A6:F4:DC:63:A2:4B:FD:CF:54:EF:2A:6A:08:2A:0A:72:DE:35:80:3E:2F:F5:FF:52:7A:E5:D8:72:06:DF:D5
1481-----BEGIN CERTIFICATE-----
1482MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBe
1483MQswCQYDVQQGEwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0
1484ZC4xKjAoBgNVBAsMIWVQS0kgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAe
1485Fw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMxMjdaMF4xCzAJBgNVBAYTAlRXMSMw
1486IQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEqMCgGA1UECwwhZVBL
1487SSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEF
1488AAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAH
1489SyZbCUNsIZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAh
1490ijHyl3SJCRImHJ7K2RKilTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3X
1491DZoTM1PRYfl61dd4s5oz9wCGzh1NlDivqOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1
1492TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX12ruOzjjK9SXDrkb5wdJ
1493fzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0OWQqraffA
1494sgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uU
1495WH1+ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLS
1496nT0IFaUQAS2zMnaolQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pH
1497dmX2Os+PYhcZewoozRrSgx4hxyy/vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJip
1498NiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXiZo1jDiVN1Rmy5nk3pyKdVDEC
1499AwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/QkqiMAwGA1UdEwQF
1500MAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH
1501ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGB
1502uvl2ICO1J2B01GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6Yl
1503PwZpVnPDimZI+ymBV3QGypzqKOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkP
1504JXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdVxrsStZf0X4OFunHB2WyBEXYKCrC/
1505gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEPNXubrjlpC2JgQCA2
1506j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+rGNm6
15075ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUB
1508o2M3IUxExJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS
1509/jQ6fbjpKdx2qcgw+BRxgMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2z
1510Gp1iro2C6pSe3VkQw63d4k3jMdXH7OjysP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTE
1511W9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmODBCEIZ43ygknQW/2xzQ+D
1512hNQ+IIX3Sj0rnP0qCglN6oH4EZw=
1513-----END CERTIFICATE-----
1514 1201
1515### Cybertrust Japan Co., Ltd. 1202### Cybertrust Japan Co., Ltd.
1516 1203
1517=== /C=JP/O=Cybertrust Japan Co., Ltd./CN=SecureSign Root CA12
1518Certificate:
1519 Data:
1520 Version: 3 (0x2)
1521 Serial Number:
1522 66:f9:c7:c1:af:ec:c2:51:b4:ed:53:97:e6:e6:82:c3:2b:1c:90:16
1523 Signature Algorithm: sha256WithRSAEncryption
1524 Validity
1525 Not Before: Apr 8 05:36:46 2020 GMT
1526 Not After : Apr 8 05:36:46 2040 GMT
1527 Subject: C=JP, O=Cybertrust Japan Co., Ltd., CN=SecureSign Root CA12
1528 X509v3 extensions:
1529 X509v3 Basic Constraints: critical
1530 CA:TRUE
1531 X509v3 Key Usage: critical
1532 Certificate Sign, CRL Sign
1533 X509v3 Subject Key Identifier:
1534 57:34:F3:74:CF:04:4B:D5:25:E6:F1:40:B6:2C:4C:D9:2D:E9:A0:AD
1535SHA1 Fingerprint=7A:22:1E:3D:DE:1B:06:AC:9E:C8:47:70:16:8E:3C:E5:F7:6B:06:F4
1536SHA256 Fingerprint=3F:03:4B:B5:70:4D:44:B2:D0:85:45:A0:20:57:DE:93:EB:F3:90:5F:CE:72:1A:CB:C7:30:C0:6D:DA:EE:90:4E
1537-----BEGIN CERTIFICATE-----
1538MIIDcjCCAlqgAwIBAgIUZvnHwa/swlG07VOX5uaCwysckBYwDQYJKoZIhvcNAQEL
1539BQAwUTELMAkGA1UEBhMCSlAxIzAhBgNVBAoTGkN5YmVydHJ1c3QgSmFwYW4gQ28u
1540LCBMdGQuMR0wGwYDVQQDExRTZWN1cmVTaWduIFJvb3QgQ0ExMjAeFw0yMDA0MDgw
1541NTM2NDZaFw00MDA0MDgwNTM2NDZaMFExCzAJBgNVBAYTAkpQMSMwIQYDVQQKExpD
1542eWJlcnRydXN0IEphcGFuIENvLiwgTHRkLjEdMBsGA1UEAxMUU2VjdXJlU2lnbiBS
1543b290IENBMTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6OcE3emhF
1544KxS06+QT61d1I02PJC0W6K6OyX2kVzsqdiUzg2zqMoqUm048luT9Ub+ZyZN+v/mt
1545p7JIKwccJ/VMvHASd6SFVLX9kHrko+RRWAPNEHl57muTH2SOa2SroxPjcf59q5zd
1546J1M3s6oYwlkm7Fsf0uZlfO+TvdhYXAvA42VvPMfKWeP+bl+sg779XSVOKik71gur
1547FzJ4pOE+lEa+Ym6b3kaosRbnhW70CEBFEaCeVESE99g2zvVQR9wsMJvuwPWW0v4J
1548hscGWa5Pro4RmHvzC1KqYiaqId+OJTN5lxZJjfU+1UefNzFJM3IFTQy2VYzxV4+K
1549h9GtxRESOaCtAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQD
1550AgEGMB0GA1UdDgQWBBRXNPN0zwRL1SXm8UC2LEzZLemgrTANBgkqhkiG9w0BAQsF
1551AAOCAQEAPrvbFxbS8hQBICw4g0utvsqFepq2m2um4fylOqyttCg6r9cBg0krY6Ld
1552mmQOmFxv3Y67ilQiLUoT865AQ9tPkbeGGuwAtEGBpE/6aouIs3YIcipJQMPTw4WJ
1553mBClnW8Zt7vPemVV2zfrPIpyMpcemik+rY3moxtt9XUa5rBouVui7mlHJzWhhpmA
15548zNL4WukJsPvdFlseqJkth5Ew1DgDzk9qTPxpfPSvWKErI4cqc1avTc7bgoitPQV
155555FYxTpE05Uo2cBl6XLK0A+9H7MV2anjpEcJnuDLN/v9vZfVvhgaaaI5gdka9at/
1556yOPiZwud9AzqVN/Ssq+xIvEg37xEHA==
1557-----END CERTIFICATE-----
1558=== /C=JP/O=Cybertrust Japan Co., Ltd./CN=SecureSign Root CA14 1204=== /C=JP/O=Cybertrust Japan Co., Ltd./CN=SecureSign Root CA14
1559Certificate: 1205Certificate:
1560 Data: 1206 Data:
@@ -2053,55 +1699,6 @@ dTdmQRCsu/WU48IxK63nI1bMNSWSs1A=
2053 1699
2054### Dhimyotis 1700### Dhimyotis
2055 1701
2056=== /C=FR/O=Dhimyotis/CN=Certigna
2057Certificate:
2058 Data:
2059 Version: 3 (0x2)
2060 Serial Number:
2061 fe:dc:e3:01:0f:c9:48:ff
2062 Signature Algorithm: sha1WithRSAEncryption
2063 Validity
2064 Not Before: Jun 29 15:13:05 2007 GMT
2065 Not After : Jun 29 15:13:05 2027 GMT
2066 Subject: C=FR, O=Dhimyotis, CN=Certigna
2067 X509v3 extensions:
2068 X509v3 Basic Constraints: critical
2069 CA:TRUE
2070 X509v3 Subject Key Identifier:
2071 1A:ED:FE:41:39:90:B4:24:59:BE:01:F2:52:D5:45:F6:5A:39:DC:11
2072 X509v3 Authority Key Identifier:
2073 keyid:1A:ED:FE:41:39:90:B4:24:59:BE:01:F2:52:D5:45:F6:5A:39:DC:11
2074 DirName:/C=FR/O=Dhimyotis/CN=Certigna
2075 serial:FE:DC:E3:01:0F:C9:48:FF
2076
2077 X509v3 Key Usage: critical
2078 Certificate Sign, CRL Sign
2079 Netscape Cert Type:
2080 SSL CA, S/MIME CA, Object Signing CA
2081SHA1 Fingerprint=B1:2E:13:63:45:86:A4:6F:1A:B2:60:68:37:58:2D:C4:AC:FD:94:97
2082SHA256 Fingerprint=E3:B6:A2:DB:2E:D7:CE:48:84:2F:7A:C5:32:41:C7:B7:1D:54:14:4B:FB:40:C1:1F:3F:1D:0B:42:F5:EE:A1:2D
2083-----BEGIN CERTIFICATE-----
2084MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNV
2085BAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4X
2086DTA3MDYyOTE1MTMwNVoXDTI3MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQ
2087BgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwIQ2VydGlnbmEwggEiMA0GCSqGSIb3
2088DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7qXOEm7RFHYeGifBZ4
2089QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyHGxny
2090gQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbw
2091zBfsV1/pogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q
2092130yGLMLLGq/jj8UEYkgDncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2
2093JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKfIrjxwo1p3Po6WAbfAgMBAAGjgbwwgbkw
2094DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQtCRZvgHyUtVF9lo53BEw
2095ZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJBgNVBAYT
2096AkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzj
2097AQ/JSP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG
20989w0BAQUFAAOCAQEAhQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8h
2099bV6lUmPOEvjvKtpv6zf+EwLHyzs+ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFnc
2100fca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1kluPBS1xp81HlDQwY9qcEQCYsuu
2101HWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY1gkIl2PlwS6w
2102t0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw
2103WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg==
2104-----END CERTIFICATE-----
2105=== /C=FR/O=Dhimyotis/OU=0002 48146308100036/CN=Certigna Root CA 1702=== /C=FR/O=Dhimyotis/OU=0002 48146308100036/CN=Certigna Root CA
2106Certificate: 1703Certificate:
2107 Data: 1704 Data:
@@ -2176,51 +1773,6 @@ jWZSaX5LaAzHHjcng6WMxwLkFM1JAbBzs/3GkDpv0mztO+7skb6iQ12LAEpmJURw
2176 1773
2177### DigiCert Inc 1774### DigiCert Inc
2178 1775
2179=== /C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert Assured ID Root CA
2180Certificate:
2181 Data:
2182 Version: 3 (0x2)
2183 Serial Number:
2184 0c:e7:e0:e5:17:d8:46:fe:8f:e5:60:fc:1b:f0:30:39
2185 Signature Algorithm: sha1WithRSAEncryption
2186 Validity
2187 Not Before: Nov 10 00:00:00 2006 GMT
2188 Not After : Nov 10 00:00:00 2031 GMT
2189 Subject: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert Assured ID Root CA
2190 X509v3 extensions:
2191 X509v3 Key Usage: critical
2192 Digital Signature, Certificate Sign, CRL Sign
2193 X509v3 Basic Constraints: critical
2194 CA:TRUE
2195 X509v3 Subject Key Identifier:
2196 45:EB:A2:AF:F4:92:CB:82:31:2D:51:8B:A7:A7:21:9D:F3:6D:C8:0F
2197 X509v3 Authority Key Identifier:
2198 keyid:45:EB:A2:AF:F4:92:CB:82:31:2D:51:8B:A7:A7:21:9D:F3:6D:C8:0F
2199
2200SHA1 Fingerprint=05:63:B8:63:0D:62:D7:5A:BB:C8:AB:1E:4B:DF:B5:A8:99:B2:4D:43
2201SHA256 Fingerprint=3E:90:99:B5:01:5E:8F:48:6C:00:BC:EA:9D:11:1E:E7:21:FA:BA:35:5A:89:BC:F1:DF:69:56:1E:3D:C6:32:5C
2202-----BEGIN CERTIFICATE-----
2203MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBl
2204MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
2205d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJv
2206b3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzExMTEwMDAwMDAwWjBlMQswCQYDVQQG
2207EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNl
2208cnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwggEi
2209MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7c
2210JpSIqvTO9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYP
2211mDI2dsze3Tyoou9q+yHyUmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+
2212wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW/lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4
2213VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpyoeb6pNnVFzF1roV9Iq4/
2214AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whfGHdPAgMB
2215AAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW
2216BBRF66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYun
2217pyGd823IDzANBgkqhkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRC
2218dWKuh+vy1dneVrOfzM4UKLkNl2BcEkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTf
2219fwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38FnSbNd67IJKusm7Xi+fT8r87cm
2220NW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i8b5QZ7dsvfPx
2221H2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe
2222+o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g==
2223-----END CERTIFICATE-----
2224=== /C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert Assured ID Root G2 1776=== /C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert Assured ID Root G2
2225Certificate: 1777Certificate:
2226 Data: 1778 Data:
@@ -2298,51 +1850,6 @@ AwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5FyYZ5eEJJZVrmDxxDnOOlY
2298JjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy1vUhZscv 1850JjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy1vUhZscv
22996pZjamVFkpUBtA== 18516pZjamVFkpUBtA==
2300-----END CERTIFICATE----- 1852-----END CERTIFICATE-----
2301=== /C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert Global Root CA
2302Certificate:
2303 Data:
2304 Version: 3 (0x2)
2305 Serial Number:
2306 08:3b:e0:56:90:42:46:b1:a1:75:6a:c9:59:91:c7:4a
2307 Signature Algorithm: sha1WithRSAEncryption
2308 Validity
2309 Not Before: Nov 10 00:00:00 2006 GMT
2310 Not After : Nov 10 00:00:00 2031 GMT
2311 Subject: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert Global Root CA
2312 X509v3 extensions:
2313 X509v3 Key Usage: critical
2314 Digital Signature, Certificate Sign, CRL Sign
2315 X509v3 Basic Constraints: critical
2316 CA:TRUE
2317 X509v3 Subject Key Identifier:
2318 03:DE:50:35:56:D1:4C:BB:66:F0:A3:E2:1B:1B:C3:97:B2:3D:D1:55
2319 X509v3 Authority Key Identifier:
2320 keyid:03:DE:50:35:56:D1:4C:BB:66:F0:A3:E2:1B:1B:C3:97:B2:3D:D1:55
2321
2322SHA1 Fingerprint=A8:98:5D:3A:65:E5:E5:C4:B2:D7:D6:6D:40:C6:DD:2F:B1:9C:54:36
2323SHA256 Fingerprint=43:48:A0:E9:44:4C:78:CB:26:5E:05:8D:5E:89:44:B4:D8:4F:96:62:BD:26:DB:25:7F:89:34:A4:43:C7:01:61
2324-----BEGIN CERTIFICATE-----
2325MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh
2326MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
2327d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD
2328QTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAwMDAwMDBaMGExCzAJBgNVBAYTAlVT
2329MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j
2330b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkqhkiG
23319w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsB
2332CSDMAZOnTjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97
2333nh6Vfe63SKMI2tavegw5BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt
233443C/dxC//AH2hdmoRBBYMql1GNXRor5H4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7P
2335T19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y7vrTC0LUq7dBMtoM1O/4
2336gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQABo2MwYTAO
2337BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbR
2338TLtm8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUw
2339DQYJKoZIhvcNAQEFBQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/Esr
2340hMAtudXH/vTBH1jLuG2cenTnmCmrEbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg
234106O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBAI+0tKIJF
2342PnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls
2343YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
2344CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
2345-----END CERTIFICATE-----
2346=== /C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert Global Root G2 1853=== /C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert Global Root G2
2347Certificate: 1854Certificate:
2348 Data: 1855 Data:
@@ -2420,52 +1927,6 @@ AK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y3maTD/HMsQmP3Wyr+mt/
2420oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34VOKa5Vt8 1927oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34VOKa5Vt8
2421sycX 1928sycX
2422-----END CERTIFICATE----- 1929-----END CERTIFICATE-----
2423=== /C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance EV Root CA
2424Certificate:
2425 Data:
2426 Version: 3 (0x2)
2427 Serial Number:
2428 02:ac:5c:26:6a:0b:40:9b:8f:0b:79:f2:ae:46:25:77
2429 Signature Algorithm: sha1WithRSAEncryption
2430 Validity
2431 Not Before: Nov 10 00:00:00 2006 GMT
2432 Not After : Nov 10 00:00:00 2031 GMT
2433 Subject: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert High Assurance EV Root CA
2434 X509v3 extensions:
2435 X509v3 Key Usage: critical
2436 Digital Signature, Certificate Sign, CRL Sign
2437 X509v3 Basic Constraints: critical
2438 CA:TRUE
2439 X509v3 Subject Key Identifier:
2440 B1:3E:C3:69:03:F8:BF:47:01:D4:98:26:1A:08:02:EF:63:64:2B:C3
2441 X509v3 Authority Key Identifier:
2442 keyid:B1:3E:C3:69:03:F8:BF:47:01:D4:98:26:1A:08:02:EF:63:64:2B:C3
2443
2444SHA1 Fingerprint=5F:B7:EE:06:33:E2:59:DB:AD:0C:4C:9A:E6:D3:8F:1A:61:C7:DC:25
2445SHA256 Fingerprint=74:31:E5:F4:C3:C1:CE:46:90:77:4F:0B:61:E0:54:40:88:3B:A9:A0:1E:D0:0B:A6:AB:D7:80:6E:D3:B1:18:CF
2446-----BEGIN CERTIFICATE-----
2447MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs
2448MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
2449d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j
2450ZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAwMFoXDTMxMTExMDAwMDAwMFowbDEL
2451MAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3
2452LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFuY2Ug
2453RVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm
2454+9S75S0tMqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTW
2455PNt0OKRKzE0lgvdKpVMSOO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEM
2456xChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFB
2457Ik5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQNAQTXKFx01p8VdteZOE3
2458hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUeh10aUAsg
2459EsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQF
2460MAMBAf8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaA
2461FLE+w2kD+L9HAdSYJhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3Nec
2462nzyIZgYIVyHbIUf4KmeqvxgydkAQV8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6z
2463eM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFpmyPInngiK3BD41VHMWEZ71jF
2464hS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkKmNEVX58Svnw2
2465Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
2466vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep
2467+OkuE6N36B9K
2468-----END CERTIFICATE-----
2469=== /C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert Trusted Root G4 1930=== /C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert Trusted Root G4
2470Certificate: 1931Certificate:
2471 Data: 1932 Data:
@@ -2661,144 +2122,6 @@ zMOl6W8KjptlwlCFtaOgUxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8x
2661L4ysEr3vQCj8KWefshNPZiTEUxnpHikV7+ZtsH8tZ/3zbBt1RqPlShfppNcL 2122L4ysEr3vQCj8KWefshNPZiTEUxnpHikV7+ZtsH8tZ/3zbBt1RqPlShfppNcL
2662-----END CERTIFICATE----- 2123-----END CERTIFICATE-----
2663 2124
2664### Entrust, Inc.
2665
2666=== /C=US/O=Entrust, Inc./OU=See www.entrust.net/legal-terms/OU=(c) 2009 Entrust, Inc. - for authorized use only/CN=Entrust Root Certification Authority - G2
2667Certificate:
2668 Data:
2669 Version: 3 (0x2)
2670 Serial Number: 1246989352 (0x4a538c28)
2671 Signature Algorithm: sha256WithRSAEncryption
2672 Validity
2673 Not Before: Jul 7 17:25:54 2009 GMT
2674 Not After : Dec 7 17:55:54 2030 GMT
2675 Subject: C=US, O=Entrust, Inc., OU=See www.entrust.net/legal-terms, OU=(c) 2009 Entrust, Inc. - for authorized use only, CN=Entrust Root Certification Authority - G2
2676 X509v3 extensions:
2677 X509v3 Key Usage: critical
2678 Certificate Sign, CRL Sign
2679 X509v3 Basic Constraints: critical
2680 CA:TRUE
2681 X509v3 Subject Key Identifier:
2682 6A:72:26:7A:D0:1E:EF:7D:E7:3B:69:51:D4:6C:8D:9F:90:12:66:AB
2683SHA1 Fingerprint=8C:F4:27:FD:79:0C:3A:D1:66:06:8D:E8:1E:57:EF:BB:93:22:72:D4
2684SHA256 Fingerprint=43:DF:57:74:B0:3E:7F:EF:5F:E4:0D:93:1A:7B:ED:F1:BB:2E:6B:42:73:8C:4E:6D:38:41:10:3D:3A:A7:F3:39
2685-----BEGIN CERTIFICATE-----
2686MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMC
2687VVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50
2688cnVzdC5uZXQvbGVnYWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3Qs
2689IEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25seTEyMDAGA1UEAxMpRW50cnVz
2690dCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwHhcNMDkwNzA3MTcy
2691NTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUVu
2692dHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwt
2693dGVybXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0
2694aG9yaXplZCB1c2Ugb25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmlj
2695YXRpb24gQXV0aG9yaXR5IC0gRzIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
2696AoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP/vaCeb9zYQYKpSfYs1/T
2697RU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXzHHfV1IWN
2698cCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hW
2699wcKUs/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1
2700U1+cPvQXLOZprE4yTGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0
2701jaWvYkxN4FisZDQSA/i2jZRjJKRxAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAP
2702BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ60B7vfec7aVHUbI2fkBJmqzAN
2703BgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5ZiXMRrEPR9RP/
2704jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ
2705Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v
27061fN2D807iDginWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4R
2707nAuknZoh8/CbCzB428Hch0P+vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmH
2708VHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xOe4pIb4tF9g==
2709-----END CERTIFICATE-----
2710=== /C=US/O=Entrust, Inc./OU=See www.entrust.net/legal-terms/OU=(c) 2012 Entrust, Inc. - for authorized use only/CN=Entrust Root Certification Authority - EC1
2711Certificate:
2712 Data:
2713 Version: 3 (0x2)
2714 Serial Number:
2715 a6:8b:79:29:00:00:00:00:50:d0:91:f9
2716 Signature Algorithm: ecdsa-with-SHA384
2717 Validity
2718 Not Before: Dec 18 15:25:36 2012 GMT
2719 Not After : Dec 18 15:55:36 2037 GMT
2720 Subject: C=US, O=Entrust, Inc., OU=See www.entrust.net/legal-terms, OU=(c) 2012 Entrust, Inc. - for authorized use only, CN=Entrust Root Certification Authority - EC1
2721 X509v3 extensions:
2722 X509v3 Key Usage: critical
2723 Certificate Sign, CRL Sign
2724 X509v3 Basic Constraints: critical
2725 CA:TRUE
2726 X509v3 Subject Key Identifier:
2727 B7:63:E7:1A:DD:8D:E9:08:A6:55:83:A4:E0:6A:50:41:65:11:42:49
2728SHA1 Fingerprint=20:D8:06:40:DF:9B:25:F5:12:25:3A:11:EA:F7:59:8A:EB:14:B5:47
2729SHA256 Fingerprint=02:ED:0E:B2:8C:14:DA:45:16:5C:56:67:91:70:0D:64:51:D7:FB:56:F0:B2:AB:1D:3B:8E:B0:70:E5:6E:DF:F5
2730-----BEGIN CERTIFICATE-----
2731MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkG
2732A1UEBhMCVVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3
2733d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVu
2734dHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25seTEzMDEGA1UEAxMq
2735RW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRUMxMB4XDTEy
2736MTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYwFAYD
2737VQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0
2738L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0g
2739Zm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBD
2740ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEVDMTB2MBAGByqGSM49AgEGBSuBBAAi
2741A2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHyAsWfoPZb1YsGGYZPUxBt
2742ByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef9eNi1KlH
2743Bz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0O
2744BBYEFLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVC
2745R98crlOZF7ZvHH3hvxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nX
2746hTcGtXsI/esni0qU+eH6p44mCOh8kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G
2747-----END CERTIFICATE-----
2748=== /C=US/O=Entrust, Inc./OU=www.entrust.net/CPS is incorporated by reference/OU=(c) 2006 Entrust, Inc./CN=Entrust Root Certification Authority
2749Certificate:
2750 Data:
2751 Version: 3 (0x2)
2752 Serial Number: 1164660820 (0x456b5054)
2753 Signature Algorithm: sha1WithRSAEncryption
2754 Validity
2755 Not Before: Nov 27 20:23:42 2006 GMT
2756 Not After : Nov 27 20:53:42 2026 GMT
2757 Subject: C=US, O=Entrust, Inc., OU=www.entrust.net/CPS is incorporated by reference, OU=(c) 2006 Entrust, Inc., CN=Entrust Root Certification Authority
2758 X509v3 extensions:
2759 X509v3 Key Usage: critical
2760 Certificate Sign, CRL Sign
2761 X509v3 Basic Constraints: critical
2762 CA:TRUE
2763 X509v3 Private Key Usage Period:
2764 Not Before: Nov 27 20:23:42 2006 GMT, Not After: Nov 27 20:53:42 2026 GMT
2765 X509v3 Authority Key Identifier:
2766 keyid:68:90:E4:67:A4:A6:53:80:C7:86:66:A4:F1:F7:4B:43:FB:84:BD:6D
2767
2768 X509v3 Subject Key Identifier:
2769 68:90:E4:67:A4:A6:53:80:C7:86:66:A4:F1:F7:4B:43:FB:84:BD:6D
2770 1.2.840.113533.7.65.0:
2771 0...V7.1:4.0....
2772SHA1 Fingerprint=B3:1E:B1:B7:40:E3:6C:84:02:DA:DC:37:D4:4D:F5:D4:67:49:52:F9
2773SHA256 Fingerprint=73:C1:76:43:4F:1B:C6:D5:AD:F4:5B:0E:76:E7:27:28:7C:8D:E5:76:16:C1:E6:E6:14:1A:2B:2C:BC:7D:8E:4C
2774-----BEGIN CERTIFICATE-----
2775MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMC
2776VVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0
2777Lm5ldC9DUFMgaXMgaW5jb3Jwb3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMW
2778KGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsGA1UEAxMkRW50cnVzdCBSb290IENl
2779cnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0MloXDTI2MTEyNzIw
2780NTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMTkw
2781NwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSBy
2782ZWZlcmVuY2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNV
2783BAMTJEVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJ
2784KoZIhvcNAQEBBQADggEPADCCAQoCggEBALaVtkNC+sZtKm9I35RMOVcF7sN5EUFo
2785Nu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYszA9u3g3s+IIRe7bJWKKf4
27864LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOwwCj0Yzfv9
2787KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGI
2788rb68j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi
278994DkZfs0Nw4pgHBNrziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOB
2790sDCBrTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAi
2791gA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1MzQyWjAfBgNVHSMEGDAWgBRo
2792kORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DHhmak8fdLQ/uE
2793vW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA
2794A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9t
2795O1KzKtvn1ISMY/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6Zua
2796AGAT/3B+XxFNSRuzFVJ7yVTav52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP
27979WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTSW3iDVuycNsMm4hH2Z0kdkquM++v/
2798eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0tHuu2guQOHXvgR1m
27990vdXcDazv/wor3ElhVsT/h5/WrQ8
2800-----END CERTIFICATE-----
2801
2802### FNMT-RCM 2125### FNMT-RCM
2803 2126
2804=== /C=ES/O=FNMT-RCM/OU=AC RAIZ FNMT-RCM 2127=== /C=ES/O=FNMT-RCM/OU=AC RAIZ FNMT-RCM
@@ -2894,48 +2217,6 @@ MQD6SmxgiHPz7riYYqnOK8LZiqZwMR2vsJRM60/G49HzYqc8/5MuB1xJAWdpEgJy
2894v+c= 2217v+c=
2895-----END CERTIFICATE----- 2218-----END CERTIFICATE-----
2896 2219
2897### Firmaprofesional SA
2898
2899=== /C=ES/O=Firmaprofesional SA/2.5.4.97=VATES-A62634068/CN=FIRMAPROFESIONAL CA ROOT-A WEB
2900Certificate:
2901 Data:
2902 Version: 3 (0x2)
2903 Serial Number:
2904 31:97:21:ed:af:89:42:7f:35:41:87:a1:67:56:4c:6d
2905 Signature Algorithm: ecdsa-with-SHA384
2906 Validity
2907 Not Before: Apr 6 09:01:36 2022 GMT
2908 Not After : Mar 31 09:01:36 2047 GMT
2909 Subject: C=ES, O=Firmaprofesional SA, 2.5.4.97=VATES-A62634068, CN=FIRMAPROFESIONAL CA ROOT-A WEB
2910 X509v3 extensions:
2911 X509v3 Basic Constraints: critical
2912 CA:TRUE
2913 X509v3 Authority Key Identifier:
2914 keyid:93:E1:43:63:5C:3C:9D:D6:27:F3:52:EC:17:B2:A9:AF:2C:F7:76:F8
2915
2916 X509v3 Subject Key Identifier:
2917 93:E1:43:63:5C:3C:9D:D6:27:F3:52:EC:17:B2:A9:AF:2C:F7:76:F8
2918 X509v3 Key Usage: critical
2919 Certificate Sign, CRL Sign
2920SHA1 Fingerprint=A8:31:11:74:A6:14:15:0D:CA:77:DD:0E:E4:0C:5D:58:FC:A0:72:A5
2921SHA256 Fingerprint=BE:F2:56:DA:F2:6E:9C:69:BD:EC:16:02:35:97:98:F3:CA:F7:18:21:A0:3E:01:82:57:C5:3C:65:61:7F:3D:4A
2922-----BEGIN CERTIFICATE-----
2923MIICejCCAgCgAwIBAgIQMZch7a+JQn81QYehZ1ZMbTAKBggqhkjOPQQDAzBuMQsw
2924CQYDVQQGEwJFUzEcMBoGA1UECgwTRmlybWFwcm9mZXNpb25hbCBTQTEYMBYGA1UE
2925YQwPVkFURVMtQTYyNjM0MDY4MScwJQYDVQQDDB5GSVJNQVBST0ZFU0lPTkFMIENB
2926IFJPT1QtQSBXRUIwHhcNMjIwNDA2MDkwMTM2WhcNNDcwMzMxMDkwMTM2WjBuMQsw
2927CQYDVQQGEwJFUzEcMBoGA1UECgwTRmlybWFwcm9mZXNpb25hbCBTQTEYMBYGA1UE
2928YQwPVkFURVMtQTYyNjM0MDY4MScwJQYDVQQDDB5GSVJNQVBST0ZFU0lPTkFMIENB
2929IFJPT1QtQSBXRUIwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAARHU+osEaR3xyrq89Zf
2930e9MEkVz6iMYiuYMQYneEMy3pA4jU4DP37XcsSmDq5G+tbbT4TIqk5B/K6k84Si6C
2931cyvHZpsKjECcfIr28jlgst7L7Ljkb+qbXbdTkBgyVcUgt5SjYzBhMA8GA1UdEwEB
2932/wQFMAMBAf8wHwYDVR0jBBgwFoAUk+FDY1w8ndYn81LsF7Kpryz3dvgwHQYDVR0O
2933BBYEFJPhQ2NcPJ3WJ/NS7Beyqa8s93b4MA4GA1UdDwEB/wQEAwIBBjAKBggqhkjO
2934PQQDAwNoADBlAjAdfKR7w4l1M+E7qUW/Runpod3JIha3RxEL2Jq68cgLcFBTApFw
2935hVmpHqTm6iMxoAACMQD94vizrxa5HnPEluPBMBnYfubDl94cT7iJLzPrSA8Z94dG
2936XSaQpYXFuXqUPoeovQA=
2937-----END CERTIFICATE-----
2938
2939### GUANG DONG CERTIFICATE AUTHORITY CO.,LTD. 2220### GUANG DONG CERTIFICATE AUTHORITY CO.,LTD.
2940 2221
2941=== /C=CN/O=GUANG DONG CERTIFICATE AUTHORITY CO.,LTD./CN=GDCA TrustAUTH R5 ROOT 2222=== /C=CN/O=GUANG DONG CERTIFICATE AUTHORITY CO.,LTD./CN=GDCA TrustAUTH R5 ROOT
@@ -3340,57 +2621,6 @@ Z6tGn6D/Qqc6f1zLXbBwHSs09dR2CQzreExZBfMzQsNhFRAbd03OIozUhfJFfbdT
33402tIMPNuzjsmhDYAPexZ3FL//2wmUspO8IFgV6dtxQ/PeEMMA3KgqlbbC1j+Qa3bb 26212tIMPNuzjsmhDYAPexZ3FL//2wmUspO8IFgV6dtxQ/PeEMMA3KgqlbbC1j+Qa3bb
3341bP6MvPJwNQzcmRk13NfIRmPVNnGuV/u3gm3c 2622bP6MvPJwNQzcmRk13NfIRmPVNnGuV/u3gm3c
3342-----END CERTIFICATE----- 2623-----END CERTIFICATE-----
3343=== /C=US/O=Google Trust Services LLC/CN=GTS Root R2
3344Certificate:
3345 Data:
3346 Version: 3 (0x2)
3347 Serial Number:
3348 02:03:e5:ae:c5:8d:04:25:1a:ab:11:25:aa
3349 Signature Algorithm: sha384WithRSAEncryption
3350 Validity
3351 Not Before: Jun 22 00:00:00 2016 GMT
3352 Not After : Jun 22 00:00:00 2036 GMT
3353 Subject: C=US, O=Google Trust Services LLC, CN=GTS Root R2
3354 X509v3 extensions:
3355 X509v3 Key Usage: critical
3356 Digital Signature, Certificate Sign, CRL Sign
3357 X509v3 Basic Constraints: critical
3358 CA:TRUE
3359 X509v3 Subject Key Identifier:
3360 BB:FF:CA:8E:23:9F:4F:99:CA:DB:E2:68:A6:A5:15:27:17:1E:D9:0E
3361SHA1 Fingerprint=9A:44:49:76:32:DB:DE:FA:D0:BC:FB:5A:7B:17:BD:9E:56:09:24:94
3362SHA256 Fingerprint=8D:25:CD:97:22:9D:BF:70:35:6B:DA:4E:B3:CC:73:40:31:E2:4C:F0:0F:AF:CF:D3:2D:C7:6E:B5:84:1C:7E:A8
3363-----BEGIN CERTIFICATE-----
3364MIIFVzCCAz+gAwIBAgINAgPlrsWNBCUaqxElqjANBgkqhkiG9w0BAQwFADBHMQsw
3365CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEU
3366MBIGA1UEAxMLR1RTIFJvb3QgUjIwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAw
3367MDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZp
3368Y2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUA
3369A4ICDwAwggIKAoICAQDO3v2m++zsFDQ8BwZabFn3GTXd98GdVarTzTukk3LvCvpt
3370nfbwhYBboUhSnznFt+4orO/LdmgUud+tAWyZH8QiHZ/+cnfgLFuv5AS/T3KgGjSY
33716Dlo7JUle3ah5mm5hRm9iYz+re026nO8/4Piy33B0s5Ks40FnotJk9/BW9BuXvAu
3372MC6C/Pq8tBcKSOWIm8Wba96wyrQD8Nr0kLhlZPdcTK3ofmZemde4wj7I0BOdre7k
3373RXuJVfeKH2JShBKzwkCX44ofR5GmdFrS+LFjKBC4swm4VndAoiaYecb+3yXuPuWg
3374f9RhD1FLPD+M2uFwdNjCaKH5wQzpoeJ/u1U8dgbuak7MkogwTZq9TwtImoS1mKPV
3375+3PBV2HdKFZ1E66HjucMUQkQdYhMvI35ezzUIkgfKtzra7tEscszcTJGr61K8Yzo
3376dDqs5xoic4DSMPclQsciOzsSrZYuxsN2B6ogtzVJV+mSSeh2FnIxZyuWfoqjx5RW
3377Ir9qS34BIbIjMt/kmkRtWVtd9QCgHJvGeJeNkP+byKq0rxFROV7Z+2et1VsRnTKa
3378G73VululycslaVNVJ1zgyjbLiGH7HrfQy+4W+9OmTN6SpdTi3/UGVN4unUu0kzCq
3379gc7dGtxRcw1PcOnlthYhGXmy5okLdWTK1au8CcEYof/UVKGFPP0UJAOyh9OktwID
3380AQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E
3381FgQUu//KjiOfT5nK2+JopqUVJxce2Q4wDQYJKoZIhvcNAQEMBQADggIBAB/Kzt3H
3382vqGf2SdMC9wXmBFqiN495nFWcrKeGk6c1SuYJF2ba3uwM4IJvd8lRuqYnrYb/oM8
33830mJhwQTtzuDFycgTE1XnqGOtjHsB/ncw4c5omwX4Eu55MaBBRTUoCnGkJE+M3DyC
3384B19m3H0Q/gxhswWV7uGugQ+o+MePTagjAiZrHYNSVc61LwDKgEDg4XSsYPWHgJ2u
3385NmSRXbBoGOqKYcl3qJfEycel/FVL8/B/uWU9J2jQzGv6U53hkRrJXRqWbTKH7QMg
3386yALOWr7Z6v2yTcQvG99fevX4i8buMTolUVVnjWQye+mew4K6Ki3pHrTgSAai/Gev
3387HyICc/sgCq+dVEuhzf9gR7A/Xe8bVr2XIZYtCtFenTgCR2y59PYjJbigapordwj6
3388xLEokCZYCDzifqrXPW+6MYgKBesntaFJ7qBFVHvmJ2WZICGoo7z7GJa7Um8M7YNR
3389TOlZ4iBgxcJlkoKM8xAfDoqXvneCbT+PHV28SSe9zE8P4c52hgQjxcCMElv924Sg
3390JPFI/2R80L5cFtHvma3AH/vLrrw4IgYmZNralw4/KBVEqE8AyvCazM90arQ+POuV
33917LXTWtiBmelDGDfrs7vRWGJB82bSj6p4lVQgw1oudCvV0b4YacCs1aTPObpRhANl
33926WLAYv7YTVWW4tAR+kg0Eeye7QUd5MjWHYbL
3393-----END CERTIFICATE-----
3394=== /C=US/O=Google Trust Services LLC/CN=GTS Root R3 2624=== /C=US/O=Google Trust Services LLC/CN=GTS Root R3
3395Certificate: 2625Certificate:
3396 Data: 2626 Data:
@@ -4474,63 +3704,6 @@ ZgKAvQU6O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhp
4474q1467HxpvMc7hU6eFbm0FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFt 3704q1467HxpvMc7hU6eFbm0FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFt
4475nh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOVhMJKzRwuJIczYOXD 3705nh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOVhMJKzRwuJIczYOXD
4476-----END CERTIFICATE----- 3706-----END CERTIFICATE-----
4477=== /C=BM/O=QuoVadis Limited/CN=QuoVadis Root CA 2
4478Certificate:
4479 Data:
4480 Version: 3 (0x2)
4481 Serial Number: 1289 (0x509)
4482 Signature Algorithm: sha1WithRSAEncryption
4483 Validity
4484 Not Before: Nov 24 18:27:00 2006 GMT
4485 Not After : Nov 24 18:23:33 2031 GMT
4486 Subject: C=BM, O=QuoVadis Limited, CN=QuoVadis Root CA 2
4487 X509v3 extensions:
4488 X509v3 Basic Constraints: critical
4489 CA:TRUE
4490 X509v3 Key Usage:
4491 Certificate Sign, CRL Sign
4492 X509v3 Subject Key Identifier:
4493 1A:84:62:BC:48:4C:33:25:04:D4:EE:D0:F6:03:C4:19:46:D1:94:6B
4494 X509v3 Authority Key Identifier:
4495 keyid:1A:84:62:BC:48:4C:33:25:04:D4:EE:D0:F6:03:C4:19:46:D1:94:6B
4496 DirName:/C=BM/O=QuoVadis Limited/CN=QuoVadis Root CA 2
4497 serial:05:09
4498
4499SHA1 Fingerprint=CA:3A:FB:CF:12:40:36:4B:44:B2:16:20:88:80:48:39:19:93:7C:F7
4500SHA256 Fingerprint=85:A0:DD:7D:D7:20:AD:B7:FF:05:F8:3D:54:2B:20:9D:C7:FF:45:28:F7:D6:77:B1:83:89:FE:A5:E5:C4:9E:86
4501-----BEGIN CERTIFICATE-----
4502MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0x
4503GTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJv
4504b3QgQ0EgMjAeFw0wNjExMjQxODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNV
4505BAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMRswGQYDVQQDExJRdW9W
4506YWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCa
4507GMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6XJxg
4508Fyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55J
4509WpzmM+Yklvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bB
4510rrcCaoF6qUWD4gXmuVbBlDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp
4511+ARz8un+XJiM9XOva7R+zdRcAitMOeGylZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1
4512ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt66/3FsvbzSUr5R/7mp/i
4513Ucw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1JdxnwQ5hYIiz
4514PtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og
4515/zOhD7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UH
4516oycR7hYQe7xFSkyyBNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuI
4517yV77zGHcizN300QyNQliBJIWENieJ0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1Ud
4518EwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBQahGK8SEwzJQTU7tD2
4519A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGUa6FJpEcwRTEL
4520MAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT
4521ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2f
4522BluornFdLwUvZ+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzn
4523g/iN/Ae42l9NLmeyhP3ZRPx3UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2Bl
4524fF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodmVjB3pjd4M1IQWK4/YY7yarHvGH5K
4525WWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK+JDSV6IZUaUtl0Ha
4526B0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrWIozc
4527hLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPR
4528TUIZ3Ph1WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWD
4529mbA4CD/pXvk1B+TJYm5Xf6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0Z
4530ohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y
45314aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8VCLAAVBpQ570su9t+Oza
45328eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u
4533-----END CERTIFICATE-----
4534=== /C=BM/O=QuoVadis Limited/CN=QuoVadis Root CA 2 G3 3707=== /C=BM/O=QuoVadis Limited/CN=QuoVadis Root CA 2 G3
4535Certificate: 3708Certificate:
4536 Data: 3709 Data:
@@ -4582,74 +3755,6 @@ KCLjsZWDzYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeM
4582HVOyToV7BjjHLPj4sHKNJeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4 3755HVOyToV7BjjHLPj4sHKNJeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4
4583WSr2Rz0ZiC3oheGe7IUIarFsNMkd7EgrO3jtZsSOeWmD3n+M 3756WSr2Rz0ZiC3oheGe7IUIarFsNMkd7EgrO3jtZsSOeWmD3n+M
4584-----END CERTIFICATE----- 3757-----END CERTIFICATE-----
4585=== /C=BM/O=QuoVadis Limited/CN=QuoVadis Root CA 3
4586Certificate:
4587 Data:
4588 Version: 3 (0x2)
4589 Serial Number: 1478 (0x5c6)
4590 Signature Algorithm: sha1WithRSAEncryption
4591 Validity
4592 Not Before: Nov 24 19:11:23 2006 GMT
4593 Not After : Nov 24 19:06:44 2031 GMT
4594 Subject: C=BM, O=QuoVadis Limited, CN=QuoVadis Root CA 3
4595 X509v3 extensions:
4596 X509v3 Basic Constraints: critical
4597 CA:TRUE
4598 X509v3 Certificate Policies:
4599 Policy: 1.3.6.1.4.1.8024.0.3
4600 User Notice:
4601 Explicit Text: Any use of this Certificate constitutes acceptance of the QuoVadis Root CA 3 Certificate Policy / Certification Practice Statement.
4602 CPS: http://www.quovadisglobal.com/cps
4603
4604 X509v3 Key Usage:
4605 Certificate Sign, CRL Sign
4606 X509v3 Subject Key Identifier:
4607 F2:C0:13:E0:82:43:3E:FB:EE:2F:67:32:96:35:5C:DB:B8:CB:02:D0
4608 X509v3 Authority Key Identifier:
4609 keyid:F2:C0:13:E0:82:43:3E:FB:EE:2F:67:32:96:35:5C:DB:B8:CB:02:D0
4610 DirName:/C=BM/O=QuoVadis Limited/CN=QuoVadis Root CA 3
4611 serial:05:C6
4612
4613SHA1 Fingerprint=1F:49:14:F7:D8:74:95:1D:DD:AE:02:C0:BE:FD:3A:2D:82:75:51:85
4614SHA256 Fingerprint=18:F1:FC:7F:20:5D:F8:AD:DD:EB:7F:E0:07:DD:57:E3:AF:37:5A:9C:4D:8D:73:54:6B:F4:F1:FE:D1:E1:8D:35
4615-----BEGIN CERTIFICATE-----
4616MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0x
4617GTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJv
4618b3QgQ0EgMzAeFw0wNjExMjQxOTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNV
4619BAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMRswGQYDVQQDExJRdW9W
4620YWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDM
4621V0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNggDhoB
46224hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUr
4623H556VOijKTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd
46248lyyBTNvijbO0BNO/79KDDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9Cabwv
4625vWhDFlaJKjdhkf2mrk7AyxRllDdLkgbvBNDInIjbC3uBr7E9KsRlOni27tyAsdLT
4626mZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwpp5ijJUMv7/FfJuGITfhe
4627btfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8nT8KKdjc
4628T5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDt
4629WAEXMJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZ
4630c6tsgLjoC2SToJyMGf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A
46314iLItLRkT9a6fUg+qGkM17uGcclzuD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYD
4632VR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHTBgkrBgEEAb5YAAMwgcUwgZMG
4633CCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmljYXRlIGNvbnN0
4634aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0
4635aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVu
4636dC4wLQYIKwYBBQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2Nw
4637czALBgNVHQ8EBAMCAQYwHQYDVR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4G
4638A1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4ywLQoUmkRzBFMQswCQYDVQQGEwJC
4639TTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UEAxMSUXVvVmFkaXMg
4640Um9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZVqyM0
46417ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSem
4642d1o417+shvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd
4643+LJ2w/w4E6oM3kJpK27zPOuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B
46444f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadN
4645t54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp8kokUvd0/bpO5qgdAm6x
4646DYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBCbjPsMZ57
4647k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6s
4648zHXug/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0j
4649Wy10QJLZYxkNc91pvGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeT
4650mJlglFwjz1onl14LBQaTNx47aTbrqZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK
46514SVhM7JZG+Ju1zdXtg2pEto=
4652-----END CERTIFICATE-----
4653=== /C=BM/O=QuoVadis Limited/CN=QuoVadis Root CA 3 G3 3758=== /C=BM/O=QuoVadis Limited/CN=QuoVadis Root CA 3 G3
4654Certificate: 3759Certificate:
4655 Data: 3760 Data:
@@ -4779,6 +3884,102 @@ t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6qtnRGEmyR7jTV7JqR50S+kDFy
4779SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03 3884SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03
4780-----END CERTIFICATE----- 3885-----END CERTIFICATE-----
4781 3886
3887### SECOM Trust Systems Co., Ltd.
3888
3889=== /C=JP/O=SECOM Trust Systems Co., Ltd./CN=SECOM TLS ECC Root CA 2024
3890Certificate:
3891 Data:
3892 Version: 3 (0x2)
3893 Serial Number:
3894 81:7a:2c:ef:8f:23:7a:44
3895 Signature Algorithm: ecdsa-with-SHA384
3896 Validity
3897 Not Before: Jan 31 05:52:34 2024 GMT
3898 Not After : Jan 14 05:52:34 2049 GMT
3899 Subject: C=JP, O=SECOM Trust Systems Co., Ltd., CN=SECOM TLS ECC Root CA 2024
3900 X509v3 extensions:
3901 X509v3 Subject Key Identifier:
3902 3B:76:11:7B:29:74:E2:4E:06:4C:56:82:40:D0:21:2F:7A:B3:C9:D5
3903 X509v3 Authority Key Identifier:
3904 keyid:3B:76:11:7B:29:74:E2:4E:06:4C:56:82:40:D0:21:2F:7A:B3:C9:D5
3905
3906 X509v3 Key Usage: critical
3907 Certificate Sign, CRL Sign
3908 X509v3 Basic Constraints: critical
3909 CA:TRUE
3910SHA1 Fingerprint=7A:1F:22:2D:72:B2:C3:19:87:44:DB:61:69:E8:A6:4B:D7:0D:44:0E
3911SHA256 Fingerprint=6A:B2:AB:75:F5:1C:B4:F4:F0:15:62:03:FB:F6:F6:46:23:2F:51:4B:E0:59:F6:28:33:30:8B:82:B4:D7:2D:B1
3912-----BEGIN CERTIFICATE-----
3913MIICTDCCAdGgAwIBAgIJAIF6LO+PI3pEMAoGCCqGSM49BAMDMFoxCzAJBgNVBAYT
3914AkpQMSYwJAYDVQQKEx1TRUNPTSBUcnVzdCBTeXN0ZW1zIENvLiwgTHRkLjEjMCEG
3915A1UEAxMaU0VDT00gVExTIEVDQyBSb290IENBIDIwMjQwHhcNMjQwMTMxMDU1MjM0
3916WhcNNDkwMTE0MDU1MjM0WjBaMQswCQYDVQQGEwJKUDEmMCQGA1UEChMdU0VDT00g
3917VHJ1c3QgU3lzdGVtcyBDby4sIEx0ZC4xIzAhBgNVBAMTGlNFQ09NIFRMUyBFQ0Mg
3918Um9vdCBDQSAyMDI0MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE7NzFMtu9dzQXSNC1
39192fabk0+GlC5finB3R7XaZonRUd20aFiWObtuNBCLUZSfk6QXAE55BjEXsXQ/NG8y
3920UqicXjsu9ksDK3JZBgCwLOVh6+nwJXTvso/dEj/GUYH5mBdoo2MwYTAdBgNVHQ4E
3921FgQUO3YReyl04k4GTFaCQNAhL3qzydUwHwYDVR0jBBgwFoAUO3YReyl04k4GTFaC
3922QNAhL3qzydUwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wCgYIKoZI
3923zj0EAwMDaQAwZgIxAN3ib8fi1pMYtAPjMilB5e5/H+t5CL0xPL+cZ5oTTZuSCjpA
3924n1v7F/VAr8bFxQXAowIxAKsBVO1ACFp7skwzPvdv1EUY5a897WGLT4lb+bjxFAWy
3925l8wDcZJdwGZ/pAHxt1AJ1g==
3926-----END CERTIFICATE-----
3927=== /C=JP/O=SECOM Trust Systems Co., Ltd./CN=SECOM TLS RSA Root CA 2024
3928Certificate:
3929 Data:
3930 Version: 3 (0x2)
3931 Serial Number:
3932 ee:89:34:d0:cb:80:e0:b2
3933 Signature Algorithm: sha384WithRSAEncryption
3934 Validity
3935 Not Before: Jan 31 05:11:55 2024 GMT
3936 Not After : Jan 14 05:11:55 2049 GMT
3937 Subject: C=JP, O=SECOM Trust Systems Co., Ltd., CN=SECOM TLS RSA Root CA 2024
3938 X509v3 extensions:
3939 X509v3 Subject Key Identifier:
3940 2C:EB:72:12:8E:58:77:64:35:15:56:35:01:57:07:A9:7D:0D:36:E6
3941 X509v3 Authority Key Identifier:
3942 keyid:2C:EB:72:12:8E:58:77:64:35:15:56:35:01:57:07:A9:7D:0D:36:E6
3943
3944 X509v3 Key Usage: critical
3945 Certificate Sign, CRL Sign
3946 X509v3 Basic Constraints: critical
3947 CA:TRUE
3948SHA1 Fingerprint=FB:97:96:7C:EF:8D:98:63:06:C0:3B:B6:11:F8:E0:13:97:A2:98:D3
3949SHA256 Fingerprint=14:35:F2:25:C5:D2:52:D7:A2:19:48:CC:3C:E6:2A:EC:FA:88:00:1E:3D:D7:2D:1C:C3:55:51:00:EB:37:2F:93
3950-----BEGIN CERTIFICATE-----
3951MIIFmjCCA4KgAwIBAgIJAO6JNNDLgOCyMA0GCSqGSIb3DQEBDAUAMFoxCzAJBgNV
3952BAYTAkpQMSYwJAYDVQQKEx1TRUNPTSBUcnVzdCBTeXN0ZW1zIENvLiwgTHRkLjEj
3953MCEGA1UEAxMaU0VDT00gVExTIFJTQSBSb290IENBIDIwMjQwHhcNMjQwMTMxMDUx
3954MTU1WhcNNDkwMTE0MDUxMTU1WjBaMQswCQYDVQQGEwJKUDEmMCQGA1UEChMdU0VD
3955T00gVHJ1c3QgU3lzdGVtcyBDby4sIEx0ZC4xIzAhBgNVBAMTGlNFQ09NIFRMUyBS
3956U0EgUm9vdCBDQSAyMDI0MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA
39574TjizUwzxbInq8Tx11gaFYNk5fO+34y7TyM4neh0UgL5JIZbJNLTz2x//L/B71+5
3958m6X6nGIr7d4lFJBGtjO677hXOz93zkcWaUTm3VbOAjBlt4YWxlcccBHXuZ7o3Q+4
3959R+ormrBdHeJ1CTUEG8ttQbKIl3G7OZYbnH8/pP8cjPub/0kDVNuMzp7xsVRROOis
3960Qt53fMoJLlYgoebbuMphOqMCtjkJ7R6efEMfLp8UAVi9ZaLRn76ET/CJkk925ndu
3961uufC4BatS4mnXFmxN0vUXb0ij9B8O/D8gixQEsVSD4GK8FWRPh3bVd/6bzdkHGJj
3962y21XI0yejVomZUbRrOfNuz0boPGV1pt18fFC39IHQEth3OFqb5NDO3L+A9bNqTgA
3963yUgRmIn4ucgDc/Ri/Km3V51ueZjy1/yk0qwJVadAVVrCt56iNeXOyEvzJADGgDQ8
3964E1Pdaqct8Cynz/47ReQM62vFYO08wcQkrjmX/tesiko1V1yyaf6EfPzUFzmaGy9x
3965vkCwdbm15EdTolOjE0H2Vb5/APDOyCFEokiYGmXTLdAUl0wKZ4IyjkHGzy0jhpaX
3966EXE/GJcEvI6VzEchjaBL03EJ0h9pG4OqeIOycKvAo3A+TbetyfsrgYyHzU0a7/qU
3967jGat1AAq1nVljMpKqpinPTsf/d9H39FTUeJL7TpzzjUCAwEAAaNjMGEwHQYDVR0O
3968BBYEFCzrchKOWHdkNRVWNQFXB6l9DTbmMB8GA1UdIwQYMBaAFCzrchKOWHdkNRVW
3969NQFXB6l9DTbmMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqG
3970SIb3DQEBDAUAA4ICAQAVwsvluSafaez5tFPR/hRTBzRxEyMMQF3XJXCVi3yegZyK
3971oec7hmE6jx2ZM8KgM1kn2yJRwFXHX8zUW9nBLEDWc4wuE8LrlZqhGZM9pJQXGmGz
3972ResDJV6JgRBna+j4sA1M7yIdlvL0sAfFXFCTRaWTD4E1V99RLrFzWfTcC+e180hD
3973uNMpqOEo46+lMeW/Wvh7ifOQs+kiK0O2gHxQDNxslSavnCs4V7l8HRDJ2La10o70
3974Bo7VLzf1W8MBvv0VTnxB+NjT5qTAbhGFh9Gvp4BaJpmdUf0C5CEP6dbQlfgxWfzY
3975r69yVT6dPQB+GFEaY03IMY+AcBCs+om1fNxrQXt9zoofMBNFbLhvpNH/JsXWdGUz
3976fNbO12uswTa5wah8LB18FTQN2/zPHYmvBEoLuyUgZ09VNLJo5YA0kXItVYkLjMe2
3977SixzK4scUHv81IK99I91DWx7FwMVKw2xgFp+ZLYB2dnpQQrqwlW64glHUcK2N9BD
3978snjLSxeZ+UPECh9RxH4WAcKiZW+cqaKMmhP2WBfR4IcR7NOL32ml11ds87hhV1CZ
3979WWFCJAcCidYZz6CZa8exzHojP9SB5RH0/v1KdHAisqhSjtJl/UIAHIQ48elOn8wr
3980TdFap4Yb5aHglmMeNx+fAIhDluWVfxTO7H4dTPU+SFVRMLAh+wwKZfqb94nMeQ==
3981-----END CERTIFICATE-----
3982
4782### SSL Corporation 3983### SSL Corporation
4783 3984
4784=== /C=US/O=SSL Corporation/CN=SSL.com TLS ECC Root CA 2022 3985=== /C=US/O=SSL Corporation/CN=SSL.com TLS ECC Root CA 2022
@@ -5151,111 +4352,6 @@ LvKRRFHQV80MNNVIIb/bE/FmJUNS0nAiNs2fxBx1IK1jcmMGDw4nztJqDby1ORrp
5151QqszKbrAKbkTidOIijlBO8n9pu0f9GBj39ItVQGL 4352QqszKbrAKbkTidOIijlBO8n9pu0f9GBj39ItVQGL
5152-----END CERTIFICATE----- 4353-----END CERTIFICATE-----
5153 4354
5154### SecureTrust Corporation
5155
5156=== /C=US/O=SecureTrust Corporation/CN=Secure Global CA
5157Certificate:
5158 Data:
5159 Version: 3 (0x2)
5160 Serial Number:
5161 07:56:22:a4:e8:d4:8a:89:4d:f4:13:c8:f0:f8:ea:a5
5162 Signature Algorithm: sha1WithRSAEncryption
5163 Validity
5164 Not Before: Nov 7 19:42:28 2006 GMT
5165 Not After : Dec 31 19:52:06 2029 GMT
5166 Subject: C=US, O=SecureTrust Corporation, CN=Secure Global CA
5167 X509v3 extensions:
5168 1.3.6.1.4.1.311.20.2:
5169 ...C.A
5170 X509v3 Key Usage:
5171 Digital Signature, Certificate Sign, CRL Sign
5172 X509v3 Basic Constraints: critical
5173 CA:TRUE
5174 X509v3 Subject Key Identifier:
5175 AF:44:04:C2:41:7E:48:83:DB:4E:39:02:EC:EC:84:7A:E6:CE:C9:A4
5176 X509v3 CRL Distribution Points:
5177
5178 Full Name:
5179 URI:http://crl.securetrust.com/SGCA.crl
5180
5181 1.3.6.1.4.1.311.21.1:
5182 ...
5183SHA1 Fingerprint=3A:44:73:5A:E5:81:90:1F:24:86:61:46:1E:3B:9C:C4:5F:F5:3A:1B
5184SHA256 Fingerprint=42:00:F5:04:3A:C8:59:0E:BB:52:7D:20:9E:D1:50:30:29:FB:CB:D4:1C:A1:B5:06:EC:27:F1:5A:DE:7D:AC:69
5185-----BEGIN CERTIFICATE-----
5186MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBK
5187MQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24x
5188GTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkx
5189MjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3Qg
5190Q29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwgQ0EwggEiMA0GCSqG
5191SIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jxYDiJ
5192iQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa
5193/FHtaMbQbqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJ
5194jnIFHovdRIWCQtBJwB1g8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnI
5195HmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYVHDGA76oYa8J719rO+TMg1fW9ajMtgQT7
5196sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi0XPnj3pDAgMBAAGjgZ0w
5197gZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1UdEwEB/wQF
5198MAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCsw
5199KaAnoCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsG
5200AQQBgjcVAQQDAgEAMA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0L
5201URYD7xh8yOOvaliTFGCRsoTciE6+OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXO
5202H0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cnCDpOGR86p1hcF895P4vkp9Mm
5203I50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/53CYNv6ZHdAbY
5204iNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc
5205f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW
5206-----END CERTIFICATE-----
5207=== /C=US/O=SecureTrust Corporation/CN=SecureTrust CA
5208Certificate:
5209 Data:
5210 Version: 3 (0x2)
5211 Serial Number:
5212 0c:f0:8e:5c:08:16:a5:ad:42:7f:f0:eb:27:18:59:d0
5213 Signature Algorithm: sha1WithRSAEncryption
5214 Validity
5215 Not Before: Nov 7 19:31:18 2006 GMT
5216 Not After : Dec 31 19:40:55 2029 GMT
5217 Subject: C=US, O=SecureTrust Corporation, CN=SecureTrust CA
5218 X509v3 extensions:
5219 1.3.6.1.4.1.311.20.2:
5220 ...C.A
5221 X509v3 Key Usage:
5222 Digital Signature, Certificate Sign, CRL Sign
5223 X509v3 Basic Constraints: critical
5224 CA:TRUE
5225 X509v3 Subject Key Identifier:
5226 42:32:B6:16:FA:04:FD:FE:5D:4B:7A:C3:FD:F7:4C:40:1D:5A:43:AF
5227 X509v3 CRL Distribution Points:
5228
5229 Full Name:
5230 URI:http://crl.securetrust.com/STCA.crl
5231
5232 1.3.6.1.4.1.311.21.1:
5233 ...
5234SHA1 Fingerprint=87:82:C6:C3:04:35:3B:CF:D2:96:92:D2:59:3E:7D:44:D9:34:FF:11
5235SHA256 Fingerprint=F1:C1:B5:0A:E5:A2:0D:D8:03:0E:C9:F6:BC:24:82:3D:D3:67:B5:25:57:59:B4:E7:1B:61:FC:E9:F7:37:5D:73
5236-----BEGIN CERTIFICATE-----
5237MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBI
5238MQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24x
5239FzAVBgNVBAMTDlNlY3VyZVRydXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIz
5240MTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAeBgNVBAoTF1NlY3VyZVRydXN0IENv
5241cnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCCASIwDQYJKoZIhvcN
5242AQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQXOZEz
5243Zum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO
52440gMdA+9tDWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIao
5245wW8xQmxSPmjL8xk037uHGFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj
52467DaUaHp3pLHnDi+BeuK1cobvomuL8A/b01k/unK8RCSc43Oz969XL0Imnal0ugBS
52478kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmHursCAwEAAaOBnTCBmjAT
5248BgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB
5249/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCeg
5250JYYjaHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGC
5251NxUBBAMCAQAwDQYJKoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt3
52526Z3q059c4EVlew3KW+JwULKUBRSuSceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/
52533XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHfmbx8IVQr5Fiiu1cprp6poxkm
5254D5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZnMUFdAvnZyPS
5255CPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR
52563ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE=
5257-----END CERTIFICATE-----
5258
5259### Starfield Technologies, Inc. 4355### Starfield Technologies, Inc.
5260 4356
5261=== /C=US/ST=Arizona/L=Scottsdale/O=Starfield Technologies, Inc./CN=Starfield Root Certificate Authority - G2 4357=== /C=US/ST=Arizona/L=Scottsdale/O=Starfield Technologies, Inc./CN=Starfield Root Certificate Authority - G2
@@ -5346,66 +4442,6 @@ sSi6
5346 4442
5347### SwissSign AG 4443### SwissSign AG
5348 4444
5349=== /C=CH/O=SwissSign AG/CN=SwissSign Gold CA - G2
5350Certificate:
5351 Data:
5352 Version: 3 (0x2)
5353 Serial Number:
5354 bb:40:1c:43:f5:5e:4f:b0
5355 Signature Algorithm: sha1WithRSAEncryption
5356 Validity
5357 Not Before: Oct 25 08:30:35 2006 GMT
5358 Not After : Oct 25 08:30:35 2036 GMT
5359 Subject: C=CH, O=SwissSign AG, CN=SwissSign Gold CA - G2
5360 X509v3 extensions:
5361 X509v3 Key Usage: critical
5362 Certificate Sign, CRL Sign
5363 X509v3 Basic Constraints: critical
5364 CA:TRUE
5365 X509v3 Subject Key Identifier:
5366 5B:25:7B:96:A4:65:51:7E:B8:39:F3:C0:78:66:5E:E8:3A:E7:F0:EE
5367 X509v3 Authority Key Identifier:
5368 keyid:5B:25:7B:96:A4:65:51:7E:B8:39:F3:C0:78:66:5E:E8:3A:E7:F0:EE
5369
5370 X509v3 Certificate Policies:
5371 Policy: 2.16.756.1.89.1.2.1.1
5372 CPS: http://repository.swisssign.com/
5373
5374SHA1 Fingerprint=D8:C5:38:8A:B7:30:1B:1B:6E:D4:7A:E6:45:25:3A:6F:9F:1A:27:61
5375SHA256 Fingerprint=62:DD:0B:E9:B9:F5:0A:16:3E:A0:F8:E7:5C:05:3B:1E:CA:57:EA:55:C8:68:8F:64:7C:68:81:F2:C8:35:7B:95
5376-----BEGIN CERTIFICATE-----
5377MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV
5378BAYTAkNIMRUwEwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2ln
5379biBHb2xkIENBIC0gRzIwHhcNMDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBF
5380MQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dpc3NTaWduIEFHMR8wHQYDVQQDExZT
5381d2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIIC
5382CgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUqt2/8
538376LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+
5384bbqBHH5CjCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c
53856bM8K8vzARO/Ws/BtQpgvd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqE
5386emA8atufK+ze3gE/bk3lUIbLtK/tREDFylqM2tIrfKjuvqblCqoOpd8FUrdVxyJd
5387MmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvRAiTysybUa9oEVeXBCsdt
5388MDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuendjIj3o02y
5389MszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69y
5390FGkOpeUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPi
5391aG59je883WX0XaxR7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxM
5392gI93e2CaHt+28kgeDrpOVG2Y4OGiGqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCB
5393qTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUWyV7
5394lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64OfPAeGZe6Drn
53958O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov
5396L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe6
539745R88a7A3hfm5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczO
5398UYrHUDFu4Up+GC9pWbY9ZIEr44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5
5399O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOfMke6UiI0HTJ6CVanfCU2qT1L2sCC
5400bwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6mGu6uLftIdxf+u+yv
5401GPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxpmo/a
540277KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCC
5403hdiDyyJkvC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid3
540492qgQmwLOM7XdVAyksLfKzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEpp
5405Ld6leNcG2mqeSz53OiATIgHQv2ieY2BrNU0LbbqhPcCT4H8js1WtciVORvnSFu+w
5406ZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6LqjviOvrv1vA+ACOzB2+htt
5407Qc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ
5408-----END CERTIFICATE-----
5409=== /C=CH/O=SwissSign AG/CN=SwissSign RSA TLS Root CA 2022 - 1 4445=== /C=CH/O=SwissSign AG/CN=SwissSign RSA TLS Root CA 2022 - 1
5410Certificate: 4446Certificate:
5411 Data: 4447 Data:
@@ -5695,6 +4731,101 @@ aspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocnyYh0igzyXxfkZ
5695YiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw== 4731YiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw==
5696-----END CERTIFICATE----- 4732-----END CERTIFICATE-----
5697 4733
4734### Telia Company AB
4735
4736=== /C=SE/O=Telia Company AB/CN=Telia EC TLS Root CA v3
4737Certificate:
4738 Data:
4739 Version: 3 (0x2)
4740 Serial Number:
4741 01:8b:d2:22:54:63:4d:04:8b:6c:e5:47:1f:d2:b5
4742 Signature Algorithm: ecdsa-with-SHA384
4743 Validity
4744 Not Before: Nov 15 08:55:26 2023 GMT
4745 Not After : May 23 11:00:00 2048 GMT
4746 Subject: C=SE, O=Telia Company AB, CN=Telia EC TLS Root CA v3
4747 X509v3 extensions:
4748 X509v3 Authority Key Identifier:
4749 keyid:D4:64:E8:43:88:3A:73:2F:D0:1A:71:82:36:0B:5E:85:DE:C7:DE:43
4750
4751 X509v3 Subject Key Identifier:
4752 D4:64:E8:43:88:3A:73:2F:D0:1A:71:82:36:0B:5E:85:DE:C7:DE:43
4753 X509v3 Key Usage: critical
4754 Certificate Sign, CRL Sign
4755 X509v3 Basic Constraints: critical
4756 CA:TRUE
4757SHA1 Fingerprint=B4:D6:07:C2:A5:95:BC:5B:F4:67:4D:C9:DC:6F:6F:0A:00:7A:A5:35
4758SHA256 Fingerprint=09:8E:08:A9:1D:BB:F7:74:78:B9:6C:CE:B8:9B:14:13:A5:DA:37:B7:C8:62:60:6A:95:5D:EB:07:17:9F:43:26
4759-----BEGIN CERTIFICATE-----
4760MIICMjCCAbegAwIBAgIPAYvSIlRjTQSLbOVHH9K1MAoGCCqGSM49BAMDMEoxCzAJ
4761BgNVBAYTAlNFMRkwFwYDVQQKDBBUZWxpYSBDb21wYW55IEFCMSAwHgYDVQQDDBdU
4762ZWxpYSBFQyBUTFMgUm9vdCBDQSB2MzAeFw0yMzExMTUwODU1MjZaFw00ODA1MjMx
4763MTAwMDBaMEoxCzAJBgNVBAYTAlNFMRkwFwYDVQQKDBBUZWxpYSBDb21wYW55IEFC
4764MSAwHgYDVQQDDBdUZWxpYSBFQyBUTFMgUm9vdCBDQSB2MzB2MBAGByqGSM49AgEG
4765BSuBBAAiA2IABMHIlhVDLbmFKUpW0iK4dpryT6emYOeS31JPwWnWPmkWRrAkTbPX
476640sQfHI9mpR7Rbktu3ngg6W+BBSXSechtMCnBmWXj/EaVlmV5cY1jD2HoTfhBQ3A
4767acpCNMLJK4NpZaNjMGEwHwYDVR0jBBgwFoAU1GToQ4g6cy/QGnGCNgtehd7H3kMw
4768HQYDVR0OBBYEFNRk6EOIOnMv0BpxgjYLXoXex95DMA4GA1UdDwEB/wQEAwIBBjAP
4769BgNVHRMBAf8EBTADAQH/MAoGCCqGSM49BAMDA2kAMGYCMQCXAUdS/9bbJ8A1JYaG
4770f/bWt/s7Ta0ot5Ulno8OjSNYRWQIlS4tVWldvTAVA7heOFgCMQCvKr8+Z2Rn+OBr
47715UHzlgBObpad1LuwNTRcdNgUJxIWadcki+UBLEi1/AURKV5md2M=
4772-----END CERTIFICATE-----
4773=== /C=SE/O=Telia Company AB/CN=Telia RSA TLS Root CA v3
4774Certificate:
4775 Data:
4776 Version: 3 (0x2)
4777 Serial Number:
4778 01:8b:d2:50:ab:42:55:2c:47:5a:bd:a1:dc:1a:c5
4779 Signature Algorithm: sha384WithRSAEncryption
4780 Validity
4781 Not Before: Nov 15 09:47:42 2023 GMT
4782 Not After : May 23 11:00:00 2048 GMT
4783 Subject: C=SE, O=Telia Company AB, CN=Telia RSA TLS Root CA v3
4784 X509v3 extensions:
4785 X509v3 Authority Key Identifier:
4786 keyid:B0:C7:A9:D2:DD:B2:28:56:73:04:94:8C:14:5C:48:6F:37:52:92:A8
4787
4788 X509v3 Subject Key Identifier:
4789 B0:C7:A9:D2:DD:B2:28:56:73:04:94:8C:14:5C:48:6F:37:52:92:A8
4790 X509v3 Key Usage: critical
4791 Certificate Sign, CRL Sign
4792 X509v3 Basic Constraints: critical
4793 CA:TRUE
4794SHA1 Fingerprint=B5:2E:88:4E:40:C1:11:FB:50:C7:E2:4F:AC:18:2B:BD:68:15:D2:34
4795SHA256 Fingerprint=D1:3D:B1:29:4C:45:EB:C6:FC:86:C6:BB:F6:9F:A2:9B:DF:E6:92:DF:F7:C7:13:C2:43:C7:A9:56:C6:A2:28:4C
4796-----BEGIN CERTIFICATE-----
4797MIIFgjCCA2qgAwIBAgIPAYvSUKtCVSxHWr2h3BrFMA0GCSqGSIb3DQEBDAUAMEsx
4798CzAJBgNVBAYTAlNFMRkwFwYDVQQKDBBUZWxpYSBDb21wYW55IEFCMSEwHwYDVQQD
4799DBhUZWxpYSBSU0EgVExTIFJvb3QgQ0EgdjMwHhcNMjMxMTE1MDk0NzQyWhcNNDgw
4800NTIzMTEwMDAwWjBLMQswCQYDVQQGEwJTRTEZMBcGA1UECgwQVGVsaWEgQ29tcGFu
4801eSBBQjEhMB8GA1UEAwwYVGVsaWEgUlNBIFRMUyBSb290IENBIHYzMIICIjANBgkq
4802hkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAsV89KG19hCf4S1Fvk8D3TyDERhmcvx8F
48037Kmb4WATx3ije1id3KHxRE0TKmcNCbAQ57bvHFEYa4hR2l20VjVadExqOW+2ld99
4804MbEiO+jRVOz+BbxLxJnmGwCqI+BfuTjjVReDxsxjQvjgBsClaO/sm5i70nlZcWGR
4805tIkvWDK3NNkT5RtwXc/O8NTFVpbUqT6cRjIj3olAblR+lRf4Ffy5o+Q9fabjYn9Z
48069S4itruElcEFf9Ljk7fwdTycT/rvJW9w/B3G2a3r0f/zXNOVruIBcqE6pkSospAC
4807U2bG42fYKrbM/GWnp7u+p9Frz4jaNwpb4YHuEeS8BratNcP8X62jXIvvKHxlsMDJ
4808Cnb4U8JzFOLsU6mohVY58BdZrvi0Gk9UOuqmgoG6dskHoksjZTlK61D/InzmEoA1
4809yAYJFDVysjRxDUOu9cAwANbqmq77WIFL6BpnZgVqPtMfG6wN8BrTKdapvilVsYR5
48109BFgIsAVBMxrGh+W+QcvmJafUpASvlArKvVG2FI4i6PiLjSBT0+6F6EQLrYqefOQ
4811F/fBNEXb+njUQ0SUVrAqtH4Y+OjCI/a4/JJQppxeemZcQ0SUShgiI5AM5xHO5iya
4812UrTjYH4zxUz9j+1FEbDH/xpstr1gXBykspup+hRTaJcbA+UbpJqtWZndAPddJmt6
4813YJQ+dU3pDu8CAwEAAaNjMGEwHwYDVR0jBBgwFoAUsMep0t2yKFZzBJSMFFxIbzdS
4814kqgwHQYDVR0OBBYEFLDHqdLdsihWcwSUjBRcSG83UpKoMA4GA1UdDwEB/wQEAwIB
4815BjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBDAUAA4ICAQBdYzFsNGDRk7bR
4816/AgRKq+5637YuOW+w6uhpoS0VnKMUpyHCwku86hEvqivakPtfmlm4bFwt++sb/8O
4817XsWBqtfbXMaBNDTZl8XRMJuLWOW2JrbKkRzgG0eBUcvsadG1rrhbmZqYvFXaAZO7
4818o4TdOZzxhBB5GOAWWXB3IeraNP4J63zyo9n8Gqw3sJBG44em5hoYjBffP+npibys
4819lnslRi4L6xHsCYj/Pab+OlqbMCB6v+sTCLeEIukRVzoR9aQ45pEK7Z1QBnSsbAKQ
4820tss0JKD9d/mX143H1xePjPhTXlv5JCkhrcj+SShz0P9+EHoWe6m9lyUEOIVn0rp+
4821yVJWNbmyDv3VkwFxHC1ApSQsgSimjGQ4wtr6cSmordYxkV+Ro8lOIIhRksXPyDk2
48227gW6IjUXCkZKpxFjkL3jiBSc8SkxnwCWtXg8xwNwdFVNBGLCCuJnsneYXjJNqzRq
4823UcoGwzsvF3Qi/ZnHUNvISdevlgIAXL4Wvrxaqvoa01wB+GCfs57RTGE4TvAGhKNK
4824us8K3hRT1BSpigzMIRzSxtAOrqPN6j//QSmW9f8Jcncri4j2ihSpVrFU0NdNkMhZ
4825eAKidTFPsxCVFuW4Aniz7jqiw5sWtjbQrlW035izIEU4sYwQoC1Nx0Svy+mMTRai
482650LqFQ+A1/Hq6xHHDNx7CI83d23Erw==
4827-----END CERTIFICATE-----
4828
5698### Telia Finland Oyj 4829### Telia Finland Oyj
5699 4830
5700=== /C=FI/O=Telia Finland Oyj/CN=Telia Root CA v2 4831=== /C=FI/O=Telia Finland Oyj/CN=Telia Root CA v2
@@ -5753,59 +4884,6 @@ ysUsWNc8e89ihmpQfTU2Zqf7N+cox9jQraVplI/owd8k+BsHMYeB2F326CjYSlKA
5753rBPuUBQemMc= 4884rBPuUBQemMc=
5754-----END CERTIFICATE----- 4885-----END CERTIFICATE-----
5755 4886
5756### TeliaSonera
5757
5758=== /O=TeliaSonera/CN=TeliaSonera Root CA v1
5759Certificate:
5760 Data:
5761 Version: 3 (0x2)
5762 Serial Number:
5763 95:be:16:a0:f7:2e:46:f1:7b:39:82:72:fa:8b:cd:96
5764 Signature Algorithm: sha1WithRSAEncryption
5765 Validity
5766 Not Before: Oct 18 12:00:50 2007 GMT
5767 Not After : Oct 18 12:00:50 2032 GMT
5768 Subject: O=TeliaSonera, CN=TeliaSonera Root CA v1
5769 X509v3 extensions:
5770 X509v3 Basic Constraints: critical
5771 CA:TRUE
5772 X509v3 Key Usage:
5773 Certificate Sign, CRL Sign
5774 X509v3 Subject Key Identifier:
5775 F0:8F:59:38:00:B3:F5:8F:9A:96:0C:D5:EB:FA:7B:AA:17:E8:13:12
5776SHA1 Fingerprint=43:13:BB:96:F1:D5:86:9B:C1:4E:6A:92:F6:CF:F6:34:69:87:82:37
5777SHA256 Fingerprint=DD:69:36:FE:21:F8:F0:77:C1:23:A1:A5:21:C1:22:24:F7:22:55:B7:3E:03:A7:26:06:93:E8:A2:4B:0F:A3:89
5778-----BEGIN CERTIFICATE-----
5779MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAw
5780NzEUMBIGA1UECgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJv
5781b3QgQ0EgdjEwHhcNMDcxMDE4MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYD
5782VQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwWVGVsaWFTb25lcmEgUm9vdCBDQSB2
5783MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+6yfwIaPzaSZVfp3F
5784VRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA3GV1
57857CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+X
5786Z75Ljo1kB1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+
5787/jXh7VB7qTCNGdMJjmhnXb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs
578881Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxHoLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkm
5789dtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3F0fUTPHSiXk+TT2YqGHe
5790Oh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJoWjiUIMu
5791sDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4
5792pgd7gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fs
5793slESl1MpWtTwEhDcTwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQ
5794arMCpgKIv7NHfirZ1fpoeDVNAgMBAAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYD
5795VR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qWDNXr+nuqF+gTEjANBgkqhkiG
57969w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNmzqjMDfz1mgbl
5797dxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx
57980GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1Tj
5799TQpgcmLNkQfWpb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBed
5800Y2gea+zDTYa4EzAvXUYNR0PVG6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7
5801Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpcc41teyWRyu5FrgZLAMzTsVlQ2jqI
5802OylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOTJsjrDNYmiLbAJM+7
5803vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2qReW
5804t88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcn
5805HL/EVlP6Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVx
5806SK236thZiNSQvxaz2emsWWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY=
5807-----END CERTIFICATE-----
5808
5809### The USERTRUST Network 4887### The USERTRUST Network
5810 4888
5811=== /C=US/ST=New Jersey/L=Jersey City/O=The USERTRUST Network/CN=USERTrust ECC Certification Authority 4889=== /C=US/ST=New Jersey/L=Jersey City/O=The USERTRUST Network/CN=USERTrust ECC Certification Authority
@@ -6082,135 +5160,6 @@ ly4wBOeY99sLAZDBHwo/+ML+TvrbmnNzFrwFuHnYWa8G5z9nODmxfKuU4CkUpijy
6082323imttUQ/hHWKNddBWcwauwxzQ= 5160323imttUQ/hHWKNddBWcwauwxzQ=
6083-----END CERTIFICATE----- 5161-----END CERTIFICATE-----
6084 5162
6085### Trustwave Holdings, Inc.
6086
6087=== /C=US/ST=Illinois/L=Chicago/O=Trustwave Holdings, Inc./CN=Trustwave Global Certification Authority
6088Certificate:
6089 Data:
6090 Version: 3 (0x2)
6091 Serial Number:
6092 05:f7:0e:86:da:49:f3:46:35:2e:ba:b2
6093 Signature Algorithm: sha256WithRSAEncryption
6094 Validity
6095 Not Before: Aug 23 19:34:12 2017 GMT
6096 Not After : Aug 23 19:34:12 2042 GMT
6097 Subject: C=US, ST=Illinois, L=Chicago, O=Trustwave Holdings, Inc., CN=Trustwave Global Certification Authority
6098 X509v3 extensions:
6099 X509v3 Basic Constraints: critical
6100 CA:TRUE
6101 X509v3 Subject Key Identifier:
6102 99:E0:19:67:0D:62:DB:76:B3:DA:3D:B8:5B:E8:FD:42:D2:31:0E:87
6103 X509v3 Key Usage: critical
6104 Certificate Sign, CRL Sign
6105SHA1 Fingerprint=2F:8F:36:4F:E1:58:97:44:21:59:87:A5:2A:9A:D0:69:95:26:7F:B5
6106SHA256 Fingerprint=97:55:20:15:F5:DD:FC:3C:87:88:C0:06:94:45:55:40:88:94:45:00:84:F1:00:86:70:86:BC:1A:2B:B5:8D:C8
6107-----BEGIN CERTIFICATE-----
6108MIIF2jCCA8KgAwIBAgIMBfcOhtpJ80Y1LrqyMA0GCSqGSIb3DQEBCwUAMIGIMQsw
6109CQYDVQQGEwJVUzERMA8GA1UECAwISWxsaW5vaXMxEDAOBgNVBAcMB0NoaWNhZ28x
6110ITAfBgNVBAoMGFRydXN0d2F2ZSBIb2xkaW5ncywgSW5jLjExMC8GA1UEAwwoVHJ1
6111c3R3YXZlIEdsb2JhbCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0xNzA4MjMx
6112OTM0MTJaFw00MjA4MjMxOTM0MTJaMIGIMQswCQYDVQQGEwJVUzERMA8GA1UECAwI
6113SWxsaW5vaXMxEDAOBgNVBAcMB0NoaWNhZ28xITAfBgNVBAoMGFRydXN0d2F2ZSBI
6114b2xkaW5ncywgSW5jLjExMC8GA1UEAwwoVHJ1c3R3YXZlIEdsb2JhbCBDZXJ0aWZp
6115Y2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIB
6116ALldUShLPDeS0YLOvR29zd24q88KPuFd5dyqCblXAj7mY2Hf8g+CY66j96xz0Xzn
6117swuvCAAJWX/NKSqIk4cXGIDtiLK0thAfLdZfVaITXdHG6wZWiYj+rDKd/VzDBcdu
61187oaJuogDnXIhhpCujwOl3J+IKMujkkkP7NAP4m1ET4BqstTnoApTAbqOl5F2brz8
61191Ws25kCI1nsvXwXoLG0R8+eyvpJETNKXpP7ScoFDB5zpET71ixpZfR9oWN0EACyW
612080OzfpgZdNmcc9kYvkHHNHnZ9GLCQ7mzJ7Aiy/k9UscwR7PJPrhq4ufogXBeQotP
6121JqX+OsIgbrv4Fo7NDKm0G2x2EOFYeUY+VM6AqFcJNykbmROPDMjWLBz7BegIlT1l
6122RtzuzWniTY+HKE40Cz7PFNm73bZQmq131BnW2hqIyE4bJ3XYsgjxroMwuREOzYfw
6123hI0Vcnyh78zyiGG69Gm7DIwLdVcEuE4qFC49DxweMqZiNu5m4iK4BUBjECLzMx10
6124coos9TkpoNPnG4CELcU9402x/RpvumUHO1jsQkUm+9jaJXLE9gCxInm943xZYkqc
6125BW89zubWR2OZxiRvchLIrH+QtAuRcOi35hYQcRfO3gZPSEF9NUqjifLJS3tBEW1n
6126twiYTOURGa5CgNz7kAXU+FDKvuStx8KU1xad5hePrzb7AgMBAAGjQjBAMA8GA1Ud
6127EwEB/wQFMAMBAf8wHQYDVR0OBBYEFJngGWcNYtt2s9o9uFvo/ULSMQ6HMA4GA1Ud
6128DwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAmHNw4rDT7TnsTGDZqRKGFx6W
61290OhUKDtkLSGm+J1WE2pIPU/HPinbbViDVD2HfSMF1OQc3Og4ZYbFdada2zUFvXfe
6130uyk3QAUHw5RSn8pk3fEbK9xGChACMf1KaA0HZJDmHvUqoai7PF35owgLEQzxPy0Q
6131lG/+4jSHg9bP5Rs1bdID4bANqKCqRieCNqcVtgimQlRXtpla4gt5kNdXElE1GYhB
6132aCXUNxeEFfsBctyV3lImIJgm4nb1J2/6ADtKYdkNy1GTKv0WBpanI5ojSP5RvbbE
6133sLFUzt5sQa0WZ37b/TjNuThOssFgy50X31ieemKyJo90lZvkWx3SD92YHJtZuSPT
6134MaCm/zjdzyBP6VhWOmfD0faZmZ26NraAL4hHT4a/RDqA5Dccprrql5gR0IRiR2Qe
6135qu5AvzSxnI9O4fKSTx+O856X3vOmeWqJcU9LJxdI/uz0UA9PSX3MReO9ekDFQdxh
6136VicGaeVyQYHTtgGJoC86cnn+OjC/QezHYj6RS8fZMXZC+fc8Y+wmjHMMfRod6qh8
6137h6jCJ3zhM0EPz8/8AKAigJ5Kp28AsEFFtyLKaEjFQqKu3R3y4G5OBVixwJAWKqQ9
6138EEC+j2Jjg6mcgn0tAumDMHzLJ8n9HmYAsC7TIS+OMxZsmO0QqAfWzJPP29FpHOTK
6139yeC2nOnOcXHebD8WpHk=
6140-----END CERTIFICATE-----
6141=== /C=US/ST=Illinois/L=Chicago/O=Trustwave Holdings, Inc./CN=Trustwave Global ECC P256 Certification Authority
6142Certificate:
6143 Data:
6144 Version: 3 (0x2)
6145 Serial Number:
6146 0d:6a:5f:08:3f:28:5c:3e:51:95:df:5d
6147 Signature Algorithm: ecdsa-with-SHA256
6148 Validity
6149 Not Before: Aug 23 19:35:10 2017 GMT
6150 Not After : Aug 23 19:35:10 2042 GMT
6151 Subject: C=US, ST=Illinois, L=Chicago, O=Trustwave Holdings, Inc., CN=Trustwave Global ECC P256 Certification Authority
6152 X509v3 extensions:
6153 X509v3 Basic Constraints: critical
6154 CA:TRUE
6155 X509v3 Key Usage: critical
6156 Certificate Sign, CRL Sign
6157 X509v3 Subject Key Identifier:
6158 A3:41:06:AC:90:6D:D1:4A:EB:75:A5:4A:10:99:B3:B1:A1:8B:4A:F7
6159SHA1 Fingerprint=B4:90:82:DD:45:0C:BE:8B:5B:B1:66:D3:E2:A4:08:26:CD:ED:42:CF
6160SHA256 Fingerprint=94:5B:BC:82:5E:A5:54:F4:89:D1:FD:51:A7:3D:DF:2E:A6:24:AC:70:19:A0:52:05:22:5C:22:A7:8C:CF:A8:B4
6161-----BEGIN CERTIFICATE-----
6162MIICYDCCAgegAwIBAgIMDWpfCD8oXD5Rld9dMAoGCCqGSM49BAMCMIGRMQswCQYD
6163VQQGEwJVUzERMA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAf
6164BgNVBAoTGFRydXN0d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3
6165YXZlIEdsb2JhbCBFQ0MgUDI1NiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0x
6166NzA4MjMxOTM1MTBaFw00MjA4MjMxOTM1MTBaMIGRMQswCQYDVQQGEwJVUzERMA8G
6167A1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRydXN0
6168d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBF
6169Q0MgUDI1NiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTBZMBMGByqGSM49AgEGCCqG
6170SM49AwEHA0IABH77bOYj43MyCMpg5lOcunSNGLB4kFKA3TjASh3RqMyTpJcGOMoN
6171FWLGjgEqZZ2q3zSRLoHB5DOSMcT9CTqmP62jQzBBMA8GA1UdEwEB/wQFMAMBAf8w
6172DwYDVR0PAQH/BAUDAwcGADAdBgNVHQ4EFgQUo0EGrJBt0UrrdaVKEJmzsaGLSvcw
6173CgYIKoZIzj0EAwIDRwAwRAIgB+ZU2g6gWrKuEZ+Hxbb/ad4lvvigtwjzRM4q3wgh
6174DDcCIC0mA6AFvWvR9lz4ZcyGbbOcNEhjhAnFjXca4syc4XR7
6175-----END CERTIFICATE-----
6176=== /C=US/ST=Illinois/L=Chicago/O=Trustwave Holdings, Inc./CN=Trustwave Global ECC P384 Certification Authority
6177Certificate:
6178 Data:
6179 Version: 3 (0x2)
6180 Serial Number:
6181 08:bd:85:97:6c:99:27:a4:80:68:47:3b
6182 Signature Algorithm: ecdsa-with-SHA384
6183 Validity
6184 Not Before: Aug 23 19:36:43 2017 GMT
6185 Not After : Aug 23 19:36:43 2042 GMT
6186 Subject: C=US, ST=Illinois, L=Chicago, O=Trustwave Holdings, Inc., CN=Trustwave Global ECC P384 Certification Authority
6187 X509v3 extensions:
6188 X509v3 Basic Constraints: critical
6189 CA:TRUE
6190 X509v3 Key Usage: critical
6191 Certificate Sign, CRL Sign
6192 X509v3 Subject Key Identifier:
6193 55:A9:84:89:D2:C1:32:BD:18:CB:6C:A6:07:4E:C8:E7:9D:BE:82:90
6194SHA1 Fingerprint=E7:F3:A3:C8:CF:6F:C3:04:2E:6D:0E:67:32:C5:9E:68:95:0D:5E:D2
6195SHA256 Fingerprint=55:90:38:59:C8:C0:C3:EB:B8:75:9E:CE:4E:25:57:22:5F:F5:75:8B:BD:38:EB:D4:82:76:60:1E:1B:D5:80:97
6196-----BEGIN CERTIFICATE-----
6197MIICnTCCAiSgAwIBAgIMCL2Fl2yZJ6SAaEc7MAoGCCqGSM49BAMDMIGRMQswCQYD
6198VQQGEwJVUzERMA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAf
6199BgNVBAoTGFRydXN0d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3
6200YXZlIEdsb2JhbCBFQ0MgUDM4NCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0x
6201NzA4MjMxOTM2NDNaFw00MjA4MjMxOTM2NDNaMIGRMQswCQYDVQQGEwJVUzERMA8G
6202A1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRydXN0
6203d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBF
6204Q0MgUDM4NCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTB2MBAGByqGSM49AgEGBSuB
6205BAAiA2IABGvaDXU1CDFHBa5FmVXxERMuSvgQMSOjfoPTfygIOiYaOs+Xgh+AtycJ
6206j9GOMMQKmw6sWASr9zZ9lCOkmwqKi6vr/TklZvFe/oyujUF5nQlgziip04pt89ZF
62071PKYhDhloKNDMEEwDwYDVR0TAQH/BAUwAwEB/zAPBgNVHQ8BAf8EBQMDBwYAMB0G
6208A1UdDgQWBBRVqYSJ0sEyvRjLbKYHTsjnnb6CkDAKBggqhkjOPQQDAwNnADBkAjA3
6209AZKXRRJ+oPM+rRk6ct30UJMDEr5E0k9BpIycnR+j9sKS50gU/k6bpZFXrsY3crsC
6210MGclCrEMXu6pY5Jv5ZAL/mYiykf9ijH3g/56vxC+GCsej/YpHpRZ744hN8tRmKVu
6211Sw==
6212-----END CERTIFICATE-----
6213
6214### Turkiye Bilimsel ve Teknolojik Arastirma Kurumu - TUBITAK 5163### Turkiye Bilimsel ve Teknolojik Arastirma Kurumu - TUBITAK
6215 5164
6216=== /C=TR/L=Gebze - Kocaeli/O=Turkiye Bilimsel ve Teknolojik Arastirma Kurumu - TUBITAK/OU=Kamu Sertifikasyon Merkezi - Kamu SM/CN=TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1 5165=== /C=TR/L=Gebze - Kocaeli/O=Turkiye Bilimsel ve Teknolojik Arastirma Kurumu - TUBITAK/OU=Kamu Sertifikasyon Merkezi - Kamu SM/CN=TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1
@@ -6492,106 +5441,6 @@ rYy0UGYwEAYJKwYBBAGCNxUBBAMCAQAwCgYIKoZIzj0EAwMDaAAwZQIwJsdpW9zV
6492Mgj/mkkCtojeFK9dbJlxjRo/i9fgojaGHAeCOnZT/cKi7e97sIBPWA9LUzm9 5441Mgj/mkkCtojeFK9dbJlxjRo/i9fgojaGHAeCOnZT/cKi7e97sIBPWA9LUzm9
6493-----END CERTIFICATE----- 5442-----END CERTIFICATE-----
6494 5443
6495### certSIGN
6496
6497=== /C=RO/O=certSIGN/OU=certSIGN ROOT CA
6498Certificate:
6499 Data:
6500 Version: 3 (0x2)
6501 Serial Number: 35210227249154 (0x200605167002)
6502 Signature Algorithm: sha1WithRSAEncryption
6503 Validity
6504 Not Before: Jul 4 17:20:04 2006 GMT
6505 Not After : Jul 4 17:20:04 2031 GMT
6506 Subject: C=RO, O=certSIGN, OU=certSIGN ROOT CA
6507 X509v3 extensions:
6508 X509v3 Basic Constraints: critical
6509 CA:TRUE
6510 X509v3 Key Usage: critical
6511 Digital Signature, Non Repudiation, Certificate Sign, CRL Sign
6512 X509v3 Subject Key Identifier:
6513 E0:8C:9B:DB:25:49:B3:F1:7C:86:D6:B2:42:87:0B:D0:6B:A0:D9:E4
6514SHA1 Fingerprint=FA:B7:EE:36:97:26:62:FB:2D:B0:2A:F6:BF:03:FD:E8:7C:4B:2F:9B
6515SHA256 Fingerprint=EA:A9:62:C4:FA:4A:6B:AF:EB:E4:15:19:6D:35:1C:CD:88:8D:4F:53:F3:FA:8A:E6:D7:C4:66:A9:4E:60:42:BB
6516-----BEGIN CERTIFICATE-----
6517MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYT
6518AlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBD
6519QTAeFw0wNjA3MDQxNzIwMDRaFw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJP
6520MREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTCC
6521ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7IJUqOtdu0KBuqV5Do
65220SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHHrfAQ
6523UySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5d
6524RdY4zTW2ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQ
6525OA7+j0xbm0bqQfWwCHTD0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwv
6526JoIQ4uNllAoEwF73XVv4EOLQunpL+943AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08C
6527AwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAcYwHQYDVR0O
6528BBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IBAQA+0hyJ
6529LjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecY
6530MnQ8SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ
653144gx+FkagQnIl6Z0x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6I
6532Jd1hJyMctTEHBDa0GpC9oHRxUIltvBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNw
6533i/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7NzTogVZ96edhBiIL5VaZVDADlN
65349u6wWk5JRFRYX0KD
6535-----END CERTIFICATE-----
6536
6537### e-commerce monitoring GmbH
6538
6539=== /C=AT/O=e-commerce monitoring GmbH/CN=GLOBALTRUST 2020
6540Certificate:
6541 Data:
6542 Version: 3 (0x2)
6543 Serial Number:
6544 5a:4b:bd:5a:fb:4f:8a:5b:fa:65:e5
6545 Signature Algorithm: sha256WithRSAEncryption
6546 Validity
6547 Not Before: Feb 10 00:00:00 2020 GMT
6548 Not After : Jun 10 00:00:00 2040 GMT
6549 Subject: C=AT, O=e-commerce monitoring GmbH, CN=GLOBALTRUST 2020
6550 X509v3 extensions:
6551 X509v3 Basic Constraints: critical
6552 CA:TRUE
6553 X509v3 Key Usage: critical
6554 Certificate Sign, CRL Sign
6555 X509v3 Subject Key Identifier:
6556 DC:2E:1F:D1:61:37:79:E4:AB:D5:D5:B3:12:71:68:3D:6A:68:9C:22
6557 X509v3 Authority Key Identifier:
6558 keyid:DC:2E:1F:D1:61:37:79:E4:AB:D5:D5:B3:12:71:68:3D:6A:68:9C:22
6559
6560SHA1 Fingerprint=D0:67:C1:13:51:01:0C:AA:D0:C7:6A:65:37:31:16:26:4F:53:71:A2
6561SHA256 Fingerprint=9A:29:6A:51:82:D1:D4:51:A2:E3:7F:43:9B:74:DA:AF:A2:67:52:33:29:F9:0F:9A:0D:20:07:C3:34:E2:3C:9A
6562-----BEGIN CERTIFICATE-----
6563MIIFgjCCA2qgAwIBAgILWku9WvtPilv6ZeUwDQYJKoZIhvcNAQELBQAwTTELMAkG
6564A1UEBhMCQVQxIzAhBgNVBAoTGmUtY29tbWVyY2UgbW9uaXRvcmluZyBHbWJIMRkw
6565FwYDVQQDExBHTE9CQUxUUlVTVCAyMDIwMB4XDTIwMDIxMDAwMDAwMFoXDTQwMDYx
6566MDAwMDAwMFowTTELMAkGA1UEBhMCQVQxIzAhBgNVBAoTGmUtY29tbWVyY2UgbW9u
6567aXRvcmluZyBHbWJIMRkwFwYDVQQDExBHTE9CQUxUUlVTVCAyMDIwMIICIjANBgkq
6568hkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAri5WrRsc7/aVj6B3GyvTY4+ETUWiD59b
6569RatZe1E0+eyLinjF3WuvvcTfk0Uev5E4C64OFudBc/jbu9G4UeDLgztzOG53ig9Z
6570YybNpyrOVPu44sB8R85gfD+yc/LAGbaKkoc1DZAoouQVBGM+uq/ufF7MpotQsjj3
6571QWPKzv9pj2gOlTblzLmMCcpL3TGQlsjMH/1WljTbjhzqLL6FLmPdqqmV0/0plRPw
6572yJiT2S0WR5ARg6I6IqIoV6Lr/sCMKKCmfecqQjuCgGOlYx8ZzHyyZqjC0203b+J+
6573BlHZRYQfEs4kUmSFC0iAToexIiIwquuuvuAC4EDosEKAA1GqtH6qRNdDYfOiaxaJ
6574SaSjpCuKAsR49GiKweR6NrFvG5Ybd0mN1MkGco/PU+PcF4UgStyYJ9ORJitHHmkH
6575r96i5OTUawuzXnzUJIBHKWk7buis/UDr2O1xcSvy6Fgd60GXIsUf1DnQJ4+H4xj0
65764KlGDfV0OoIu0G4skaMxXDtG6nsEEFZegB31pWXogvziB4xiRfUg3kZwhqG8k9Me
6577dKZssCz3AwyIDMvUclOGvGBG85hqwvG/Q/lwIHfKN0F5VVJjjVsSn8VoxIidrPIw
6578q7ejMZdnrY8XD2zHc+0klGvIg5rQmjdJBKuxFshsSUktq6HQjJLyQUp5ISXbY9e2
6579nKd+Qmn7OmMCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
6580AQYwHQYDVR0OBBYEFNwuH9FhN3nkq9XVsxJxaD1qaJwiMB8GA1UdIwQYMBaAFNwu
6581H9FhN3nkq9XVsxJxaD1qaJwiMA0GCSqGSIb3DQEBCwUAA4ICAQCR8EICaEDuw2jA
6582VC/f7GLDw56KoDEoqoOOpFaWEhCGVrqXctJUMHytGdUdaG/7FELYjQ7ztdGl4wJC
6583XtzoRlgHNQIw4Lx0SsFDKv/bGtCwr2zD/cuz9X9tAy5ZVp0tLTWMstZDFyySCstd
65846IwPS3BD0IL/qMy/pJTAvoe9iuOTe8aPmxadJ2W8esVCgmxcB9CpwYhgROmYhRZf
6585+I/KARDOJcP5YBugxZfD0yyIMaK9MOzQ0MAS8cE54+X1+NZK3TTN+2/BT+MAi1bi
6586kvcoskJ3ciNnxz8RFbLEAwW+uxF7Cr+obuf/WEPPm2eggAe2HcqtbepBEX4tdJP7
6587wry+UUTF72glJ4DjyKDUEuzZpTcdN3y0kcra1LGWge9oXHYQSa9+pTeAsRxSvTOB
6588TI/53WXZFM2KJVj04sWDpQmQ1GwUY7VA3+vA/MRYfg0UFodUJ25W5HCEuGwyEn6C
6589MUO+1918oa2u1qsgEu8KwxCMSZY13At1XrFP1U80DhEgB3VDRemjEdqso5nCtnkn
65904rnvyOL2NSl6dPrFf4IFYqYK6miyeUcGbvJXqBUzxvd4Sj1Ce2t+/vdG6tHrju+I
6591aFvowdlxfv1k7/9nR4hYJS8+hge9+6jlgqispdNpQ80xiEmEU5LAsTkbOYMBMMTy
6592qfrQA71yN2BWHzZ8vTmR9W0Nv3vXkg==
6593-----END CERTIFICATE-----
6594
6595### eMudhra Inc 5444### eMudhra Inc
6596 5445
6597=== /C=US/OU=emSign PKI/O=eMudhra Inc/CN=emSign ECC Root CA - C3 5446=== /C=US/OU=emSign PKI/O=eMudhra Inc/CN=emSign ECC Root CA - C3
diff --git a/src/lib/libcrypto/cms/cms_kari.c b/src/lib/libcrypto/cms/cms_kari.c
index c23da18058..a16f51a569 100644
--- a/src/lib/libcrypto/cms/cms_kari.c
+++ b/src/lib/libcrypto/cms/cms_kari.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cms_kari.c,v 1.18 2025/05/10 05:54:38 tb Exp $ */ 1/* $OpenBSD: cms_kari.c,v 1.19 2026/08/27 07:13:34 tb Exp $ */
2/* 2/*
3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
4 * project. 4 * project.
@@ -250,6 +250,7 @@ cms_kek_cipher(unsigned char **pout, size_t *poutlen, const unsigned char *in,
250 size_t keklen; 250 size_t keklen;
251 int rv = 0; 251 int rv = 0;
252 unsigned char *out = NULL; 252 unsigned char *out = NULL;
253 size_t outsize = 0;
253 int outlen; 254 int outlen;
254 255
255 keklen = EVP_CIPHER_CTX_key_length(kari->ctx); 256 keklen = EVP_CIPHER_CTX_key_length(kari->ctx);
@@ -264,7 +265,11 @@ cms_kek_cipher(unsigned char **pout, size_t *poutlen, const unsigned char *in,
264 /* obtain output length of ciphered key */ 265 /* obtain output length of ciphered key */
265 if (!EVP_CipherUpdate(kari->ctx, NULL, &outlen, in, inlen)) 266 if (!EVP_CipherUpdate(kari->ctx, NULL, &outlen, in, inlen))
266 goto err; 267 goto err;
267 out = malloc(outlen); 268
269 outsize = outlen;
270 if (outsize < inlen)
271 outsize = inlen;
272 out = malloc(outsize);
268 if (out == NULL) 273 if (out == NULL)
269 goto err; 274 goto err;
270 if (!EVP_CipherUpdate(kari->ctx, out, &outlen, in, inlen)) 275 if (!EVP_CipherUpdate(kari->ctx, out, &outlen, in, inlen))
@@ -276,7 +281,7 @@ cms_kek_cipher(unsigned char **pout, size_t *poutlen, const unsigned char *in,
276 err: 281 err:
277 explicit_bzero(kek, keklen); 282 explicit_bzero(kek, keklen);
278 if (!rv) 283 if (!rv)
279 free(out); 284 freezero(out, outsize);
280 (void)EVP_CIPHER_CTX_reset(kari->ctx); 285 (void)EVP_CIPHER_CTX_reset(kari->ctx);
281 /* FIXME: WHY IS kari->pctx freed here? /RL */ 286 /* FIXME: WHY IS kari->pctx freed here? /RL */
282 EVP_PKEY_CTX_free(kari->pctx); 287 EVP_PKEY_CTX_free(kari->pctx);
diff --git a/src/lib/libcrypto/cms/cms_pwri.c b/src/lib/libcrypto/cms/cms_pwri.c
index f64f4ab68c..36a53568d1 100644
--- a/src/lib/libcrypto/cms/cms_pwri.c
+++ b/src/lib/libcrypto/cms/cms_pwri.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cms_pwri.c,v 1.35 2025/09/30 12:51:16 tb Exp $ */ 1/* $OpenBSD: cms_pwri.c,v 1.37 2026/06/09 12:20:34 tb Exp $ */
2/* 2/*
3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
4 * project. 4 * project.
@@ -232,6 +232,10 @@ kek_unwrap_key(unsigned char *out, size_t *outlen, const unsigned char *in,
232 unsigned char *tmp; 232 unsigned char *tmp;
233 int outl, rv = 0; 233 int outl, rv = 0;
234 234
235 /* Ensure inlen is large enough that tmp[6] is in bounds. */
236 if (blocklen < 4)
237 return 0;
238
235 if (inlen < 2 * blocklen) { 239 if (inlen < 2 * blocklen) {
236 /* too small */ 240 /* too small */
237 return 0; 241 return 0;
@@ -386,6 +390,10 @@ cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri,
386 } 390 }
387 391
388 algtmp = pwri->keyDerivationAlgorithm; 392 algtmp = pwri->keyDerivationAlgorithm;
393 if (algtmp == NULL) {
394 CMSerror(CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER);
395 goto err;
396 }
389 397
390 /* Finish password based key derivation to setup key in "ctx" */ 398 /* Finish password based key derivation to setup key in "ctx" */
391 399
diff --git a/src/lib/libcrypto/conf/conf_api.c b/src/lib/libcrypto/conf/conf_api.c
index 0d5a67d9a5..f04243d36c 100644
--- a/src/lib/libcrypto/conf/conf_api.c
+++ b/src/lib/libcrypto/conf/conf_api.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: conf_api.c,v 1.29 2025/12/21 07:31:22 tb Exp $ */ 1/* $OpenBSD: conf_api.c,v 1.30 2026/06/22 08:45:55 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 *
@@ -76,12 +76,13 @@ _CONF_get_section(const CONF *conf, const char *section)
76{ 76{
77 CONF_VALUE *v, vv; 77 CONF_VALUE *v, vv;
78 78
79 if ((conf == NULL) || (section == NULL)) 79 if (conf == NULL || section == NULL)
80 return (NULL); 80 return NULL;
81 vv.name = NULL; 81 vv.name = NULL;
82 vv.section = (char *)section; 82 vv.section = (char *)section;
83 v = lh_CONF_VALUE_retrieve(conf->data, &vv); 83 v = lh_CONF_VALUE_retrieve(conf->data, &vv);
84 return (v); 84
85 return v;
85} 86}
86 87
87int 88int
@@ -113,24 +114,24 @@ _CONF_get_string(const CONF *conf, const char *section, const char *name)
113 CONF_VALUE *v, vv; 114 CONF_VALUE *v, vv;
114 115
115 if (name == NULL) 116 if (name == NULL)
116 return (NULL); 117 return NULL;
117 if (conf != NULL) { 118 if (conf != NULL) {
118 if (section != NULL) { 119 if (section != NULL) {
119 vv.name = (char *)name; 120 vv.name = (char *)name;
120 vv.section = (char *)section; 121 vv.section = (char *)section;
121 v = lh_CONF_VALUE_retrieve(conf->data, &vv); 122 v = lh_CONF_VALUE_retrieve(conf->data, &vv);
122 if (v != NULL) 123 if (v != NULL)
123 return (v->value); 124 return v->value;
124 } 125 }
125 vv.section = "default"; 126 vv.section = "default";
126 vv.name = (char *)name; 127 vv.name = (char *)name;
127 v = lh_CONF_VALUE_retrieve(conf->data, &vv); 128 v = lh_CONF_VALUE_retrieve(conf->data, &vv);
128 if (v != NULL) 129 if (v != NULL)
129 return (v->value); 130 return v->value;
130 else 131 else
131 return (NULL); 132 return NULL;
132 } else 133 } else
133 return (NULL); 134 return NULL;
134} 135}
135 136
136static unsigned long 137static unsigned long
@@ -149,15 +150,15 @@ conf_value_cmp(const CONF_VALUE *a, const CONF_VALUE *b)
149 if (a->section != b->section) { 150 if (a->section != b->section) {
150 i = strcmp(a->section, b->section); 151 i = strcmp(a->section, b->section);
151 if (i) 152 if (i)
152 return (i); 153 return i;
153 } 154 }
154 if ((a->name != NULL) && (b->name != NULL)) { 155 if ((a->name != NULL) && (b->name != NULL)) {
155 i = strcmp(a->name, b->name); 156 i = strcmp(a->name, b->name);
156 return (i); 157 return i;
157 } else if (a->name == b->name) 158 } else if (a->name == b->name)
158 return (0); 159 return 0;
159 else 160 else
160 return ((a->name == NULL)?-1 : 1); 161 return a->name == NULL ? -1 : 1;
161} 162}
162 163
163static IMPLEMENT_LHASH_COMP_FN(conf_value, CONF_VALUE) 164static IMPLEMENT_LHASH_COMP_FN(conf_value, CONF_VALUE)
diff --git a/src/lib/libcrypto/conf/conf_mod.c b/src/lib/libcrypto/conf/conf_mod.c
index 6e697cc478..f90cf0f729 100644
--- a/src/lib/libcrypto/conf/conf_mod.c
+++ b/src/lib/libcrypto/conf/conf_mod.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: conf_mod.c,v 1.41 2025/05/10 05:54:38 tb Exp $ */ 1/* $OpenBSD: conf_mod.c,v 1.42 2026/07/31 00:50:52 kenjiro 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 */
@@ -65,6 +65,7 @@
65#include <openssl/crypto.h> 65#include <openssl/crypto.h>
66#include <openssl/x509.h> 66#include <openssl/x509.h>
67 67
68#include "conf_local.h"
68#include "err_local.h" 69#include "err_local.h"
69 70
70/* This structure contains data about supported modules. */ 71/* This structure contains data about supported modules. */
diff --git a/src/lib/libcrypto/conf/ssleay.cnf b/src/lib/libcrypto/conf/ssleay.cnf
deleted file mode 100644
index ed33af601e..0000000000
--- a/src/lib/libcrypto/conf/ssleay.cnf
+++ /dev/null
@@ -1,78 +0,0 @@
1#
2# This is a test configuration file for use in SSLeay etc...
3#
4
5init = 5
6in\#it1 =10
7init2='10'
8init3='10\''
9init4="10'"
10init5='='10\'' again'
11
12SSLeay::version = 0.5.0
13
14[genrsa]
15default_bits = 512
16SSLEAY::version = 0.5.0
17
18[gendh]
19default_bits = 512
20def_generator = 2
21
22[s_client]
23cipher1 = DES_CBC_MD5:DES_CBC_SHA:DES_EDE_SHA:RC4_MD5\
24cipher2 = 'DES_CBC_MD5 DES_CBC_SHA DES_EDE_SHA RC4_MD5'
25cipher3 = "DES_CBC_MD5 DES_CBC_SHA DES_EDE_SHA RC4_MD5"
26cipher4 = DES_CBC_MD5 DES_CBC_SHA DES_EDE_SHA RC4_MD5
27
28[ default ]
29cert_dir = $ENV::HOME/.ca_certs
30
31HOME = /tmp/eay
32
33tmp_cert_dir = $HOME/.ca_certs
34tmp2_cert_dir = thisis$(HOME)stuff
35
36LOGNAME = Eric Young (home=$HOME)
37
38[ special ]
39
40H=$HOME
41H=$default::HOME
42H=$ENV::HOME
43#
44# SSLeay example configuration file.
45# This is mostly being used for generation of certificate requests.
46#
47
48RANDFILE = $HOME/.rand
49
50[ req ]
51default_bits = 512
52default_keyfile = privkey.pem
53
54Attribute_type_1 = countryName
55Attribute_text_1 = Country Name (2 letter code)
56Attribute_default_1 = AU
57
58Attribute_type_2 = stateOrProvinceName
59Attribute_text_2 = State or Province Name (full name)
60Attribute_default_2 = Queensland
61
62Attribute_type_3 = localityName
63Attribute_text_3 = Locality Name (eg, city)
64
65Attribute_type_4 = organizationName
66Attribute_text_4 = Organization Name (eg, company)
67Attribute_default_4 = Mincom Pty Ltd
68
69Attribute_type_5 = organizationalUnitName
70Attribute_text_5 = Organizational Unit Name (eg, section)
71Attribute_default_5 = TR
72
73Attribute_type_6 = commonName
74Attribute_text_6 = Common Name (eg, YOUR name)
75
76Attribute_type_7 = emailAddress
77Attribute_text_7 = Email Address
78
diff --git a/src/lib/libcrypto/crypto.h b/src/lib/libcrypto/crypto.h
index 9fcf868403..2a121dda85 100644
--- a/src/lib/libcrypto/crypto.h
+++ b/src/lib/libcrypto/crypto.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: crypto.h,v 1.80 2025/09/28 07:52:53 tb Exp $ */ 1/* $OpenBSD: crypto.h,v 1.81 2026/08/30 12:19:37 kenjiro Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -305,8 +305,7 @@ void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);
305 * (relative to the class type involved) */ 305 * (relative to the class type involved) */
306int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val); 306int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val);
307void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx); 307void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx);
308/* This function cleans up all "ex_data" state. It mustn't be called under 308/* Deprecated no-op retained for compatibility. */
309 * potential race-conditions. */
310void CRYPTO_cleanup_all_ex_data(void); 309void CRYPTO_cleanup_all_ex_data(void);
311 310
312void CRYPTO_lock(int mode, int type, const char *file, int line); 311void CRYPTO_lock(int mode, int type, const char *file, int line);
diff --git a/src/lib/libcrypto/crypto_assembly.h b/src/lib/libcrypto/crypto_assembly.h
index 0ae78a81ab..e42ed947dd 100644
--- a/src/lib/libcrypto/crypto_assembly.h
+++ b/src/lib/libcrypto/crypto_assembly.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: crypto_assembly.h,v 1.1 2026/03/28 13:09:55 jsing Exp $ */ 1/* $OpenBSD: crypto_assembly.h,v 1.5 2026/05/07 15:50:47 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2026 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2026 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -27,4 +27,47 @@
27#endif 27#endif
28#endif 28#endif
29 29
30#if defined(__APPLE__) && defined(__aarch64__)
31#define CRYPTO_ASSEMBLY_SEPARATOR %%
32#else
33#define CRYPTO_ASSEMBLY_SEPARATOR ;
34#endif
35
36#if defined(__APPLE__)
37#define CRYPTO_ASSEMBLY_SECTION_TEXT __TEXT,__text
38#define CRYPTO_ASSEMBLY_SECTION_RODATA __DATA,__const
39
40#define CRYPTO_ASSEMBLY_SYMBOL_NAME(name) _name
41#define CRYPTO_ASSEMBLY_TYPE_FUNCTION(name)
42#define CRYPTO_ASSEMBLY_TYPE_OBJECT(name)
43#define CRYPTO_ASSEMBLY_OBJECT_SIZE(name)
44
45#define CRYPTO_ASSEMBLY_AARCH64_SYM_HI(name) name@PAGE
46#define CRYPTO_ASSEMBLY_AARCH64_SYM_LO(name) name@PAGEOFF
47
48#else
49#define CRYPTO_ASSEMBLY_SECTION_TEXT .text
50#define CRYPTO_ASSEMBLY_SECTION_RODATA .rodata
51
52#define CRYPTO_ASSEMBLY_SYMBOL_NAME(name) name
53#define CRYPTO_ASSEMBLY_TYPE_FUNCTION(name) .type name,@function
54#define CRYPTO_ASSEMBLY_TYPE_OBJECT(name) .type name,@object
55#define CRYPTO_ASSEMBLY_OBJECT_SIZE(name) .size name,.-name
56
57#define CRYPTO_ASSEMBLY_AARCH64_SYM_HI(name) name
58#define CRYPTO_ASSEMBLY_AARCH64_SYM_LO(name) :lo12:name
59#endif
60
61#define CRYPTO_ASSEMBLY_GLOBAL_FUNCTION(name) \
62 .global CRYPTO_ASSEMBLY_SYMBOL_NAME(name) CRYPTO_ASSEMBLY_SEPARATOR \
63 CRYPTO_ASSEMBLY_TYPE_FUNCTION(name) CRYPTO_ASSEMBLY_SEPARATOR \
64 CRYPTO_ASSEMBLY_SYMBOL_NAME(name)
65
66#define CRYPTO_ASSEMBLY_OBJECT_START(name) \
67 CRYPTO_ASSEMBLY_TYPE_OBJECT(name) CRYPTO_ASSEMBLY_SEPARATOR \
68 name
69
70#define CRYPTO_ASSEMBLY_OBJECT_END(name) \
71 CRYPTO_ASSEMBLY_OBJECT_SIZE(name)
72
30#endif 73#endif
diff --git a/src/lib/libcrypto/crypto_ex_data.c b/src/lib/libcrypto/crypto_ex_data.c
index 233905f888..2066098653 100644
--- a/src/lib/libcrypto/crypto_ex_data.c
+++ b/src/lib/libcrypto/crypto_ex_data.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: crypto_ex_data.c,v 1.6 2025/06/15 15:58:56 tb Exp $ */ 1/* $OpenBSD: crypto_ex_data.c,v 1.7 2026/08/30 12:19:37 kenjiro Exp $ */
2/* 2/*
3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -19,6 +19,8 @@
19 19
20#include <openssl/crypto.h> 20#include <openssl/crypto.h>
21 21
22#include "crypto_internal.h"
23
22#define CRYPTO_EX_DATA_MAX_INDEX 32 24#define CRYPTO_EX_DATA_MAX_INDEX 32
23 25
24struct crypto_ex_data { 26struct crypto_ex_data {
@@ -151,6 +153,16 @@ LCRYPTO_ALIAS(CRYPTO_get_ex_new_index);
151void 153void
152CRYPTO_cleanup_all_ex_data(void) 154CRYPTO_cleanup_all_ex_data(void)
153{ 155{
156}
157LCRYPTO_ALIAS(CRYPTO_cleanup_all_ex_data);
158
159/*
160 * Free process-wide ex_data state during OPENSSL_cleanup(). The caller must
161 * ensure that no other thread is using libcrypto.
162 */
163void
164crypto_ex_data_cleanup(void)
165{
154 struct crypto_ex_data_class *class; 166 struct crypto_ex_data_class *class;
155 int i, j; 167 int i, j;
156 168
@@ -173,7 +185,6 @@ CRYPTO_cleanup_all_ex_data(void)
173 free(classes); 185 free(classes);
174 classes = NULL; 186 classes = NULL;
175} 187}
176LCRYPTO_ALIAS(CRYPTO_cleanup_all_ex_data);
177 188
178static void 189static void
179crypto_ex_data_clear(CRYPTO_EX_DATA *exdata) 190crypto_ex_data_clear(CRYPTO_EX_DATA *exdata)
diff --git a/src/lib/libcrypto/crypto_init.c b/src/lib/libcrypto/crypto_init.c
index ae4914e358..5b7ce3d4fa 100644
--- a/src/lib/libcrypto/crypto_init.c
+++ b/src/lib/libcrypto/crypto_init.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: crypto_init.c,v 1.26 2025/06/11 07:41:12 tb Exp $ */ 1/* $OpenBSD: crypto_init.c,v 1.27 2026/08/30 12:19:37 kenjiro Exp $ */
2/* 2/*
3 * Copyright (c) 2018 Bob Beck <beck@openbsd.org> 3 * Copyright (c) 2018 Bob Beck <beck@openbsd.org>
4 * 4 *
@@ -107,7 +107,7 @@ OPENSSL_cleanup(void)
107 /* This currently calls init... */ 107 /* This currently calls init... */
108 ERR_free_strings(); 108 ERR_free_strings();
109 109
110 CRYPTO_cleanup_all_ex_data(); 110 crypto_ex_data_cleanup();
111 EVP_cleanup(); 111 EVP_cleanup();
112 112
113 X509_VERIFY_PARAM_table_cleanup(); 113 X509_VERIFY_PARAM_table_cleanup();
diff --git a/src/lib/libcrypto/crypto_internal.h b/src/lib/libcrypto/crypto_internal.h
index 058245e95e..2dce750724 100644
--- a/src/lib/libcrypto/crypto_internal.h
+++ b/src/lib/libcrypto/crypto_internal.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: crypto_internal.h,v 1.16 2025/07/22 09:18:02 jsing Exp $ */ 1/* $OpenBSD: crypto_internal.h,v 1.17 2026/08/30 12:19:37 kenjiro Exp $ */
2/* 2/*
3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -299,5 +299,6 @@ crypto_ror_u64(uint64_t v, size_t shift)
299#endif 299#endif
300 300
301void crypto_cpu_caps_init(void); 301void crypto_cpu_caps_init(void);
302void crypto_ex_data_cleanup(void);
302 303
303#endif 304#endif
diff --git a/src/lib/libcrypto/ct/ct_x509v3.c b/src/lib/libcrypto/ct/ct_x509v3.c
index b14ffc9532..c4cf9b823d 100644
--- a/src/lib/libcrypto/ct/ct_x509v3.c
+++ b/src/lib/libcrypto/ct/ct_x509v3.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ct_x509v3.c,v 1.7 2024/07/13 15:08:58 tb Exp $ */ 1/* $OpenBSD: ct_x509v3.c,v 1.8 2026/07/31 00:50:52 kenjiro Exp $ */
2/* 2/*
3 * Written by Rob Stradling (rob@comodo.com) and Stephen Henson 3 * Written by Rob Stradling (rob@comodo.com) and Stephen Henson
4 * (steve@openssl.org) for the OpenSSL project 2014. 4 * (steve@openssl.org) for the OpenSSL project 2014.
@@ -64,6 +64,7 @@
64#include <string.h> 64#include <string.h>
65 65
66#include "ct_local.h" 66#include "ct_local.h"
67#include "x509_local.h"
67 68
68static char * 69static char *
69i2s_poison(const X509V3_EXT_METHOD *method, void *val) 70i2s_poison(const X509V3_EXT_METHOD *method, void *val)
diff --git a/src/lib/libcrypto/ec/ec_ameth.c b/src/lib/libcrypto/ec/ec_ameth.c
index ddc8adea1e..d1654d4041 100644
--- a/src/lib/libcrypto/ec/ec_ameth.c
+++ b/src/lib/libcrypto/ec/ec_ameth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec_ameth.c,v 1.74 2025/05/10 05:54:38 tb Exp $ */ 1/* $OpenBSD: ec_ameth.c,v 1.75 2026/07/31 00:50:52 kenjiro 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 2006. 3 * project 2006.
4 */ 4 */
@@ -73,6 +73,7 @@
73 73
74#include "asn1_local.h" 74#include "asn1_local.h"
75#include "bn_local.h" 75#include "bn_local.h"
76#include "ec_local.h"
76#include "err_local.h" 77#include "err_local.h"
77#include "evp_local.h" 78#include "evp_local.h"
78#include "x509_local.h" 79#include "x509_local.h"
diff --git a/src/lib/libcrypto/ec/ec_convert.c b/src/lib/libcrypto/ec/ec_convert.c
index 3b88bd20ba..ca79a898db 100644
--- a/src/lib/libcrypto/ec/ec_convert.c
+++ b/src/lib/libcrypto/ec/ec_convert.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec_convert.c,v 1.16 2025/12/26 18:44:19 tb Exp $ */ 1/* $OpenBSD: ec_convert.c,v 1.17 2026/06/07 11:17:15 tb Exp $ */
2/* 2/*
3 * Originally written by Bodo Moeller for the OpenSSL project. 3 * Originally written by Bodo Moeller for the OpenSSL project.
4 */ 4 */
@@ -78,8 +78,8 @@
78 * at infinity. In compressed and hybrid form bit 1 indicates if the even 78 * at infinity. In compressed and hybrid form bit 1 indicates if the even
79 * or the odd solution of the quadratic equation for y should be used. 79 * or the odd solution of the quadratic equation for y should be used.
80 * 80 *
81 * The public point_conversion_t enum lacks the point at infinity, so we 81 * The public point_conversion_form_t enum lacks the point at infinity,
82 * ignore it except at the API boundary. 82 * so we ignore it except at the API boundary.
83 */ 83 */
84 84
85#define EC_POINT_YBIT 0x01 85#define EC_POINT_YBIT 0x01
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c
index 30b2cf95b8..fc66d29a9f 100644
--- a/src/lib/libcrypto/ec/ec_lib.c
+++ b/src/lib/libcrypto/ec/ec_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec_lib.c,v 1.131 2025/12/26 18:49:13 tb Exp $ */ 1/* $OpenBSD: ec_lib.c,v 1.132 2026/06/09 05:23:30 tb Exp $ */
2/* 2/*
3 * Originally written by Bodo Moeller for the OpenSSL project. 3 * Originally written by Bodo Moeller for the OpenSSL project.
4 */ 4 */
@@ -972,7 +972,7 @@ EC_POINT_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *point,
972 BN_CTX *ctx = NULL; 972 BN_CTX *ctx = NULL;
973 int ret = 0; 973 int ret = 0;
974 974
975 if (EC_POINT_is_at_infinity(group, point) > 0) { 975 if (EC_POINT_is_at_infinity(group, point)) {
976 ECerror(EC_R_POINT_AT_INFINITY); 976 ECerror(EC_R_POINT_AT_INFINITY);
977 goto err; 977 goto err;
978 } 978 }
diff --git a/src/lib/libcrypto/ecdh/ecdh.c b/src/lib/libcrypto/ecdh/ecdh.c
index f970db7750..218c584558 100644
--- a/src/lib/libcrypto/ecdh/ecdh.c
+++ b/src/lib/libcrypto/ecdh/ecdh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ecdh.c,v 1.13 2026/03/18 08:02:40 tb Exp $ */ 1/* $OpenBSD: ecdh.c,v 1.15 2026/06/09 05:24:47 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. 3 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
4 * 4 *
@@ -169,8 +169,15 @@ ec_key_ecdh_compute_key(unsigned char **out, size_t *out_len,
169 if ((group = EC_KEY_get0_group(ecdh)) == NULL) 169 if ((group = EC_KEY_get0_group(ecdh)) == NULL)
170 goto err; 170 goto err;
171 171
172 if (EC_POINT_is_on_curve(group, pub_key, ctx) <= 0) 172 if (EC_POINT_is_at_infinity(group, pub_key)) {
173 ECerror(EC_R_POINT_AT_INFINITY);
173 goto err; 174 goto err;
175 }
176
177 if (EC_POINT_is_on_curve(group, pub_key, ctx) <= 0) {
178 ECerror(EC_R_POINT_IS_NOT_ON_CURVE);
179 goto err;
180 }
174 181
175 if ((point = EC_POINT_new(group)) == NULL) { 182 if ((point = EC_POINT_new(group)) == NULL) {
176 ECerror(ERR_R_MALLOC_FAILURE); 183 ECerror(ERR_R_MALLOC_FAILURE);
diff --git a/src/lib/libcrypto/err/err.c b/src/lib/libcrypto/err/err.c
index a60769fc2a..5bfdf66aee 100644
--- a/src/lib/libcrypto/err/err.c
+++ b/src/lib/libcrypto/err/err.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: err.c,v 1.78 2025/06/10 08:53:37 tb Exp $ */ 1/* $OpenBSD: err.c,v 1.79 2026/07/31 00:50:52 kenjiro 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 *
@@ -122,6 +122,9 @@
122#include <openssl/err.h> 122#include <openssl/err.h>
123#include <openssl/lhash.h> 123#include <openssl/lhash.h>
124 124
125#include "constant_time.h"
126#include "err_local.h"
127
125DECLARE_LHASH_OF(ERR_STRING_DATA); 128DECLARE_LHASH_OF(ERR_STRING_DATA);
126DECLARE_LHASH_OF(ERR_STATE); 129DECLARE_LHASH_OF(ERR_STATE);
127 130
diff --git a/src/lib/libcrypto/evp/bio_b64.c b/src/lib/libcrypto/evp/bio_b64.c
index 32cd1f06df..61a26df868 100644
--- a/src/lib/libcrypto/evp/bio_b64.c
+++ b/src/lib/libcrypto/evp/bio_b64.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bio_b64.c,v 1.29 2024/04/09 13:52:41 beck Exp $ */ 1/* $OpenBSD: bio_b64.c,v 1.30 2026/07/17 12:41:52 kenjiro 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 *
@@ -380,7 +380,6 @@ b64_write(BIO *b, const char *in, int inl)
380 BIO_copy_next_retry(b); 380 BIO_copy_next_retry(b);
381 return (i); 381 return (i);
382 } 382 }
383 OPENSSL_assert(i <= n);
384 ctx->buf_off += i; 383 ctx->buf_off += i;
385 OPENSSL_assert(ctx->buf_off <= (int)sizeof(ctx->buf)); 384 OPENSSL_assert(ctx->buf_off <= (int)sizeof(ctx->buf));
386 OPENSSL_assert(ctx->buf_len >= ctx->buf_off); 385 OPENSSL_assert(ctx->buf_len >= ctx->buf_off);
@@ -453,7 +452,6 @@ b64_write(BIO *b, const char *in, int inl)
453 BIO_copy_next_retry(b); 452 BIO_copy_next_retry(b);
454 return ((ret == 0) ? i : ret); 453 return ((ret == 0) ? i : ret);
455 } 454 }
456 OPENSSL_assert(i <= n);
457 n -= i; 455 n -= i;
458 ctx->buf_off += i; 456 ctx->buf_off += i;
459 OPENSSL_assert(ctx->buf_off <= (int)sizeof(ctx->buf)); 457 OPENSSL_assert(ctx->buf_off <= (int)sizeof(ctx->buf));
diff --git a/src/lib/libcrypto/man/ASN1_STRING_length.3 b/src/lib/libcrypto/man/ASN1_STRING_length.3
index 922ae89ac6..96eb50e193 100644
--- a/src/lib/libcrypto/man/ASN1_STRING_length.3
+++ b/src/lib/libcrypto/man/ASN1_STRING_length.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_STRING_length.3,v 1.31 2025/06/08 22:37:23 schwarze Exp $ 1.\" $OpenBSD: ASN1_STRING_length.3,v 1.32 2026/08/23 05:10:18 tb Exp $
2.\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 2.\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -66,13 +66,12 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: June 8 2025 $ 69.Dd $Mdocdate: August 23 2026 $
70.Dt ASN1_STRING_LENGTH 3 70.Dt ASN1_STRING_LENGTH 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
73.Nm ASN1_STRING_cmp , 73.Nm ASN1_STRING_cmp ,
74.Nm ASN1_OCTET_STRING_cmp , 74.Nm ASN1_OCTET_STRING_cmp ,
75.Nm ASN1_STRING_data ,
76.Nm ASN1_STRING_dup , 75.Nm ASN1_STRING_dup ,
77.Nm ASN1_OCTET_STRING_dup , 76.Nm ASN1_OCTET_STRING_dup ,
78.Nm ASN1_STRING_get0_data , 77.Nm ASN1_STRING_get0_data ,
@@ -83,7 +82,8 @@
83.Nm ASN1_OCTET_STRING_set , 82.Nm ASN1_OCTET_STRING_set ,
84.Nm ASN1_STRING_copy , 83.Nm ASN1_STRING_copy ,
85.Nm ASN1_STRING_to_UTF8 , 84.Nm ASN1_STRING_to_UTF8 ,
86.Nm ASN1_STRING_type 85.Nm ASN1_STRING_type ,
86.Nm ASN1_STRING_data
87.Nd ASN1_STRING utility functions 87.Nd ASN1_STRING utility functions
88.Sh SYNOPSIS 88.Sh SYNOPSIS
89.Lb libcrypto 89.Lb libcrypto
@@ -98,10 +98,6 @@
98.Fa "const ASN1_OCTET_STRING *a" 98.Fa "const ASN1_OCTET_STRING *a"
99.Fa "const ASN1_OCTET_STRING *b" 99.Fa "const ASN1_OCTET_STRING *b"
100.Fc 100.Fc
101.Ft unsigned char *
102.Fo ASN1_STRING_data
103.Fa "ASN1_STRING *x"
104.Fc
105.Ft ASN1_STRING * 101.Ft ASN1_STRING *
106.Fo ASN1_STRING_dup 102.Fo ASN1_STRING_dup
107.Fa "const ASN1_STRING *a" 103.Fa "const ASN1_STRING *a"
@@ -155,6 +151,13 @@
155.Fo ASN1_STRING_type 151.Fo ASN1_STRING_type
156.Fa "const ASN1_STRING *x" 152.Fa "const ASN1_STRING *x"
157.Fc 153.Fc
154.Pp
155Deprecated:
156.Pp
157.Ft unsigned char *
158.Fo ASN1_STRING_data
159.Fa "ASN1_STRING *x"
160.Fc
158.Sh DESCRIPTION 161.Sh DESCRIPTION
159These functions manipulate 162These functions manipulate
160.Vt ASN1_STRING 163.Vt ASN1_STRING
@@ -171,15 +174,6 @@ does exactly the same as
171.Fn ASN1_STRING_cmp 174.Fn ASN1_STRING_cmp
172without providing any type safety. 175without providing any type safety.
173.Pp 176.Pp
174.Fn ASN1_STRING_data
175is similar to
176.Fn ASN1_STRING_get0_data
177except that the returned value is not constant.
178This function is deprecated.
179Applications should use
180.Fn ASN1_STRING_get0_data
181instead.
182.Pp
183.Fn ASN1_STRING_dup 177.Fn ASN1_STRING_dup
184allocates a new 178allocates a new
185.Vt ASN1_STRING 179.Vt ASN1_STRING
@@ -283,6 +277,15 @@ is set in the return value,
283.Fa x 277.Fa x
284is an ASN.1 INTEGER or ENUMERATED object with a negative value. 278is an ASN.1 INTEGER or ENUMERATED object with a negative value.
285.Pp 279.Pp
280.Fn ASN1_STRING_data
281is similar to
282.Fn ASN1_STRING_get0_data
283except that the returned value is not constant.
284This function is deprecated.
285Applications should use
286.Fn ASN1_STRING_get0_data
287instead.
288.Pp
286Almost all ASN.1 types are represented as 289Almost all ASN.1 types are represented as
287.Vt ASN1_STRING 290.Vt ASN1_STRING
288structures. 291structures.
@@ -341,9 +344,9 @@ In contrast to
341.Xr strcmp 3 , 344.Xr strcmp 3 ,
342the sign of the return value does not indicate lexicographical ordering. 345the sign of the return value does not indicate lexicographical ordering.
343.Pp 346.Pp
344.Fn ASN1_STRING_data
345and
346.Fn ASN1_STRING_get0_data 347.Fn ASN1_STRING_get0_data
348and
349.Fn ASN1_STRING_data
347return an internal pointer to the data of 350return an internal pointer to the data of
348.Fa x . 351.Fa x .
349.Pp 352.Pp
diff --git a/src/lib/libcrypto/man/ASN1_parse_dump.3 b/src/lib/libcrypto/man/ASN1_parse_dump.3
index 45aa673d4c..809bf01337 100644
--- a/src/lib/libcrypto/man/ASN1_parse_dump.3
+++ b/src/lib/libcrypto/man/ASN1_parse_dump.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_parse_dump.3,v 1.4 2025/06/08 22:40:29 schwarze Exp $ 1.\" $OpenBSD: ASN1_parse_dump.3,v 1.5 2026/05/16 06:17:05 tb Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: June 8 2025 $ 17.Dd $Mdocdate: May 16 2026 $
18.Dt ASN1_PARSE_DUMP 3 18.Dt ASN1_PARSE_DUMP 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -180,7 +180,11 @@ with 0 passed as the
180.Fa dump 180.Fa dump
181argument. 181argument.
182.Sh RETURN VALUES 182.Sh RETURN VALUES
183These functions return 1 for success or 0 for failure. 183These functions normally return 1 for success or 0 for failure;
184when printing indefinite-length encoded BER with a tag of class
185.Dv V_ASN1_UNIVERSAL ,
186the return value 2 indicates that the printing stopped
187when reaching the end-of-content marker.
184.Pp 188.Pp
185In particular, they print an error message to 189In particular, they print an error message to
186.Fa bio , 190.Fa bio ,
diff --git a/src/lib/libcrypto/man/BIO_dump.3 b/src/lib/libcrypto/man/BIO_dump.3
index 2c06c8cc9c..30020dfd26 100644
--- a/src/lib/libcrypto/man/BIO_dump.3
+++ b/src/lib/libcrypto/man/BIO_dump.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_dump.3,v 1.6 2025/06/08 22:40:29 schwarze Exp $ 1.\" $OpenBSD: BIO_dump.3,v 1.7 2026/05/16 06:15:22 tb Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: June 8 2025 $ 17.Dd $Mdocdate: May 16 2026 $
18.Dt BIO_DUMP 3 18.Dt BIO_DUMP 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -77,16 +77,14 @@ is 7 or more, the number of data columns is reduced such that the
77total width of the output does not exceed 79 characters per line. 77total width of the output does not exceed 79 characters per line.
78.Sh RETURN VALUES 78.Sh RETURN VALUES
79On success these functions return the total number of bytes written by 79On success these functions return the total number of bytes written by
80.Xr BIO_write 3 80.Xr BIO_printf 3 .
81or
82.Xr fwrite 3 .
83If a failure occurs at any point when writing, these 81If a failure occurs at any point when writing, these
84functions will stop after having potentially written out partial results, 82functions will stop after having potentially written out partial results,
85and return -1. 83and return -1.
86.Sh SEE ALSO 84.Sh SEE ALSO
87.Xr hexdump 1 , 85.Xr hexdump 1 ,
88.Xr BIO_new 3 , 86.Xr BIO_new 3 ,
89.Xr BIO_write 3 87.Xr BIO_printf 3
90.Sh HISTORY 88.Sh HISTORY
91.Fn BIO_dump 89.Fn BIO_dump
92first appeared in SSLeay 0.6.5 and has been available since 90first appeared in SSLeay 0.6.5 and has been available since
diff --git a/src/lib/libcrypto/man/BN_generate_prime.3 b/src/lib/libcrypto/man/BN_generate_prime.3
index 55eed14e75..417d974f12 100644
--- a/src/lib/libcrypto/man/BN_generate_prime.3
+++ b/src/lib/libcrypto/man/BN_generate_prime.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BN_generate_prime.3,v 1.26 2025/06/08 22:40:29 schwarze Exp $ 1.\" $OpenBSD: BN_generate_prime.3,v 1.27 2026/09/01 05:51:25 jsg Exp $
2.\" full merge up to: OpenSSL f987a4dd Jun 27 10:12:08 2019 +0200 2.\" full merge up to: OpenSSL f987a4dd Jun 27 10:12:08 2019 +0200
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -67,7 +67,7 @@
67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
68.\" OF THE POSSIBILITY OF SUCH DAMAGE. 68.\" OF THE POSSIBILITY OF SUCH DAMAGE.
69.\" 69.\"
70.Dd $Mdocdate: June 8 2025 $ 70.Dd $Mdocdate: September 1 2026 $
71.Dt BN_GENERATE_PRIME 3 71.Dt BN_GENERATE_PRIME 3
72.Os 72.Os
73.Sh NAME 73.Sh NAME
@@ -181,7 +181,7 @@ If
181.Dv NULL 181.Dv NULL
182is passed for the 182is passed for the
183.Fa ctx 183.Fa ctx
184argument, these function allocate a 184argument, these functions allocate a
185.Vt BN_CTX 185.Vt BN_CTX
186object internally when they need one and free it before returning. 186object internally when they need one and free it before returning.
187Alternatively, to save the overhead of allocating and freeing 187Alternatively, to save the overhead of allocating and freeing
diff --git a/src/lib/libcrypto/man/CRYPTO_set_ex_data.3 b/src/lib/libcrypto/man/CRYPTO_set_ex_data.3
index 57cdbfb4ca..00b5785533 100644
--- a/src/lib/libcrypto/man/CRYPTO_set_ex_data.3
+++ b/src/lib/libcrypto/man/CRYPTO_set_ex_data.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: CRYPTO_set_ex_data.3,v 1.16 2025/06/08 22:40:29 schwarze Exp $ 1.\" $OpenBSD: CRYPTO_set_ex_data.3,v 1.18 2026/08/30 12:19:37 kenjiro Exp $
2.\" 2.\"
3.\" Copyright (c) 2023 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2023 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: June 8 2025 $ 17.Dd $Mdocdate: August 30 2026 $
18.Dt CRYPTO_SET_EX_DATA 3 18.Dt CRYPTO_SET_EX_DATA 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -25,7 +25,8 @@
25.Nm CRYPTO_new_ex_data , 25.Nm CRYPTO_new_ex_data ,
26.Nm CRYPTO_set_ex_data , 26.Nm CRYPTO_set_ex_data ,
27.Nm CRYPTO_get_ex_data , 27.Nm CRYPTO_get_ex_data ,
28.Nm CRYPTO_free_ex_data 28.Nm CRYPTO_free_ex_data ,
29.Nm CRYPTO_cleanup_all_ex_data
29.Nd low-level functions for application specific data 30.Nd low-level functions for application specific data
30.Sh SYNOPSIS 31.Sh SYNOPSIS
31.Lb libcrypto 32.Lb libcrypto
@@ -89,6 +90,8 @@
89.Fa "void *parent" 90.Fa "void *parent"
90.Fa "CRYPTO_EX_DATA *ad" 91.Fa "CRYPTO_EX_DATA *ad"
91.Fc 92.Fc
93.Ft void
94.Fn CRYPTO_cleanup_all_ex_data void
92.Sh DESCRIPTION 95.Sh DESCRIPTION
93The library implements the functions documented in the 96The library implements the functions documented in the
94.Xr RSA_get_ex_new_index 3 97.Xr RSA_get_ex_new_index 3
@@ -342,6 +345,20 @@ Despite its name,
342does not free 345does not free
343.Fa ad 346.Fa ad
344itself. 347itself.
348.Pp
349.Fn CRYPTO_cleanup_all_ex_data
350is deprecated and has no effect.
351It is retained for source and binary compatibility only.
352Application programs should not call it after individual operations,
353from individual library components, or during process shutdown.
354No replacement call is needed.
355.Pp
356In particular,
357.Xr OPENSSL_cleanup 3
358is not a replacement for
359.Fn CRYPTO_cleanup_all_ex_data .
360It tears down process-wide library state and is only intended for final
361shutdown after all threads using libcrypto have stopped.
345.Sh RETURN VALUES 362.Sh RETURN VALUES
346.Fn CRYPTO_get_ex_new_index 363.Fn CRYPTO_get_ex_new_index
347returns a new index equal to or greater than 1 364returns a new index equal to or greater than 1
@@ -425,8 +442,12 @@ and
425.Fn CRYPTO_EX_dup 442.Fn CRYPTO_EX_dup
426first appeared in OpenSSL 0.9.5 and have been available since 443first appeared in OpenSSL 0.9.5 and have been available since
427.Ox 2.7 . 444.Ox 2.7 .
445.Pp
446.Fn CRYPTO_cleanup_all_ex_data
447first appeared in OpenSSL 0.9.7 and has been available since
448.Ox 3.2 .
428.Sh CAVEATS 449.Sh CAVEATS
429If an program installs callback functions, the last call to 450If a program installs callback functions, the last call to
430.Fn CRYPTO_get_ex_new_index 451.Fn CRYPTO_get_ex_new_index
431installing a function of a certain type for a certain 452installing a function of a certain type for a certain
432.Fa class_index 453.Fa class_index
diff --git a/src/lib/libcrypto/man/EC_GROUP_check.3 b/src/lib/libcrypto/man/EC_GROUP_check.3
index 146c3d255d..2c45033834 100644
--- a/src/lib/libcrypto/man/EC_GROUP_check.3
+++ b/src/lib/libcrypto/man/EC_GROUP_check.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EC_GROUP_check.3,v 1.6 2025/07/04 05:16:56 jsg Exp $ 1.\" $OpenBSD: EC_GROUP_check.3,v 1.7 2026/08/26 09:03:57 jsg Exp $
2.\" 2.\"
3.\" Copyright (c) 2025 Theo Buehler <tb@openbsd.org> 3.\" Copyright (c) 2025 Theo Buehler <tb@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: July 4 2025 $ 17.Dd $Mdocdate: August 26 2026 $
18.Dt EC_GROUP_CHECK 3 18.Dt EC_GROUP_CHECK 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -75,7 +75,7 @@ is a point on the curve whose order divides
75It checks with 75It checks with
76.Fn EC_GROUP_check_discriminant 76.Fn EC_GROUP_check_discriminant
77that the discriminant is non-zero 77that the discriminant is non-zero
78and then verifies that that 78and then verifies that the
79.Fa order 79.Fa order
80is non-zero and that the product 80is non-zero and that the product
81.Fa generator No * Fa order 81.Fa generator No * Fa order
diff --git a/src/lib/libcrypto/man/MD5.3 b/src/lib/libcrypto/man/MD5.3
index c9c89c33af..c36318994d 100644
--- a/src/lib/libcrypto/man/MD5.3
+++ b/src/lib/libcrypto/man/MD5.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: MD5.3,v 1.10 2025/06/08 22:40:30 schwarze Exp $ 1.\" $OpenBSD: MD5.3,v 1.11 2026/08/25 00:08:28 jsg Exp $
2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org> and 4.\" This file was written by Ulf Moeller <ulf@openssl.org> and
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: June 8 2025 $ 52.Dd $Mdocdate: August 25 2026 $
53.Dt MD5 3 53.Dt MD5 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -129,7 +129,7 @@ The following functions may be used if the message is not completely
129stored in memory: 129stored in memory:
130.Pp 130.Pp
131.Fn MD5_Init 131.Fn MD5_Init
132initializes a 132initializes an
133.Vt MD5_CTX 133.Vt MD5_CTX
134structure. 134structure.
135.Pp 135.Pp
diff --git a/src/lib/libcrypto/man/OBJ_create.3 b/src/lib/libcrypto/man/OBJ_create.3
index 75d51f4bb8..e3ec7f01f3 100644
--- a/src/lib/libcrypto/man/OBJ_create.3
+++ b/src/lib/libcrypto/man/OBJ_create.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: OBJ_create.3,v 1.11 2025/06/08 22:37:23 schwarze Exp $ 1.\" $OpenBSD: OBJ_create.3,v 1.13 2026/08/05 08:45:43 tb Exp $
2.\" full merge up to: 2.\" full merge up to:
3.\" OpenSSL OBJ_nid2obj.pod 9b86974e Aug 17 15:21:33 2015 -0400 3.\" OpenSSL OBJ_nid2obj.pod 9b86974e Aug 17 15:21:33 2015 -0400
4.\" selective merge up to: 4.\" selective merge up to:
@@ -69,12 +69,11 @@
69.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 69.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
70.\" OF THE POSSIBILITY OF SUCH DAMAGE. 70.\" OF THE POSSIBILITY OF SUCH DAMAGE.
71.\" 71.\"
72.Dd $Mdocdate: June 8 2025 $ 72.Dd $Mdocdate: August 5 2026 $
73.Dt OBJ_CREATE 3 73.Dt OBJ_CREATE 3
74.Os 74.Os
75.Sh NAME 75.Sh NAME
76.Nm OBJ_new_nid , 76.Nm OBJ_new_nid ,
77.Nm OBJ_add_object ,
78.Nm OBJ_create , 77.Nm OBJ_create ,
79.Nm OBJ_create_objects , 78.Nm OBJ_create_objects ,
80.Nm OBJ_cleanup 79.Nm OBJ_cleanup
@@ -85,8 +84,6 @@
85.Ft int 84.Ft int
86.Fn OBJ_new_nid "int increment" 85.Fn OBJ_new_nid "int increment"
87.Ft int 86.Ft int
88.Fn OBJ_add_object "const ASN1_OBJECT *object"
89.Ft int
90.Fo OBJ_create 87.Fo OBJ_create
91.Fa "const char *oid" 88.Fa "const char *oid"
92.Fa "const char *sn" 89.Fa "const char *sn"
@@ -106,19 +103,14 @@ Passing an argument of 1 is usually recommended.
106The return value can be assigned to a new object by passing it as the 103The return value can be assigned to a new object by passing it as the
107.Fa nid 104.Fa nid
108argument to 105argument to
109.Xr ASN1_OBJECT_create 3 106.Xr ASN1_OBJECT_create 3 .
110and by passing the resulting object to
111.Fn OBJ_add_object .
112.Pp 107.Pp
113.Fn OBJ_add_object 108.Fn OBJ_create
114adds a copy of the 109adds an
115.Fa object 110.Vt ASN1_OBJECT
116to the internal table of ASN.1 object identifiers for use by 111to the internal table of ASN.1 object identifiers for use by
117.Xr OBJ_nid2obj 3 112.Xr OBJ_nid2obj 3
118and related functions. 113and related functions.
119.Pp
120.Fn OBJ_create
121provides a simpler way to add a new object to the internal table.
122.Fa oid 114.Fa oid
123is the numerical form of the object, 115is the numerical form of the object,
124.Fa sn 116.Fa sn
@@ -141,8 +133,11 @@ for every line read.
141The three fields of the input lines 133The three fields of the input lines
142are separated by one or more whitespace characters. 134are separated by one or more whitespace characters.
143.Pp 135.Pp
144For all three functions, the objects added to the internal table and 136For the objects added to the internal table by
145all the data contained in them is marked as not dynamically allocated. 137.Fn OBJ_create
138and
139.Fn OBJ_create_objects ,
140all the data contained is marked as not dynamically allocated.
146Consequently, retrieving them with 141Consequently, retrieving them with
147.Xr OBJ_nid2obj 3 142.Xr OBJ_nid2obj 3
148or a similar function and then calling 143or a similar function and then calling
@@ -152,7 +147,6 @@ on the returned pointer will have no effect.
152.Fn OBJ_cleanup 147.Fn OBJ_cleanup
153resets the internal object table to its default state, 148resets the internal object table to its default state,
154removing and freeing all objects that were added with 149removing and freeing all objects that were added with
155.Fn OBJ_add_object ,
156.Fn OBJ_create , 150.Fn OBJ_create ,
157or 151or
158.Fn OBJ_create_objects . 152.Fn OBJ_create_objects .
@@ -160,17 +154,6 @@ or
160.Fn OBJ_new_nid 154.Fn OBJ_new_nid
161returns the new NID. 155returns the new NID.
162.Pp 156.Pp
163.Fn OBJ_add_object
164returns the NID of the added
165.Fa object
166or
167.Dv NID_undef
168if no object was added because the
169.Fa object
170argument was
171.Dv NULL ,
172did not contain an NID, or memory allocation failed.
173.Pp
174.Fn OBJ_create 157.Fn OBJ_create
175returns the new NID or 158returns the new NID or
176.Dv NID_undef 159.Dv NID_undef
@@ -183,8 +166,7 @@ or if memory allocation fails.
183returns the number of objects added. 166returns the number of objects added.
184.Pp 167.Pp
185In some cases of failure of 168In some cases of failure of
186.Fn OBJ_add_object , 169.Fn OBJ_create
187.Fn OBJ_create ,
188and 170and
189.Fn OBJ_create_objects , 171.Fn OBJ_create_objects ,
190the reason can be determined with 172the reason can be determined with
@@ -203,7 +185,6 @@ obj = OBJ_nid2obj(new_nid);
203.Xr OBJ_nid2obj 3 185.Xr OBJ_nid2obj 3
204.Sh HISTORY 186.Sh HISTORY
205.Fn OBJ_new_nid , 187.Fn OBJ_new_nid ,
206.Fn OBJ_add_object ,
207and 188and
208.Fn OBJ_cleanup 189.Fn OBJ_cleanup
209first appeared in SSLeay 0.8.0 and 190first appeared in SSLeay 0.8.0 and
@@ -212,12 +193,6 @@ in SSLeay 0.9.0.
212These functions have been available since 193These functions have been available since
213.Ox 2.4 . 194.Ox 2.4 .
214.Sh CAVEATS 195.Sh CAVEATS
215.Fn OBJ_add_object
216indicates success even after adding an incomplete object that was created with
217.Xr ASN1_OBJECT_create 3
218but lacks a short name, a long name, or an OID.
219.Pp
220Even
221.Fn OBJ_create 196.Fn OBJ_create
222tolerates 197tolerates
223.Dv NULL 198.Dv NULL
@@ -229,11 +204,11 @@ arguments, in which case
229.Xr OBJ_nid2sn 3 204.Xr OBJ_nid2sn 3
230and 205and
231.Xr OBJ_sn2nid 3 206.Xr OBJ_sn2nid 3
232or 207and/or
233.Xr OBJ_nid2ln 3 208.Xr OBJ_nid2ln 3
234and 209and
235.Xr OBJ_ln2nid 3 210.Xr OBJ_ln2nid 3
236will not work on the added object, respectively. 211will not work on the added object.
237.Sh BUGS 212.Sh BUGS
238.Fn OBJ_new_nid 213.Fn OBJ_new_nid
239does not reserve any return value to indicate an error. 214does not reserve any return value to indicate an error.
diff --git a/src/lib/libcrypto/man/OPENSSL_init_crypto.3 b/src/lib/libcrypto/man/OPENSSL_init_crypto.3
index 5c29d55aa9..24756bc396 100644
--- a/src/lib/libcrypto/man/OPENSSL_init_crypto.3
+++ b/src/lib/libcrypto/man/OPENSSL_init_crypto.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: OPENSSL_init_crypto.3,v 1.7 2025/06/09 12:43:53 schwarze Exp $ 1.\" $OpenBSD: OPENSSL_init_crypto.3,v 1.8 2026/08/30 12:19:37 kenjiro Exp $
2.\" Copyright (c) 2018, 2020 Ingo Schwarze <schwarze@openbsd.org> 2.\" Copyright (c) 2018, 2020 Ingo Schwarze <schwarze@openbsd.org>
3.\" 3.\"
4.\" Permission to use, copy, modify, and distribute this software for any 4.\" Permission to use, copy, modify, and distribute this software for any
@@ -13,13 +13,14 @@
13.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15.\" 15.\"
16.Dd $Mdocdate: June 9 2025 $ 16.Dd $Mdocdate: August 30 2026 $
17.Dt OPENSSL_INIT_CRYPTO 3 17.Dt OPENSSL_INIT_CRYPTO 3
18.Os 18.Os
19.Sh NAME 19.Sh NAME
20.Nm OPENSSL_init_crypto , 20.Nm OPENSSL_init_crypto ,
21.Nm OPENSSL_init 21.Nm OPENSSL_init ,
22.Nd initialise the crypto library 22.Nm OPENSSL_cleanup
23.Nd initialise and shut down the crypto library
23.Sh SYNOPSIS 24.Sh SYNOPSIS
24.Lb libcrypto 25.Lb libcrypto
25.In openssl/crypto.h 26.In openssl/crypto.h
@@ -30,8 +31,13 @@
30.Fc 31.Fc
31.Ft void 32.Ft void
32.Fn OPENSSL_init void 33.Fn OPENSSL_init void
34.Ft void
35.Fn OPENSSL_cleanup void
33.Sh DESCRIPTION 36.Sh DESCRIPTION
34These functions are deprecated. 37.Fn OPENSSL_init_crypto
38and
39.Fn OPENSSL_init
40are deprecated.
35It is never useful for an application program 41It is never useful for an application program
36to call either of them explicitly. 42to call either of them explicitly.
37.Pp 43.Pp
@@ -84,6 +90,21 @@ the first one have any effect.
84.Pp 90.Pp
85.Fn OPENSSL_init 91.Fn OPENSSL_init
86has no effect at all. 92has no effect at all.
93.Pp
94.Fn OPENSSL_cleanup
95frees process-wide resources allocated by libcrypto.
96It is intended exclusively for the final shutdown of libcrypto in a process.
97Before calling it, the application has to ensure that all other threads
98that may use libcrypto have stopped and that no library component will use
99libcrypto again.
100After it returns, libcrypto cannot be reinitialized and no libcrypto or
101libssl function may be called.
102.Pp
103.Fn OPENSSL_cleanup
104is not a replacement for deprecated cleanup functions such as
105.Xr CRYPTO_cleanup_all_ex_data 3
106and must not be called after individual cryptographic operations or when an
107individual library component is finished with libcrypto.
87.Sh RETURN VALUES 108.Sh RETURN VALUES
88.Fn OPENSSL_init_crypto 109.Fn OPENSSL_init_crypto
89is intended to return 1 on success or 0 on error. 110is intended to return 1 on success or 0 on error.
@@ -101,6 +122,10 @@ It stopped having any effect in OpenSSL 1.1.1 and in
101.Fn OPENSSL_init_crypto 122.Fn OPENSSL_init_crypto
102first appeared in OpenSSL 1.1.0 and has been available since 123first appeared in OpenSSL 1.1.0 and has been available since
103.Ox 6.3 . 124.Ox 6.3 .
125.Pp
126.Fn OPENSSL_cleanup
127first appeared in OpenSSL 1.1.0 and has been available since
128.Ox 7.2 .
104.Sh BUGS 129.Sh BUGS
105.Fn OPENSSL_init_crypto 130.Fn OPENSSL_init_crypto
106silently ignores almost all kinds of errors. 131silently ignores almost all kinds of errors.
diff --git a/src/lib/libcrypto/man/X509_STORE_CTX_get_error.3 b/src/lib/libcrypto/man/X509_STORE_CTX_get_error.3
index 5eb2bfe8cb..ab7909a24d 100644
--- a/src/lib/libcrypto/man/X509_STORE_CTX_get_error.3
+++ b/src/lib/libcrypto/man/X509_STORE_CTX_get_error.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_STORE_CTX_get_error.3,v 1.29 2025/06/08 22:40:30 schwarze Exp $ 1.\" $OpenBSD: X509_STORE_CTX_get_error.3,v 1.31 2026/08/29 05:53:59 tb Exp $
2.\" full merge up to: 2.\" full merge up to:
3.\" OpenSSL man3/X509_STORE_CTX_get_error 24a535ea Sep 22 13:14:20 2020 +0100 3.\" OpenSSL man3/X509_STORE_CTX_get_error 24a535ea Sep 22 13:14:20 2020 +0100
4.\" OpenSSL man3/X509_STORE_CTX_new 24a535ea Sep 22 13:14:20 2020 +0100 4.\" OpenSSL man3/X509_STORE_CTX_new 24a535ea Sep 22 13:14:20 2020 +0100
@@ -68,7 +68,7 @@
68.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 68.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
69.\" OF THE POSSIBILITY OF SUCH DAMAGE. 69.\" OF THE POSSIBILITY OF SUCH DAMAGE.
70.\" 70.\"
71.Dd $Mdocdate: June 8 2025 $ 71.Dd $Mdocdate: August 29 2026 $
72.Dt X509_STORE_CTX_GET_ERROR 3 72.Dt X509_STORE_CTX_GET_ERROR 3
73.Os 73.Os
74.Sh NAME 74.Sh NAME
@@ -241,7 +241,7 @@ validation of a related CRL issuer certificate, and if the latter,
241what the target certificate is. 241what the target certificate is.
242.Pp 242.Pp
243.Fn X509_STORE_CTX_get0_chain 243.Fn X509_STORE_CTX_get0_chain
244returns an internal pointer to a complete validate chain 244returns an internal pointer to a complete validated chain of certificates
245if a previous call to 245if a previous call to
246.Xr X509_verify_cert 3 246.Xr X509_verify_cert 3
247was successful. 247was successful.
@@ -259,7 +259,7 @@ When it is no longer needed, it should be freed using
259.Fn sk_X509_pop_free chain X509_free . 259.Fn sk_X509_pop_free chain X509_free .
260.Pp 260.Pp
261.Fn X509_STORE_CTX_set0_verified_chain 261.Fn X509_STORE_CTX_set0_verified_chain
262frees the validate chain generated by if a previous call to 262frees the validated chain generated by a previous call to
263.Xr X509_verify_cert 3 , 263.Xr X509_verify_cert 3 ,
264if any, and replaces it with the given 264if any, and replaces it with the given
265.Fa chain . 265.Fa chain .
diff --git a/src/lib/libcrypto/man/X509v3_addr_add_inherit.3 b/src/lib/libcrypto/man/X509v3_addr_add_inherit.3
index d33de1f6a8..70d5ec2563 100644
--- a/src/lib/libcrypto/man/X509v3_addr_add_inherit.3
+++ b/src/lib/libcrypto/man/X509v3_addr_add_inherit.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509v3_addr_add_inherit.3,v 1.12 2025/06/08 22:40:30 schwarze Exp $ 1.\" $OpenBSD: X509v3_addr_add_inherit.3,v 1.13 2026/05/10 10:35:20 tb Exp $
2.\" 2.\"
3.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> 3.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: June 8 2025 $ 17.Dd $Mdocdate: May 10 2026 $
18.Dt X509V3_ADDR_ADD_INHERIT 3 18.Dt X509V3_ADDR_ADD_INHERIT 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -467,6 +467,7 @@ dereference.
467The code only supports the IPv4 and IPv6 AFIs. 467The code only supports the IPv4 and IPv6 AFIs.
468This is not consistently enforced across implementations. 468This is not consistently enforced across implementations.
469.Pp 469.Pp
470In some implementations
470.Fn X509v3_addr_add_range 471.Fn X509v3_addr_add_range
471fails to clear the unused bits set to 1 in the last octet of 472fails to clear the unused bits set to 1 in the last octet of
472the 473the
diff --git a/src/lib/libcrypto/man/d2i_X509_SIG.3 b/src/lib/libcrypto/man/d2i_X509_SIG.3
index 1700b2d728..6a446c0874 100644
--- a/src/lib/libcrypto/man/d2i_X509_SIG.3
+++ b/src/lib/libcrypto/man/d2i_X509_SIG.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_X509_SIG.3,v 1.11 2025/06/08 22:40:30 schwarze Exp $ 1.\" $OpenBSD: d2i_X509_SIG.3,v 1.12 2026/08/25 00:08:28 jsg Exp $
2.\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 2.\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400
3.\" 3.\"
4.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 4.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
@@ -15,7 +15,7 @@
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\" 17.\"
18.Dd $Mdocdate: June 8 2025 $ 18.Dd $Mdocdate: August 25 2026 $
19.Dt D2I_X509_SIG 3 19.Dt D2I_X509_SIG 3
20.Os 20.Os
21.Sh NAME 21.Sh NAME
@@ -99,7 +99,7 @@ pointer.
99.Fn d2i_PKCS8_bio , 99.Fn d2i_PKCS8_bio ,
100and 100and
101.Fn d2i_PKCS8_fp 101.Fn d2i_PKCS8_fp
102return a 102return an
103.Vt X509_SIG 103.Vt X509_SIG
104object or 104object or
105.Dv NULL 105.Dv NULL
diff --git a/src/lib/libcrypto/man/s2i_ASN1_INTEGER.3 b/src/lib/libcrypto/man/s2i_ASN1_INTEGER.3
index 16646c69d1..f7ab217d48 100644
--- a/src/lib/libcrypto/man/s2i_ASN1_INTEGER.3
+++ b/src/lib/libcrypto/man/s2i_ASN1_INTEGER.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: s2i_ASN1_INTEGER.3,v 1.11 2025/06/13 18:34:00 schwarze Exp $ 1.\" $OpenBSD: s2i_ASN1_INTEGER.3,v 1.12 2026/08/18 11:27:46 tb Exp $
2.\" 2.\"
3.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> 3.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: June 13 2025 $ 17.Dd $Mdocdate: August 18 2026 $
18.Dt S2I_ASN1_INTEGER 3 18.Dt S2I_ASN1_INTEGER 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -162,7 +162,9 @@ The default
162.Fa methods 162.Fa methods
163corresponding to the following 163corresponding to the following
164.Fa nid 164.Fa nid
165arguments have strings configured in their usr_data field: 165arguments have strings configured in their
166.Fa usr_data
167field:
166.Pp 168.Pp
167.Bl -column NID_netscape_cert_type "Netscape certificate type (obsolete)" -compact 169.Bl -column NID_netscape_cert_type "Netscape certificate type (obsolete)" -compact
168.It Dv NID_crl_reason Ta reason codes, RFC 5280, 5.3.1 170.It Dv NID_crl_reason Ta reason codes, RFC 5280, 5.3.1
diff --git a/src/lib/libcrypto/md5/md5_amd64_generic.S b/src/lib/libcrypto/md5/md5_amd64_generic.S
index 35e6fcdada..02f6ebdbcc 100644
--- a/src/lib/libcrypto/md5/md5_amd64_generic.S
+++ b/src/lib/libcrypto/md5/md5_amd64_generic.S
@@ -1,4 +1,4 @@
1/* $OpenBSD: md5_amd64_generic.S,v 1.2 2026/03/28 13:11:28 jsing Exp $ */ 1/* $OpenBSD: md5_amd64_generic.S,v 1.3 2026/05/12 15:07:30 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2025 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2025 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -231,3 +231,7 @@ md5_block_data_order:
231 popq %rbx 231 popq %rbx
232 232
233 ret 233 ret
234
235#if defined(__linux__) && defined(__ELF__)
236.section .note.GNU-stack,"",%progbits
237#endif
diff --git a/src/lib/libcrypto/mlkem/mlkem_internal.c b/src/lib/libcrypto/mlkem/mlkem_internal.c
index 12b1c3e235..2e707704a4 100644
--- a/src/lib/libcrypto/mlkem/mlkem_internal.c
+++ b/src/lib/libcrypto/mlkem/mlkem_internal.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: mlkem_internal.c,v 1.8 2026/03/29 06:31:07 tb Exp $ */ 1/* $OpenBSD: mlkem_internal.c,v 1.9 2026/05/04 20:44:36 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2024, Google Inc. 3 * Copyright (c) 2024, Google Inc.
4 * Copyright (c) 2024, 2025 Bob Beck <beck@obtuse.com> 4 * Copyright (c) 2024, 2025 Bob Beck <beck@obtuse.com>
@@ -1137,6 +1137,7 @@ mlkem_decap(const MLKEM_private_key *private_key, const uint8_t *ciphertext,
1137 err: 1137 err:
1138 freezero(expected_ciphertext, expected_ciphertext_length); 1138 freezero(expected_ciphertext, expected_ciphertext_length);
1139 explicit_bzero(key_and_randomness, sizeof(key_and_randomness)); 1139 explicit_bzero(key_and_randomness, sizeof(key_and_randomness));
1140 explicit_bzero(failure_key, sizeof(failure_key));
1140 explicit_bzero(decrypted, sizeof(decrypted)); 1141 explicit_bzero(decrypted, sizeof(decrypted));
1141 1142
1142 return ret; 1143 return ret;
diff --git a/src/lib/libcrypto/objects/obj_mac.num b/src/lib/libcrypto/objects/obj_mac.num
index 2f93e12b82..938ed866e7 100644
--- a/src/lib/libcrypto/objects/obj_mac.num
+++ b/src/lib/libcrypto/objects/obj_mac.num
@@ -1054,3 +1054,8 @@ acmeIdentifier 1053
1054id_ct_rpkiSignedPrefixList 1054 1054id_ct_rpkiSignedPrefixList 1054
1055tls1_prf 1055 1055tls1_prf 1055
1056X25519MLKEM768 1056 1056X25519MLKEM768 1056
1057id_ct_rpkiCanonicalCacheRepresentation 1057
1058id_ct_rpkiErikIndex 1058
1059id_ct_rpkiErikPartition 1059
1060id_ct_CDR 1060
1061communityDefinition 1061
diff --git a/src/lib/libcrypto/objects/objects.txt b/src/lib/libcrypto/objects/objects.txt
index 933fa51f71..4bafd9da7c 100644
--- a/src/lib/libcrypto/objects/objects.txt
+++ b/src/lib/libcrypto/objects/objects.txt
@@ -269,6 +269,10 @@ id-smime-ct 48 : id-ct-signedChecklist
269id-smime-ct 49 : id-ct-ASPA 269id-smime-ct 49 : id-ct-ASPA
270id-smime-ct 50 : id-ct-signedTAL 270id-smime-ct 50 : id-ct-signedTAL
271id-smime-ct 51 : id-ct-rpkiSignedPrefixList 271id-smime-ct 51 : id-ct-rpkiSignedPrefixList
272id-smime-ct 54 : id-ct-rpkiCanonicalCacheRepresentation
273id-smime-ct 55 : id-ct-rpkiErikIndex
274id-smime-ct 56 : id-ct-rpkiErikPartition
275id-smime-ct 58 : id-ct-CDR
272 276
273# S/MIME Attributes 277# S/MIME Attributes
274id-smime-aa 1 : id-smime-aa-receiptRequest 278id-smime-aa 1 : id-smime-aa-receiptRequest
@@ -632,6 +636,7 @@ id-ad 5 : caRepository : CA Repository
632id-ad 10 : rpkiManifest : RPKI Manifest 636id-ad 10 : rpkiManifest : RPKI Manifest
633id-ad 11 : signedObject : Signed Object 637id-ad 11 : signedObject : Signed Object
634id-ad 13 : rpkiNotify : RPKI Notify 638id-ad 13 : rpkiNotify : RPKI Notify
639id-ad 15 : communityDefinition : Community Definition Reference
635 640
636!Alias id-pkix-OCSP ad-OCSP 641!Alias id-pkix-OCSP ad-OCSP
637!module id-pkix-OCSP 642!module id-pkix-OCSP
diff --git a/src/lib/libcrypto/pem/pem_info.c b/src/lib/libcrypto/pem/pem_info.c
index 26061f6f08..24f0ddb011 100644
--- a/src/lib/libcrypto/pem/pem_info.c
+++ b/src/lib/libcrypto/pem/pem_info.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pem_info.c,v 1.33 2025/07/16 15:59:26 tb Exp $ */ 1/* $OpenBSD: pem_info.c,v 1.34 2026/07/31 03:59:50 kenjiro 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 *
@@ -77,7 +77,7 @@
77#include "err_local.h" 77#include "err_local.h"
78#include "evp_local.h" 78#include "evp_local.h"
79 79
80X509_PKEY * 80static X509_PKEY *
81X509_PKEY_new(void) 81X509_PKEY_new(void)
82{ 82{
83 X509_PKEY *x_pkey; 83 X509_PKEY *x_pkey;
@@ -90,7 +90,7 @@ X509_PKEY_new(void)
90 return x_pkey; 90 return x_pkey;
91} 91}
92 92
93void 93static void
94X509_PKEY_free(X509_PKEY *x_pkey) 94X509_PKEY_free(X509_PKEY *x_pkey)
95{ 95{
96 if (x_pkey == NULL) 96 if (x_pkey == NULL)
diff --git a/src/lib/libcrypto/pkcs12/p12_decr.c b/src/lib/libcrypto/pkcs12/p12_decr.c
index 3090781eba..b4d8c4e7f8 100644
--- a/src/lib/libcrypto/pkcs12/p12_decr.c
+++ b/src/lib/libcrypto/pkcs12/p12_decr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p12_decr.c,v 1.28 2026/01/27 14:03:01 tb Exp $ */ 1/* $OpenBSD: p12_decr.c,v 1.29 2026/07/31 00:50:52 kenjiro 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 */
@@ -63,6 +63,7 @@
63 63
64#include "err_local.h" 64#include "err_local.h"
65#include "evp_local.h" 65#include "evp_local.h"
66#include "pkcs12_local.h"
66 67
67/* Encrypt/Decrypt a buffer based on password and algor, result in a 68/* Encrypt/Decrypt a buffer based on password and algor, result in a
68 * malloc'ed buffer 69 * malloc'ed buffer
diff --git a/src/lib/libcrypto/pkcs12/p12_npas.c b/src/lib/libcrypto/pkcs12/p12_npas.c
index c78deb9182..cf5d1ef9e0 100644
--- a/src/lib/libcrypto/pkcs12/p12_npas.c
+++ b/src/lib/libcrypto/pkcs12/p12_npas.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p12_npas.c,v 1.28 2025/05/10 05:54:38 tb Exp $ */ 1/* $OpenBSD: p12_npas.c,v 1.29 2026/05/09 10:52:02 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 */
@@ -276,11 +276,11 @@ PKCS12_newpass(PKCS12 *pkcs12, const char *oldpass, const char *newpass)
276 276
277 switch (OBJ_obj2nid(pkcs7->type)) { 277 switch (OBJ_obj2nid(pkcs7->type)) {
278 case NID_pkcs7_data: 278 case NID_pkcs7_data:
279 if (pkcs7_repack_data(pkcs7, safes, oldpass, newpass)) 279 if (!pkcs7_repack_data(pkcs7, safes, oldpass, newpass))
280 goto err; 280 goto err;
281 break; 281 break;
282 case NID_pkcs7_encrypted: 282 case NID_pkcs7_encrypted:
283 if (pkcs7_repack_encdata(pkcs7, safes, oldpass, newpass)) 283 if (!pkcs7_repack_encdata(pkcs7, safes, oldpass, newpass))
284 goto err; 284 goto err;
285 break; 285 break;
286 } 286 }
diff --git a/src/lib/libcrypto/pkcs12/pkcs12_local.h b/src/lib/libcrypto/pkcs12/pkcs12_local.h
index 4a3ce4b3f0..b076784d89 100644
--- a/src/lib/libcrypto/pkcs12/pkcs12_local.h
+++ b/src/lib/libcrypto/pkcs12/pkcs12_local.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: pkcs12_local.h,v 1.6 2025/03/09 15:45:52 tb Exp $ */ 1/* $OpenBSD: pkcs12_local.h,v 1.7 2026/07/31 00:50:52 kenjiro 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 */
@@ -59,6 +59,8 @@
59#ifndef HEADER_PKCS12_LOCAL_H 59#ifndef HEADER_PKCS12_LOCAL_H
60#define HEADER_PKCS12_LOCAL_H 60#define HEADER_PKCS12_LOCAL_H
61 61
62#include <openssl/pkcs12.h>
63
62__BEGIN_HIDDEN_DECLS 64__BEGIN_HIDDEN_DECLS
63 65
64struct PKCS12_MAC_DATA_st { 66struct PKCS12_MAC_DATA_st {
diff --git a/src/lib/libcrypto/pkcs7/pk7_doit.c b/src/lib/libcrypto/pkcs7/pk7_doit.c
index 2e0b0a4f2a..0377c33cde 100644
--- a/src/lib/libcrypto/pkcs7/pk7_doit.c
+++ b/src/lib/libcrypto/pkcs7/pk7_doit.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pk7_doit.c,v 1.62 2026/04/24 15:10:20 tb Exp $ */ 1/* $OpenBSD: pk7_doit.c,v 1.69 2026/07/31 00:50:52 kenjiro 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 *
@@ -66,30 +66,24 @@
66 66
67#include "err_local.h" 67#include "err_local.h"
68#include "evp_local.h" 68#include "evp_local.h"
69/* XXX - for PKCS7_get_octet_string(), which belongs in pkcs7_local.h. */
70#include "pkcs12_local.h"
69#include "x509_local.h" 71#include "x509_local.h"
70 72
71static int 73static int
72PKCS7_type_is_other(PKCS7* p7) 74PKCS7_type_is_other(PKCS7* p7)
73{ 75{
74 int isOther = 1; 76 switch (OBJ_obj2nid(p7->type)) {
75
76 int nid = OBJ_obj2nid(p7->type);
77
78 switch (nid ) {
79 case NID_pkcs7_data: 77 case NID_pkcs7_data:
80 case NID_pkcs7_signed: 78 case NID_pkcs7_signed:
81 case NID_pkcs7_enveloped: 79 case NID_pkcs7_enveloped:
82 case NID_pkcs7_signedAndEnveloped: 80 case NID_pkcs7_signedAndEnveloped:
83 case NID_pkcs7_digest: 81 case NID_pkcs7_digest:
84 case NID_pkcs7_encrypted: 82 case NID_pkcs7_encrypted:
85 isOther = 0; 83 return 0;
86 break;
87 default:
88 isOther = 1;
89 } 84 }
90 85
91 return isOther; 86 return 1;
92
93} 87}
94 88
95ASN1_OCTET_STRING * 89ASN1_OCTET_STRING *
@@ -284,10 +278,9 @@ PKCS7_dataInit(PKCS7 *p7, BIO *bio)
284 return NULL; 278 return NULL;
285 } 279 }
286 280
287 i = OBJ_obj2nid(p7->type);
288 p7->state = PKCS7_S_HEADER; 281 p7->state = PKCS7_S_HEADER;
289 282
290 switch (i) { 283 switch (OBJ_obj2nid(p7->type)) {
291 case NID_pkcs7_signed: 284 case NID_pkcs7_signed:
292 md_sk = p7->d.sign->md_algs; 285 md_sk = p7->d.sign->md_algs;
293 os = PKCS7_get_octet_string(p7->d.sign->contents); 286 os = PKCS7_get_octet_string(p7->d.sign->contents);
@@ -424,7 +417,6 @@ pkcs7_cmp_ri(PKCS7_RECIP_INFO *ri, X509 *pcert)
424BIO * 417BIO *
425PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) 418PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert)
426{ 419{
427 int i, j;
428 BIO *out = NULL, *btmp = NULL, *etmp = NULL, *bio = NULL; 420 BIO *out = NULL, *btmp = NULL, *etmp = NULL, *bio = NULL;
429 X509_ALGOR *xa; 421 X509_ALGOR *xa;
430 ASN1_OCTET_STRING *data_body = NULL; 422 ASN1_OCTET_STRING *data_body = NULL;
@@ -437,6 +429,7 @@ PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert)
437 PKCS7_RECIP_INFO *ri = NULL; 429 PKCS7_RECIP_INFO *ri = NULL;
438 unsigned char *ek = NULL, *tkey = NULL; 430 unsigned char *ek = NULL, *tkey = NULL;
439 int eklen = 0, tkeylen = 0; 431 int eklen = 0, tkeylen = 0;
432 int i;
440 433
441 if (p7 == NULL) { 434 if (p7 == NULL) {
442 PKCS7error(PKCS7_R_INVALID_NULL_POINTER); 435 PKCS7error(PKCS7_R_INVALID_NULL_POINTER);
@@ -448,10 +441,9 @@ PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert)
448 return NULL; 441 return NULL;
449 } 442 }
450 443
451 i = OBJ_obj2nid(p7->type);
452 p7->state = PKCS7_S_HEADER; 444 p7->state = PKCS7_S_HEADER;
453 445
454 switch (i) { 446 switch (OBJ_obj2nid(p7->type)) {
455 case NID_pkcs7_signed: 447 case NID_pkcs7_signed:
456 data_body = PKCS7_get_octet_string(p7->d.sign->contents); 448 data_body = PKCS7_get_octet_string(p7->d.sign->contents);
457 md_sk = p7->d.sign->md_algs; 449 md_sk = p7->d.sign->md_algs;
@@ -491,8 +483,7 @@ PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert)
491 goto err; 483 goto err;
492 } 484 }
493 485
494 j = OBJ_obj2nid(xa->algorithm); 486 evp_md = EVP_get_digestbynid(OBJ_obj2nid(xa->algorithm));
495 evp_md = EVP_get_digestbynid(j);
496 if (evp_md == NULL) { 487 if (evp_md == NULL) {
497 PKCS7error(PKCS7_R_UNKNOWN_DIGEST_TYPE); 488 PKCS7error(PKCS7_R_UNKNOWN_DIGEST_TYPE);
498 goto err; 489 goto err;
@@ -692,14 +683,14 @@ do_pkcs7_signed_attrib(PKCS7_SIGNER_INFO *si, EVP_MD_CTX *mctx)
692int 683int
693PKCS7_dataFinal(PKCS7 *p7, BIO *bio) 684PKCS7_dataFinal(PKCS7 *p7, BIO *bio)
694{ 685{
695 int ret = 0;
696 int i, j;
697 BIO *btmp; 686 BIO *btmp;
698 PKCS7_SIGNER_INFO *si; 687 PKCS7_SIGNER_INFO *si;
699 EVP_MD_CTX *mdc, ctx_tmp; 688 EVP_MD_CTX *mdc, ctx_tmp;
700 STACK_OF(X509_ATTRIBUTE) *sk; 689 STACK_OF(X509_ATTRIBUTE) *sk;
701 STACK_OF(PKCS7_SIGNER_INFO) *si_sk = NULL; 690 STACK_OF(PKCS7_SIGNER_INFO) *si_sk = NULL;
702 ASN1_OCTET_STRING *os = NULL; 691 ASN1_OCTET_STRING *os = NULL;
692 int i, nid;
693 int ret = 0;
703 694
704 if (p7 == NULL) { 695 if (p7 == NULL) {
705 PKCS7error(PKCS7_R_INVALID_NULL_POINTER); 696 PKCS7error(PKCS7_R_INVALID_NULL_POINTER);
@@ -712,10 +703,9 @@ PKCS7_dataFinal(PKCS7 *p7, BIO *bio)
712 } 703 }
713 704
714 EVP_MD_CTX_legacy_clear(&ctx_tmp); 705 EVP_MD_CTX_legacy_clear(&ctx_tmp);
715 i = OBJ_obj2nid(p7->type);
716 p7->state = PKCS7_S_HEADER; 706 p7->state = PKCS7_S_HEADER;
717 707
718 switch (i) { 708 switch (nid = OBJ_obj2nid(p7->type)) {
719 case NID_pkcs7_data: 709 case NID_pkcs7_data:
720 os = p7->d.data; 710 os = p7->d.data;
721 break; 711 break;
@@ -785,9 +775,8 @@ PKCS7_dataFinal(PKCS7 *p7, BIO *bio)
785 if (si->pkey == NULL) 775 if (si->pkey == NULL)
786 continue; 776 continue;
787 777
788 j = OBJ_obj2nid(si->digest_alg->algorithm); 778 nid = OBJ_obj2nid(si->digest_alg->algorithm);
789 779 if ((btmp = PKCS7_find_digest(&mdc, bio, nid)) == NULL)
790 if ((btmp = PKCS7_find_digest(&mdc, bio, j)) == NULL)
791 goto err; 780 goto err;
792 781
793 /* We now have the EVP_MD_CTX, lets do the 782 /* We now have the EVP_MD_CTX, lets do the
@@ -819,7 +808,7 @@ PKCS7_dataFinal(PKCS7 *p7, BIO *bio)
819 ASN1_STRING_set0(si->enc_digest, abuf, abuflen); 808 ASN1_STRING_set0(si->enc_digest, abuf, abuflen);
820 } 809 }
821 } 810 }
822 } else if (i == NID_pkcs7_digest) { 811 } else if (nid == NID_pkcs7_digest) {
823 unsigned char md_data[EVP_MAX_MD_SIZE]; 812 unsigned char md_data[EVP_MAX_MD_SIZE];
824 unsigned int md_len; 813 unsigned int md_len;
825 814
@@ -930,9 +919,9 @@ PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx, BIO *bio,
930 PKCS7 *p7, PKCS7_SIGNER_INFO *si) 919 PKCS7 *p7, PKCS7_SIGNER_INFO *si)
931{ 920{
932 PKCS7_ISSUER_AND_SERIAL *ias; 921 PKCS7_ISSUER_AND_SERIAL *ias;
933 int ret = 0, i;
934 STACK_OF(X509) *cert; 922 STACK_OF(X509) *cert;
935 X509 *x509; 923 X509 *x509;
924 int ret = 0;
936 925
937 if (p7 == NULL) { 926 if (p7 == NULL) {
938 PKCS7error(PKCS7_R_INVALID_NULL_POINTER); 927 PKCS7error(PKCS7_R_INVALID_NULL_POINTER);
@@ -972,8 +961,7 @@ PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx, BIO *bio,
972 X509_STORE_CTX_cleanup(ctx); 961 X509_STORE_CTX_cleanup(ctx);
973 goto err; 962 goto err;
974 } 963 }
975 i = X509_verify_cert(ctx); 964 if (X509_verify_cert(ctx) <= 0) {
976 if (i <= 0) {
977 PKCS7error(ERR_R_X509_LIB); 965 PKCS7error(ERR_R_X509_LIB);
978 X509_STORE_CTX_cleanup(ctx); 966 X509_STORE_CTX_cleanup(ctx);
979 goto err; 967 goto err;
@@ -1161,24 +1149,42 @@ PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk)
1161} 1149}
1162LCRYPTO_ALIAS(PKCS7_digest_from_attributes); 1150LCRYPTO_ALIAS(PKCS7_digest_from_attributes);
1163 1151
1164int 1152static STACK_OF(X509_ATTRIBUTE) *
1165PKCS7_set_signed_attributes(PKCS7_SIGNER_INFO *p7si, 1153sk_X509_ATTRIBUTE_deep_copy(const STACK_OF(X509_ATTRIBUTE) *in_attrs)
1166 STACK_OF(X509_ATTRIBUTE) *sk)
1167{ 1154{
1155 STACK_OF(X509_ATTRIBUTE) *attrs = NULL;
1156 X509_ATTRIBUTE *attr = NULL;
1168 int i; 1157 int i;
1169 1158
1170 if (p7si->auth_attr != NULL) 1159 if ((attrs = sk_X509_ATTRIBUTE_new_null()) == NULL) {
1171 sk_X509_ATTRIBUTE_pop_free(p7si->auth_attr, 1160 X509error(ERR_R_MALLOC_FAILURE);
1172 X509_ATTRIBUTE_free); 1161 goto err;
1173 p7si->auth_attr = sk_X509_ATTRIBUTE_dup(sk);
1174 if (p7si->auth_attr == NULL)
1175 return 0;
1176 for (i = 0; i < sk_X509_ATTRIBUTE_num(sk); i++) {
1177 if ((sk_X509_ATTRIBUTE_set(p7si->auth_attr, i,
1178 X509_ATTRIBUTE_dup(sk_X509_ATTRIBUTE_value(sk, i))))
1179 == NULL)
1180 return 0;
1181 } 1162 }
1163
1164 for (i = 0; i < sk_X509_ATTRIBUTE_num(in_attrs); i++) {
1165 attr = X509_ATTRIBUTE_dup(sk_X509_ATTRIBUTE_value(in_attrs, i));
1166 if (attr == NULL)
1167 goto err;
1168 if (!sk_X509_ATTRIBUTE_push(attrs, attr))
1169 goto err;
1170 attr = NULL;
1171 }
1172
1173 return attrs;
1174
1175 err:
1176 X509_ATTRIBUTE_free(attr);
1177 sk_X509_ATTRIBUTE_pop_free(attrs, X509_ATTRIBUTE_free);
1178
1179 return NULL;
1180}
1181
1182int
1183PKCS7_set_signed_attributes(PKCS7_SIGNER_INFO *p7si, STACK_OF(X509_ATTRIBUTE) *sk)
1184{
1185 sk_X509_ATTRIBUTE_pop_free(p7si->auth_attr, X509_ATTRIBUTE_free);
1186 if ((p7si->auth_attr = sk_X509_ATTRIBUTE_deep_copy(sk)) == NULL)
1187 return 0;
1182 return 1; 1188 return 1;
1183} 1189}
1184LCRYPTO_ALIAS(PKCS7_set_signed_attributes); 1190LCRYPTO_ALIAS(PKCS7_set_signed_attributes);
@@ -1186,20 +1192,9 @@ LCRYPTO_ALIAS(PKCS7_set_signed_attributes);
1186int 1192int
1187PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si, STACK_OF(X509_ATTRIBUTE) *sk) 1193PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si, STACK_OF(X509_ATTRIBUTE) *sk)
1188{ 1194{
1189 int i; 1195 sk_X509_ATTRIBUTE_pop_free(p7si->unauth_attr, X509_ATTRIBUTE_free);
1190 1196 if ((p7si->unauth_attr = sk_X509_ATTRIBUTE_deep_copy(sk)) == NULL)
1191 if (p7si->unauth_attr != NULL)
1192 sk_X509_ATTRIBUTE_pop_free(p7si->unauth_attr,
1193 X509_ATTRIBUTE_free);
1194 p7si->unauth_attr = sk_X509_ATTRIBUTE_dup(sk);
1195 if (p7si->unauth_attr == NULL)
1196 return 0; 1197 return 0;
1197 for (i = 0; i < sk_X509_ATTRIBUTE_num(sk); i++) {
1198 if ((sk_X509_ATTRIBUTE_set(p7si->unauth_attr, i,
1199 X509_ATTRIBUTE_dup(sk_X509_ATTRIBUTE_value(sk, i))))
1200 == NULL)
1201 return 0;
1202 }
1203 return 1; 1198 return 1;
1204} 1199}
1205LCRYPTO_ALIAS(PKCS7_set_attributes); 1200LCRYPTO_ALIAS(PKCS7_set_attributes);
diff --git a/src/lib/libcrypto/pkcs7/pk7_lib.c b/src/lib/libcrypto/pkcs7/pk7_lib.c
index 8712a2ecc1..58e5c88a5e 100644
--- a/src/lib/libcrypto/pkcs7/pk7_lib.c
+++ b/src/lib/libcrypto/pkcs7/pk7_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pk7_lib.c,v 1.31 2025/05/10 05:54:38 tb Exp $ */ 1/* $OpenBSD: pk7_lib.c,v 1.33 2026/08/30 16:56:45 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 *
@@ -650,6 +650,11 @@ PKCS7_stream(unsigned char ***boundary, PKCS7 *p7)
650 break; 650 break;
651 651
652 case NID_pkcs7_signedAndEnveloped: 652 case NID_pkcs7_signedAndEnveloped:
653 if (p7->d.signed_and_enveloped == NULL ||
654 p7->d.signed_and_enveloped->enc_data == NULL) {
655 PKCS7error(PKCS7_R_NO_CONTENT);
656 break;
657 }
653 os = p7->d.signed_and_enveloped->enc_data->enc_data; 658 os = p7->d.signed_and_enveloped->enc_data->enc_data;
654 if (os == NULL) { 659 if (os == NULL) {
655 os = ASN1_OCTET_STRING_new(); 660 os = ASN1_OCTET_STRING_new();
@@ -658,6 +663,11 @@ PKCS7_stream(unsigned char ***boundary, PKCS7 *p7)
658 break; 663 break;
659 664
660 case NID_pkcs7_enveloped: 665 case NID_pkcs7_enveloped:
666 if (p7->d.enveloped == NULL ||
667 p7->d.enveloped->enc_data == NULL) {
668 PKCS7error(PKCS7_R_NO_CONTENT);
669 break;
670 }
661 os = p7->d.enveloped->enc_data->enc_data; 671 os = p7->d.enveloped->enc_data->enc_data;
662 if (os == NULL) { 672 if (os == NULL) {
663 os = ASN1_OCTET_STRING_new(); 673 os = ASN1_OCTET_STRING_new();
@@ -666,6 +676,14 @@ PKCS7_stream(unsigned char ***boundary, PKCS7 *p7)
666 break; 676 break;
667 677
668 case NID_pkcs7_signed: 678 case NID_pkcs7_signed:
679 if (p7->d.sign == NULL || p7->d.sign->contents == NULL) {
680 PKCS7error(PKCS7_R_NO_CONTENT);
681 break;
682 }
683 if (!PKCS7_type_is_data(p7->d.sign->contents)) {
684 PKCS7error(PKCS7_R_UNSUPPORTED_CONTENT_TYPE);
685 break;
686 }
669 os = p7->d.sign->contents->d.data; 687 os = p7->d.sign->contents->d.data;
670 break; 688 break;
671 689
diff --git a/src/lib/libcrypto/pkcs7/pk7_smime.c b/src/lib/libcrypto/pkcs7/pk7_smime.c
index 9baff7f525..3806d17082 100644
--- a/src/lib/libcrypto/pkcs7/pk7_smime.c
+++ b/src/lib/libcrypto/pkcs7/pk7_smime.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pk7_smime.c,v 1.29 2025/12/20 07:22:43 tb Exp $ */ 1/* $OpenBSD: pk7_smime.c,v 1.30 2026/06/09 12:34:08 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 */
@@ -259,7 +259,7 @@ PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, BIO *indata,
259 char buf[4096]; 259 char buf[4096];
260 int i, j = 0, k, ret = 0; 260 int i, j = 0, k, ret = 0;
261 BIO *p7bio; 261 BIO *p7bio;
262 BIO *tmpin, *tmpout; 262 BIO *next, *tmpin, *tmpout;
263 263
264 if (!p7) { 264 if (!p7) {
265 PKCS7error(PKCS7_R_INVALID_NULL_POINTER); 265 PKCS7error(PKCS7_R_INVALID_NULL_POINTER);
@@ -409,12 +409,12 @@ PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, BIO *indata,
409 409
410 ret = 1; 410 ret = 1;
411 411
412err: 412 err:
413 if (tmpin == indata) { 413 while (p7bio != NULL && p7bio != indata) {
414 if (indata) 414 next = BIO_pop(p7bio);
415 BIO_pop(p7bio); 415 BIO_free(p7bio);
416 p7bio = next;
416 } 417 }
417 BIO_free_all(p7bio);
418 sk_X509_free(signers); 418 sk_X509_free(signers);
419 419
420 return ret; 420 return ret;
diff --git a/src/lib/libcrypto/ripemd/ripemd.h b/src/lib/libcrypto/ripemd/ripemd.h
index c7b1bd79b9..7866626ffc 100644
--- a/src/lib/libcrypto/ripemd/ripemd.h
+++ b/src/lib/libcrypto/ripemd/ripemd.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ripemd.h,v 1.20 2025/01/25 17:59:44 tb Exp $ */ 1/* $OpenBSD: ripemd.h,v 1.21 2026/05/08 05:15:20 jsg 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 *
@@ -71,14 +71,7 @@
71extern "C" { 71extern "C" {
72#endif 72#endif
73 73
74#if defined(__LP32__)
75#define RIPEMD160_LONG unsigned long
76#elif defined(__ILP64__)
77#define RIPEMD160_LONG unsigned long
78#define RIPEMD160_LONG_LOG2 3
79#else
80#define RIPEMD160_LONG unsigned int 74#define RIPEMD160_LONG unsigned int
81#endif
82 75
83#define RIPEMD160_CBLOCK 64 76#define RIPEMD160_CBLOCK 64
84#define RIPEMD160_LBLOCK (RIPEMD160_CBLOCK/4) 77#define RIPEMD160_LBLOCK (RIPEMD160_CBLOCK/4)
diff --git a/src/lib/libcrypto/rsa/rsa_ameth.c b/src/lib/libcrypto/rsa/rsa_ameth.c
index aca00a9ec8..9d8e2d2789 100644
--- a/src/lib/libcrypto/rsa/rsa_ameth.c
+++ b/src/lib/libcrypto/rsa/rsa_ameth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_ameth.c,v 1.65 2026/04/07 13:16:41 tb Exp $ */ 1/* $OpenBSD: rsa_ameth.c,v 1.66 2026/08/21 17:15:22 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 2006. 3 * project 2006.
4 */ 4 */
@@ -879,7 +879,7 @@ rsa_pss_signature_info(const X509_ALGOR *alg, int *out_md_nid,
879 goto err; 879 goto err;
880 880
881 /* 881 /*
882 * RFC 8446, section 4.2.3 - restricts the digest algorithm: 882 * RFC 9846, section 4.3.3 - restricts the digest algorithm:
883 * - it must be one of SHA256, SHA384, and SHA512; 883 * - it must be one of SHA256, SHA384, and SHA512;
884 * - the same digest must be used in the mask generation function; 884 * - the same digest must be used in the mask generation function;
885 * - the salt length must match the output length of the digest. 885 * - the salt length must match the output length of the digest.
diff --git a/src/lib/libcrypto/rsa/rsa_eay.c b/src/lib/libcrypto/rsa/rsa_eay.c
index 65ccfc35e1..0a88c812be 100644
--- a/src/lib/libcrypto/rsa/rsa_eay.c
+++ b/src/lib/libcrypto/rsa/rsa_eay.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_eay.c,v 1.66 2025/05/10 05:54:38 tb Exp $ */ 1/* $OpenBSD: rsa_eay.c,v 1.67 2026/08/27 07:18:40 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 *
@@ -126,7 +126,7 @@ rsa_public_encrypt(int flen, const unsigned char *from, unsigned char *to,
126 RSA *rsa, int padding) 126 RSA *rsa, int padding)
127{ 127{
128 BIGNUM *f, *ret; 128 BIGNUM *f, *ret;
129 int i, j, k, num = 0, r = -1; 129 int i, num = 0, r = -1;
130 unsigned char *buf = NULL; 130 unsigned char *buf = NULL;
131 BN_CTX *ctx = NULL; 131 BN_CTX *ctx = NULL;
132 132
@@ -200,15 +200,9 @@ rsa_public_encrypt(int flen, const unsigned char *from, unsigned char *to,
200 rsa->_method_mod_n)) 200 rsa->_method_mod_n))
201 goto err; 201 goto err;
202 202
203 /* put in leading 0 bytes if the number is less than the 203 r = BN_bn2binpad(ret, to, num);
204 * length of the modulus */
205 j = BN_num_bytes(ret);
206 i = BN_bn2bin(ret, &(to[num - j]));
207 for (k = 0; k < num - i; k++)
208 to[k] = 0;
209 204
210 r = num; 205 err:
211err:
212 if (ctx != NULL) { 206 if (ctx != NULL) {
213 BN_CTX_end(ctx); 207 BN_CTX_end(ctx);
214 BN_CTX_free(ctx); 208 BN_CTX_free(ctx);
@@ -306,7 +300,7 @@ rsa_private_encrypt(int flen, const unsigned char *from, unsigned char *to,
306 RSA *rsa, int padding) 300 RSA *rsa, int padding)
307{ 301{
308 BIGNUM *f, *ret, *res; 302 BIGNUM *f, *ret, *res;
309 int i, j, k, num = 0, r = -1; 303 int i, num = 0, r = -1;
310 unsigned char *buf = NULL; 304 unsigned char *buf = NULL;
311 BN_CTX *ctx = NULL; 305 BN_CTX *ctx = NULL;
312 int local_blinding = 0; 306 int local_blinding = 0;
@@ -412,15 +406,9 @@ rsa_private_encrypt(int flen, const unsigned char *from, unsigned char *to,
412 } else 406 } else
413 res = ret; 407 res = ret;
414 408
415 /* put in leading 0 bytes if the number is less than the 409 r = BN_bn2binpad(res, to, num);
416 * length of the modulus */
417 j = BN_num_bytes(res);
418 i = BN_bn2bin(res, &(to[num - j]));
419 for (k = 0; k < num - i; k++)
420 to[k] = 0;
421 410
422 r = num; 411 err:
423err:
424 if (ctx != NULL) { 412 if (ctx != NULL) {
425 BN_CTX_end(ctx); 413 BN_CTX_end(ctx);
426 BN_CTX_free(ctx); 414 BN_CTX_free(ctx);
diff --git a/src/lib/libcrypto/rsa/rsa_x931.c b/src/lib/libcrypto/rsa/rsa_x931.c
index 8a0190d7fe..c4b4179f7b 100644
--- a/src/lib/libcrypto/rsa/rsa_x931.c
+++ b/src/lib/libcrypto/rsa/rsa_x931.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_x931.c,v 1.13 2025/05/10 05:54:38 tb Exp $ */ 1/* $OpenBSD: rsa_x931.c,v 1.14 2026/07/31 00:50:52 kenjiro 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 2005. 3 * project 2005.
4 */ 4 */
@@ -64,6 +64,7 @@
64#include <openssl/rsa.h> 64#include <openssl/rsa.h>
65 65
66#include "err_local.h" 66#include "err_local.h"
67#include "rsa_local.h"
67 68
68int 69int
69RSA_padding_add_X931(unsigned char *to, int tlen, const unsigned char *from, 70RSA_padding_add_X931(unsigned char *to, int tlen, const unsigned char *from,
diff --git a/src/lib/libcrypto/sha/sha1_aarch64.c b/src/lib/libcrypto/sha/sha1_aarch64.c
index 04c87761e0..a9fb8235c6 100644
--- a/src/lib/libcrypto/sha/sha1_aarch64.c
+++ b/src/lib/libcrypto/sha/sha1_aarch64.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sha1_aarch64.c,v 1.1 2025/06/28 12:51:08 jsing Exp $ */ 1/* $OpenBSD: sha1_aarch64.c,v 1.2 2026/05/09 07:03:49 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2025 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2025 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -19,11 +19,11 @@
19 19
20#include "crypto_arch.h" 20#include "crypto_arch.h"
21 21
22void sha1_block_ce(SHA256_CTX *ctx, const void *in, size_t num); 22void sha1_block_ce(SHA_CTX *ctx, const void *in, size_t num);
23void sha1_block_generic(SHA256_CTX *ctx, const void *in, size_t num); 23void sha1_block_generic(SHA_CTX *ctx, const void *in, size_t num);
24 24
25void 25void
26sha1_block_data_order(SHA256_CTX *ctx, const void *in, size_t num) 26sha1_block_data_order(SHA_CTX *ctx, const void *in, size_t num)
27{ 27{
28 if ((crypto_cpu_caps_aarch64 & CRYPTO_CPU_CAPS_AARCH64_SHA1) != 0) { 28 if ((crypto_cpu_caps_aarch64 & CRYPTO_CPU_CAPS_AARCH64_SHA1) != 0) {
29 sha1_block_ce(ctx, in, num); 29 sha1_block_ce(ctx, in, num);
diff --git a/src/lib/libcrypto/sha/sha1_aarch64_ce.S b/src/lib/libcrypto/sha/sha1_aarch64_ce.S
index 641500a1e5..913a7b8fc1 100644
--- a/src/lib/libcrypto/sha/sha1_aarch64_ce.S
+++ b/src/lib/libcrypto/sha/sha1_aarch64_ce.S
@@ -1,4 +1,4 @@
1/* $OpenBSD: sha1_aarch64_ce.S,v 1.5 2026/01/25 08:22:17 jsing Exp $ */ 1/* $OpenBSD: sha1_aarch64_ce.S,v 1.10 2026/05/12 15:07:30 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2023,2025 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2023,2025 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -15,6 +15,10 @@
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */ 16 */
17 17
18#include "crypto_assembly.h"
19
20#define _SEP CRYPTO_ASSEMBLY_SEPARATOR
21
18/* 22/*
19 * SHA-1 implementation using the ARM Cryptographic Extension (CE). 23 * SHA-1 implementation using the ARM Cryptographic Extension (CE).
20 * 24 *
@@ -65,7 +69,7 @@
65 * W0 = W8 ^ W2 ^ W0, while sha1su1 computes rol(W0 ^ W13, 1). 69 * W0 = W8 ^ W2 ^ W0, while sha1su1 computes rol(W0 ^ W13, 1).
66 */ 70 */
67#define sha1_message_schedule_update(m0, m1, m2, m3) \ 71#define sha1_message_schedule_update(m0, m1, m2, m3) \
68 sha1su0 m0.4s, m1.4s, m2.4s; \ 72 sha1su0 m0.4s, m1.4s, m2.4s _SEP \
69 sha1su1 m0.4s, m3.4s 73 sha1su1 m0.4s, m3.4s
70 74
71/* 75/*
@@ -75,41 +79,39 @@
75 */ 79 */
76 80
77#define sha1_round1(h0, h1, w, k) \ 81#define sha1_round1(h0, h1, w, k) \
78 add tmp0.4s, w.4s, k.4s; /* Tt = Wt + Kt */ \ 82 add tmp0.4s, w.4s, k.4s /* Tt = Wt + Kt */ _SEP \
79 mov tmp1, h0.s[0]; \ 83 mov tmp1, h0.s[0] _SEP \
80 sha1c h0##q, h1##s, tmp0.4s; \ 84 sha1c h0##q, h1##s, tmp0.4s _SEP \
81 sha1h h1##s, tmp1 85 sha1h h1##s, tmp1
82 86
83#define sha1_round2(h0, h1, w, k) \ 87#define sha1_round2(h0, h1, w, k) \
84 add tmp0.4s, w.4s, k.4s; /* Tt = Wt + Kt */ \ 88 add tmp0.4s, w.4s, k.4s /* Tt = Wt + Kt */ _SEP \
85 mov tmp1, h0.s[0]; \ 89 mov tmp1, h0.s[0] _SEP \
86 sha1p h0##q, h1##s, tmp0.4s; \ 90 sha1p h0##q, h1##s, tmp0.4s _SEP \
87 sha1h h1##s, tmp1 91 sha1h h1##s, tmp1
88 92
89#define sha1_round3(h0, h1, w, k) \ 93#define sha1_round3(h0, h1, w, k) \
90 add tmp0.4s, w.4s, k.4s; /* Tt = Wt + Kt */ \ 94 add tmp0.4s, w.4s, k.4s /* Tt = Wt + Kt */ _SEP \
91 mov tmp1, h0.s[0]; \ 95 mov tmp1, h0.s[0] _SEP \
92 sha1m h0##q, h1##s, tmp0.4s; \ 96 sha1m h0##q, h1##s, tmp0.4s _SEP \
93 sha1h h1##s, tmp1 97 sha1h h1##s, tmp1
94 98
95#define sha1_round4(h0, h1, w, k) \ 99#define sha1_round4(h0, h1, w, k) \
96 add tmp0.4s, w.4s, k.4s; /* Tt = Wt + Kt */ \ 100 add tmp0.4s, w.4s, k.4s /* Tt = Wt + Kt */ _SEP \
97 mov tmp1, h0.s[0]; \ 101 mov tmp1, h0.s[0] _SEP \
98 sha1p h0##q, h1##s, tmp0.4s; \ 102 sha1p h0##q, h1##s, tmp0.4s _SEP \
99 sha1h h1##s, tmp1 103 sha1h h1##s, tmp1
100 104
101.arch armv8-a+sha2 105.arch armv8-a+sha2
102 106
103.section .text 107.section CRYPTO_ASSEMBLY_SECTION_TEXT
104 108
105/* 109/*
106 * void sha1_block_ce(SHA256_CTX *ctx, const void *in, size_t num); 110 * void sha1_block_ce(SHA_CTX *ctx, const void *in, size_t num);
107 * 111 *
108 * Standard ARM ABI: x0 = ctx, x1 = in, x2 = num 112 * Standard ARM ABI: x0 = ctx, x1 = in, x2 = num
109 */ 113 */
110.globl sha1_block_ce 114CRYPTO_ASSEMBLY_GLOBAL_FUNCTION(sha1_block_ce):
111.type sha1_block_ce,@function
112sha1_block_ce:
113 115
114 /* 116 /*
115 * Load SHA-1 round constants. 117 * Load SHA-1 round constants.
@@ -213,3 +215,7 @@ sha1_block_ce:
213 str hc1s, [ctx, #(4*4)] 215 str hc1s, [ctx, #(4*4)]
214 216
215 ret 217 ret
218
219#if defined(__linux__) && defined(__ELF__)
220.section .note.GNU-stack,"",%progbits
221#endif
diff --git a/src/lib/libcrypto/sha/sha1_amd64_generic.S b/src/lib/libcrypto/sha/sha1_amd64_generic.S
index 57709c0a1f..c890d0d7fe 100644
--- a/src/lib/libcrypto/sha/sha1_amd64_generic.S
+++ b/src/lib/libcrypto/sha/sha1_amd64_generic.S
@@ -1,4 +1,4 @@
1/* $OpenBSD: sha1_amd64_generic.S,v 1.5 2026/03/28 13:11:28 jsing Exp $ */ 1/* $OpenBSD: sha1_amd64_generic.S,v 1.8 2026/05/12 15:07:30 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -17,6 +17,8 @@
17 17
18#include "crypto_assembly.h" 18#include "crypto_assembly.h"
19 19
20#define _SEP CRYPTO_ASSEMBLY_SEPARATOR
21
20#define ctx %rdi 22#define ctx %rdi
21#define in %rsi 23#define in %rsi
22#define num %rdx 24#define num %rdx
@@ -40,8 +42,8 @@
40 * Wt = Mt 42 * Wt = Mt
41 */ 43 */
42#define sha1_message_schedule_load(idx, m, w, wt) \ 44#define sha1_message_schedule_load(idx, m, w, wt) \
43 movl ((idx&0xf)*4)(m), wt; \ 45 movl ((idx&0xf)*4)(m), wt _SEP \
44 bswapl wt; \ 46 bswapl wt _SEP \
45 movl wt, ((idx&0xf)*4)(w) 47 movl wt, ((idx&0xf)*4)(w)
46 48
47/* 49/*
@@ -50,11 +52,11 @@
50 * W0 = rol(W13 ^ W8 ^ W2 ^ W0, 1) 52 * W0 = rol(W13 ^ W8 ^ W2 ^ W0, 1)
51 */ 53 */
52#define sha1_message_schedule_update(idx, w, wt) \ 54#define sha1_message_schedule_update(idx, w, wt) \
53 movl (((idx-3)&0xf)*4)(w), wt; /* W13 */ \ 55 movl (((idx-3)&0xf)*4)(w), wt /* W13 */ _SEP \
54 xorl (((idx-8)&0xf)*4)(w), wt; /* W8 */ \ 56 xorl (((idx-8)&0xf)*4)(w), wt /* W8 */ _SEP \
55 xorl (((idx-14)&0xf)*4)(w), wt; /* W2 */ \ 57 xorl (((idx-14)&0xf)*4)(w), wt /* W2 */ _SEP \
56 xorl (((idx)&0xf)*4)(w), wt; /* W0 */ \ 58 xorl (((idx)&0xf)*4)(w), wt /* W0 */ _SEP \
57 roll $1, wt; \ 59 roll $1, wt _SEP \
58 \ 60 \
59 movl wt, ((idx&0xf)*4)(w) 61 movl wt, ((idx&0xf)*4)(w)
60 62
@@ -69,13 +71,13 @@
69 * Upon completion b = rol(b, 30), e = T, pending rotation. 71 * Upon completion b = rol(b, 30), e = T, pending rotation.
70 */ 72 */
71#define sha1_round(a, b, c, d, e, kt, wt) \ 73#define sha1_round(a, b, c, d, e, kt, wt) \
72 leal kt(wt, e, 1), e; /* Kt + Wt */ \ 74 leal kt(wt, e, 1), e /* Kt + Wt */ _SEP \
73 \ 75 \
74 movl a, tmp1; /* rol(a, 5) */ \ 76 movl a, tmp1 /* rol(a, 5) */ _SEP \
75 roll $5, tmp1; \ 77 roll $5, tmp1 _SEP \
76 addl tmp1, e; \ 78 addl tmp1, e _SEP \
77 \ 79 \
78 roll $30, b; /* rol(b, 30) */ 80 roll $30, b /* rol(b, 30) */
79 81
80/* 82/*
81 * Compute a SHA-1 round with Ch: 83 * Compute a SHA-1 round with Ch:
@@ -87,11 +89,11 @@
87 * Upon completion b = rol(b, 30), e = T, pending rotation. 89 * Upon completion b = rol(b, 30), e = T, pending rotation.
88 */ 90 */
89#define sha1_round_ch(a, b, c, d, e, kt, wt) \ 91#define sha1_round_ch(a, b, c, d, e, kt, wt) \
90 movl c, tmp2; /* Ch */ \ 92 movl c, tmp2 /* Ch */ _SEP \
91 xorl d, tmp2; /* Ch */ \ 93 xorl d, tmp2 /* Ch */ _SEP \
92 andl b, tmp2; /* Ch */ \ 94 andl b, tmp2 /* Ch */ _SEP \
93 xorl d, tmp2; /* Ch */ \ 95 xorl d, tmp2 /* Ch */ _SEP \
94 addl tmp2, e; /* Ch */ \ 96 addl tmp2, e /* Ch */ _SEP \
95 \ 97 \
96 sha1_round(a, b, c, d, e, kt, wt) 98 sha1_round(a, b, c, d, e, kt, wt)
97 99
@@ -105,10 +107,10 @@
105 * Upon completion b = rol(b, 30), e = T, pending rotation. 107 * Upon completion b = rol(b, 30), e = T, pending rotation.
106 */ 108 */
107#define sha1_round_parity(a, b, c, d, e, kt, wt) \ 109#define sha1_round_parity(a, b, c, d, e, kt, wt) \
108 movl b, tmp2; /* Parity */ \ 110 movl b, tmp2 /* Parity */ _SEP \
109 xorl c, tmp2; /* Parity */ \ 111 xorl c, tmp2 /* Parity */ _SEP \
110 xorl d, tmp2; /* Parity */ \ 112 xorl d, tmp2 /* Parity */ _SEP \
111 addl tmp2, e; /* Parity */ \ 113 addl tmp2, e /* Parity */ _SEP \
112 \ 114 \
113 sha1_round(a, b, c, d, e, kt, wt) 115 sha1_round(a, b, c, d, e, kt, wt)
114 116
@@ -122,34 +124,34 @@
122 * Upon completion b = rol(b, 30), e = T, pending rotation. 124 * Upon completion b = rol(b, 30), e = T, pending rotation.
123 */ 125 */
124#define sha1_round_maj(a, b, c, d, e, kt, wt) \ 126#define sha1_round_maj(a, b, c, d, e, kt, wt) \
125 movl c, tmp2; /* Maj */ \ 127 movl c, tmp2 /* Maj */ _SEP \
126 xorl d, tmp2; /* Maj */ \ 128 xorl d, tmp2 /* Maj */ _SEP \
127 andl b, tmp2; /* Maj */ \ 129 andl b, tmp2 /* Maj */ _SEP \
128 movl c, tmp3; /* Maj */ \ 130 movl c, tmp3 /* Maj */ _SEP \
129 andl d, tmp3; /* Maj */ \ 131 andl d, tmp3 /* Maj */ _SEP \
130 xorl tmp2, tmp3; /* Maj */ \ 132 xorl tmp2, tmp3 /* Maj */ _SEP \
131 addl tmp3, e; /* Maj */ \ 133 addl tmp3, e /* Maj */ _SEP \
132 \ 134 \
133 sha1_round(a, b, c, d, e, kt, wt) 135 sha1_round(a, b, c, d, e, kt, wt)
134 136
135#define sha1_round1_load(idx, a, b, c, d, e) \ 137#define sha1_round1_load(idx, a, b, c, d, e) \
136 sha1_message_schedule_load(idx, in, %rsp, tmp0); \ 138 sha1_message_schedule_load(idx, in, %rsp, tmp0) _SEP \
137 sha1_round_ch(a, b, c, d, e, 0x5a827999, tmp0) 139 sha1_round_ch(a, b, c, d, e, 0x5a827999, tmp0)
138 140
139#define sha1_round1_update(idx, a, b, c, d, e) \ 141#define sha1_round1_update(idx, a, b, c, d, e) \
140 sha1_message_schedule_update(idx, %rsp, tmp0); \ 142 sha1_message_schedule_update(idx, %rsp, tmp0) _SEP \
141 sha1_round_ch(a, b, c, d, e, 0x5a827999, tmp0) 143 sha1_round_ch(a, b, c, d, e, 0x5a827999, tmp0)
142 144
143#define sha1_round2_update(idx, a, b, c, d, e) \ 145#define sha1_round2_update(idx, a, b, c, d, e) \
144 sha1_message_schedule_update(idx, %rsp, tmp0); \ 146 sha1_message_schedule_update(idx, %rsp, tmp0) _SEP \
145 sha1_round_parity(a, b, c, d, e, 0x6ed9eba1, tmp0) 147 sha1_round_parity(a, b, c, d, e, 0x6ed9eba1, tmp0)
146 148
147#define sha1_round3_update(idx, a, b, c, d, e) \ 149#define sha1_round3_update(idx, a, b, c, d, e) \
148 sha1_message_schedule_update(idx, %rsp, tmp0); \ 150 sha1_message_schedule_update(idx, %rsp, tmp0) _SEP \
149 sha1_round_maj(a, b, c, d, e, 0x8f1bbcdc, tmp0) 151 sha1_round_maj(a, b, c, d, e, 0x8f1bbcdc, tmp0)
150 152
151#define sha1_round4_update(idx, a, b, c, d, e) \ 153#define sha1_round4_update(idx, a, b, c, d, e) \
152 sha1_message_schedule_update(idx, %rsp, tmp0); \ 154 sha1_message_schedule_update(idx, %rsp, tmp0) _SEP \
153 sha1_round_parity(a, b, c, d, e, 0xca62c1d6, tmp0) 155 sha1_round_parity(a, b, c, d, e, 0xca62c1d6, tmp0)
154 156
155.section .text 157.section .text
@@ -160,9 +162,7 @@
160 * Standard x86-64 ABI: rdi = ctx, rsi = in, rdx = num 162 * Standard x86-64 ABI: rdi = ctx, rsi = in, rdx = num
161 */ 163 */
162.align 16 164.align 16
163.globl sha1_block_generic 165CRYPTO_ASSEMBLY_GLOBAL_FUNCTION(sha1_block_generic):
164.type sha1_block_generic,@function
165sha1_block_generic:
166 _CET_ENDBR 166 _CET_ENDBR
167 167
168 /* Save callee save registers. */ 168 /* Save callee save registers. */
@@ -308,3 +308,7 @@ sha1_block_generic:
308 popq %rbx 308 popq %rbx
309 309
310 ret 310 ret
311
312#if defined(__linux__) && defined(__ELF__)
313.section .note.GNU-stack,"",%progbits
314#endif
diff --git a/src/lib/libcrypto/sha/sha1_amd64_shani.S b/src/lib/libcrypto/sha/sha1_amd64_shani.S
index 7fc5168907..afba0b9f14 100644
--- a/src/lib/libcrypto/sha/sha1_amd64_shani.S
+++ b/src/lib/libcrypto/sha/sha1_amd64_shani.S
@@ -1,4 +1,4 @@
1/* $OpenBSD: sha1_amd64_shani.S,v 1.4 2026/03/28 13:11:28 jsing Exp $ */ 1/* $OpenBSD: sha1_amd64_shani.S,v 1.9 2026/05/12 15:07:30 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -17,6 +17,8 @@
17 17
18#include "crypto_assembly.h" 18#include "crypto_assembly.h"
19 19
20#define _SEP CRYPTO_ASSEMBLY_SEPARATOR
21
20/* 22/*
21 * SHA-1 implementation using the Intel SHA extensions: 23 * SHA-1 implementation using the Intel SHA extensions:
22 * 24 *
@@ -45,39 +47,37 @@
45 47
46 48
47#define sha1_message_schedule_load(idx, m, xmsg) \ 49#define sha1_message_schedule_load(idx, m, xmsg) \
48 movdqu (idx*16)(m), xmsg; \ 50 movdqu (idx*16)(m), xmsg _SEP \
49 pshufb xshufmask, xmsg 51 pshufb xshufmask, xmsg
50 52
51#define sha1_message_schedule_update(xm0, xm1, xm2, xm3) \ 53#define sha1_message_schedule_update(xm0, xm1, xm2, xm3) \
52 sha1msg1 xm1, xm0; \ 54 sha1msg1 xm1, xm0 _SEP \
53 pxor xm2, xm0; \ 55 pxor xm2, xm0 _SEP \
54 sha1msg2 xm3, xm0 56 sha1msg2 xm3, xm0
55 57
56#define sha1_shani_round(fn, xmsg, xe, xe_next) \ 58#define sha1_shani_round(fn, xmsg, xe, xe_next) \
57 sha1nexte xmsg, xe; \ 59 sha1nexte xmsg, xe _SEP \
58 movdqa xabcd, xe_next; \ 60 movdqa xabcd, xe_next _SEP \
59 sha1rnds4 fn, xe, xabcd 61 sha1rnds4 fn, xe, xabcd
60 62
61#define sha1_shani_round_load(fn, idx, m, xmsg, xe, xe_next) \ 63#define sha1_shani_round_load(fn, idx, m, xmsg, xe, xe_next) \
62 sha1_message_schedule_load(idx, m, xmsg); \ 64 sha1_message_schedule_load(idx, m, xmsg) _SEP \
63 sha1_shani_round(fn, xmsg, xe, xe_next) 65 sha1_shani_round(fn, xmsg, xe, xe_next)
64 66
65#define sha1_shani_round_update(fn, xm0, xm1, xm2, xm3, xe, xe_next) \ 67#define sha1_shani_round_update(fn, xm0, xm1, xm2, xm3, xe, xe_next) \
66 sha1_message_schedule_update(xm0, xm1, xm2, xm3); \ 68 sha1_message_schedule_update(xm0, xm1, xm2, xm3) _SEP \
67 sha1_shani_round(fn, xm0, xe, xe_next) 69 sha1_shani_round(fn, xm0, xe, xe_next)
68 70
69 71
70.section .text 72.section CRYPTO_ASSEMBLY_SECTION_TEXT
71 73
72/* 74/*
73 * void sha1_block_shani(SHA256_CTX *ctx, const void *in, size_t num); 75 * void sha1_block_shani(SHA_CTX *ctx, const void *in, size_t num);
74 * 76 *
75 * Standard x86-64 ABI: rdi = ctx, rsi = in, rdx = num 77 * Standard x86-64 ABI: rdi = ctx, rsi = in, rdx = num
76 */ 78 */
77.align 16 79.align 16
78.globl sha1_block_shani 80CRYPTO_ASSEMBLY_GLOBAL_FUNCTION(sha1_block_shani):
79.type sha1_block_shani,@function
80sha1_block_shani:
81 _CET_ENDBR 81 _CET_ENDBR
82 82
83 /* Save callee save registers. */ 83 /* Save callee save registers. */
@@ -153,14 +153,17 @@ sha1_block_shani:
153 153
154 ret 154 ret
155 155
156.section .rodata 156.section CRYPTO_ASSEMBLY_SECTION_RODATA
157 157
158/* 158/*
159 * Shuffle mask - byte reversal for little endian to big endian word conversion, 159 * Shuffle mask - byte reversal for little endian to big endian word conversion,
160 * and reordering to abcd. 160 * and reordering to abcd.
161 */ 161 */
162.align 16 162.align 16
163.type shufmask,@object 163CRYPTO_ASSEMBLY_OBJECT_START(shufmask):
164shufmask:
165.octa 0x000102030405060708090a0b0c0d0e0f 164.octa 0x000102030405060708090a0b0c0d0e0f
166.size shufmask,.-shufmask 165CRYPTO_ASSEMBLY_OBJECT_END(shufmask)
166
167#if defined(__linux__) && defined(__ELF__)
168.section .note.GNU-stack,"",%progbits
169#endif
diff --git a/src/lib/libcrypto/sha/sha256.c b/src/lib/libcrypto/sha/sha256.c
index 5d002ca62c..de7904293e 100644
--- a/src/lib/libcrypto/sha/sha256.c
+++ b/src/lib/libcrypto/sha/sha256.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sha256.c,v 1.33 2025/02/14 12:01:58 jsing Exp $ */ 1/* $OpenBSD: sha256.c,v 1.38 2026/05/09 07:14:42 jsing Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -72,7 +72,10 @@ void sha256_block_data_order(SHA256_CTX *ctx, const void *_in, size_t num);
72void sha256_block_generic(SHA256_CTX *ctx, const void *_in, size_t num); 72void sha256_block_generic(SHA256_CTX *ctx, const void *_in, size_t num);
73 73
74#ifndef HAVE_SHA256_BLOCK_GENERIC 74#ifndef HAVE_SHA256_BLOCK_GENERIC
75static const SHA_LONG K256[64] = { 75/*
76 * SHA-256 constants - see FIPS 180-4 section 4.2.2.
77 */
78static const uint32_t K256[64] = {
76 0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL, 79 0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL,
77 0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL, 80 0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL,
78 0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL, 81 0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL,
@@ -91,55 +94,55 @@ static const SHA_LONG K256[64] = {
91 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL, 94 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL,
92}; 95};
93 96
94static inline SHA_LONG 97static inline uint32_t
95Sigma0(SHA_LONG x) 98Sigma0(uint32_t x)
96{ 99{
97 return crypto_ror_u32(x, 2) ^ crypto_ror_u32(x, 13) ^ 100 return crypto_ror_u32(x, 2) ^ crypto_ror_u32(x, 13) ^
98 crypto_ror_u32(x, 22); 101 crypto_ror_u32(x, 22);
99} 102}
100 103
101static inline SHA_LONG 104static inline uint32_t
102Sigma1(SHA_LONG x) 105Sigma1(uint32_t x)
103{ 106{
104 return crypto_ror_u32(x, 6) ^ crypto_ror_u32(x, 11) ^ 107 return crypto_ror_u32(x, 6) ^ crypto_ror_u32(x, 11) ^
105 crypto_ror_u32(x, 25); 108 crypto_ror_u32(x, 25);
106} 109}
107 110
108static inline SHA_LONG 111static inline uint32_t
109sigma0(SHA_LONG x) 112sigma0(uint32_t x)
110{ 113{
111 return crypto_ror_u32(x, 7) ^ crypto_ror_u32(x, 18) ^ (x >> 3); 114 return crypto_ror_u32(x, 7) ^ crypto_ror_u32(x, 18) ^ (x >> 3);
112} 115}
113 116
114static inline SHA_LONG 117static inline uint32_t
115sigma1(SHA_LONG x) 118sigma1(uint32_t x)
116{ 119{
117 return crypto_ror_u32(x, 17) ^ crypto_ror_u32(x, 19) ^ (x >> 10); 120 return crypto_ror_u32(x, 17) ^ crypto_ror_u32(x, 19) ^ (x >> 10);
118} 121}
119 122
120static inline SHA_LONG 123static inline uint32_t
121Ch(SHA_LONG x, SHA_LONG y, SHA_LONG z) 124Ch(uint32_t x, uint32_t y, uint32_t z)
122{ 125{
123 return (x & y) ^ (~x & z); 126 return (x & y) ^ (~x & z);
124} 127}
125 128
126static inline SHA_LONG 129static inline uint32_t
127Maj(SHA_LONG x, SHA_LONG y, SHA_LONG z) 130Maj(uint32_t x, uint32_t y, uint32_t z)
128{ 131{
129 return (x & y) ^ (x & z) ^ (y & z); 132 return (x & y) ^ (x & z) ^ (y & z);
130} 133}
131 134
132static inline void 135static inline void
133sha256_msg_schedule_update(SHA_LONG *W0, SHA_LONG W1, SHA_LONG W9, SHA_LONG W14) 136sha256_msg_schedule_update(uint32_t *W0, uint32_t W1, uint32_t W9, uint32_t W14)
134{ 137{
135 *W0 = sigma1(W14) + W9 + sigma0(W1) + *W0; 138 *W0 = sigma1(W14) + W9 + sigma0(W1) + *W0;
136} 139}
137 140
138static inline void 141static inline void
139sha256_round(SHA_LONG *a, SHA_LONG *b, SHA_LONG *c, SHA_LONG *d, SHA_LONG *e, 142sha256_round(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e,
140 SHA_LONG *f, SHA_LONG *g, SHA_LONG *h, SHA_LONG Kt, SHA_LONG Wt) 143 uint32_t *f, uint32_t *g, uint32_t *h, uint32_t Kt, uint32_t Wt)
141{ 144{
142 SHA_LONG T1, T2; 145 uint32_t T1, T2;
143 146
144 T1 = *h + Sigma1(*e) + Ch(*e, *f, *g) + Kt + Wt; 147 T1 = *h + Sigma1(*e) + Ch(*e, *f, *g) + Kt + Wt;
145 T2 = Sigma0(*a) + Maj(*a, *b, *c); 148 T2 = Sigma0(*a) + Maj(*a, *b, *c);
@@ -158,9 +161,9 @@ void
158sha256_block_generic(SHA256_CTX *ctx, const void *_in, size_t num) 161sha256_block_generic(SHA256_CTX *ctx, const void *_in, size_t num)
159{ 162{
160 const uint8_t *in = _in; 163 const uint8_t *in = _in;
161 const SHA_LONG *in32; 164 const uint32_t *in32;
162 SHA_LONG a, b, c, d, e, f, g, h; 165 uint32_t a, b, c, d, e, f, g, h;
163 SHA_LONG X[16]; 166 uint32_t W[16];
164 int i; 167 int i;
165 168
166 while (num--) { 169 while (num--) {
@@ -175,95 +178,95 @@ sha256_block_generic(SHA256_CTX *ctx, const void *_in, size_t num)
175 178
176 if ((size_t)in % 4 == 0) { 179 if ((size_t)in % 4 == 0) {
177 /* Input is 32 bit aligned. */ 180 /* Input is 32 bit aligned. */
178 in32 = (const SHA_LONG *)in; 181 in32 = (const uint32_t *)in;
179 X[0] = be32toh(in32[0]); 182 W[0] = be32toh(in32[0]);
180 X[1] = be32toh(in32[1]); 183 W[1] = be32toh(in32[1]);
181 X[2] = be32toh(in32[2]); 184 W[2] = be32toh(in32[2]);
182 X[3] = be32toh(in32[3]); 185 W[3] = be32toh(in32[3]);
183 X[4] = be32toh(in32[4]); 186 W[4] = be32toh(in32[4]);
184 X[5] = be32toh(in32[5]); 187 W[5] = be32toh(in32[5]);
185 X[6] = be32toh(in32[6]); 188 W[6] = be32toh(in32[6]);
186 X[7] = be32toh(in32[7]); 189 W[7] = be32toh(in32[7]);
187 X[8] = be32toh(in32[8]); 190 W[8] = be32toh(in32[8]);
188 X[9] = be32toh(in32[9]); 191 W[9] = be32toh(in32[9]);
189 X[10] = be32toh(in32[10]); 192 W[10] = be32toh(in32[10]);
190 X[11] = be32toh(in32[11]); 193 W[11] = be32toh(in32[11]);
191 X[12] = be32toh(in32[12]); 194 W[12] = be32toh(in32[12]);
192 X[13] = be32toh(in32[13]); 195 W[13] = be32toh(in32[13]);
193 X[14] = be32toh(in32[14]); 196 W[14] = be32toh(in32[14]);
194 X[15] = be32toh(in32[15]); 197 W[15] = be32toh(in32[15]);
195 } else { 198 } else {
196 /* Input is not 32 bit aligned. */ 199 /* Input is not 32 bit aligned. */
197 X[0] = crypto_load_be32toh(&in[0 * 4]); 200 W[0] = crypto_load_be32toh(&in[0 * 4]);
198 X[1] = crypto_load_be32toh(&in[1 * 4]); 201 W[1] = crypto_load_be32toh(&in[1 * 4]);
199 X[2] = crypto_load_be32toh(&in[2 * 4]); 202 W[2] = crypto_load_be32toh(&in[2 * 4]);
200 X[3] = crypto_load_be32toh(&in[3 * 4]); 203 W[3] = crypto_load_be32toh(&in[3 * 4]);
201 X[4] = crypto_load_be32toh(&in[4 * 4]); 204 W[4] = crypto_load_be32toh(&in[4 * 4]);
202 X[5] = crypto_load_be32toh(&in[5 * 4]); 205 W[5] = crypto_load_be32toh(&in[5 * 4]);
203 X[6] = crypto_load_be32toh(&in[6 * 4]); 206 W[6] = crypto_load_be32toh(&in[6 * 4]);
204 X[7] = crypto_load_be32toh(&in[7 * 4]); 207 W[7] = crypto_load_be32toh(&in[7 * 4]);
205 X[8] = crypto_load_be32toh(&in[8 * 4]); 208 W[8] = crypto_load_be32toh(&in[8 * 4]);
206 X[9] = crypto_load_be32toh(&in[9 * 4]); 209 W[9] = crypto_load_be32toh(&in[9 * 4]);
207 X[10] = crypto_load_be32toh(&in[10 * 4]); 210 W[10] = crypto_load_be32toh(&in[10 * 4]);
208 X[11] = crypto_load_be32toh(&in[11 * 4]); 211 W[11] = crypto_load_be32toh(&in[11 * 4]);
209 X[12] = crypto_load_be32toh(&in[12 * 4]); 212 W[12] = crypto_load_be32toh(&in[12 * 4]);
210 X[13] = crypto_load_be32toh(&in[13 * 4]); 213 W[13] = crypto_load_be32toh(&in[13 * 4]);
211 X[14] = crypto_load_be32toh(&in[14 * 4]); 214 W[14] = crypto_load_be32toh(&in[14 * 4]);
212 X[15] = crypto_load_be32toh(&in[15 * 4]); 215 W[15] = crypto_load_be32toh(&in[15 * 4]);
213 } 216 }
214 in += SHA256_CBLOCK; 217 in += SHA256_CBLOCK;
215 218
216 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[0], X[0]); 219 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[0], W[0]);
217 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[1], X[1]); 220 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[1], W[1]);
218 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[2], X[2]); 221 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[2], W[2]);
219 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[3], X[3]); 222 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[3], W[3]);
220 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[4], X[4]); 223 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[4], W[4]);
221 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[5], X[5]); 224 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[5], W[5]);
222 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[6], X[6]); 225 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[6], W[6]);
223 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[7], X[7]); 226 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[7], W[7]);
224 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[8], X[8]); 227 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[8], W[8]);
225 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[9], X[9]); 228 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[9], W[9]);
226 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[10], X[10]); 229 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[10], W[10]);
227 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[11], X[11]); 230 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[11], W[11]);
228 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[12], X[12]); 231 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[12], W[12]);
229 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[13], X[13]); 232 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[13], W[13]);
230 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[14], X[14]); 233 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[14], W[14]);
231 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[15], X[15]); 234 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[15], W[15]);
232 235
233 for (i = 16; i < 64; i += 16) { 236 for (i = 16; i < 64; i += 16) {
234 sha256_msg_schedule_update(&X[0], X[1], X[9], X[14]); 237 sha256_msg_schedule_update(&W[0], W[1], W[9], W[14]);
235 sha256_msg_schedule_update(&X[1], X[2], X[10], X[15]); 238 sha256_msg_schedule_update(&W[1], W[2], W[10], W[15]);
236 sha256_msg_schedule_update(&X[2], X[3], X[11], X[0]); 239 sha256_msg_schedule_update(&W[2], W[3], W[11], W[0]);
237 sha256_msg_schedule_update(&X[3], X[4], X[12], X[1]); 240 sha256_msg_schedule_update(&W[3], W[4], W[12], W[1]);
238 sha256_msg_schedule_update(&X[4], X[5], X[13], X[2]); 241 sha256_msg_schedule_update(&W[4], W[5], W[13], W[2]);
239 sha256_msg_schedule_update(&X[5], X[6], X[14], X[3]); 242 sha256_msg_schedule_update(&W[5], W[6], W[14], W[3]);
240 sha256_msg_schedule_update(&X[6], X[7], X[15], X[4]); 243 sha256_msg_schedule_update(&W[6], W[7], W[15], W[4]);
241 sha256_msg_schedule_update(&X[7], X[8], X[0], X[5]); 244 sha256_msg_schedule_update(&W[7], W[8], W[0], W[5]);
242 sha256_msg_schedule_update(&X[8], X[9], X[1], X[6]); 245 sha256_msg_schedule_update(&W[8], W[9], W[1], W[6]);
243 sha256_msg_schedule_update(&X[9], X[10], X[2], X[7]); 246 sha256_msg_schedule_update(&W[9], W[10], W[2], W[7]);
244 sha256_msg_schedule_update(&X[10], X[11], X[3], X[8]); 247 sha256_msg_schedule_update(&W[10], W[11], W[3], W[8]);
245 sha256_msg_schedule_update(&X[11], X[12], X[4], X[9]); 248 sha256_msg_schedule_update(&W[11], W[12], W[4], W[9]);
246 sha256_msg_schedule_update(&X[12], X[13], X[5], X[10]); 249 sha256_msg_schedule_update(&W[12], W[13], W[5], W[10]);
247 sha256_msg_schedule_update(&X[13], X[14], X[6], X[11]); 250 sha256_msg_schedule_update(&W[13], W[14], W[6], W[11]);
248 sha256_msg_schedule_update(&X[14], X[15], X[7], X[12]); 251 sha256_msg_schedule_update(&W[14], W[15], W[7], W[12]);
249 sha256_msg_schedule_update(&X[15], X[0], X[8], X[13]); 252 sha256_msg_schedule_update(&W[15], W[0], W[8], W[13]);
250 253
251 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 0], X[0]); 254 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 0], W[0]);
252 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 1], X[1]); 255 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 1], W[1]);
253 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 2], X[2]); 256 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 2], W[2]);
254 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 3], X[3]); 257 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 3], W[3]);
255 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 4], X[4]); 258 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 4], W[4]);
256 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 5], X[5]); 259 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 5], W[5]);
257 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 6], X[6]); 260 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 6], W[6]);
258 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 7], X[7]); 261 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 7], W[7]);
259 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 8], X[8]); 262 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 8], W[8]);
260 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 9], X[9]); 263 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 9], W[9]);
261 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 10], X[10]); 264 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 10], W[10]);
262 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 11], X[11]); 265 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 11], W[11]);
263 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 12], X[12]); 266 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 12], W[12]);
264 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 13], X[13]); 267 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 13], W[13]);
265 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 14], X[14]); 268 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 14], W[14]);
266 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 15], X[15]); 269 sha256_round(&a, &b, &c, &d, &e, &f, &g, &h, K256[i + 15], W[15]);
267 } 270 }
268 271
269 ctx->h[0] += a; 272 ctx->h[0] += a;
@@ -287,123 +290,119 @@ sha256_block_data_order(SHA256_CTX *ctx, const void *_in, size_t num)
287#endif 290#endif
288 291
289int 292int
290SHA224_Init(SHA256_CTX *c) 293SHA224_Init(SHA256_CTX *ctx)
291{ 294{
292 memset(c, 0, sizeof(*c)); 295 memset(ctx, 0, sizeof(*ctx));
293 296
294 c->h[0] = 0xc1059ed8UL; 297 /* FIPS 180-4 section 5.3.2. */
295 c->h[1] = 0x367cd507UL; 298 ctx->h[0] = 0xc1059ed8UL;
296 c->h[2] = 0x3070dd17UL; 299 ctx->h[1] = 0x367cd507UL;
297 c->h[3] = 0xf70e5939UL; 300 ctx->h[2] = 0x3070dd17UL;
298 c->h[4] = 0xffc00b31UL; 301 ctx->h[3] = 0xf70e5939UL;
299 c->h[5] = 0x68581511UL; 302 ctx->h[4] = 0xffc00b31UL;
300 c->h[6] = 0x64f98fa7UL; 303 ctx->h[5] = 0x68581511UL;
301 c->h[7] = 0xbefa4fa4UL; 304 ctx->h[6] = 0x64f98fa7UL;
305 ctx->h[7] = 0xbefa4fa4UL;
302 306
303 c->md_len = SHA224_DIGEST_LENGTH; 307 ctx->md_len = SHA224_DIGEST_LENGTH;
304 308
305 return 1; 309 return 1;
306} 310}
307LCRYPTO_ALIAS(SHA224_Init); 311LCRYPTO_ALIAS(SHA224_Init);
308 312
309int 313int
310SHA224_Update(SHA256_CTX *c, const void *data, size_t len) 314SHA224_Update(SHA256_CTX *ctx, const void *data, size_t len)
311{ 315{
312 return SHA256_Update(c, data, len); 316 return SHA256_Update(ctx, data, len);
313} 317}
314LCRYPTO_ALIAS(SHA224_Update); 318LCRYPTO_ALIAS(SHA224_Update);
315 319
316int 320int
317SHA224_Final(unsigned char *md, SHA256_CTX *c) 321SHA224_Final(unsigned char *md, SHA256_CTX *ctx)
318{ 322{
319 return SHA256_Final(md, c); 323 return SHA256_Final(md, ctx);
320} 324}
321LCRYPTO_ALIAS(SHA224_Final); 325LCRYPTO_ALIAS(SHA224_Final);
322 326
323unsigned char * 327unsigned char *
324SHA224(const unsigned char *d, size_t n, unsigned char *md) 328SHA224(const unsigned char *data, size_t len, unsigned char *md)
325{ 329{
326 SHA256_CTX c; 330 SHA256_CTX ctx;
327 331
328 SHA224_Init(&c); 332 SHA224_Init(&ctx);
329 SHA256_Update(&c, d, n); 333 SHA256_Update(&ctx, data, len);
330 SHA256_Final(md, &c); 334 SHA256_Final(md, &ctx);
331 335
332 explicit_bzero(&c, sizeof(c)); 336 explicit_bzero(&ctx, sizeof(ctx));
333 337
334 return (md); 338 return (md);
335} 339}
336LCRYPTO_ALIAS(SHA224); 340LCRYPTO_ALIAS(SHA224);
337 341
338int 342int
339SHA256_Init(SHA256_CTX *c) 343SHA256_Init(SHA256_CTX *ctx)
340{ 344{
341 memset(c, 0, sizeof(*c)); 345 memset(ctx, 0, sizeof(*ctx));
342 346
343 c->h[0] = 0x6a09e667UL; 347 /* FIPS 180-4 section 5.3.3. */
344 c->h[1] = 0xbb67ae85UL; 348 ctx->h[0] = 0x6a09e667UL;
345 c->h[2] = 0x3c6ef372UL; 349 ctx->h[1] = 0xbb67ae85UL;
346 c->h[3] = 0xa54ff53aUL; 350 ctx->h[2] = 0x3c6ef372UL;
347 c->h[4] = 0x510e527fUL; 351 ctx->h[3] = 0xa54ff53aUL;
348 c->h[5] = 0x9b05688cUL; 352 ctx->h[4] = 0x510e527fUL;
349 c->h[6] = 0x1f83d9abUL; 353 ctx->h[5] = 0x9b05688cUL;
350 c->h[7] = 0x5be0cd19UL; 354 ctx->h[6] = 0x1f83d9abUL;
355 ctx->h[7] = 0x5be0cd19UL;
351 356
352 c->md_len = SHA256_DIGEST_LENGTH; 357 ctx->md_len = SHA256_DIGEST_LENGTH;
353 358
354 return 1; 359 return 1;
355} 360}
356LCRYPTO_ALIAS(SHA256_Init); 361LCRYPTO_ALIAS(SHA256_Init);
357 362
358int 363int
359SHA256_Update(SHA256_CTX *c, const void *data_, size_t len) 364SHA256_Update(SHA256_CTX *ctx, const void *data_, size_t len)
360{ 365{
361 const unsigned char *data = data_; 366 const unsigned char *data = data_;
362 unsigned char *p; 367 unsigned char *p;
363 SHA_LONG l;
364 size_t n; 368 size_t n;
365 369
366 if (len == 0) 370 if (len == 0)
367 return 1; 371 return 1;
368 372
369 l = (c->Nl + (((SHA_LONG)len) << 3)) & 0xffffffffUL; 373 /* Update message bit counter. */
370 /* 95-05-24 eay Fixed a bug with the overflow handling, thanks to 374 crypto_add_u32dw_u64(&ctx->Nh, &ctx->Nl, (uint64_t)len << 3);
371 * Wei Dai <weidai@eskimo.com> for pointing it out. */
372 if (l < c->Nl) /* overflow */
373 c->Nh++;
374 c->Nh += (SHA_LONG)(len >> 29); /* might cause compiler warning on 16-bit */
375 c->Nl = l;
376 375
377 n = c->num; 376 n = ctx->num;
378 if (n != 0) { 377 if (n != 0) {
379 p = (unsigned char *)c->data; 378 p = (unsigned char *)ctx->data;
380 379
381 if (len >= SHA_CBLOCK || len + n >= SHA_CBLOCK) { 380 if (len >= SHA_CBLOCK || len + n >= SHA_CBLOCK) {
382 memcpy(p + n, data, SHA_CBLOCK - n); 381 memcpy(p + n, data, SHA_CBLOCK - n);
383 sha256_block_data_order(c, p, 1); 382 sha256_block_data_order(ctx, p, 1);
384 n = SHA_CBLOCK - n; 383 n = SHA_CBLOCK - n;
385 data += n; 384 data += n;
386 len -= n; 385 len -= n;
387 c->num = 0; 386 ctx->num = 0;
388 memset(p, 0, SHA_CBLOCK); /* keep it zeroed */ 387 memset(p, 0, SHA_CBLOCK); /* keep it zeroed */
389 } else { 388 } else {
390 memcpy(p + n, data, len); 389 memcpy(p + n, data, len);
391 c->num += (unsigned int)len; 390 ctx->num += (unsigned int)len;
392 return 1; 391 return 1;
393 } 392 }
394 } 393 }
395 394
396 n = len/SHA_CBLOCK; 395 n = len/SHA_CBLOCK;
397 if (n > 0) { 396 if (n > 0) {
398 sha256_block_data_order(c, data, n); 397 sha256_block_data_order(ctx, data, n);
399 n *= SHA_CBLOCK; 398 n *= SHA_CBLOCK;
400 data += n; 399 data += n;
401 len -= n; 400 len -= n;
402 } 401 }
403 402
404 if (len != 0) { 403 if (len != 0) {
405 p = (unsigned char *)c->data; 404 p = (unsigned char *)ctx->data;
406 c->num = (unsigned int)len; 405 ctx->num = (unsigned int)len;
407 memcpy(p, data, len); 406 memcpy(p, data, len);
408 } 407 }
409 return 1; 408 return 1;
@@ -411,17 +410,17 @@ SHA256_Update(SHA256_CTX *c, const void *data_, size_t len)
411LCRYPTO_ALIAS(SHA256_Update); 410LCRYPTO_ALIAS(SHA256_Update);
412 411
413void 412void
414SHA256_Transform(SHA256_CTX *c, const unsigned char *data) 413SHA256_Transform(SHA256_CTX *ctx, const unsigned char *data)
415{ 414{
416 sha256_block_data_order(c, data, 1); 415 sha256_block_data_order(ctx, data, 1);
417} 416}
418LCRYPTO_ALIAS(SHA256_Transform); 417LCRYPTO_ALIAS(SHA256_Transform);
419 418
420int 419int
421SHA256_Final(unsigned char *md, SHA256_CTX *c) 420SHA256_Final(unsigned char *md, SHA256_CTX *ctx)
422{ 421{
423 unsigned char *p = (unsigned char *)c->data; 422 unsigned char *p = (unsigned char *)ctx->data;
424 size_t n = c->num; 423 size_t n = ctx->num;
425 unsigned int nn; 424 unsigned int nn;
426 425
427 p[n] = 0x80; /* there is always room for one */ 426 p[n] = 0x80; /* there is always room for one */
@@ -430,15 +429,15 @@ SHA256_Final(unsigned char *md, SHA256_CTX *c)
430 if (n > (SHA_CBLOCK - 8)) { 429 if (n > (SHA_CBLOCK - 8)) {
431 memset(p + n, 0, SHA_CBLOCK - n); 430 memset(p + n, 0, SHA_CBLOCK - n);
432 n = 0; 431 n = 0;
433 sha256_block_data_order(c, p, 1); 432 sha256_block_data_order(ctx, p, 1);
434 } 433 }
435 434
436 memset(p + n, 0, SHA_CBLOCK - 8 - n); 435 memset(p + n, 0, SHA_CBLOCK - 8 - n);
437 c->data[SHA_LBLOCK - 2] = htobe32(c->Nh); 436 ctx->data[SHA_LBLOCK - 2] = htobe32(ctx->Nh);
438 c->data[SHA_LBLOCK - 1] = htobe32(c->Nl); 437 ctx->data[SHA_LBLOCK - 1] = htobe32(ctx->Nl);
439 438
440 sha256_block_data_order(c, p, 1); 439 sha256_block_data_order(ctx, p, 1);
441 c->num = 0; 440 ctx->num = 0;
442 memset(p, 0, SHA_CBLOCK); 441 memset(p, 0, SHA_CBLOCK);
443 442
444 /* 443 /*
@@ -449,26 +448,26 @@ SHA256_Final(unsigned char *md, SHA256_CTX *c)
449 * Idea behind separate cases for pre-defined lengths is to let the 448 * Idea behind separate cases for pre-defined lengths is to let the
450 * compiler decide if it's appropriate to unroll small loops. 449 * compiler decide if it's appropriate to unroll small loops.
451 */ 450 */
452 switch (c->md_len) { 451 switch (ctx->md_len) {
453 case SHA224_DIGEST_LENGTH: 452 case SHA224_DIGEST_LENGTH:
454 for (nn = 0; nn < SHA224_DIGEST_LENGTH / 4; nn++) { 453 for (nn = 0; nn < SHA224_DIGEST_LENGTH / 4; nn++) {
455 crypto_store_htobe32(md, c->h[nn]); 454 crypto_store_htobe32(md, ctx->h[nn]);
456 md += 4; 455 md += 4;
457 } 456 }
458 break; 457 break;
459 458
460 case SHA256_DIGEST_LENGTH: 459 case SHA256_DIGEST_LENGTH:
461 for (nn = 0; nn < SHA256_DIGEST_LENGTH / 4; nn++) { 460 for (nn = 0; nn < SHA256_DIGEST_LENGTH / 4; nn++) {
462 crypto_store_htobe32(md, c->h[nn]); 461 crypto_store_htobe32(md, ctx->h[nn]);
463 md += 4; 462 md += 4;
464 } 463 }
465 break; 464 break;
466 465
467 default: 466 default:
468 if (c->md_len > SHA256_DIGEST_LENGTH) 467 if (ctx->md_len > SHA256_DIGEST_LENGTH)
469 return 0; 468 return 0;
470 for (nn = 0; nn < c->md_len / 4; nn++) { 469 for (nn = 0; nn < ctx->md_len / 4; nn++) {
471 crypto_store_htobe32(md, c->h[nn]); 470 crypto_store_htobe32(md, ctx->h[nn]);
472 md += 4; 471 md += 4;
473 } 472 }
474 break; 473 break;
@@ -479,15 +478,15 @@ SHA256_Final(unsigned char *md, SHA256_CTX *c)
479LCRYPTO_ALIAS(SHA256_Final); 478LCRYPTO_ALIAS(SHA256_Final);
480 479
481unsigned char * 480unsigned char *
482SHA256(const unsigned char *d, size_t n, unsigned char *md) 481SHA256(const unsigned char *data, size_t len, unsigned char *md)
483{ 482{
484 SHA256_CTX c; 483 SHA256_CTX ctx;
485 484
486 SHA256_Init(&c); 485 SHA256_Init(&ctx);
487 SHA256_Update(&c, d, n); 486 SHA256_Update(&ctx, data, len);
488 SHA256_Final(md, &c); 487 SHA256_Final(md, &ctx);
489 488
490 explicit_bzero(&c, sizeof(c)); 489 explicit_bzero(&ctx, sizeof(ctx));
491 490
492 return (md); 491 return (md);
493} 492}
diff --git a/src/lib/libcrypto/sha/sha256_aarch64_ce.S b/src/lib/libcrypto/sha/sha256_aarch64_ce.S
index 8a26f91b06..75352b4f7a 100644
--- a/src/lib/libcrypto/sha/sha256_aarch64_ce.S
+++ b/src/lib/libcrypto/sha/sha256_aarch64_ce.S
@@ -1,4 +1,4 @@
1/* $OpenBSD: sha256_aarch64_ce.S,v 1.6 2026/01/25 08:22:17 jsing Exp $ */ 1/* $OpenBSD: sha256_aarch64_ce.S,v 1.11 2026/05/12 15:07:30 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2023,2025 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2023,2025 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -15,6 +15,10 @@
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */ 16 */
17 17
18#include "crypto_assembly.h"
19
20#define _SEP CRYPTO_ASSEMBLY_SEPARATOR
21
18/* 22/*
19 * SHA-256 implementation using the ARM Cryptographic Extension (CE). 23 * SHA-256 implementation using the ARM Cryptographic Extension (CE).
20 * 24 *
@@ -68,7 +72,7 @@
68 * W0:W1:W2:W3 = sigma1(W14:W15:W0:W1) + W9:W10:W12:W13 + W0:W1:W2:W3 72 * W0:W1:W2:W3 = sigma1(W14:W15:W0:W1) + W9:W10:W12:W13 + W0:W1:W2:W3
69 */ 73 */
70#define sha256_message_schedule_update(m0, m1, m2, m3) \ 74#define sha256_message_schedule_update(m0, m1, m2, m3) \
71 sha256su0 m0.4s, m1.4s; \ 75 sha256su0 m0.4s, m1.4s _SEP \
72 sha256su1 m0.4s, m2.4s, m3.4s 76 sha256su1 m0.4s, m2.4s, m3.4s
73 77
74/* 78/*
@@ -77,34 +81,32 @@
77 * sha256h/sha256h2. 81 * sha256h/sha256h2.
78 */ 82 */
79#define sha256_round(h0, h1, w, k) \ 83#define sha256_round(h0, h1, w, k) \
80 add tmp0.4s, w.4s, k.4s; /* Tt = Wt + Kt */ \ 84 add tmp0.4s, w.4s, k.4s /* Tt = Wt + Kt */ _SEP \
81 mov tmp1.16b, h0.16b; \ 85 mov tmp1.16b, h0.16b _SEP \
82 sha256h h0##q, h1##q, tmp0.4s; \ 86 sha256h h0##q, h1##q, tmp0.4s _SEP \
83 sha256h2 h1##q, tmp1##q, tmp0.4s 87 sha256h2 h1##q, tmp1##q, tmp0.4s
84 88
85#define sha256_round_initial(h0, h1, w, k) \ 89#define sha256_round_initial(h0, h1, w, k) \
86 sha256_round(h0, h1, w, k) 90 sha256_round(h0, h1, w, k)
87 91
88#define sha256_round_update(h0, h1, m0, m1, m2, m3, k) \ 92#define sha256_round_update(h0, h1, m0, m1, m2, m3, k) \
89 sha256_message_schedule_update(m0, m1, m2, m3); \ 93 sha256_message_schedule_update(m0, m1, m2, m3) _SEP \
90 sha256_round(h0, h1, m0, k) 94 sha256_round(h0, h1, m0, k)
91 95
92.arch armv8-a+sha2 96.arch armv8-a+sha2
93 97
94.section .text 98.section CRYPTO_ASSEMBLY_SECTION_TEXT
95 99
96/* 100/*
97 * void sha256_block_ce(SHA256_CTX *ctx, const void *in, size_t num); 101 * void sha256_block_ce(SHA256_CTX *ctx, const void *in, size_t num);
98 * 102 *
99 * Standard ARM ABI: x0 = ctx, x1 = in, x2 = num 103 * Standard ARM ABI: x0 = ctx, x1 = in, x2 = num
100 */ 104 */
101.globl sha256_block_ce 105CRYPTO_ASSEMBLY_GLOBAL_FUNCTION(sha256_block_ce):
102.type sha256_block_ce,@function
103sha256_block_ce:
104 106
105 /* Address of SHA-256 constants. */ 107 /* Address of SHA-256 constants. */
106 adrp k256_base, K256 108 adrp k256_base, CRYPTO_ASSEMBLY_AARCH64_SYM_HI(K256)
107 add k256_base, k256_base, :lo12:K256 109 add k256_base, k256_base, CRYPTO_ASSEMBLY_AARCH64_SYM_LO(K256)
108 110
109 /* 111 /*
110 * Load current hash state from context. 112 * Load current hash state from context.
@@ -170,14 +172,13 @@ sha256_block_ce:
170 172
171 ret 173 ret
172 174
173.section .rodata 175.section CRYPTO_ASSEMBLY_SECTION_RODATA
174 176
175/* 177/*
176 * SHA-256 constants - see FIPS 180-4 section 4.2.3. 178 * SHA-256 constants - see FIPS 180-4 section 4.2.3.
177 */ 179 */
178.align 4 180.align 4
179.type K256,@object 181CRYPTO_ASSEMBLY_OBJECT_START(K256):
180K256:
181.long 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5 182.long 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5
182.long 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5 183.long 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5
183.long 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3 184.long 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3
@@ -194,4 +195,8 @@ K256:
194.long 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3 195.long 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3
195.long 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208 196.long 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208
196.long 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 197.long 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
197.size K256,.-K256 198CRYPTO_ASSEMBLY_OBJECT_END(K256)
199
200#if defined(__linux__) && defined(__ELF__)
201.section .note.GNU-stack,"",%progbits
202#endif
diff --git a/src/lib/libcrypto/sha/sha256_amd64_generic.S b/src/lib/libcrypto/sha/sha256_amd64_generic.S
index 52ad974eab..0d18e95d04 100644
--- a/src/lib/libcrypto/sha/sha256_amd64_generic.S
+++ b/src/lib/libcrypto/sha/sha256_amd64_generic.S
@@ -1,4 +1,4 @@
1/* $OpenBSD: sha256_amd64_generic.S,v 1.6 2026/03/28 13:11:28 jsing Exp $ */ 1/* $OpenBSD: sha256_amd64_generic.S,v 1.10 2026/05/12 15:07:30 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -17,6 +17,8 @@
17 17
18#include "crypto_assembly.h" 18#include "crypto_assembly.h"
19 19
20#define _SEP CRYPTO_ASSEMBLY_SEPARATOR
21
20#define ctx %rdi 22#define ctx %rdi
21#define in %rsi 23#define in %rsi
22#define num %rdx 24#define num %rdx
@@ -45,8 +47,8 @@
45 * Wt = Mt 47 * Wt = Mt
46 */ 48 */
47#define sha256_message_schedule_load(idx, m, w, wt) \ 49#define sha256_message_schedule_load(idx, m, w, wt) \
48 movl (m, round, 4), wt; \ 50 movl (m, round, 4), wt _SEP \
49 bswapl wt; \ 51 bswapl wt _SEP \
50 movl wt, ((idx&0xf)*4)(w) 52 movl wt, ((idx&0xf)*4)(w)
51 53
52/* 54/*
@@ -58,25 +60,25 @@
58 * sigma1(x) = ror(x, 17) ^ ror(x, 19) ^ (x >> 10) 60 * sigma1(x) = ror(x, 17) ^ ror(x, 19) ^ (x >> 10)
59 */ 61 */
60#define sha256_message_schedule_update(idx, w, wt) \ 62#define sha256_message_schedule_update(idx, w, wt) \
61 movl (((idx-2)&0xf)*4)(w), wt; /* sigma1 */ \ 63 movl (((idx-2)&0xf)*4)(w), wt /* sigma1 */ _SEP \
62 movl wt, tmp1; /* sigma1 */ \ 64 movl wt, tmp1 /* sigma1 */ _SEP \
63 rorl $(19-17), tmp1; /* sigma1 */ \ 65 rorl $(19-17), tmp1 /* sigma1 */ _SEP \
64 xorl wt, tmp1; /* sigma1 */ \ 66 xorl wt, tmp1 /* sigma1 */ _SEP \
65 rorl $17, tmp1; /* sigma1 */ \ 67 rorl $17, tmp1 /* sigma1 */ _SEP \
66 shrl $10, wt; /* sigma1 */ \ 68 shrl $10, wt /* sigma1 */ _SEP \
67 xorl tmp1, wt; /* sigma1 */ \ 69 xorl tmp1, wt /* sigma1 */ _SEP \
68 \ 70 \
69 addl (((idx-7)&0xf)*4)(w), wt; /* Wt-7 */ \ 71 addl (((idx-7)&0xf)*4)(w), wt /* Wt-7 */ _SEP \
70 addl (((idx-16)&0xf)*4)(w), wt; /* Wt-16 */ \ 72 addl (((idx-16)&0xf)*4)(w), wt /* Wt-16 */ _SEP \
71 \ 73 \
72 movl (((idx-15)&0xf)*4)(w), tmp2; /* sigma0 */ \ 74 movl (((idx-15)&0xf)*4)(w), tmp2 /* sigma0 */ _SEP \
73 movl tmp2, tmp3; /* sigma0 */ \ 75 movl tmp2, tmp3 /* sigma0 */ _SEP \
74 rorl $(18-7), tmp2; /* sigma0 */ \ 76 rorl $(18-7), tmp2 /* sigma0 */ _SEP \
75 xorl tmp3, tmp2; /* sigma0 */ \ 77 xorl tmp3, tmp2 /* sigma0 */ _SEP \
76 rorl $7, tmp2; /* sigma0 */ \ 78 rorl $7, tmp2 /* sigma0 */ _SEP \
77 shrl $3, tmp3; /* sigma0 */ \ 79 shrl $3, tmp3 /* sigma0 */ _SEP \
78 xorl tmp3, tmp2; /* sigma0 */ \ 80 xorl tmp3, tmp2 /* sigma0 */ _SEP \
79 addl tmp2, wt; /* sigma0 */ \ 81 addl tmp2, wt /* sigma0 */ _SEP \
80 \ 82 \
81 movl wt, ((idx&0xf)*4)(w) 83 movl wt, ((idx&0xf)*4)(w)
82 84
@@ -94,52 +96,52 @@
94 * Upon completion d = d + T1, h = T1 + T2, pending rotation. 96 * Upon completion d = d + T1, h = T1 + T2, pending rotation.
95 */ 97 */
96#define sha256_round(idx, a, b, c, d, e, f, g, h, k, w, wt) \ 98#define sha256_round(idx, a, b, c, d, e, f, g, h, k, w, wt) \
97 addl wt, h; /* T1 Wt */ \ 99 addl wt, h /* T1 Wt */ _SEP \
98 addl (k256, round, 4), h; /* T1 Kt */ \ 100 addl (k256, round, 4), h /* T1 Kt */ _SEP \
99 \ 101 \
100 movl e, tmp1; /* T1 Sigma1 */ \ 102 movl e, tmp1 /* T1 Sigma1 */ _SEP \
101 rorl $(25-11), tmp1; /* T1 Sigma1 */ \ 103 rorl $(25-11), tmp1 /* T1 Sigma1 */ _SEP \
102 xorl e, tmp1; /* T1 Sigma1 */ \ 104 xorl e, tmp1 /* T1 Sigma1 */ _SEP \
103 rorl $(11-6), tmp1; /* T1 Sigma1 */ \ 105 rorl $(11-6), tmp1 /* T1 Sigma1 */ _SEP \
104 xorl e, tmp1; /* T1 Sigma1 */ \ 106 xorl e, tmp1 /* T1 Sigma1 */ _SEP \
105 rorl $6, tmp1; /* T1 Sigma1 */ \ 107 rorl $6, tmp1 /* T1 Sigma1 */ _SEP \
106 addl tmp1, h; /* T1 Sigma1 */ \ 108 addl tmp1, h /* T1 Sigma1 */ _SEP \
107 \ 109 \
108 movl f, tmp2; /* T1 Ch */ \ 110 movl f, tmp2 /* T1 Ch */ _SEP \
109 xorl g, tmp2; /* T1 Ch */ \ 111 xorl g, tmp2 /* T1 Ch */ _SEP \
110 andl e, tmp2; /* T1 Ch */ \ 112 andl e, tmp2 /* T1 Ch */ _SEP \
111 xorl g, tmp2; /* T1 Ch */ \ 113 xorl g, tmp2 /* T1 Ch */ _SEP \
112 addl tmp2, h; /* T1 Ch */ \ 114 addl tmp2, h /* T1 Ch */ _SEP \
113 \ 115 \
114 addl h, d; /* d += T1 */ \ 116 addl h, d /* d += T1 */ _SEP \
115 \ 117 \
116 movl a, tmp1; /* T2 Sigma0 */ \ 118 movl a, tmp1 /* T2 Sigma0 */ _SEP \
117 rorl $(22-13), tmp1; /* T2 Sigma0 */ \ 119 rorl $(22-13), tmp1 /* T2 Sigma0 */ _SEP \
118 xorl a, tmp1; /* T2 Sigma0 */ \ 120 xorl a, tmp1 /* T2 Sigma0 */ _SEP \
119 rorl $(13-2), tmp1; /* T2 Sigma0 */ \ 121 rorl $(13-2), tmp1 /* T2 Sigma0 */ _SEP \
120 xorl a, tmp1; /* T2 Sigma0 */ \ 122 xorl a, tmp1 /* T2 Sigma0 */ _SEP \
121 rorl $2, tmp1; /* T2 Sigma0 */ \ 123 rorl $2, tmp1 /* T2 Sigma0 */ _SEP \
122 addl tmp1, h; /* T2 Sigma0 */ \ 124 addl tmp1, h /* T2 Sigma0 */ _SEP \
123 \ 125 \
124 movl b, tmp2; /* T2 Maj */ \ 126 movl b, tmp2 /* T2 Maj */ _SEP \
125 xorl c, tmp2; /* T2 Maj */ \ 127 xorl c, tmp2 /* T2 Maj */ _SEP \
126 andl a, tmp2; /* T2 Maj */ \ 128 andl a, tmp2 /* T2 Maj */ _SEP \
127 movl b, tmp3; /* T2 Maj */ \ 129 movl b, tmp3 /* T2 Maj */ _SEP \
128 andl c, tmp3; /* T2 Maj */ \ 130 andl c, tmp3 /* T2 Maj */ _SEP \
129 xorl tmp2, tmp3; /* T2 Maj */ \ 131 xorl tmp2, tmp3 /* T2 Maj */ _SEP \
130 addl tmp3, h; /* T2 Maj */ \ 132 addl tmp3, h /* T2 Maj */ _SEP \
131 \ 133 \
132 addq $1, round 134 addq $1, round
133 135
134#define sha256_round_load(idx, a, b, c, d, e, f, g, h) \ 136#define sha256_round_load(idx, a, b, c, d, e, f, g, h) \
135 sha256_message_schedule_load(idx, in, %rsp, tmp0); \ 137 sha256_message_schedule_load(idx, in, %rsp, tmp0) _SEP \
136 sha256_round(idx, a, b, c, d, e, f, g, h, k256, %rsp, tmp0) 138 sha256_round(idx, a, b, c, d, e, f, g, h, k256, %rsp, tmp0)
137 139
138#define sha256_round_update(idx, a, b, c, d, e, f, g, h) \ 140#define sha256_round_update(idx, a, b, c, d, e, f, g, h) \
139 sha256_message_schedule_update(idx, %rsp, tmp0); \ 141 sha256_message_schedule_update(idx, %rsp, tmp0) _SEP \
140 sha256_round(idx, a, b, c, d, e, f, g, h, k256, %rsp, tmp0) 142 sha256_round(idx, a, b, c, d, e, f, g, h, k256, %rsp, tmp0)
141 143
142.section .text 144.section CRYPTO_ASSEMBLY_SECTION_TEXT
143 145
144/* 146/*
145 * void sha256_block_generic(SHA256_CTX *ctx, const void *in, size_t num); 147 * void sha256_block_generic(SHA256_CTX *ctx, const void *in, size_t num);
@@ -147,9 +149,7 @@
147 * Standard x86-64 ABI: rdi = ctx, rsi = in, rdx = num 149 * Standard x86-64 ABI: rdi = ctx, rsi = in, rdx = num
148 */ 150 */
149.align 16 151.align 16
150.globl sha256_block_generic 152CRYPTO_ASSEMBLY_GLOBAL_FUNCTION(sha256_block_generic):
151.type sha256_block_generic,@function
152sha256_block_generic:
153 _CET_ENDBR 153 _CET_ENDBR
154 154
155 /* Save callee save registers. */ 155 /* Save callee save registers. */
@@ -272,14 +272,13 @@ sha256_block_generic:
272 272
273 ret 273 ret
274 274
275.section .rodata 275.section CRYPTO_ASSEMBLY_SECTION_RODATA
276 276
277/* 277/*
278 * SHA-256 constants - see FIPS 180-4 section 4.2.2. 278 * SHA-256 constants - see FIPS 180-4 section 4.2.2.
279 */ 279 */
280.align 64 280.align 64
281.type K256,@object 281CRYPTO_ASSEMBLY_OBJECT_START(K256):
282K256:
283.long 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5 282.long 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5
284.long 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5 283.long 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5
285.long 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3 284.long 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3
@@ -296,4 +295,8 @@ K256:
296.long 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3 295.long 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3
297.long 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208 296.long 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208
298.long 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 297.long 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
299.size K256,.-K256 298CRYPTO_ASSEMBLY_OBJECT_END(K256)
299
300#if defined(__linux__) && defined(__ELF__)
301.section .note.GNU-stack,"",%progbits
302#endif
diff --git a/src/lib/libcrypto/sha/sha256_amd64_shani.S b/src/lib/libcrypto/sha/sha256_amd64_shani.S
index d86be5be68..e51a168062 100644
--- a/src/lib/libcrypto/sha/sha256_amd64_shani.S
+++ b/src/lib/libcrypto/sha/sha256_amd64_shani.S
@@ -1,4 +1,4 @@
1/* $OpenBSD: sha256_amd64_shani.S,v 1.4 2026/03/28 13:11:28 jsing Exp $ */ 1/* $OpenBSD: sha256_amd64_shani.S,v 1.8 2026/05/12 15:07:30 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -17,6 +17,8 @@
17 17
18#include "crypto_assembly.h" 18#include "crypto_assembly.h"
19 19
20#define _SEP CRYPTO_ASSEMBLY_SEPARATOR
21
20/* 22/*
21 * SHA-256 implementation using the Intel SHA extensions: 23 * SHA-256 implementation using the Intel SHA extensions:
22 * 24 *
@@ -50,33 +52,33 @@
50#define xtmp0 %xmm12 52#define xtmp0 %xmm12
51 53
52#define sha256_message_schedule_load(idx, m, xmsgtmp) \ 54#define sha256_message_schedule_load(idx, m, xmsgtmp) \
53 movdqu (idx*16)(m), xmsg; \ 55 movdqu (idx*16)(m), xmsg _SEP \
54 pshufb xshufmask, xmsg; \ 56 pshufb xshufmask, xmsg _SEP \
55 movdqa xmsg, xmsgtmp 57 movdqa xmsg, xmsgtmp
56 58
57#define sha256_message_schedule_update(xmt0, xmt1, xmt2, xmt3) \ 59#define sha256_message_schedule_update(xmt0, xmt1, xmt2, xmt3) \
58 sha256msg1 xmt1, xmt0; \ 60 sha256msg1 xmt1, xmt0 _SEP \
59 movdqa xmt3, xmsgtmp4; \ 61 movdqa xmt3, xmsgtmp4 _SEP \
60 palignr $4, xmt2, xmsgtmp4; \ 62 palignr $4, xmt2, xmsgtmp4 _SEP \
61 paddd xmsgtmp4, xmt0; \ 63 paddd xmsgtmp4, xmt0 _SEP \
62 sha256msg2 xmt3, xmt0 64 sha256msg2 xmt3, xmt0
63 65
64#define sha256_shani_round(idx) \ 66#define sha256_shani_round(idx) \
65 paddd (idx*16)(k256), xmsg; \ 67 paddd (idx*16)(k256), xmsg _SEP \
66 sha256rnds2 xmsg, xhs0, xhs1; \ 68 sha256rnds2 xmsg, xhs0, xhs1 _SEP \
67 pshufd $0x0e, xmsg, xmsg; \ 69 pshufd $0x0e, xmsg, xmsg _SEP \
68 sha256rnds2 xmsg, xhs1, xhs0 70 sha256rnds2 xmsg, xhs1, xhs0
69 71
70#define sha256_shani_round_load(idx, m, xmsgtmp) \ 72#define sha256_shani_round_load(idx, m, xmsgtmp) \
71 sha256_message_schedule_load(idx, m, xmsgtmp); \ 73 sha256_message_schedule_load(idx, m, xmsgtmp) _SEP \
72 sha256_shani_round(idx) 74 sha256_shani_round(idx)
73 75
74#define sha256_shani_round_update(idx, xmt0, xmt1, xmt2, xmt3) \ 76#define sha256_shani_round_update(idx, xmt0, xmt1, xmt2, xmt3) \
75 sha256_message_schedule_update(xmt0, xmt1, xmt2, xmt3); \ 77 sha256_message_schedule_update(xmt0, xmt1, xmt2, xmt3) _SEP \
76 movdqa xmt0, xmsg; \ 78 movdqa xmt0, xmsg _SEP \
77 sha256_shani_round(idx) 79 sha256_shani_round(idx)
78 80
79.section .text 81.section CRYPTO_ASSEMBLY_SECTION_TEXT
80 82
81/* 83/*
82 * void sha256_block_shani(SHA256_CTX *ctx, const void *in, size_t num); 84 * void sha256_block_shani(SHA256_CTX *ctx, const void *in, size_t num);
@@ -84,9 +86,7 @@
84 * Standard x86-64 ABI: rdi = ctx, rsi = in, rdx = num 86 * Standard x86-64 ABI: rdi = ctx, rsi = in, rdx = num
85 */ 87 */
86.align 16 88.align 16
87.globl sha256_block_shani 89CRYPTO_ASSEMBLY_GLOBAL_FUNCTION(sha256_block_shani):
88.type sha256_block_shani,@function
89sha256_block_shani:
90 _CET_ENDBR 90 _CET_ENDBR
91 91
92 /* Save callee save registers. */ 92 /* Save callee save registers. */
@@ -169,23 +169,21 @@ sha256_block_shani:
169 169
170 ret 170 ret
171 171
172.section .rodata 172.section CRYPTO_ASSEMBLY_SECTION_RODATA
173 173
174/* 174/*
175 * Shuffle mask - little endian to big endian word conversion. 175 * Shuffle mask - little endian to big endian word conversion.
176 */ 176 */
177.align 16 177.align 16
178.type shufmask,@object 178CRYPTO_ASSEMBLY_OBJECT_START(shufmask):
179shufmask:
180.octa 0x0c0d0e0f08090a0b0405060700010203 179.octa 0x0c0d0e0f08090a0b0405060700010203
181.size shufmask,.-shufmask 180CRYPTO_ASSEMBLY_OBJECT_END(shufmask)
182 181
183/* 182/*
184 * SHA-256 constants - see FIPS 180-4 section 4.2.2. 183 * SHA-256 constants - see FIPS 180-4 section 4.2.2.
185 */ 184 */
186.align 64 185.align 64
187.type K256,@object 186CRYPTO_ASSEMBLY_OBJECT_START(K256):
188K256:
189.long 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5 187.long 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5
190.long 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5 188.long 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5
191.long 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3 189.long 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3
@@ -202,4 +200,8 @@ K256:
202.long 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3 200.long 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3
203.long 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208 201.long 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208
204.long 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 202.long 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
205.size K256,.-K256 203CRYPTO_ASSEMBLY_OBJECT_END(K256)
204
205#if defined(__linux__) && defined(__ELF__)
206.section .note.GNU-stack,"",%progbits
207#endif
diff --git a/src/lib/libcrypto/sha/sha3.c b/src/lib/libcrypto/sha/sha3.c
index fde0da94ff..bfbbe10303 100644
--- a/src/lib/libcrypto/sha/sha3.c
+++ b/src/lib/libcrypto/sha/sha3.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sha3.c,v 1.20 2025/04/18 07:36:11 jsing Exp $ */ 1/* $OpenBSD: sha3.c,v 1.21 2026/07/22 14:34:38 jsing Exp $ */
2/* 2/*
3 * The MIT License (MIT) 3 * The MIT License (MIT)
4 * 4 *
@@ -41,55 +41,299 @@ static const uint64_t sha3_keccakf_rndc[24] = {
41 0x000000000000800a, 0x800000008000000a, 0x8000000080008081, 41 0x000000000000800a, 0x800000008000000a, 0x8000000080008081,
42 0x8000000000008080, 0x0000000080000001, 0x8000000080008008 42 0x8000000000008080, 0x0000000080000001, 0x8000000080008008
43}; 43};
44static const int sha3_keccakf_rotc[24] = {
45 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 2, 14,
46 27, 41, 56, 8, 25, 43, 62, 18, 39, 61, 20, 44
47};
48static const int sha3_keccakf_piln[24] = {
49 10, 7, 11, 17, 18, 3, 5, 16, 8, 21, 24, 4,
50 15, 23, 19, 13, 12, 2, 20, 14, 22, 9, 6, 1
51};
52 44
53static void 45static void
54sha3_keccakf(uint64_t st[25]) 46sha3_keccakf(uint64_t st[25])
55{ 47{
56 uint64_t t0, t1, bc[5]; 48 uint64_t bc0, bc1, bc2, bc3, bc4;
57 int i, j, r; 49 uint64_t d0, d1, d2, d3, d4;
50 int i, r;
58 51
59 for (i = 0; i < 25; i++) 52 for (i = 0; i < 25; i++)
60 st[i] = le64toh(st[i]); 53 st[i] = le64toh(st[i]);
61 54
62 for (r = 0; r < KECCAKF_ROUNDS; r++) { 55 /*
56 * Optimized Keccak algorithm from
57 * KeccakReferenceAndOptimized/Sources/Keccak-inplace.c contained in
58 * https://keccak.team/obsolete/KeccakReferenceAndOptimized-3.2.zip
59 */
63 60
64 /* Theta */ 61 for (r = 0; r < KECCAKF_ROUNDS; r += 4) {
65 for (i = 0; i < 5; i++) 62 /*
66 bc[i] = st[i] ^ st[i + 5] ^ st[i + 10] ^ st[i + 15] ^ st[i + 20]; 63 * Round 1
64 */
65 bc0 = st[0] ^ st[5] ^ st[10] ^ st[15] ^ st[20];
66 bc1 = st[1] ^ st[6] ^ st[11] ^ st[16] ^ st[21];
67 bc2 = st[2] ^ st[7] ^ st[12] ^ st[17] ^ st[22];
68 bc3 = st[3] ^ st[8] ^ st[13] ^ st[18] ^ st[23];
69 bc4 = st[4] ^ st[9] ^ st[14] ^ st[19] ^ st[24];
70 d0 = bc4 ^ crypto_rol_u64(bc1, 1);
71 d1 = bc0 ^ crypto_rol_u64(bc2, 1);
72 d2 = bc1 ^ crypto_rol_u64(bc3, 1);
73 d3 = bc2 ^ crypto_rol_u64(bc4, 1);
74 d4 = bc3 ^ crypto_rol_u64(bc0, 1);
67 75
68 for (i = 0; i < 5; i++) { 76 bc0 = st[0] ^ d0;
69 t0 = bc[(i + 4) % 5] ^ crypto_rol_u64(bc[(i + 1) % 5], 1); 77 bc1 = crypto_rol_u64(st[6] ^ d1, 44);
70 for (j = 0; j < 25; j += 5) 78 bc2 = crypto_rol_u64(st[12] ^ d2, 43);
71 st[j + i] ^= t0; 79 bc3 = crypto_rol_u64(st[18] ^ d3, 21);
72 } 80 bc4 = crypto_rol_u64(st[24] ^ d4, 14);
81 st[0] = bc0 ^ (~bc1 & bc2) ^ sha3_keccakf_rndc[r + 0];
82 st[6] = bc1 ^ (~bc2 & bc3);
83 st[12] = bc2 ^ (~bc3 & bc4);
84 st[18] = bc3 ^ (~bc4 & bc0);
85 st[24] = bc4 ^ (~bc0 & bc1);
73 86
74 /* Rho Pi */ 87 bc2 = crypto_rol_u64(st[10] ^ d0, 3);
75 t0 = st[1]; 88 bc3 = crypto_rol_u64(st[16] ^ d1, 45);
76 for (i = 0; i < 24; i++) { 89 bc4 = crypto_rol_u64(st[22] ^ d2, 61);
77 j = sha3_keccakf_piln[i]; 90 bc0 = crypto_rol_u64(st[3] ^ d3, 28);
78 t1 = st[j]; 91 bc1 = crypto_rol_u64(st[9] ^ d4, 20);
79 st[j] = crypto_rol_u64(t0, sha3_keccakf_rotc[i]); 92 st[10] = bc0 ^ (~bc1 & bc2);
80 t0 = t1; 93 st[16] = bc1 ^ (~bc2 & bc3);
81 } 94 st[22] = bc2 ^ (~bc3 & bc4);
95 st[3] = bc3 ^ (~bc4 & bc0);
96 st[9] = bc4 ^ (~bc0 & bc1);
82 97
83 /* Chi */ 98 bc4 = crypto_rol_u64(st[20] ^ d0, 18);
84 for (j = 0; j < 25; j += 5) { 99 bc0 = crypto_rol_u64(st[1] ^ d1, 1);
85 for (i = 0; i < 5; i++) 100 bc1 = crypto_rol_u64(st[7] ^ d2, 6);
86 bc[i] = st[j + i]; 101 bc2 = crypto_rol_u64(st[13] ^ d3, 25);
87 for (i = 0; i < 5; i++) 102 bc3 = crypto_rol_u64(st[19] ^ d4, 8);
88 st[j + i] ^= (~bc[(i + 1) % 5]) & bc[(i + 2) % 5]; 103 st[20] = bc0 ^ (~bc1 & bc2);
89 } 104 st[1] = bc1 ^ (~bc2 & bc3);
105 st[7] = bc2 ^ (~bc3 & bc4);
106 st[13] = bc3 ^ (~bc4 & bc0);
107 st[19] = bc4 ^ (~bc0 & bc1);
108
109 bc1 = crypto_rol_u64(st[5] ^ d0, 36);
110 bc2 = crypto_rol_u64(st[11] ^ d1, 10);
111 bc3 = crypto_rol_u64(st[17] ^ d2, 15);
112 bc4 = crypto_rol_u64(st[23] ^ d3, 56);
113 bc0 = crypto_rol_u64(st[4] ^ d4, 27);
114 st[5] = bc0 ^ (~bc1 & bc2);
115 st[11] = bc1 ^ (~bc2 & bc3);
116 st[17] = bc2 ^ (~bc3 & bc4);
117 st[23] = bc3 ^ (~bc4 & bc0);
118 st[4] = bc4 ^ (~bc0 & bc1);
119
120 bc3 = crypto_rol_u64(st[15] ^ d0, 41);
121 bc4 = crypto_rol_u64(st[21] ^ d1, 2);
122 bc0 = crypto_rol_u64(st[2] ^ d2, 62);
123 bc1 = crypto_rol_u64(st[8] ^ d3, 55);
124 bc2 = crypto_rol_u64(st[14] ^ d4, 39);
125 st[15] = bc0 ^ (~bc1 & bc2);
126 st[21] = bc1 ^ (~bc2 & bc3);
127 st[2] = bc2 ^ (~bc3 & bc4);
128 st[8] = bc3 ^ (~bc4 & bc0);
129 st[14] = bc4 ^ (~bc0 & bc1);
130
131 /*
132 * Round 2
133 */
134 bc0 = st[0] ^ st[5] ^ st[10] ^ st[15] ^ st[20];
135 bc1 = st[1] ^ st[6] ^ st[11] ^ st[16] ^ st[21];
136 bc2 = st[2] ^ st[7] ^ st[12] ^ st[17] ^ st[22];
137 bc3 = st[3] ^ st[8] ^ st[13] ^ st[18] ^ st[23];
138 bc4 = st[4] ^ st[9] ^ st[14] ^ st[19] ^ st[24];
139 d0 = bc4 ^ crypto_rol_u64(bc1, 1);
140 d1 = bc0 ^ crypto_rol_u64(bc2, 1);
141 d2 = bc1 ^ crypto_rol_u64(bc3, 1);
142 d3 = bc2 ^ crypto_rol_u64(bc4, 1);
143 d4 = bc3 ^ crypto_rol_u64(bc0, 1);
144
145 bc0 = st[0] ^ d0;
146 bc1 = crypto_rol_u64(st[16] ^ d1, 44);
147 bc2 = crypto_rol_u64(st[7] ^ d2, 43);
148 bc3 = crypto_rol_u64(st[23] ^ d3, 21);
149 bc4 = crypto_rol_u64(st[14] ^ d4, 14);
150 st[0] = bc0 ^ (~bc1 & bc2) ^ sha3_keccakf_rndc[r + 1];
151 st[16] = bc1 ^ (~bc2 & bc3);
152 st[7] = bc2 ^ (~bc3 & bc4);
153 st[23] = bc3 ^ (~bc4 & bc0);
154 st[14] = bc4 ^ (~bc0 & bc1);
155
156 bc2 = crypto_rol_u64(st[20] ^ d0, 3);
157 bc3 = crypto_rol_u64(st[11] ^ d1, 45);
158 bc4 = crypto_rol_u64(st[2] ^ d2, 61);
159 bc0 = crypto_rol_u64(st[18] ^ d3, 28);
160 bc1 = crypto_rol_u64(st[9] ^ d4, 20);
161 st[20] = bc0 ^ (~bc1 & bc2);
162 st[11] = bc1 ^ (~bc2 & bc3);
163 st[2] = bc2 ^ (~bc3 & bc4);
164 st[18] = bc3 ^ (~bc4 & bc0);
165 st[9] = bc4 ^ (~bc0 & bc1);
166
167 bc4 = crypto_rol_u64(st[15] ^ d0, 18);
168 bc0 = crypto_rol_u64(st[6] ^ d1, 1);
169 bc1 = crypto_rol_u64(st[22] ^ d2, 6);
170 bc2 = crypto_rol_u64(st[13] ^ d3, 25);
171 bc3 = crypto_rol_u64(st[4] ^ d4, 8);
172 st[15] = bc0 ^ (~bc1 & bc2);
173 st[6] = bc1 ^ (~bc2 & bc3);
174 st[22] = bc2 ^ (~bc3 & bc4);
175 st[13] = bc3 ^ (~bc4 & bc0);
176 st[4] = bc4 ^ (~bc0 & bc1);
177
178 bc1 = crypto_rol_u64(st[10] ^ d0, 36);
179 bc2 = crypto_rol_u64(st[1] ^ d1, 10);
180 bc3 = crypto_rol_u64(st[17] ^ d2, 15);
181 bc4 = crypto_rol_u64(st[8] ^ d3, 56);
182 bc0 = crypto_rol_u64(st[24] ^ d4, 27);
183 st[10] = bc0 ^ (~bc1 & bc2);
184 st[1] = bc1 ^ (~bc2 & bc3);
185 st[17] = bc2 ^ (~bc3 & bc4);
186 st[8] = bc3 ^ (~bc4 & bc0);
187 st[24] = bc4 ^ (~bc0 & bc1);
188
189 bc3 = crypto_rol_u64(st[5] ^ d0, 41);
190 bc4 = crypto_rol_u64(st[21] ^ d1, 2);
191 bc0 = crypto_rol_u64(st[12] ^ d2, 62);
192 bc1 = crypto_rol_u64(st[3] ^ d3, 55);
193 bc2 = crypto_rol_u64(st[19] ^ d4, 39);
194 st[5] = bc0 ^ (~bc1 & bc2);
195 st[21] = bc1 ^ (~bc2 & bc3);
196 st[12] = bc2 ^ (~bc3 & bc4);
197 st[3] = bc3 ^ (~bc4 & bc0);
198 st[19] = bc4 ^ (~bc0 & bc1);
199
200 /*
201 * Round 3
202 */
203 bc0 = st[0] ^ st[5] ^ st[10] ^ st[15] ^ st[20];
204 bc1 = st[1] ^ st[6] ^ st[11] ^ st[16] ^ st[21];
205 bc2 = st[2] ^ st[7] ^ st[12] ^ st[17] ^ st[22];
206 bc3 = st[3] ^ st[8] ^ st[13] ^ st[18] ^ st[23];
207 bc4 = st[4] ^ st[9] ^ st[14] ^ st[19] ^ st[24];
208 d0 = bc4 ^ crypto_rol_u64(bc1, 1);
209 d1 = bc0 ^ crypto_rol_u64(bc2, 1);
210 d2 = bc1 ^ crypto_rol_u64(bc3, 1);
211 d3 = bc2 ^ crypto_rol_u64(bc4, 1);
212 d4 = bc3 ^ crypto_rol_u64(bc0, 1);
213
214 bc0 = st[0] ^ d0;
215 bc1 = crypto_rol_u64(st[11] ^ d1, 44);
216 bc2 = crypto_rol_u64(st[22] ^ d2, 43);
217 bc3 = crypto_rol_u64(st[8] ^ d3, 21);
218 bc4 = crypto_rol_u64(st[19] ^ d4, 14);
219 st[0] = bc0 ^ (~bc1 & bc2) ^ sha3_keccakf_rndc[r + 2];
220 st[11] = bc1 ^ (~bc2 & bc3);
221 st[22] = bc2 ^ (~bc3 & bc4);
222 st[8] = bc3 ^ (~bc4 & bc0);
223 st[19] = bc4 ^ (~bc0 & bc1);
224
225 bc2 = crypto_rol_u64(st[15] ^ d0, 3);
226 bc3 = crypto_rol_u64(st[1] ^ d1, 45);
227 bc4 = crypto_rol_u64(st[12] ^ d2, 61);
228 bc0 = crypto_rol_u64(st[23] ^ d3, 28);
229 bc1 = crypto_rol_u64(st[9] ^ d4, 20);
230 st[15] = bc0 ^ (~bc1 & bc2);
231 st[1] = bc1 ^ (~bc2 & bc3);
232 st[12] = bc2 ^ (~bc3 & bc4);
233 st[23] = bc3 ^ (~bc4 & bc0);
234 st[9] = bc4 ^ (~bc0 & bc1);
235
236 bc4 = crypto_rol_u64(st[5] ^ d0, 18);
237 bc0 = crypto_rol_u64(st[16] ^ d1, 1);
238 bc1 = crypto_rol_u64(st[2] ^ d2, 6);
239 bc2 = crypto_rol_u64(st[13] ^ d3, 25);
240 bc3 = crypto_rol_u64(st[24] ^ d4, 8);
241 st[5] = bc0 ^ (~bc1 & bc2);
242 st[16] = bc1 ^ (~bc2 & bc3);
243 st[2] = bc2 ^ (~bc3 & bc4);
244 st[13] = bc3 ^ (~bc4 & bc0);
245 st[24] = bc4 ^ (~bc0 & bc1);
246
247 bc1 = crypto_rol_u64(st[20] ^ d0, 36);
248 bc2 = crypto_rol_u64(st[6] ^ d1, 10);
249 bc3 = crypto_rol_u64(st[17] ^ d2, 15);
250 bc4 = crypto_rol_u64(st[3] ^ d3, 56);
251 bc0 = crypto_rol_u64(st[14] ^ d4, 27);
252 st[20] = bc0 ^ (~bc1 & bc2);
253 st[6] = bc1 ^ (~bc2 & bc3);
254 st[17] = bc2 ^ (~bc3 & bc4);
255 st[3] = bc3 ^ (~bc4 & bc0);
256 st[14] = bc4 ^ (~bc0 & bc1);
257
258 bc3 = crypto_rol_u64(st[10] ^ d0, 41);
259 bc4 = crypto_rol_u64(st[21] ^ d1, 2);
260 bc0 = crypto_rol_u64(st[7] ^ d2, 62);
261 bc1 = crypto_rol_u64(st[18] ^ d3, 55);
262 bc2 = crypto_rol_u64(st[4] ^ d4, 39);
263 st[10] = bc0 ^ (~bc1 & bc2);
264 st[21] = bc1 ^ (~bc2 & bc3);
265 st[7] = bc2 ^ (~bc3 & bc4);
266 st[18] = bc3 ^ (~bc4 & bc0);
267 st[4] = bc4 ^ (~bc0 & bc1);
268
269 /*
270 * Round 4
271 */
272 bc0 = st[0] ^ st[5] ^ st[10] ^ st[15] ^ st[20];
273 bc1 = st[1] ^ st[6] ^ st[11] ^ st[16] ^ st[21];
274 bc2 = st[2] ^ st[7] ^ st[12] ^ st[17] ^ st[22];
275 bc3 = st[3] ^ st[8] ^ st[13] ^ st[18] ^ st[23];
276 bc4 = st[4] ^ st[9] ^ st[14] ^ st[19] ^ st[24];
277 d0 = bc4 ^ crypto_rol_u64(bc1, 1);
278 d1 = bc0 ^ crypto_rol_u64(bc2, 1);
279 d2 = bc1 ^ crypto_rol_u64(bc3, 1);
280 d3 = bc2 ^ crypto_rol_u64(bc4, 1);
281 d4 = bc3 ^ crypto_rol_u64(bc0, 1);
282
283 bc0 = st[0] ^ d0;
284 bc1 = crypto_rol_u64(st[1] ^ d1, 44);
285 bc2 = crypto_rol_u64(st[2] ^ d2, 43);
286 bc3 = crypto_rol_u64(st[3] ^ d3, 21);
287 bc4 = crypto_rol_u64(st[4] ^ d4, 14);
288 st[0] = bc0 ^ (~bc1 & bc2) ^ sha3_keccakf_rndc[r + 3];
289 st[1] = bc1 ^ (~bc2 & bc3);
290 st[2] = bc2 ^ (~bc3 & bc4);
291 st[3] = bc3 ^ (~bc4 & bc0);
292 st[4] = bc4 ^ (~bc0 & bc1);
293
294 bc2 = crypto_rol_u64(st[5] ^ d0, 3);
295 bc3 = crypto_rol_u64(st[6] ^ d1, 45);
296 bc4 = crypto_rol_u64(st[7] ^ d2, 61);
297 bc0 = crypto_rol_u64(st[8] ^ d3, 28);
298 bc1 = crypto_rol_u64(st[9] ^ d4, 20);
299 st[5] = bc0 ^ (~bc1 & bc2);
300 st[6] = bc1 ^ (~bc2 & bc3);
301 st[7] = bc2 ^ (~bc3 & bc4);
302 st[8] = bc3 ^ (~bc4 & bc0);
303 st[9] = bc4 ^ (~bc0 & bc1);
304
305 bc4 = crypto_rol_u64(st[10] ^ d0, 18);
306 bc0 = crypto_rol_u64(st[11] ^ d1, 1);
307 bc1 = crypto_rol_u64(st[12] ^ d2, 6);
308 bc2 = crypto_rol_u64(st[13] ^ d3, 25);
309 bc3 = crypto_rol_u64(st[14] ^ d4, 8);
310 st[10] = bc0 ^ (~bc1 & bc2);
311 st[11] = bc1 ^ (~bc2 & bc3);
312 st[12] = bc2 ^ (~bc3 & bc4);
313 st[13] = bc3 ^ (~bc4 & bc0);
314 st[14] = bc4 ^ (~bc0 & bc1);
315
316 bc1 = crypto_rol_u64(st[15] ^ d0, 36);
317 bc2 = crypto_rol_u64(st[16] ^ d1, 10);
318 bc3 = crypto_rol_u64(st[17] ^ d2, 15);
319 bc4 = crypto_rol_u64(st[18] ^ d3, 56);
320 bc0 = crypto_rol_u64(st[19] ^ d4, 27);
321 st[15] = bc0 ^ (~bc1 & bc2);
322 st[16] = bc1 ^ (~bc2 & bc3);
323 st[17] = bc2 ^ (~bc3 & bc4);
324 st[18] = bc3 ^ (~bc4 & bc0);
325 st[19] = bc4 ^ (~bc0 & bc1);
90 326
91 /* Iota */ 327 bc3 = crypto_rol_u64(st[20] ^ d0, 41);
92 st[0] ^= sha3_keccakf_rndc[r]; 328 bc4 = crypto_rol_u64(st[21] ^ d1, 2);
329 bc0 = crypto_rol_u64(st[22] ^ d2, 62);
330 bc1 = crypto_rol_u64(st[23] ^ d3, 55);
331 bc2 = crypto_rol_u64(st[24] ^ d4, 39);
332 st[20] = bc0 ^ (~bc1 & bc2);
333 st[21] = bc1 ^ (~bc2 & bc3);
334 st[22] = bc2 ^ (~bc3 & bc4);
335 st[23] = bc3 ^ (~bc4 & bc0);
336 st[24] = bc4 ^ (~bc0 & bc1);
93 } 337 }
94 338
95 for (i = 0; i < 25; i++) 339 for (i = 0; i < 25; i++)
diff --git a/src/lib/libcrypto/sha/sha512_aarch64_ce.S b/src/lib/libcrypto/sha/sha512_aarch64_ce.S
index 6efe775ff5..8c88696e4a 100644
--- a/src/lib/libcrypto/sha/sha512_aarch64_ce.S
+++ b/src/lib/libcrypto/sha/sha512_aarch64_ce.S
@@ -1,4 +1,4 @@
1/* $OpenBSD: sha512_aarch64_ce.S,v 1.4 2026/01/25 08:22:17 jsing Exp $ */ 1/* $OpenBSD: sha512_aarch64_ce.S,v 1.9 2026/05/12 15:07:30 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2023,2025 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2023,2025 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -15,6 +15,10 @@
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */ 16 */
17 17
18#include "crypto_assembly.h"
19
20#define _SEP CRYPTO_ASSEMBLY_SEPARATOR
21
18/* 22/*
19 * SHA-512 implementation using the ARM Cryptographic Extension (CE). 23 * SHA-512 implementation using the ARM Cryptographic Extension (CE).
20 * 24 *
@@ -103,9 +107,9 @@
103 * W0 = sigma1(W14) + W9 + sigma0(W1) + W0 107 * W0 = sigma1(W14) + W9 + sigma0(W1) + W0
104 */ 108 */
105#define sha512_message_schedule_update(m0, m1, m4, m5, m7) \ 109#define sha512_message_schedule_update(m0, m1, m4, m5, m7) \
106 sha512su0 m0.2d, m1.2d; /* W0 += sigma0(W1) */ \ 110 sha512su0 m0.2d, m1.2d /* W0 += sigma0(W1) */ _SEP \
107 ext tmp2.16b, m4.16b, m5.16b, #8; /* W9:W10 */ \ 111 ext tmp2.16b, m4.16b, m5.16b, #8 /* W9:W10 */ _SEP \
108 sha512su1 m0.2d, m7.2d, tmp2.2d; /* W0 += sigma1(W14) + W9 */ 112 sha512su1 m0.2d, m7.2d, tmp2.2d /* W0 += sigma1(W14) + W9 */
109 113
110/* 114/*
111 * Compute two SHA-512 rounds by adding W0:W1 + K0:K1, then computing T1 for two 115 * Compute two SHA-512 rounds by adding W0:W1 + K0:K1, then computing T1 for two
@@ -142,33 +146,32 @@
142 * These values are then rotated by the caller to perform the next two rounds. 146 * These values are then rotated by the caller to perform the next two rounds.
143 */ 147 */
144#define sha512_round(h0, h1, h2, h3, h4, h5, w, k) \ 148#define sha512_round(h0, h1, h2, h3, h4, h5, w, k) \
145 add h4.2d, w.2d, k.2d; /* W0:W1 += K0:K1 */ \ 149 add h4.2d, w.2d, k.2d /* W0:W1 += K0:K1 */ _SEP \
146 ext h4.16b, h4.16b, h4.16b, #8; /* W1:W0 (swap) */ \ 150 ext h4.16b, h4.16b, h4.16b, #8 /* W1:W0 (swap) */ _SEP \
147 add h4.2d, h4.2d, h3.2d; /* W1:W0 += g:h */ \ 151 add h4.2d, h4.2d, h3.2d /* W1:W0 += g:h */ _SEP \
148 ext tmp0.16b, h2.16b, h3.16b, #8; /* f:g */ \ 152 ext tmp0.16b, h2.16b, h3.16b, #8 /* f:g */ _SEP \
149 ext tmp1.16b, h1.16b, h2.16b, #8; /* d:e */ \ 153 ext tmp1.16b, h1.16b, h2.16b, #8 /* d:e */ _SEP \
150 sha512h h4##q, tmp0##q, tmp1.2d; /* T1 */ \ 154 sha512h h4##q, tmp0##q, tmp1.2d /* T1 */ _SEP \
151 add h5.2d, h1.2d, h4.2d; /* c:d + T1 */ \ 155 add h5.2d, h1.2d, h4.2d /* c:d + T1 */ _SEP \
152 sha512h2 h4##q, h1##q, h0.2d; /* T1 + T2 */ 156 sha512h2 h4##q, h1##q, h0.2d /* T1 + T2 */
153 157
154#define sha512_round_initial(h0, h1, h2, h3, h4, h5, w, k) \ 158#define sha512_round_initial(h0, h1, h2, h3, h4, h5, w, k) \
155 sha512_round(h0, h1, h2, h3, h4, h5, w, k) 159 sha512_round(h0, h1, h2, h3, h4, h5, w, k)
156 160
157#define sha512_round_update(h0, h1, h2, h3, h4, h5, m0, m1, m2, m3, m4, k) \ 161#define sha512_round_update(h0, h1, h2, h3, h4, h5, m0, m1, m2, m3, m4, k) \
158 sha512_message_schedule_update(m0, m1, m2, m3, m4) \ 162 sha512_message_schedule_update(m0, m1, m2, m3, m4) _SEP \
159 sha512_round(h0, h1, h2, h3, h4, h5, m0, k) 163 sha512_round(h0, h1, h2, h3, h4, h5, m0, k)
160 164
161.arch armv8-a+sha3 165.arch armv8-a+sha3
162 166
163.section .text 167.section CRYPTO_ASSEMBLY_SECTION_TEXT
164 168
165/* 169/*
166 * void sha512_block_ce(SHA512_CTX *ctx, const void *in, size_t num); 170 * void sha512_block_ce(SHA512_CTX *ctx, const void *in, size_t num);
167 * 171 *
168 * Standard ARM ABI: x0 = ctx, x1 = in, x2 = num 172 * Standard ARM ABI: x0 = ctx, x1 = in, x2 = num
169 */ 173 */
170.globl sha512_block_ce 174CRYPTO_ASSEMBLY_GLOBAL_FUNCTION(sha512_block_ce):
171sha512_block_ce:
172 175
173 /* Save low 64 bits of v8 through v15 to the stack. */ 176 /* Save low 64 bits of v8 through v15 to the stack. */
174 sub sp, sp, #32 177 sub sp, sp, #32
@@ -177,8 +180,8 @@ sha512_block_ce:
177 st4 {v12.d, v13.d, v14.d, v15.d}[0], [sp] 180 st4 {v12.d, v13.d, v14.d, v15.d}[0], [sp]
178 181
179 /* Address of SHA-512 constants. */ 182 /* Address of SHA-512 constants. */
180 adrp k512_base, K512 183 adrp k512_base, CRYPTO_ASSEMBLY_AARCH64_SYM_HI(K512)
181 add k512_base, k512_base, :lo12:K512 184 add k512_base, k512_base, CRYPTO_ASSEMBLY_AARCH64_SYM_LO(K512)
182 185
183 /* 186 /*
184 * Load current hash state from context. 187 * Load current hash state from context.
@@ -291,14 +294,13 @@ sha512_block_ce:
291 294
292 ret 295 ret
293 296
294.section .rodata 297.section CRYPTO_ASSEMBLY_SECTION_RODATA
295 298
296/* 299/*
297 * SHA-512 constants - see FIPS 180-4 section 4.2.3. 300 * SHA-512 constants - see FIPS 180-4 section 4.2.3.
298 */ 301 */
299.align 4 302.align 4
300.type K512,@object 303CRYPTO_ASSEMBLY_OBJECT_START(K512):
301K512:
302.quad 0x428a2f98d728ae22, 0x7137449123ef65cd, 0xb5c0fbcfec4d3b2f, 0xe9b5dba58189dbbc 304.quad 0x428a2f98d728ae22, 0x7137449123ef65cd, 0xb5c0fbcfec4d3b2f, 0xe9b5dba58189dbbc
303.quad 0x3956c25bf348b538, 0x59f111f1b605d019, 0x923f82a4af194f9b, 0xab1c5ed5da6d8118 305.quad 0x3956c25bf348b538, 0x59f111f1b605d019, 0x923f82a4af194f9b, 0xab1c5ed5da6d8118
304.quad 0xd807aa98a3030242, 0x12835b0145706fbe, 0x243185be4ee4b28c, 0x550c7dc3d5ffb4e2 306.quad 0xd807aa98a3030242, 0x12835b0145706fbe, 0x243185be4ee4b28c, 0x550c7dc3d5ffb4e2
@@ -319,4 +321,8 @@ K512:
319.quad 0x06f067aa72176fba, 0x0a637dc5a2c898a6, 0x113f9804bef90dae, 0x1b710b35131c471b 321.quad 0x06f067aa72176fba, 0x0a637dc5a2c898a6, 0x113f9804bef90dae, 0x1b710b35131c471b
320.quad 0x28db77f523047d84, 0x32caab7b40c72493, 0x3c9ebe0a15c9bebc, 0x431d67c49c100d4c 322.quad 0x28db77f523047d84, 0x32caab7b40c72493, 0x3c9ebe0a15c9bebc, 0x431d67c49c100d4c
321.quad 0x4cc5d4becb3e42b6, 0x597f299cfc657e2a, 0x5fcb6fab3ad6faec, 0x6c44198c4a475817 323.quad 0x4cc5d4becb3e42b6, 0x597f299cfc657e2a, 0x5fcb6fab3ad6faec, 0x6c44198c4a475817
322.size K512,.-K512 324CRYPTO_ASSEMBLY_OBJECT_END(K512)
325
326#if defined(__linux__) && defined(__ELF__)
327.section .note.GNU-stack,"",%progbits
328#endif
diff --git a/src/lib/libcrypto/sha/sha512_amd64_generic.S b/src/lib/libcrypto/sha/sha512_amd64_generic.S
index de759875f4..2e862df5ef 100644
--- a/src/lib/libcrypto/sha/sha512_amd64_generic.S
+++ b/src/lib/libcrypto/sha/sha512_amd64_generic.S
@@ -1,4 +1,4 @@
1/* $OpenBSD: sha512_amd64_generic.S,v 1.4 2026/03/28 13:11:28 jsing Exp $ */ 1/* $OpenBSD: sha512_amd64_generic.S,v 1.8 2026/05/12 15:07:30 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -17,6 +17,8 @@
17 17
18#include "crypto_assembly.h" 18#include "crypto_assembly.h"
19 19
20#define _SEP CRYPTO_ASSEMBLY_SEPARATOR
21
20#define ctx %rdi 22#define ctx %rdi
21#define in %rsi 23#define in %rsi
22#define num %rdx 24#define num %rdx
@@ -45,8 +47,8 @@
45 * Wt = Mt 47 * Wt = Mt
46 */ 48 */
47#define sha512_message_schedule_load(idx, m, w, wt) \ 49#define sha512_message_schedule_load(idx, m, w, wt) \
48 movq (m, round, 8), wt; \ 50 movq (m, round, 8), wt _SEP \
49 bswapq wt; \ 51 bswapq wt _SEP \
50 movq wt, ((idx&0xf)*8)(w) 52 movq wt, ((idx&0xf)*8)(w)
51 53
52/* 54/*
@@ -59,25 +61,25 @@
59 * 61 *
60 */ 62 */
61#define sha512_message_schedule_update(idx, w, wt) \ 63#define sha512_message_schedule_update(idx, w, wt) \
62 movq (((idx-2)&0xf)*8)(w), wt; /* sigma1 */ \ 64 movq (((idx-2)&0xf)*8)(w), wt /* sigma1 */ _SEP \
63 movq wt, tmp1; /* sigma1 */ \ 65 movq wt, tmp1 /* sigma1 */ _SEP \
64 rorq $(61-19), tmp1; /* sigma1 */ \ 66 rorq $(61-19), tmp1 /* sigma1 */ _SEP \
65 xorq wt, tmp1; /* sigma1 */ \ 67 xorq wt, tmp1 /* sigma1 */ _SEP \
66 rorq $19, tmp1; /* sigma1 */ \ 68 rorq $19, tmp1 /* sigma1 */ _SEP \
67 shrq $6, wt; /* sigma1 */ \ 69 shrq $6, wt /* sigma1 */ _SEP \
68 xorq tmp1, wt; /* sigma1 */ \ 70 xorq tmp1, wt /* sigma1 */ _SEP \
69 \ 71 \
70 addq (((idx-7)&0xf)*8)(w), wt; /* Wt-7 */ \ 72 addq (((idx-7)&0xf)*8)(w), wt /* Wt-7 */ _SEP \
71 addq (((idx-16)&0xf)*8)(w), wt; /* Wt-16 */ \ 73 addq (((idx-16)&0xf)*8)(w), wt /* Wt-16 */ _SEP \
72 \ 74 \
73 movq (((idx-15)&0xf)*8)(w), tmp2; /* sigma0 */ \ 75 movq (((idx-15)&0xf)*8)(w), tmp2 /* sigma0 */ _SEP \
74 movq tmp2, tmp3; /* sigma0 */ \ 76 movq tmp2, tmp3 /* sigma0 */ _SEP \
75 rorq $(8-1), tmp2; /* sigma0 */ \ 77 rorq $(8-1), tmp2 /* sigma0 */ _SEP \
76 xorq tmp3, tmp2; /* sigma0 */ \ 78 xorq tmp3, tmp2 /* sigma0 */ _SEP \
77 rorq $1, tmp2; /* sigma0 */ \ 79 rorq $1, tmp2 /* sigma0 */ _SEP \
78 shrq $7, tmp3; /* sigma0 */ \ 80 shrq $7, tmp3 /* sigma0 */ _SEP \
79 xorq tmp3, tmp2; /* sigma0 */ \ 81 xorq tmp3, tmp2 /* sigma0 */ _SEP \
80 addq tmp2, wt; /* sigma0 */ \ 82 addq tmp2, wt /* sigma0 */ _SEP \
81 \ 83 \
82 movq wt, ((idx&0xf)*8)(w) 84 movq wt, ((idx&0xf)*8)(w)
83 85
@@ -95,52 +97,52 @@
95 * Upon completion d = d + T1, h = T1 + T2, pending rotation. 97 * Upon completion d = d + T1, h = T1 + T2, pending rotation.
96 */ 98 */
97#define sha512_round(idx, a, b, c, d, e, f, g, h, k, w, wt) \ 99#define sha512_round(idx, a, b, c, d, e, f, g, h, k, w, wt) \
98 addq wt, h; /* T1 Wt */ \ 100 addq wt, h /* T1 Wt */ _SEP \
99 addq (k512, round, 8), h; /* T1 Kt */ \ 101 addq (k512, round, 8), h /* T1 Kt */ _SEP \
100 \ 102 \
101 movq e, tmp1; /* T1 Sigma1 */ \ 103 movq e, tmp1 /* T1 Sigma1 */ _SEP \
102 rorq $(41-18), tmp1; /* T1 Sigma1 */ \ 104 rorq $(41-18), tmp1 /* T1 Sigma1 */ _SEP \
103 xorq e, tmp1; /* T1 Sigma1 */ \ 105 xorq e, tmp1 /* T1 Sigma1 */ _SEP \
104 rorq $(18-14), tmp1; /* T1 Sigma1 */ \ 106 rorq $(18-14), tmp1 /* T1 Sigma1 */ _SEP \
105 xorq e, tmp1; /* T1 Sigma1 */ \ 107 xorq e, tmp1 /* T1 Sigma1 */ _SEP \
106 rorq $14, tmp1; /* T1 Sigma1 */ \ 108 rorq $14, tmp1 /* T1 Sigma1 */ _SEP \
107 addq tmp1, h; /* T1 Sigma1 */ \ 109 addq tmp1, h /* T1 Sigma1 */ _SEP \
108 \ 110 \
109 movq f, tmp2; /* T1 Ch */ \ 111 movq f, tmp2 /* T1 Ch */ _SEP \
110 xorq g, tmp2; /* T1 Ch */ \ 112 xorq g, tmp2 /* T1 Ch */ _SEP \
111 andq e, tmp2; /* T1 Ch */ \ 113 andq e, tmp2 /* T1 Ch */ _SEP \
112 xorq g, tmp2; /* T1 Ch */ \ 114 xorq g, tmp2 /* T1 Ch */ _SEP \
113 addq tmp2, h; /* T1 Ch */ \ 115 addq tmp2, h /* T1 Ch */ _SEP \
114 \ 116 \
115 addq h, d; /* d += T1 */ \ 117 addq h, d /* d += T1 */ _SEP \
116 \ 118 \
117 movq a, tmp1; /* T2 Sigma0 */ \ 119 movq a, tmp1 /* T2 Sigma0 */ _SEP \
118 rorq $(39-34), tmp1; /* T2 Sigma0 */ \ 120 rorq $(39-34), tmp1 /* T2 Sigma0 */ _SEP \
119 xorq a, tmp1; /* T2 Sigma0 */ \ 121 xorq a, tmp1 /* T2 Sigma0 */ _SEP \
120 rorq $(34-28), tmp1; /* T2 Sigma0 */ \ 122 rorq $(34-28), tmp1 /* T2 Sigma0 */ _SEP \
121 xorq a, tmp1; /* T2 Sigma0 */ \ 123 xorq a, tmp1 /* T2 Sigma0 */ _SEP \
122 rorq $28, tmp1; /* T2 Sigma0 */ \ 124 rorq $28, tmp1 /* T2 Sigma0 */ _SEP \
123 addq tmp1, h; /* T2 Sigma0 */ \ 125 addq tmp1, h /* T2 Sigma0 */ _SEP \
124 \ 126 \
125 movq b, tmp2; /* T2 Maj */ \ 127 movq b, tmp2 /* T2 Maj */ _SEP \
126 xorq c, tmp2; /* T2 Maj */ \ 128 xorq c, tmp2 /* T2 Maj */ _SEP \
127 andq a, tmp2; /* T2 Maj */ \ 129 andq a, tmp2 /* T2 Maj */ _SEP \
128 movq b, tmp3; /* T2 Maj */ \ 130 movq b, tmp3 /* T2 Maj */ _SEP \
129 andq c, tmp3; /* T2 Maj */ \ 131 andq c, tmp3 /* T2 Maj */ _SEP \
130 xorq tmp2, tmp3; /* T2 Maj */ \ 132 xorq tmp2, tmp3 /* T2 Maj */ _SEP \
131 addq tmp3, h; /* T2 Maj */ \ 133 addq tmp3, h /* T2 Maj */ _SEP \
132 \ 134 \
133 addq $1, round 135 addq $1, round
134 136
135#define sha512_round_load(idx, a, b, c, d, e, f, g, h) \ 137#define sha512_round_load(idx, a, b, c, d, e, f, g, h) \
136 sha512_message_schedule_load(idx, in, %rsp, tmp0); \ 138 sha512_message_schedule_load(idx, in, %rsp, tmp0) _SEP \
137 sha512_round(idx, a, b, c, d, e, f, g, h, k512, %rsp, tmp0) 139 sha512_round(idx, a, b, c, d, e, f, g, h, k512, %rsp, tmp0)
138 140
139#define sha512_round_update(idx, a, b, c, d, e, f, g, h) \ 141#define sha512_round_update(idx, a, b, c, d, e, f, g, h) \
140 sha512_message_schedule_update(idx, %rsp, tmp0); \ 142 sha512_message_schedule_update(idx, %rsp, tmp0) _SEP \
141 sha512_round(idx, a, b, c, d, e, f, g, h, k512, %rsp, tmp0) 143 sha512_round(idx, a, b, c, d, e, f, g, h, k512, %rsp, tmp0)
142 144
143.section .text 145.section CRYPTO_ASSEMBLY_SECTION_TEXT
144 146
145/* 147/*
146 * void sha512_block_generic(SHA512_CTX *ctx, const void *in, size_t num); 148 * void sha512_block_generic(SHA512_CTX *ctx, const void *in, size_t num);
@@ -148,9 +150,7 @@
148 * Standard x86-64 ABI: rdi = ctx, rsi = in, rdx = num 150 * Standard x86-64 ABI: rdi = ctx, rsi = in, rdx = num
149 */ 151 */
150.align 16 152.align 16
151.globl sha512_block_generic 153CRYPTO_ASSEMBLY_GLOBAL_FUNCTION(sha512_block_generic):
152.type sha512_block_generic,@function
153sha512_block_generic:
154 _CET_ENDBR 154 _CET_ENDBR
155 155
156 /* Save callee save registers. */ 156 /* Save callee save registers. */
@@ -273,14 +273,13 @@ sha512_block_generic:
273 273
274 ret 274 ret
275 275
276.section .rodata 276.section CRYPTO_ASSEMBLY_SECTION_RODATA
277 277
278/* 278/*
279 * SHA-512 constants - see FIPS 180-4 section 4.2.3. 279 * SHA-512 constants - see FIPS 180-4 section 4.2.3.
280 */ 280 */
281.align 64 281.align 64
282.type K512,@object 282CRYPTO_ASSEMBLY_OBJECT_START(K512):
283K512:
284.quad 0x428a2f98d728ae22, 0x7137449123ef65cd, 0xb5c0fbcfec4d3b2f, 0xe9b5dba58189dbbc 283.quad 0x428a2f98d728ae22, 0x7137449123ef65cd, 0xb5c0fbcfec4d3b2f, 0xe9b5dba58189dbbc
285.quad 0x3956c25bf348b538, 0x59f111f1b605d019, 0x923f82a4af194f9b, 0xab1c5ed5da6d8118 284.quad 0x3956c25bf348b538, 0x59f111f1b605d019, 0x923f82a4af194f9b, 0xab1c5ed5da6d8118
286.quad 0xd807aa98a3030242, 0x12835b0145706fbe, 0x243185be4ee4b28c, 0x550c7dc3d5ffb4e2 285.quad 0xd807aa98a3030242, 0x12835b0145706fbe, 0x243185be4ee4b28c, 0x550c7dc3d5ffb4e2
@@ -301,4 +300,8 @@ K512:
301.quad 0x06f067aa72176fba, 0x0a637dc5a2c898a6, 0x113f9804bef90dae, 0x1b710b35131c471b 300.quad 0x06f067aa72176fba, 0x0a637dc5a2c898a6, 0x113f9804bef90dae, 0x1b710b35131c471b
302.quad 0x28db77f523047d84, 0x32caab7b40c72493, 0x3c9ebe0a15c9bebc, 0x431d67c49c100d4c 301.quad 0x28db77f523047d84, 0x32caab7b40c72493, 0x3c9ebe0a15c9bebc, 0x431d67c49c100d4c
303.quad 0x4cc5d4becb3e42b6, 0x597f299cfc657e2a, 0x5fcb6fab3ad6faec, 0x6c44198c4a475817 302.quad 0x4cc5d4becb3e42b6, 0x597f299cfc657e2a, 0x5fcb6fab3ad6faec, 0x6c44198c4a475817
304.size K512,.-K512 303CRYPTO_ASSEMBLY_OBJECT_END(K512)
304
305#if defined(__linux__) && defined(__ELF__)
306.section .note.GNU-stack,"",%progbits
307#endif
diff --git a/src/lib/libcrypto/ui/ui_lib.c b/src/lib/libcrypto/ui/ui_lib.c
index cc9de59c19..4562464cc7 100644
--- a/src/lib/libcrypto/ui/ui_lib.c
+++ b/src/lib/libcrypto/ui/ui_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ui_lib.c,v 1.52 2025/05/10 05:54:39 tb Exp $ */ 1/* $OpenBSD: ui_lib.c,v 1.55 2026/07/25 07:33:43 tb Exp $ */
2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL 2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
3 * project 2001. 3 * project 2001.
4 */ 4 */
@@ -68,6 +68,39 @@
68 68
69static const UI_METHOD *default_UI_meth = NULL; 69static const UI_METHOD *default_UI_meth = NULL;
70 70
71struct ui_string_st {
72 enum UI_string_types type; /* Input */
73 const char *out_string; /* Input */
74 int input_flags; /* Flags from the user */
75
76 /* The following parameters are completely irrelevant for UIT_INFO,
77 and can therefore be set to 0 or NULL */
78 char *result_buf; /* Input and Output: If not NULL, user-defined
79 with size in result_maxsize. Otherwise, it
80 may be allocated by the UI routine, meaning
81 result_minsize is going to be overwritten.*/
82 union {
83 struct {
84 int result_minsize; /* Input: minimum required
85 size of the result.
86 */
87 int result_maxsize; /* Input: maximum permitted
88 size of the result */
89
90 const char *test_buf; /* Input: test string to verify
91 against */
92 } string_data;
93 struct {
94 const char *action_desc; /* Input */
95 const char *ok_chars; /* Input */
96 const char *cancel_chars; /* Input */
97 } boolean_data;
98 } u;
99
100#define OUT_STRING_FREEABLE 0x01
101 int flags; /* flags for internal use */
102};
103
71UI * 104UI *
72UI_new(void) 105UI_new(void)
73{ 106{
@@ -101,9 +134,9 @@ free_string(UI_STRING *uis)
101 free((char *) uis->out_string); 134 free((char *) uis->out_string);
102 switch (uis->type) { 135 switch (uis->type) {
103 case UIT_BOOLEAN: 136 case UIT_BOOLEAN:
104 free((char *)uis->_.boolean_data.action_desc); 137 free((char *)uis->u.boolean_data.action_desc);
105 free((char *)uis->_.boolean_data.ok_chars); 138 free((char *)uis->u.boolean_data.ok_chars);
106 free((char *)uis->_.boolean_data.cancel_chars); 139 free((char *)uis->u.boolean_data.cancel_chars);
107 break; 140 break;
108 default: 141 default:
109 break; 142 break;
@@ -186,9 +219,9 @@ general_allocate_string(UI *ui, const char *prompt, int dup_prompt,
186 if ((s = general_allocate_prompt(prompt, dup_prompt, type, input_flags, 219 if ((s = general_allocate_prompt(prompt, dup_prompt, type, input_flags,
187 result_buf)) == NULL) 220 result_buf)) == NULL)
188 goto err; 221 goto err;
189 s->_.string_data.result_minsize = minsize; 222 s->u.string_data.result_minsize = minsize;
190 s->_.string_data.result_maxsize = maxsize; 223 s->u.string_data.result_maxsize = maxsize;
191 s->_.string_data.test_buf = test_buf; 224 s->u.string_data.test_buf = test_buf;
192 225
193 if (allocate_string_stack(ui) < 0) 226 if (allocate_string_stack(ui) < 0)
194 goto err; 227 goto err;
@@ -225,25 +258,25 @@ general_allocate_boolean(UI *ui, const char *prompt, const char *action_desc,
225 258
226 if (dup_strings) { 259 if (dup_strings) {
227 if (action_desc != NULL) { 260 if (action_desc != NULL) {
228 if ((s->_.boolean_data.action_desc = 261 if ((s->u.boolean_data.action_desc =
229 strdup(action_desc)) == NULL) { 262 strdup(action_desc)) == NULL) {
230 UIerror(ERR_R_MALLOC_FAILURE); 263 UIerror(ERR_R_MALLOC_FAILURE);
231 goto err; 264 goto err;
232 } 265 }
233 } 266 }
234 if ((s->_.boolean_data.ok_chars = strdup(ok_chars)) == NULL) { 267 if ((s->u.boolean_data.ok_chars = strdup(ok_chars)) == NULL) {
235 UIerror(ERR_R_MALLOC_FAILURE); 268 UIerror(ERR_R_MALLOC_FAILURE);
236 goto err; 269 goto err;
237 } 270 }
238 if ((s->_.boolean_data.cancel_chars = strdup(cancel_chars)) == 271 if ((s->u.boolean_data.cancel_chars = strdup(cancel_chars)) ==
239 NULL) { 272 NULL) {
240 UIerror(ERR_R_MALLOC_FAILURE); 273 UIerror(ERR_R_MALLOC_FAILURE);
241 goto err; 274 goto err;
242 } 275 }
243 } else { 276 } else {
244 s->_.boolean_data.action_desc = action_desc; 277 s->u.boolean_data.action_desc = action_desc;
245 s->_.boolean_data.ok_chars = ok_chars; 278 s->u.boolean_data.ok_chars = ok_chars;
246 s->_.boolean_data.cancel_chars = cancel_chars; 279 s->u.boolean_data.cancel_chars = cancel_chars;
247 } 280 }
248 281
249 if (allocate_string_stack(ui) < 0) 282 if (allocate_string_stack(ui) < 0)
@@ -428,8 +461,10 @@ UI_process(UI *ui)
428{ 461{
429 int i, ok = 0; 462 int i, ok = 0;
430 463
431 if (ui->meth->ui_open_session && !ui->meth->ui_open_session(ui)) 464 if (ui->meth->ui_open_session && !ui->meth->ui_open_session(ui)) {
432 return -1; 465 ok = -1;
466 goto err;
467 }
433 468
434 if (ui->flags & UI_FLAG_PRINT_ERRORS) 469 if (ui->flags & UI_FLAG_PRINT_ERRORS)
435 ERR_print_errors_cb(print_error, ui); 470 ERR_print_errors_cb(print_error, ui);
@@ -772,7 +807,7 @@ UI_get0_action_string(UI_STRING *uis)
772 switch (uis->type) { 807 switch (uis->type) {
773 case UIT_PROMPT: 808 case UIT_PROMPT:
774 case UIT_BOOLEAN: 809 case UIT_BOOLEAN:
775 return uis->_.boolean_data.action_desc; 810 return uis->u.boolean_data.action_desc;
776 default: 811 default:
777 return NULL; 812 return NULL;
778 } 813 }
@@ -803,7 +838,7 @@ UI_get0_test_string(UI_STRING *uis)
803 838
804 switch (uis->type) { 839 switch (uis->type) {
805 case UIT_VERIFY: 840 case UIT_VERIFY:
806 return uis->_.string_data.test_buf; 841 return uis->u.string_data.test_buf;
807 default: 842 default:
808 return NULL; 843 return NULL;
809 } 844 }
@@ -819,7 +854,7 @@ UI_get_result_minsize(UI_STRING *uis)
819 switch (uis->type) { 854 switch (uis->type) {
820 case UIT_PROMPT: 855 case UIT_PROMPT:
821 case UIT_VERIFY: 856 case UIT_VERIFY:
822 return uis->_.string_data.result_minsize; 857 return uis->u.string_data.result_minsize;
823 default: 858 default:
824 return -1; 859 return -1;
825 } 860 }
@@ -835,7 +870,7 @@ UI_get_result_maxsize(UI_STRING *uis)
835 switch (uis->type) { 870 switch (uis->type) {
836 case UIT_PROMPT: 871 case UIT_PROMPT:
837 case UIT_VERIFY: 872 case UIT_VERIFY:
838 return uis->_.string_data.result_maxsize; 873 return uis->u.string_data.result_maxsize;
839 default: 874 default:
840 return -1; 875 return -1;
841 } 876 }
@@ -856,22 +891,22 @@ UI_set_result(UI *ui, UI_STRING *uis, const char *result)
856 switch (uis->type) { 891 switch (uis->type) {
857 case UIT_PROMPT: 892 case UIT_PROMPT:
858 case UIT_VERIFY: 893 case UIT_VERIFY:
859 if (l < uis->_.string_data.result_minsize) { 894 if (l < uis->u.string_data.result_minsize) {
860 ui->flags |= UI_FLAG_REDOABLE; 895 ui->flags |= UI_FLAG_REDOABLE;
861 UIerror(UI_R_RESULT_TOO_SMALL); 896 UIerror(UI_R_RESULT_TOO_SMALL);
862 ERR_asprintf_error_data 897 ERR_asprintf_error_data
863 ("You must type in %d to %d characters", 898 ("You must type in %d to %d characters",
864 uis->_.string_data.result_minsize, 899 uis->u.string_data.result_minsize,
865 uis->_.string_data.result_maxsize); 900 uis->u.string_data.result_maxsize);
866 return -1; 901 return -1;
867 } 902 }
868 if (l > uis->_.string_data.result_maxsize) { 903 if (l > uis->u.string_data.result_maxsize) {
869 ui->flags |= UI_FLAG_REDOABLE; 904 ui->flags |= UI_FLAG_REDOABLE;
870 UIerror(UI_R_RESULT_TOO_LARGE); 905 UIerror(UI_R_RESULT_TOO_LARGE);
871 ERR_asprintf_error_data 906 ERR_asprintf_error_data
872 ("You must type in %d to %d characters", 907 ("You must type in %d to %d characters",
873 uis->_.string_data.result_minsize, 908 uis->u.string_data.result_minsize,
874 uis->_.string_data.result_maxsize); 909 uis->u.string_data.result_maxsize);
875 return -1; 910 return -1;
876 } 911 }
877 if (!uis->result_buf) { 912 if (!uis->result_buf) {
@@ -879,7 +914,7 @@ UI_set_result(UI *ui, UI_STRING *uis, const char *result)
879 return -1; 914 return -1;
880 } 915 }
881 strlcpy(uis->result_buf, result, 916 strlcpy(uis->result_buf, result,
882 uis->_.string_data.result_maxsize + 1); 917 uis->u.string_data.result_maxsize + 1);
883 break; 918 break;
884 case UIT_BOOLEAN: 919 case UIT_BOOLEAN:
885 if (!uis->result_buf) { 920 if (!uis->result_buf) {
@@ -888,14 +923,14 @@ UI_set_result(UI *ui, UI_STRING *uis, const char *result)
888 } 923 }
889 uis->result_buf[0] = '\0'; 924 uis->result_buf[0] = '\0';
890 for (p = result; *p; p++) { 925 for (p = result; *p; p++) {
891 if (strchr(uis->_.boolean_data.ok_chars, *p)) { 926 if (strchr(uis->u.boolean_data.ok_chars, *p)) {
892 uis->result_buf[0] = 927 uis->result_buf[0] =
893 uis->_.boolean_data.ok_chars[0]; 928 uis->u.boolean_data.ok_chars[0];
894 break; 929 break;
895 } 930 }
896 if (strchr(uis->_.boolean_data.cancel_chars, *p)) { 931 if (strchr(uis->u.boolean_data.cancel_chars, *p)) {
897 uis->result_buf[0] = 932 uis->result_buf[0] =
898 uis->_.boolean_data.cancel_chars[0]; 933 uis->u.boolean_data.cancel_chars[0];
899 break; 934 break;
900 } 935 }
901 } 936 }
diff --git a/src/lib/libcrypto/ui/ui_local.h b/src/lib/libcrypto/ui/ui_local.h
index 460b5600bd..f16ea34b29 100644
--- a/src/lib/libcrypto/ui/ui_local.h
+++ b/src/lib/libcrypto/ui/ui_local.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ui_local.h,v 1.2 2022/11/26 17:23:18 tb Exp $ */ 1/* $OpenBSD: ui_local.h,v 1.4 2026/05/19 10:44:42 jsg Exp $ */
2 2
3/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL 3/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
4 * project 2001. 4 * project 2001.
@@ -65,10 +65,6 @@
65 65
66__BEGIN_HIDDEN_DECLS 66__BEGIN_HIDDEN_DECLS
67 67
68#ifdef _
69#undef _
70#endif
71
72struct ui_method_st { 68struct ui_method_st {
73 char *name; 69 char *name;
74 70
@@ -101,39 +97,6 @@ struct ui_method_st {
101 const char *object_name); 97 const char *object_name);
102}; 98};
103 99
104struct ui_string_st {
105 enum UI_string_types type; /* Input */
106 const char *out_string; /* Input */
107 int input_flags; /* Flags from the user */
108
109 /* The following parameters are completely irrelevant for UIT_INFO,
110 and can therefore be set to 0 or NULL */
111 char *result_buf; /* Input and Output: If not NULL, user-defined
112 with size in result_maxsize. Otherwise, it
113 may be allocated by the UI routine, meaning
114 result_minsize is going to be overwritten.*/
115 union {
116 struct {
117 int result_minsize; /* Input: minimum required
118 size of the result.
119 */
120 int result_maxsize; /* Input: maximum permitted
121 size of the result */
122
123 const char *test_buf; /* Input: test string to verify
124 against */
125 } string_data;
126 struct {
127 const char *action_desc; /* Input */
128 const char *ok_chars; /* Input */
129 const char *cancel_chars; /* Input */
130 } boolean_data;
131 } _;
132
133#define OUT_STRING_FREEABLE 0x01
134 int flags; /* flags for internal use */
135};
136
137struct ui_st { 100struct ui_st {
138 const UI_METHOD *meth; 101 const UI_METHOD *meth;
139 STACK_OF(UI_STRING) *strings; /* We might want to prompt for more 102 STACK_OF(UI_STRING) *strings; /* We might want to prompt for more
diff --git a/src/lib/libcrypto/x509/x509_addr.c b/src/lib/libcrypto/x509/x509_addr.c
index b4ee92a14b..c48a0ab118 100644
--- a/src/lib/libcrypto/x509/x509_addr.c
+++ b/src/lib/libcrypto/x509/x509_addr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_addr.c,v 1.94 2025/05/10 05:54:39 tb Exp $ */ 1/* $OpenBSD: x509_addr.c,v 1.96 2026/05/18 04:24:01 tb Exp $ */
2/* 2/*
3 * Contributed to the OpenSSL Project by the American Registry for 3 * Contributed to the OpenSSL Project by the American Registry for
4 * Internet Numbers ("ARIN"). 4 * Internet Numbers ("ARIN").
@@ -504,10 +504,10 @@ IPAddressFamily_cmp(const IPAddressFamily *const *a_,
504 const ASN1_OCTET_STRING *b = (*b_)->addressFamily; 504 const ASN1_OCTET_STRING *b = (*b_)->addressFamily;
505 int len, cmp; 505 int len, cmp;
506 506
507 len = MINIMUM(a->length, b->length); 507 if ((len = MINIMUM(a->length, b->length)) != 0) {
508 508 if ((cmp = memcmp(a->data, b->data, len)) != 0)
509 if ((cmp = memcmp(a->data, b->data, len)) != 0) 509 return cmp;
510 return cmp; 510 }
511 511
512 return a->length - b->length; 512 return a->length - b->length;
513} 513}
@@ -961,18 +961,22 @@ trim_end_u8(CBS *cbs, uint8_t trim)
961 * RFC 3779, 2.1.2. 961 * RFC 3779, 2.1.2.
962 */ 962 */
963static int 963static int
964make_addressRange(IPAddressOrRange **out_aor, uint8_t *min, uint8_t *max, 964make_addressRange(IPAddressOrRange **out_aor, uint8_t *min, uint8_t *in_max,
965 uint32_t afi, int length) 965 uint32_t afi, int length)
966{ 966{
967 IPAddressOrRange *aor = NULL; 967 IPAddressOrRange *aor = NULL;
968 IPAddressRange *range; 968 IPAddressRange *range;
969 int prefix_len; 969 int prefix_len;
970 CBS cbs; 970 CBS cbs;
971 CBB cbb;
972 uint8_t max[ADDR_RAW_BUF_LEN];
971 size_t max_len, min_len; 973 size_t max_len, min_len;
972 uint8_t unused_bits_min, unused_bits_max; 974 uint8_t unused_bits_min, unused_bits_max;
973 uint8_t octet; 975 uint8_t octet;
974 976
975 if (memcmp(min, max, length) > 0) 977 memset(&cbb, 0, sizeof(cbb));
978
979 if (memcmp(min, in_max, length) > 0)
976 goto err; 980 goto err;
977 981
978 /* 982 /*
@@ -980,7 +984,7 @@ make_addressRange(IPAddressOrRange **out_aor, uint8_t *min, uint8_t *max,
980 * must be encoded as a prefix. 984 * must be encoded as a prefix.
981 */ 985 */
982 986
983 if ((prefix_len = range_should_be_prefix(min, max, length)) >= 0) 987 if ((prefix_len = range_should_be_prefix(min, in_max, length)) >= 0)
984 return make_addressPrefix(out_aor, min, afi, prefix_len); 988 return make_addressPrefix(out_aor, min, afi, prefix_len);
985 989
986 /* 990 /*
@@ -1008,19 +1012,31 @@ make_addressRange(IPAddressOrRange **out_aor, uint8_t *min, uint8_t *max,
1008 * the trailing ones of the last octet. 1012 * the trailing ones of the last octet.
1009 */ 1013 */
1010 1014
1011 CBS_init(&cbs, max, length); 1015 CBS_init(&cbs, in_max, length);
1016 if (!CBB_init_fixed(&cbb, max, sizeof(max)))
1017 goto err;
1012 1018
1013 if (!trim_end_u8(&cbs, 0xff)) 1019 if (!trim_end_u8(&cbs, 0xff))
1014 goto err; 1020 goto err;
1015 1021
1016 unused_bits_max = 0; 1022 unused_bits_max = 0;
1017 if ((max_len = CBS_len(&cbs)) > 0) { 1023 if ((max_len = CBS_len(&cbs)) > 0) {
1018 if (!CBS_peek_last_u8(&cbs, &octet)) 1024 if (!CBS_get_last_u8(&cbs, &octet))
1019 goto err; 1025 goto err;
1020 1026
1021 unused_bits_max = count_trailing_zeroes(octet + 1); 1027 unused_bits_max = count_trailing_zeroes(octet + 1);
1028 octet &= 0xff << unused_bits_max;
1022 } 1029 }
1023 1030
1031 if (!CBB_add_bytes(&cbb, CBS_data(&cbs), CBS_len(&cbs)))
1032 goto err;
1033 if (max_len > 0) {
1034 if (!CBB_add_u8(&cbb, octet))
1035 goto err;
1036 }
1037 if (!CBB_finish(&cbb, NULL, NULL))
1038 goto err;
1039
1024 /* 1040 /*
1025 * Populate IPAddressOrRange. 1041 * Populate IPAddressOrRange.
1026 */ 1042 */
@@ -1048,6 +1064,7 @@ make_addressRange(IPAddressOrRange **out_aor, uint8_t *min, uint8_t *max,
1048 return 1; 1064 return 1;
1049 1065
1050 err: 1066 err:
1067 CBB_cleanup(&cbb);
1051 IPAddressOrRange_free(aor); 1068 IPAddressOrRange_free(aor);
1052 return 0; 1069 return 0;
1053} 1070}
diff --git a/src/lib/libcrypto/x509/x509_constraints.c b/src/lib/libcrypto/x509/x509_constraints.c
index c4f32c9cfc..be93f3fd6c 100644
--- a/src/lib/libcrypto/x509/x509_constraints.c
+++ b/src/lib/libcrypto/x509/x509_constraints.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_constraints.c,v 1.33 2026/04/13 17:04:23 beck Exp $ */ 1/* $OpenBSD: x509_constraints.c,v 1.35 2026/07/31 03:59:50 kenjiro Exp $ */
2/* 2/*
3 * Copyright (c) 2020 Bob Beck <beck@openbsd.org> 3 * Copyright (c) 2020 Bob Beck <beck@openbsd.org>
4 * 4 *
@@ -38,26 +38,45 @@
38#define MAX_IP_ADDRESS_LENGTH (size_t)46 38#define MAX_IP_ADDRESS_LENGTH (size_t)46
39 39
40static int 40static int
41cbs_is_ip_address(CBS *cbs, int *is_ip) 41host_is_ip_address(CBS *cbs, int *is_ip)
42{ 42{
43 struct sockaddr_in6 sin6; 43 struct sockaddr_in6 sin6;
44 struct sockaddr_in sin4; 44 struct sockaddr_in sin4;
45 uint8_t first, last;
45 char *name = NULL; 46 char *name = NULL;
47 CBS ipv6_cbs;
46 48
47 *is_ip = 0; 49 *is_ip = 0;
50
48 if (CBS_len(cbs) > MAX_IP_ADDRESS_LENGTH) 51 if (CBS_len(cbs) > MAX_IP_ADDRESS_LENGTH)
49 return 1; 52 return 1;
53
54 /* Must be an IPv6 literal. */
55 CBS_dup(cbs, &ipv6_cbs);
56 if (!CBS_get_u8(&ipv6_cbs, &first))
57 return 1;
58 if (!CBS_get_last_u8(&ipv6_cbs, &last))
59 return 1;
60 if (first == '[' && last == ']') {
61 if (!CBS_strdup(&ipv6_cbs, &name))
62 return 0;
63 if (inet_pton(AF_INET6, name, &sin6) == 1)
64 *is_ip = 1;
65 goto done;
66 }
67
68 /* Or an IPv4 address. */
50 if (!CBS_strdup(cbs, &name)) 69 if (!CBS_strdup(cbs, &name))
51 return 0; 70 return 0;
52 if (inet_pton(AF_INET, name, &sin4) == 1 || 71 if (inet_pton(AF_INET, name, &sin4) == 1)
53 inet_pton(AF_INET6, name, &sin6) == 1)
54 *is_ip = 1; 72 *is_ip = 1;
55 73
74 done:
56 free(name); 75 free(name);
57 return 1; 76 return 1;
58} 77}
59 78
60struct x509_constraints_name * 79static struct x509_constraints_name *
61x509_constraints_name_new(void) 80x509_constraints_name_new(void)
62{ 81{
63 return (calloc(1, sizeof(struct x509_constraints_name))); 82 return (calloc(1, sizeof(struct x509_constraints_name)));
@@ -81,7 +100,7 @@ x509_constraints_name_free(struct x509_constraints_name *name)
81 free(name); 100 free(name);
82} 101}
83 102
84struct x509_constraints_name * 103static struct x509_constraints_name *
85x509_constraints_name_dup(struct x509_constraints_name *name) 104x509_constraints_name_dup(struct x509_constraints_name *name)
86{ 105{
87 struct x509_constraints_name *new; 106 struct x509_constraints_name *new;
@@ -273,13 +292,13 @@ x509_constraints_valid_host(CBS *cbs, int permit_ip)
273 return 0; 292 return 0;
274 if (first == '.') 293 if (first == '.')
275 return 0; /* leading . not allowed in a host name or IP */ 294 return 0; /* leading . not allowed in a host name or IP */
276 if (!permit_ip) { 295 if (!host_is_ip_address(cbs, &is_ip))
277 if (!cbs_is_ip_address(cbs, &is_ip)) 296 return 0;
278 return 0; 297 if (is_ip) {
279 if (is_ip) 298 if (permit_ip)
280 return 0; 299 return 1;
300 return 0;
281 } 301 }
282
283 return x509_constraints_valid_domain_internal(cbs, 0); 302 return x509_constraints_valid_domain_internal(cbs, 0);
284} 303}
285 304
@@ -508,10 +527,11 @@ x509_constraints_valid_domain_constraint(CBS *cbs)
508int 527int
509x509_constraints_uri_host(uint8_t *uri, size_t len, char **hostpart) 528x509_constraints_uri_host(uint8_t *uri, size_t len, char **hostpart)
510{ 529{
511 size_t i, hostlen = 0;
512 uint8_t *authority = NULL; 530 uint8_t *authority = NULL;
513 char *host = NULL; 531 uint8_t *host = NULL;
532 size_t hostlen = 0;
514 CBS host_cbs; 533 CBS host_cbs;
534 size_t i;
515 535
516 /* 536 /*
517 * Find first '//'. there must be at least a '//' and 537 * Find first '//'. there must be at least a '//' and
@@ -542,31 +562,55 @@ x509_constraints_uri_host(uint8_t *uri, size_t len, char **hostpart)
542 for (i = authority - uri; i < len; i++) { 562 for (i = authority - uri; i < len; i++) {
543 if (!isascii(uri[i])) 563 if (!isascii(uri[i]))
544 return 0; 564 return 0;
545 /* it has a userinfo part */ 565 /*
546 if (uri[i] == '@') { 566 * Per RFC 3986 section 3.2, authority is terminated
547 hostlen = 0; 567 * by a slash (/), question mark (?), hash (#) or by
548 /* it can only have one */ 568 * the end of the URI.
549 if (host != NULL) 569 */
550 break; 570 if (uri[i] == '/' || uri[i] == '?' || uri[i] == '#')
551 /* start after the userinfo part */
552 host = uri + i + 1;
553 continue;
554 }
555 /* did we find the end? */
556 if (uri[i] == ':' || uri[i] == '/' || uri[i] == '?' ||
557 uri[i] == '#')
558 break; 571 break;
572
559 hostlen++; 573 hostlen++;
560 } 574 }
575
576 host = authority;
577
578 /* Remove any leading userinfo part. */
579 for (i = 0; i < hostlen; i++) {
580 if (authority[i] != '@')
581 continue;
582
583 /* Only one at-sign (@) is permitted. */
584 if (host != authority)
585 return 0;
586
587 /* Start after the userinfo part. */
588 host = authority + i + 1;
589 }
590 hostlen = hostlen - (host - authority);
591
592 if (hostlen == 0)
593 return 0;
594
595 /* Remove any port part, respecting IPv6 literals. */
596 for (i = hostlen - 1; i > 0; i--) {
597 if (host[i] == ']')
598 break;
599 if (host[i] == ':') {
600 hostlen = i;
601 break;
602 }
603 }
604
561 if (hostlen == 0) 605 if (hostlen == 0)
562 return 0; 606 return 0;
563 if (host == NULL) 607
564 host = authority;
565 CBS_init(&host_cbs, host, hostlen); 608 CBS_init(&host_cbs, host, hostlen);
566 if (!x509_constraints_valid_host(&host_cbs, 1)) 609 if (!x509_constraints_valid_host(&host_cbs, 1))
567 return 0; 610 return 0;
568 if (hostpart != NULL && !CBS_strdup(&host_cbs, hostpart)) 611 if (hostpart != NULL && !CBS_strdup(&host_cbs, hostpart))
569 return 0; 612 return 0;
613
570 return 1; 614 return 1;
571} 615}
572 616
@@ -647,8 +691,7 @@ x509_constraints_domain(char *domain, size_t dlen, char *constraint, size_t len)
647 691
648int 692int
649x509_constraints_uri(uint8_t *uri, size_t ulen, uint8_t *constraint, 693x509_constraints_uri(uint8_t *uri, size_t ulen, uint8_t *constraint,
650 size_t len, 694 size_t len, int *error)
651 int *error)
652{ 695{
653 int ret = 0; 696 int ret = 0;
654 char *hostpart = NULL; 697 char *hostpart = NULL;
@@ -681,7 +724,7 @@ x509_constraints_uri(uint8_t *uri, size_t ulen, uint8_t *constraint,
681 * respectively for ipv4 addresses and constraints, and a length of 724 * respectively for ipv4 addresses and constraints, and a length of
682 * 16 and 32 respectively for ipv6 address constraints by the caller. 725 * 16 and 32 respectively for ipv6 address constraints by the caller.
683 */ 726 */
684int 727static int
685x509_constraints_ipaddr(uint8_t *address, size_t alen, uint8_t *constraint, 728x509_constraints_ipaddr(uint8_t *address, size_t alen, uint8_t *constraint,
686 size_t len) 729 size_t len)
687{ 730{
@@ -703,7 +746,7 @@ x509_constraints_ipaddr(uint8_t *address, size_t alen, uint8_t *constraint,
703 * Verify a canonicalized der encoded constraint dirname 746 * Verify a canonicalized der encoded constraint dirname
704 * a canonicalized der encoded constraint. 747 * a canonicalized der encoded constraint.
705 */ 748 */
706int 749static int
707x509_constraints_dirname(uint8_t *dirname, size_t dlen, 750x509_constraints_dirname(uint8_t *dirname, size_t dlen,
708 uint8_t *constraint, size_t len) 751 uint8_t *constraint, size_t len)
709{ 752{
@@ -1151,7 +1194,7 @@ x509_constraints_extract_constraints(X509 *cert,
1151 * Match a validated name in "name" against a validated constraint in 1194 * Match a validated name in "name" against a validated constraint in
1152 * "constraint" return 1 if then name matches, 0 otherwise. 1195 * "constraint" return 1 if then name matches, 0 otherwise.
1153 */ 1196 */
1154int 1197static int
1155x509_constraints_match(struct x509_constraints_name *name, 1198x509_constraints_match(struct x509_constraints_name *name,
1156 struct x509_constraints_name *constraint) 1199 struct x509_constraints_name *constraint)
1157{ 1200{
diff --git a/src/lib/libcrypto/x509/x509_ia5.c b/src/lib/libcrypto/x509/x509_ia5.c
index b8886c6cb8..712ce5c702 100644
--- a/src/lib/libcrypto/x509/x509_ia5.c
+++ b/src/lib/libcrypto/x509/x509_ia5.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_ia5.c,v 1.3 2025/05/10 05:54:39 tb Exp $ */ 1/* $OpenBSD: x509_ia5.c,v 1.4 2026/07/31 00:50:52 kenjiro 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 */
@@ -64,6 +64,7 @@
64#include <openssl/x509v3.h> 64#include <openssl/x509v3.h>
65 65
66#include "err_local.h" 66#include "err_local.h"
67#include "x509_local.h"
67 68
68static char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5); 69static char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5);
69static ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, 70static ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method,
diff --git a/src/lib/libcrypto/x509/x509_info.c b/src/lib/libcrypto/x509/x509_info.c
index c91642a02e..4b2ee10d28 100644
--- a/src/lib/libcrypto/x509/x509_info.c
+++ b/src/lib/libcrypto/x509/x509_info.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_info.c,v 1.6 2025/05/10 05:54:39 tb Exp $ */ 1/* $OpenBSD: x509_info.c,v 1.7 2026/07/31 00:50:52 kenjiro 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 */
@@ -65,6 +65,7 @@
65#include <openssl/x509v3.h> 65#include <openssl/x509v3.h>
66 66
67#include "err_local.h" 67#include "err_local.h"
68#include "x509_local.h"
68 69
69static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_INFO_ACCESS( 70static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_INFO_ACCESS(
70 X509V3_EXT_METHOD *method, AUTHORITY_INFO_ACCESS *ainfo, 71 X509V3_EXT_METHOD *method, AUTHORITY_INFO_ACCESS *ainfo,
diff --git a/src/lib/libcrypto/x509/x509_int.c b/src/lib/libcrypto/x509/x509_int.c
index 2236bfe4c4..76979f79b0 100644
--- a/src/lib/libcrypto/x509/x509_int.c
+++ b/src/lib/libcrypto/x509/x509_int.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_int.c,v 1.2 2024/07/13 15:08:58 tb Exp $ */ 1/* $OpenBSD: x509_int.c,v 1.3 2026/07/31 00:50:52 kenjiro 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 */
@@ -60,6 +60,8 @@
60 60
61#include <openssl/x509v3.h> 61#include <openssl/x509v3.h>
62 62
63#include "x509_local.h"
64
63static const X509V3_EXT_METHOD x509v3_ext_crl_number = { 65static const X509V3_EXT_METHOD x509v3_ext_crl_number = {
64 .ext_nid = NID_crl_number, 66 .ext_nid = NID_crl_number,
65 .ext_flags = 0, 67 .ext_flags = 0,
diff --git a/src/lib/libcrypto/x509/x509_lib.c b/src/lib/libcrypto/x509/x509_lib.c
index 0285ac0d3a..ca9f1550bf 100644
--- a/src/lib/libcrypto/x509/x509_lib.c
+++ b/src/lib/libcrypto/x509/x509_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_lib.c,v 1.25 2025/05/10 05:54:39 tb Exp $ */ 1/* $OpenBSD: x509_lib.c,v 1.26 2026/08/07 23:58:20 kenjiro 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 */
@@ -108,6 +108,8 @@ X509V3_EXT_get_nid(int nid)
108 return x509v3_ext_method_id_pkix_OCSP_acceptableResponses(); 108 return x509v3_ext_method_id_pkix_OCSP_acceptableResponses();
109 case NID_id_pkix_OCSP_archiveCutoff: 109 case NID_id_pkix_OCSP_archiveCutoff:
110 return x509v3_ext_method_id_pkix_OCSP_archiveCutoff(); 110 return x509v3_ext_method_id_pkix_OCSP_archiveCutoff();
111 case NID_id_pkix_OCSP_noCheck:
112 return x509v3_ext_method_id_pkix_OCSP_noCheck();
111 case NID_id_pkix_OCSP_serviceLocator: 113 case NID_id_pkix_OCSP_serviceLocator:
112 return x509v3_ext_method_id_pkix_OCSP_serviceLocator(); 114 return x509v3_ext_method_id_pkix_OCSP_serviceLocator();
113#endif 115#endif
diff --git a/src/lib/libcrypto/x509/x509_local.h b/src/lib/libcrypto/x509/x509_local.h
index 5b9c1e51f7..e46052b382 100644
--- a/src/lib/libcrypto/x509/x509_local.h
+++ b/src/lib/libcrypto/x509/x509_local.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_local.h,v 1.39 2025/10/10 11:31:13 tb Exp $ */ 1/* $OpenBSD: x509_local.h,v 1.40 2026/08/07 23:58:20 kenjiro 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 2013. 3 * project 2013.
4 */ 4 */
@@ -472,6 +472,7 @@ const X509V3_EXT_METHOD *x509v3_ext_method_id_pkix_OCSP_CrlID(void);
472const X509V3_EXT_METHOD *x509v3_ext_method_id_pkix_OCSP_Nonce(void); 472const X509V3_EXT_METHOD *x509v3_ext_method_id_pkix_OCSP_Nonce(void);
473const X509V3_EXT_METHOD *x509v3_ext_method_id_pkix_OCSP_acceptableResponses(void); 473const X509V3_EXT_METHOD *x509v3_ext_method_id_pkix_OCSP_acceptableResponses(void);
474const X509V3_EXT_METHOD *x509v3_ext_method_id_pkix_OCSP_archiveCutoff(void); 474const X509V3_EXT_METHOD *x509v3_ext_method_id_pkix_OCSP_archiveCutoff(void);
475const X509V3_EXT_METHOD *x509v3_ext_method_id_pkix_OCSP_noCheck(void);
475const X509V3_EXT_METHOD *x509v3_ext_method_id_pkix_OCSP_serviceLocator(void); 476const X509V3_EXT_METHOD *x509v3_ext_method_id_pkix_OCSP_serviceLocator(void);
476const X509V3_EXT_METHOD *x509v3_ext_method_info_access(void); 477const X509V3_EXT_METHOD *x509v3_ext_method_info_access(void);
477const X509V3_EXT_METHOD *x509v3_ext_method_inhibit_any_policy(void); 478const X509V3_EXT_METHOD *x509v3_ext_method_inhibit_any_policy(void);
diff --git a/src/lib/libcrypto/x509/x509_ocsp.c b/src/lib/libcrypto/x509/x509_ocsp.c
index d0a0d49890..54a04ea8fa 100644
--- a/src/lib/libcrypto/x509/x509_ocsp.c
+++ b/src/lib/libcrypto/x509/x509_ocsp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_ocsp.c,v 1.5 2025/05/10 05:54:39 tb Exp $ */ 1/* $OpenBSD: x509_ocsp.c,v 1.6 2026/07/31 00:50:52 kenjiro 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 */
@@ -70,6 +70,7 @@
70 70
71#include "err_local.h" 71#include "err_local.h"
72#include "ocsp_local.h" 72#include "ocsp_local.h"
73#include "x509_local.h"
73 74
74/* OCSP extensions and a couple of CRL entry extensions 75/* OCSP extensions and a couple of CRL entry extensions
75 */ 76 */
diff --git a/src/lib/libcrypto/x509/x509_pku.c b/src/lib/libcrypto/x509/x509_pku.c
index 6753f0f733..75cf5e6763 100644
--- a/src/lib/libcrypto/x509/x509_pku.c
+++ b/src/lib/libcrypto/x509/x509_pku.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_pku.c,v 1.5 2024/07/13 15:08:58 tb Exp $ */ 1/* $OpenBSD: x509_pku.c,v 1.6 2026/07/31 00:50:52 kenjiro 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,6 +62,8 @@
62#include <openssl/asn1t.h> 62#include <openssl/asn1t.h>
63#include <openssl/x509v3.h> 63#include <openssl/x509v3.h>
64 64
65#include "x509_local.h"
66
65static int i2r_PKEY_USAGE_PERIOD(X509V3_EXT_METHOD *method, 67static int i2r_PKEY_USAGE_PERIOD(X509V3_EXT_METHOD *method,
66 PKEY_USAGE_PERIOD *usage, BIO *out, int indent); 68 PKEY_USAGE_PERIOD *usage, BIO *out, int indent);
67 69
diff --git a/src/lib/libcrypto/x509/x509_policy.c b/src/lib/libcrypto/x509/x509_policy.c
index 2df965aad1..addd4b29ef 100644
--- a/src/lib/libcrypto/x509/x509_policy.c
+++ b/src/lib/libcrypto/x509/x509_policy.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_policy.c,v 1.33 2025/08/10 06:36:45 beck Exp $ */ 1/* $OpenBSD: x509_policy.c,v 1.34 2026/07/31 03:59:50 kenjiro Exp $ */
2/* 2/*
3 * Copyright (c) 2022, Google Inc. 3 * Copyright (c) 2022, Google Inc.
4 * 4 *
@@ -158,7 +158,7 @@ DECLARE_STACK_OF(X509_POLICY_LEVEL)
158 * this the OpenSSL way either, and we are not using this boringsslism 158 * this the OpenSSL way either, and we are not using this boringsslism
159 * anywhere else. Callers should ensure that the stack in data is sorted. 159 * anywhere else. Callers should ensure that the stack in data is sorted.
160 */ 160 */
161void 161static void
162sk_X509_POLICY_NODE_delete_if(STACK_OF(X509_POLICY_NODE) *nodes, 162sk_X509_POLICY_NODE_delete_if(STACK_OF(X509_POLICY_NODE) *nodes,
163 int (*delete_if)(X509_POLICY_NODE *, void *), void *data) 163 int (*delete_if)(X509_POLICY_NODE *, void *), void *data)
164{ 164{
diff --git a/src/lib/libcrypto/x509/x509_prn.c b/src/lib/libcrypto/x509/x509_prn.c
index 23c649a7b9..5be754a71d 100644
--- a/src/lib/libcrypto/x509/x509_prn.c
+++ b/src/lib/libcrypto/x509/x509_prn.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_prn.c,v 1.7 2025/06/02 12:18:22 jsg Exp $ */ 1/* $OpenBSD: x509_prn.c,v 1.11 2026/05/16 07:12:27 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 */
@@ -55,7 +55,6 @@
55 * Hudson (tjh@cryptsoft.com). 55 * Hudson (tjh@cryptsoft.com).
56 * 56 *
57 */ 57 */
58/* X509 v3 extension utilities */
59 58
60#include <stdio.h> 59#include <stdio.h>
61 60
@@ -64,13 +63,6 @@
64 63
65#include "x509_local.h" 64#include "x509_local.h"
66 65
67/* Extension printing routines */
68
69static int unknown_ext_print(BIO *out, X509_EXTENSION *ext, unsigned long flag,
70 int indent, int supported);
71
72/* Print out a name+value stack */
73
74void 66void
75X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent, int ml) 67X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent, int ml)
76{ 68{
@@ -102,7 +94,29 @@ X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent, int ml)
102} 94}
103LCRYPTO_ALIAS(X509V3_EXT_val_prn); 95LCRYPTO_ALIAS(X509V3_EXT_val_prn);
104 96
105/* Main routine: print out a general extension */ 97static int
98unknown_ext_print(BIO *out, X509_EXTENSION *ext, unsigned long flag,
99 int indent, int supported)
100{
101 switch (flag & X509V3_EXT_UNKNOWN_MASK) {
102 case X509V3_EXT_DEFAULT:
103 return 0;
104 case X509V3_EXT_ERROR_UNKNOWN:
105 if (supported)
106 BIO_printf(out, "%*s<Parse Error>", indent, "");
107 else
108 BIO_printf(out, "%*s<Not Supported>", indent, "");
109 return 1;
110 case X509V3_EXT_PARSE_UNKNOWN:
111 return ASN1_parse_dump(out,
112 ext->value->data, ext->value->length, indent, -1) > 0;
113 case X509V3_EXT_DUMP_UNKNOWN:
114 return BIO_dump_indent(out, (const char *)ext->value->data,
115 ext->value->length, indent) > 0;
116 default:
117 return 1;
118 }
119}
106 120
107int 121int
108X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, int indent) 122X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, int indent)
@@ -192,31 +206,6 @@ X509V3_extensions_print(BIO *bp, const char *title,
192} 206}
193LCRYPTO_ALIAS(X509V3_extensions_print); 207LCRYPTO_ALIAS(X509V3_extensions_print);
194 208
195static int
196unknown_ext_print(BIO *out, X509_EXTENSION *ext, unsigned long flag,
197 int indent, int supported)
198{
199 switch (flag & X509V3_EXT_UNKNOWN_MASK) {
200 case X509V3_EXT_DEFAULT:
201 return 0;
202 case X509V3_EXT_ERROR_UNKNOWN:
203 if (supported)
204 BIO_printf(out, "%*s<Parse Error>", indent, "");
205 else
206 BIO_printf(out, "%*s<Not Supported>", indent, "");
207 return 1;
208 case X509V3_EXT_PARSE_UNKNOWN:
209 return ASN1_parse_dump(out,
210 ext->value->data, ext->value->length, indent, -1);
211 case X509V3_EXT_DUMP_UNKNOWN:
212 return BIO_dump_indent(out, (char *)ext->value->data,
213 ext->value->length, indent);
214 default:
215 return 1;
216 }
217}
218
219
220int 209int
221X509V3_EXT_print_fp(FILE *fp, X509_EXTENSION *ext, int flag, int indent) 210X509V3_EXT_print_fp(FILE *fp, X509_EXTENSION *ext, int flag, int indent)
222{ 211{
diff --git a/src/lib/libcrypto/x509/x509_purp.c b/src/lib/libcrypto/x509/x509_purp.c
index 36dfe6abee..ff6d272d39 100644
--- a/src/lib/libcrypto/x509/x509_purp.c
+++ b/src/lib/libcrypto/x509/x509_purp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_purp.c,v 1.44 2025/05/10 05:54:39 tb Exp $ */ 1/* $OpenBSD: x509_purp.c,v 1.45 2026/05/08 04:28:28 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 2001. 3 * project 2001.
4 */ 4 */
@@ -580,13 +580,17 @@ x509v3_cache_extensions(X509 *x)
580 return (x->ex_flags & EXFLAG_INVALID) == 0; 580 return (x->ex_flags & EXFLAG_INVALID) == 0;
581} 581}
582 582
583/* CA checks common to all purposes 583/*
584 * CA checks common to all purposes
584 * return codes: 585 * return codes:
585 * 0 not a CA 586 * 0 not a CA
586 * 1 is a CA 587 * 1 is a CA per RFC 5280.
587 * 2 basicConstraints absent so "maybe" a CA 588 * 2 basicConstraints absent so "maybe" a CA
589 * "I don't know..." fallback removed in 2004 (OpenSSL commit 8f284faa)
588 * 3 basicConstraints absent but self signed V1. 590 * 3 basicConstraints absent but self signed V1.
589 * 4 basicConstraints absent but keyUsage present and keyCertSign asserted. 591 * 4 basicConstraints absent but keyUsage present and keyCertSign asserted.
592 * 5 basicConstraints absent but outdated Netscape Certificate Type extension
593 * indicates that it is a CA certificate
590 */ 594 */
591 595
592static int 596static int
diff --git a/src/lib/libcrypto/x509/x509_utl.c b/src/lib/libcrypto/x509/x509_utl.c
index 2e60834edf..20c58dd8c5 100644
--- a/src/lib/libcrypto/x509/x509_utl.c
+++ b/src/lib/libcrypto/x509/x509_utl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_utl.c,v 1.28 2026/01/12 22:08:34 tb Exp $ */ 1/* $OpenBSD: x509_utl.c,v 1.29 2026/07/31 00:50:52 kenjiro 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 */
@@ -69,6 +69,7 @@
69#include "bytestring.h" 69#include "bytestring.h"
70#include "conf_local.h" 70#include "conf_local.h"
71#include "err_local.h" 71#include "err_local.h"
72#include "x509_local.h"
72 73
73/* 74/*
74 * Match reference identifiers starting with "." to any sub-domain. This 75 * Match reference identifiers starting with "." to any sub-domain. This
diff --git a/src/lib/libcrypto/x509/x509_verify.c b/src/lib/libcrypto/x509/x509_verify.c
index fc3fbc14da..a8fd5a37d3 100644
--- a/src/lib/libcrypto/x509/x509_verify.c
+++ b/src/lib/libcrypto/x509/x509_verify.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_verify.c,v 1.75 2026/04/01 14:38:26 jsing Exp $ */ 1/* $OpenBSD: x509_verify.c,v 1.79 2026/08/26 16:25:12 beck Exp $ */
2/* 2/*
3 * Copyright (c) 2020-2021 Bob Beck <beck@openbsd.org> 3 * Copyright (c) 2020-2021 Bob Beck <beck@openbsd.org>
4 * 4 *
@@ -83,7 +83,7 @@ x509_verify_asn1_time_to_time_t(const ASN1_TIME *atime, int notAfter,
83 return asn1_time_tm_to_time_t(&tm, out); 83 return asn1_time_tm_to_time_t(&tm, out);
84} 84}
85 85
86struct x509_verify_chain * 86static struct x509_verify_chain *
87x509_verify_chain_new(void) 87x509_verify_chain_new(void)
88{ 88{
89 struct x509_verify_chain *chain; 89 struct x509_verify_chain *chain;
@@ -199,7 +199,7 @@ x509_verify_chain_last(struct x509_verify_chain *chain)
199 return sk_X509_value(chain->certs, last); 199 return sk_X509_value(chain->certs, last);
200} 200}
201 201
202X509 * 202static X509 *
203x509_verify_chain_leaf(struct x509_verify_chain *chain) 203x509_verify_chain_leaf(struct x509_verify_chain *chain)
204{ 204{
205 if (chain->certs == NULL) 205 if (chain->certs == NULL)
@@ -668,11 +668,9 @@ x509_verify_build_chains(struct x509_verify_ctx *ctx, X509 *cert,
668 depth = sk_X509_num(current_chain->certs); 668 depth = sk_X509_num(current_chain->certs);
669 if (depth > 0) 669 if (depth > 0)
670 depth--; 670 depth--;
671 if (depth >= ctx->max_depth) { 671 if (depth >= ctx->max_depth && !x509_verify_cert_error(ctx, cert, depth,
672 (void)x509_verify_cert_error(ctx, cert, depth, 672 X509_V_ERR_CERT_CHAIN_TOO_LONG, 0))
673 X509_V_ERR_CERT_CHAIN_TOO_LONG, 0);
674 return; 673 return;
675 }
676 674
677 count = ctx->chains_count; 675 count = ctx->chains_count;
678 676
@@ -762,8 +760,11 @@ x509_verify_cert_hostname(struct x509_verify_ctx *ctx, X509 *cert, char *name)
762 if (ctx->xsc != NULL) { 760 if (ctx->xsc != NULL) {
763 int ret; 761 int ret;
764 762
765 if ((ret = x509_vfy_check_id(ctx->xsc)) == 0) 763 ret = x509_vfy_check_id(ctx->xsc);
764 if (ctx->xsc->error != X509_V_OK) {
766 ctx->error = ctx->xsc->error; 765 ctx->error = ctx->xsc->error;
766 ctx->error_depth = ctx->xsc->error_depth;
767 }
767 return ret; 768 return ret;
768 } 769 }
769 return 1; 770 return 1;
@@ -911,7 +912,8 @@ x509_verify_cert_extensions(struct x509_verify_ctx *ctx, X509 *cert, int need_ca
911 ctx->error = X509_V_ERR_INVALID_CA; 912 ctx->error = X509_V_ERR_INVALID_CA;
912 return 0; 913 return 0;
913 } 914 }
914 if (ctx->purpose > 0 && X509_check_purpose(cert, ctx->purpose, need_ca)) { 915 if (ctx->purpose > 0 &&
916 X509_check_purpose(cert, ctx->purpose, need_ca) != 1) {
915 ctx->error = X509_V_ERR_INVALID_PURPOSE; 917 ctx->error = X509_V_ERR_INVALID_PURPOSE;
916 return 0; 918 return 0;
917 } 919 }
diff --git a/src/lib/libcrypto/x509/x509_vfy.c b/src/lib/libcrypto/x509/x509_vfy.c
index 776478508e..993d057d10 100644
--- a/src/lib/libcrypto/x509/x509_vfy.c
+++ b/src/lib/libcrypto/x509/x509_vfy.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_vfy.c,v 1.149 2026/04/07 12:48:37 tb Exp $ */ 1/* $OpenBSD: x509_vfy.c,v 1.153 2026/06/26 06:03:32 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 *
@@ -1074,26 +1074,35 @@ get_crl_sk(X509_STORE_CTX *ctx, X509_CRL **pcrl, X509_CRL **pdcrl,
1074 reasons = *preasons; 1074 reasons = *preasons;
1075 crl_score = get_crl_score(ctx, &crl_issuer, &reasons, crl, x); 1075 crl_score = get_crl_score(ctx, &crl_issuer, &reasons, crl, x);
1076 1076
1077 if (crl_score > best_score) { 1077 if (crl_score < best_score || crl_score == 0)
1078 best_crl = crl; 1078 continue;
1079 best_crl_issuer = crl_issuer; 1079
1080 best_score = crl_score; 1080 if (crl_score == best_score && best_crl != NULL) {
1081 best_reasons = reasons; 1081 int day, sec;
1082
1083 if (!ASN1_TIME_diff(&day, &sec, best_crl->crl->lastUpdate,
1084 crl->crl->lastUpdate))
1085 continue;
1086
1087 if (day <= 0 && sec <= 0)
1088 continue;
1082 } 1089 }
1090
1091 best_crl = crl;
1092 best_crl_issuer = crl_issuer;
1093 best_score = crl_score;
1094 best_reasons = reasons;
1083 } 1095 }
1084 1096
1085 if (best_crl) { 1097 if (best_crl != NULL) {
1086 if (*pcrl) 1098 X509_CRL_free(*pcrl);
1087 X509_CRL_free(*pcrl);
1088 *pcrl = best_crl; 1099 *pcrl = best_crl;
1089 *pissuer = best_crl_issuer; 1100 *pissuer = best_crl_issuer;
1090 *pscore = best_score; 1101 *pscore = best_score;
1091 *preasons = best_reasons; 1102 *preasons = best_reasons;
1092 CRYPTO_add(&best_crl->references, 1, CRYPTO_LOCK_X509_CRL); 1103 CRYPTO_add(&best_crl->references, 1, CRYPTO_LOCK_X509_CRL);
1093 if (*pdcrl) { 1104 X509_CRL_free(*pdcrl);
1094 X509_CRL_free(*pdcrl); 1105 *pdcrl = NULL;
1095 *pdcrl = NULL;
1096 }
1097 get_delta_sk(ctx, pdcrl, pscore, best_crl, crls); 1106 get_delta_sk(ctx, pdcrl, pscore, best_crl, crls);
1098 } 1107 }
1099 1108
@@ -2420,9 +2429,9 @@ LCRYPTO_ALIAS(X509_STORE_get_check_issued);
2420 2429
2421void 2430void
2422X509_STORE_set_check_issued(X509_STORE *store, 2431X509_STORE_set_check_issued(X509_STORE *store,
2423 X509_STORE_CTX_check_issued_fn check_issued) 2432 X509_STORE_CTX_check_issued_fn check_issued_fn)
2424{ 2433{
2425 store->check_issued = check_issued; 2434 store->check_issued = check_issued_fn;
2426} 2435}
2427LCRYPTO_ALIAS(X509_STORE_set_check_issued); 2436LCRYPTO_ALIAS(X509_STORE_set_check_issued);
2428 2437
diff --git a/src/lib/libssl/Makefile b/src/lib/libssl/Makefile
index 7e423b0b43..0d5934508a 100644
--- a/src/lib/libssl/Makefile
+++ b/src/lib/libssl/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.86 2026/04/03 07:26:20 jsing Exp $ 1# $OpenBSD: Makefile,v 1.87 2026/05/16 08:20:41 jsing Exp $
2 2
3.include <bsd.own.mk> 3.include <bsd.own.mk>
4.ifndef NOMAN 4.ifndef NOMAN
@@ -43,6 +43,7 @@ SRCS= \
43 d1_lib.c \ 43 d1_lib.c \
44 d1_pkt.c \ 44 d1_pkt.c \
45 d1_srtp.c \ 45 d1_srtp.c \
46 dtls12_handshake_msg.c \
46 pqueue.c \ 47 pqueue.c \
47 s3_cbc.c \ 48 s3_cbc.c \
48 s3_lib.c \ 49 s3_lib.c \
diff --git a/src/lib/libssl/d1_both.c b/src/lib/libssl/d1_both.c
index e144d8f533..b57c8960c1 100644
--- a/src/lib/libssl/d1_both.c
+++ b/src/lib/libssl/d1_both.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_both.c,v 1.85 2025/03/09 15:12:18 tb Exp $ */ 1/* $OpenBSD: d1_both.c,v 1.99 2026/07/16 14:43:22 jsing Exp $ */
2/* 2/*
3 * DTLS implementation written by Nagendra Modadugu 3 * DTLS implementation written by Nagendra Modadugu
4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
@@ -159,8 +159,6 @@ static const unsigned char bitmask_end_values[] = {
159static const unsigned int g_probable_mtu[] = {1500 - 28, 512 - 28, 256 - 28}; 159static const unsigned int g_probable_mtu[] = {1500 - 28, 512 - 28, 256 - 28};
160 160
161static unsigned int dtls1_guess_mtu(unsigned int curr_mtu); 161static unsigned int dtls1_guess_mtu(unsigned int curr_mtu);
162static void dtls1_fix_message_header(SSL *s, unsigned long frag_off,
163 unsigned long frag_len);
164static int dtls1_write_message_header(const struct hm_header_st *msg_hdr, 162static int dtls1_write_message_header(const struct hm_header_st *msg_hdr,
165 unsigned long frag_off, unsigned long frag_len, unsigned char *p); 163 unsigned long frag_off, unsigned long frag_len, unsigned char *p);
166static long dtls1_get_message_fragment(SSL *s, int st1, int stn, long max, 164static long dtls1_get_message_fragment(SSL *s, int st1, int stn, long max,
@@ -206,14 +204,49 @@ dtls1_hm_fragment_free(hm_fragment *frag)
206 free(frag); 204 free(frag);
207} 205}
208 206
209/* send s->init_buf in records of type 'type' (SSL3_RT_HANDSHAKE or SSL3_RT_CHANGE_CIPHER_SPEC) */ 207static int
210int 208dtls12_create_handshake_msg(SSL *s)
211dtls1_do_write(SSL *s, int type)
212{ 209{
213 int ret; 210 CBB cbb;
214 int curr_mtu; 211
215 unsigned int len, frag_off; 212 OPENSSL_assert(s->init_off == 0);
213 OPENSSL_assert(s->init_num == (int)s->d1->w_msg_hdr.msg_len +
214 DTLS1_HM_HEADER_LENGTH);
215
216 /* Skip over the existing header. */
217 s->init_off += DTLS1_HM_HEADER_LENGTH;
218 s->init_num -= DTLS1_HM_HEADER_LENGTH;
219
220 if (s->d1->hs_msg != NULL)
221 goto err;
222
223 if ((s->d1->hs_msg = dtls12_handshake_msg_new()) == NULL)
224 goto err;
225 if (!dtls12_handshake_msg_start(s->d1->hs_msg, &cbb,
226 s->d1->w_msg_hdr.type, s->d1->w_msg_hdr.seq))
227 goto err;
228 if (!CBB_add_bytes(&cbb, &s->init_buf->data[s->init_off],
229 s->init_num))
230 goto err;
231 if (!dtls12_handshake_msg_finish(s->d1->hs_msg))
232 goto err;
233
234 return 1;
235
236 err:
237 dtls12_handshake_msg_free(s->d1->hs_msg);
238 s->d1->hs_msg = NULL;
239
240 return 0;
241}
242
243static int
244dtls1_do_write_handshake_message(SSL *s)
245{
246 int curr_mtu, written;
216 size_t overhead; 247 size_t overhead;
248 CBS cbs;
249 int ret;
217 250
218 /* AHA! Figure out the MTU, and stick to the right size */ 251 /* AHA! Figure out the MTU, and stick to the right size */
219 if (s->d1->mtu < dtls1_min_mtu() && 252 if (s->d1->mtu < dtls1_min_mtu() &&
@@ -237,15 +270,15 @@ dtls1_do_write(SSL *s, int type)
237 OPENSSL_assert(s->d1->mtu >= dtls1_min_mtu()); 270 OPENSSL_assert(s->d1->mtu >= dtls1_min_mtu());
238 /* should have something reasonable now */ 271 /* should have something reasonable now */
239 272
240 if (s->init_off == 0 && type == SSL3_RT_HANDSHAKE) 273 if (s->d1->hs_msg == NULL) {
241 OPENSSL_assert(s->init_num == 274 if (!dtls12_create_handshake_msg(s))
242 (int)s->d1->w_msg_hdr.msg_len + DTLS1_HM_HEADER_LENGTH); 275 return -1;
276 }
243 277
244 if (!tls12_record_layer_write_overhead(s->rl, &overhead)) 278 if (!tls12_record_layer_write_overhead(s->rl, &overhead))
245 return -1; 279 return -1;
246 280
247 frag_off = 0; 281 do {
248 while (s->init_num) {
249 curr_mtu = s->d1->mtu - BIO_wpending(SSL_get_wbio(s)) - 282 curr_mtu = s->d1->mtu - BIO_wpending(SSL_get_wbio(s)) -
250 DTLS1_RT_HEADER_LENGTH - overhead; 283 DTLS1_RT_HEADER_LENGTH - overhead;
251 284
@@ -258,38 +291,14 @@ dtls1_do_write(SSL *s, int type)
258 overhead; 291 overhead;
259 } 292 }
260 293
261 if (s->init_num > curr_mtu) 294 OPENSSL_assert(curr_mtu >= DTLS1_HM_HEADER_LENGTH);
262 len = curr_mtu;
263 else
264 len = s->init_num;
265
266 /* XDTLS: this function is too long. split out the CCS part */
267 if (type == SSL3_RT_HANDSHAKE) {
268 if (s->init_off != 0) {
269 OPENSSL_assert(s->init_off > DTLS1_HM_HEADER_LENGTH);
270 s->init_off -= DTLS1_HM_HEADER_LENGTH;
271 s->init_num += DTLS1_HM_HEADER_LENGTH;
272
273 if (s->init_num > curr_mtu)
274 len = curr_mtu;
275 else
276 len = s->init_num;
277 }
278
279 dtls1_fix_message_header(s, frag_off,
280 len - DTLS1_HM_HEADER_LENGTH);
281
282 if (!dtls1_write_message_header(&s->d1->w_msg_hdr,
283 s->d1->w_msg_hdr.frag_off, s->d1->w_msg_hdr.frag_len,
284 (unsigned char *)&s->init_buf->data[s->init_off]))
285 return -1;
286 295
287 OPENSSL_assert(len >= DTLS1_HM_HEADER_LENGTH); 296 if (!dtls12_handshake_msg_fragment_build(s->d1->hs_msg,
288 } 297 curr_mtu - DTLS1_HM_HEADER_LENGTH, &cbs))
298 return -1;
289 299
290 ret = dtls1_write_bytes(s, type, 300 if ((written = dtls1_write_bytes(s, SSL3_RT_HANDSHAKE,
291 &s->init_buf->data[s->init_off], len); 301 CBS_data(&cbs), CBS_len(&cbs))) < 0) {
292 if (ret < 0) {
293 /* 302 /*
294 * Might need to update MTU here, but we don't know 303 * Might need to update MTU here, but we don't know
295 * which previous packet caused the failure -- so 304 * which previous packet caused the failure -- so
@@ -298,69 +307,83 @@ dtls1_do_write(SSL *s, int type)
298 * handle the retransmit 307 * handle the retransmit
299 */ 308 */
300 if (BIO_ctrl(SSL_get_wbio(s), 309 if (BIO_ctrl(SSL_get_wbio(s),
301 BIO_CTRL_DGRAM_MTU_EXCEEDED, 0, NULL) > 0) 310 BIO_CTRL_DGRAM_MTU_EXCEEDED, 0, NULL) <= 0)
302 s->d1->mtu = BIO_ctrl(SSL_get_wbio(s), 311 return -1;
303 BIO_CTRL_DGRAM_QUERY_MTU, 0, NULL);
304 else
305 return (-1);
306 } else {
307 312
308 /* 313 s->d1->mtu = BIO_ctrl(SSL_get_wbio(s),
309 * Bad if this assert fails, only part of the 314 BIO_CTRL_DGRAM_QUERY_MTU, 0, NULL);
310 * handshake message got sent. but why would 315
311 * this happen? 316 continue;
312 */
313 OPENSSL_assert(len == (unsigned int)ret);
314
315 if (type == SSL3_RT_HANDSHAKE &&
316 !s->d1->retransmitting) {
317 /*
318 * Should not be done for 'Hello Request's,
319 * but in that case we'll ignore the result
320 * anyway
321 */
322 unsigned char *p = (unsigned char *)&s->init_buf->data[s->init_off];
323 const struct hm_header_st *msg_hdr = &s->d1->w_msg_hdr;
324 int xlen;
325
326 if (frag_off == 0) {
327 /*
328 * Reconstruct message header is if it
329 * is being sent in single fragment
330 */
331 if (!dtls1_write_message_header(msg_hdr,
332 0, msg_hdr->msg_len, p))
333 return (-1);
334 xlen = ret;
335 } else {
336 p += DTLS1_HM_HEADER_LENGTH;
337 xlen = ret - DTLS1_HM_HEADER_LENGTH;
338 }
339
340 tls1_transcript_record(s, p, xlen);
341 }
342
343 if (ret == s->init_num) {
344 if (s->msg_callback)
345 s->msg_callback(1, s->version, type,
346 s->init_buf->data,
347 (size_t)(s->init_off + s->init_num),
348 s, s->msg_callback_arg);
349
350 s->init_off = 0;
351 /* done writing this message */
352 s->init_num = 0;
353
354 return (1);
355 }
356 s->init_off += ret;
357 s->init_num -= ret;
358 frag_off += (ret -= DTLS1_HM_HEADER_LENGTH);
359 } 317 }
318
319 /*
320 * Bad if this assert fails, only part of the
321 * handshake message got sent. but why would
322 * this happen?
323 */
324 OPENSSL_assert(CBS_len(&cbs) == (size_t)written);
325
326 if (!dtls12_handshake_msg_fragment_next(s->d1->hs_msg))
327 return -1;
328
329 } while (dtls12_handshake_msg_fragment_pending(s->d1->hs_msg));
330
331 dtls12_handshake_msg_data(s->d1->hs_msg, &cbs);
332
333 if (!s->d1->retransmitting) {
334 /*
335 * The TLS transcript is based on each handshake message being
336 * sent as a single fragment - see RFC 6347 section 4.2.6. This
337 * should not be called for a HelloRequest, however the result
338 * will be ignored.
339 */
340 tls1_transcript_record(s, CBS_data(&cbs), CBS_len(&cbs));
360 } 341 }
361 return (0); 342
343 ssl_msg_callback(s, 1, SSL3_RT_HANDSHAKE, CBS_data(&cbs), CBS_len(&cbs));
344
345 dtls12_handshake_msg_free(s->d1->hs_msg);
346 s->d1->hs_msg = NULL;
347
348 s->init_off = 0;
349 s->init_num = 0;
350
351 return 1;
362} 352}
363 353
354static int
355dtls1_do_write_ccs(SSL *s)
356{
357 const uint8_t ccs[] = { SSL3_MT_CCS };
358 int ret;
359
360 OPENSSL_assert(s->d1->mtu >= dtls1_min_mtu());
361
362 if ((ret = dtls1_write_bytes(s, SSL3_RT_CHANGE_CIPHER_SPEC,
363 ccs, sizeof(ccs))) < 0)
364 return -1;
365
366 OPENSSL_assert(sizeof(ccs) == ret);
367
368 ssl_msg_callback(s, 1, SSL3_RT_CHANGE_CIPHER_SPEC,
369 ccs, sizeof(ccs));
370
371 s->init_off = 0;
372 s->init_num = 0;
373
374 return 1;
375}
376
377int
378dtls1_do_write(SSL *s, int msg_type)
379{
380 if (msg_type == SSL3_RT_HANDSHAKE)
381 return dtls1_do_write_handshake_message(s);
382 if (msg_type == SSL3_RT_CHANGE_CIPHER_SPEC)
383 return dtls1_do_write_ccs(s);
384
385 return -1;
386}
364 387
365/* 388/*
366 * Obtain handshake message of message type 'mt' (any if mt == -1), 389 * Obtain handshake message of message type 'mt' (any if mt == -1),
@@ -413,9 +436,8 @@ dtls1_get_message(SSL *s, int st1, int stn, int mt, long max)
413 msg_len += DTLS1_HM_HEADER_LENGTH; 436 msg_len += DTLS1_HM_HEADER_LENGTH;
414 437
415 tls1_transcript_record(s, p, msg_len); 438 tls1_transcript_record(s, p, msg_len);
416 if (s->msg_callback) 439
417 s->msg_callback(0, s->version, SSL3_RT_HANDSHAKE, p, msg_len, 440 ssl_msg_callback(s, 0, SSL3_RT_HANDSHAKE, p, msg_len);
418 s, s->msg_callback_arg);
419 441
420 memset(msg_hdr, 0, sizeof(struct hm_header_st)); 442 memset(msg_hdr, 0, sizeof(struct hm_header_st));
421 443
@@ -797,11 +819,8 @@ dtls1_get_message_fragment(SSL *s, int st1, int stn, long max, int *ok)
797 * 'Finished' MAC. 819 * 'Finished' MAC.
798 */ 820 */
799 if (wire[1] == 0 && wire[2] == 0 && wire[3] == 0) { 821 if (wire[1] == 0 && wire[2] == 0 && wire[3] == 0) {
800 if (s->msg_callback) 822 ssl_msg_callback(s, 0, SSL3_RT_HANDSHAKE, wire,
801 s->msg_callback(0, s->version, 823 DTLS1_HM_HEADER_LENGTH);
802 SSL3_RT_HANDSHAKE, wire,
803 DTLS1_HM_HEADER_LENGTH, s,
804 s->msg_callback_arg);
805 824
806 s->init_num = 0; 825 s->init_num = 0;
807 goto again; 826 goto again;
@@ -907,6 +926,46 @@ dtls1_get_queue_priority(unsigned short seq, int is_ccs)
907 return seq * 2 - is_ccs; 926 return seq * 2 - is_ccs;
908} 927}
909 928
929static int
930dtls1_retransmit_message(SSL *s, hm_fragment *frag)
931{
932 unsigned long header_length;
933 uint16_t epoch;
934 int ret;
935
936 if (frag->msg_header.is_ccs)
937 header_length = DTLS1_CCS_HEADER_LENGTH;
938 else
939 header_length = DTLS1_HM_HEADER_LENGTH;
940
941 memcpy(s->init_buf->data, frag->fragment,
942 frag->msg_header.msg_len + header_length);
943 s->init_num = frag->msg_header.msg_len + header_length;
944
945 dtls1_set_message_header(s, frag->msg_header.type,
946 frag->msg_header.msg_len, frag->msg_header.seq, 0,
947 frag->msg_header.frag_len);
948
949 epoch = tls12_record_layer_write_epoch(s->rl);
950
951 s->d1->retransmitting = 1;
952
953 /* Switch to the epoch that was used to send the message. */
954 if (!tls12_record_layer_use_write_epoch(s->rl, frag->msg_header.epoch))
955 return 0;
956
957 ret = dtls1_do_write(s, frag->msg_header.is_ccs ?
958 SSL3_RT_CHANGE_CIPHER_SPEC : SSL3_RT_HANDSHAKE);
959
960 if (!tls12_record_layer_use_write_epoch(s->rl, epoch))
961 return 0;
962
963 s->d1->retransmitting = 0;
964
965 (void)BIO_flush(SSL_get_wbio(s));
966 return ret;
967}
968
910int 969int
911dtls1_retransmit_buffered_messages(SSL *s) 970dtls1_retransmit_buffered_messages(SSL *s)
912{ 971{
@@ -914,17 +973,12 @@ dtls1_retransmit_buffered_messages(SSL *s)
914 piterator iter; 973 piterator iter;
915 pitem *item; 974 pitem *item;
916 hm_fragment *frag; 975 hm_fragment *frag;
917 int found = 0;
918 976
919 iter = pqueue_iterator(sent); 977 iter = pqueue_iterator(sent);
920 978
921 for (item = pqueue_next(&iter); item != NULL; 979 for (item = pqueue_next(&iter); item != NULL; item = pqueue_next(&iter)) {
922 item = pqueue_next(&iter)) {
923 frag = (hm_fragment *)item->data; 980 frag = (hm_fragment *)item->data;
924 if (dtls1_retransmit_message(s, 981 if (dtls1_retransmit_message(s, frag) <= 0) {
925 (unsigned short)dtls1_get_queue_priority(
926 frag->msg_header.seq, frag->msg_header.is_ccs), 0,
927 &found) <= 0 && found) {
928#ifdef DEBUG 982#ifdef DEBUG
929 fprintf(stderr, "dtls1_retransmit_message() failed\n"); 983 fprintf(stderr, "dtls1_retransmit_message() failed\n");
930#endif 984#endif
@@ -960,6 +1014,7 @@ dtls1_buffer_message(SSL *s, int is_ccs)
960 (is_ccs ? DTLS1_CCS_HEADER_LENGTH : DTLS1_HM_HEADER_LENGTH) == 1014 (is_ccs ? DTLS1_CCS_HEADER_LENGTH : DTLS1_HM_HEADER_LENGTH) ==
961 (unsigned int)s->init_num); 1015 (unsigned int)s->init_num);
962 1016
1017 frag->msg_header.epoch = tls12_record_layer_write_epoch(s->rl);
963 frag->msg_header.msg_len = s->d1->w_msg_hdr.msg_len; 1018 frag->msg_header.msg_len = s->d1->w_msg_hdr.msg_len;
964 frag->msg_header.seq = s->d1->w_msg_hdr.seq; 1019 frag->msg_header.seq = s->d1->w_msg_hdr.seq;
965 frag->msg_header.type = s->d1->w_msg_hdr.type; 1020 frag->msg_header.type = s->d1->w_msg_hdr.type;
@@ -967,11 +1022,6 @@ dtls1_buffer_message(SSL *s, int is_ccs)
967 frag->msg_header.frag_len = s->d1->w_msg_hdr.msg_len; 1022 frag->msg_header.frag_len = s->d1->w_msg_hdr.msg_len;
968 frag->msg_header.is_ccs = is_ccs; 1023 frag->msg_header.is_ccs = is_ccs;
969 1024
970 /* save current state*/
971 frag->msg_header.saved_retransmit_state.session = s->session;
972 frag->msg_header.saved_retransmit_state.epoch =
973 tls12_record_layer_write_epoch(s->rl);
974
975 memset(seq64be, 0, sizeof(seq64be)); 1025 memset(seq64be, 0, sizeof(seq64be));
976 seq64be[6] = (unsigned char)(dtls1_get_queue_priority( 1026 seq64be[6] = (unsigned char)(dtls1_get_queue_priority(
977 frag->msg_header.seq, frag->msg_header.is_ccs) >> 8); 1027 frag->msg_header.seq, frag->msg_header.is_ccs) >> 8);
@@ -988,80 +1038,6 @@ dtls1_buffer_message(SSL *s, int is_ccs)
988 return 1; 1038 return 1;
989} 1039}
990 1040
991int
992dtls1_retransmit_message(SSL *s, unsigned short seq, unsigned long frag_off,
993 int *found)
994{
995 int ret;
996 /* XDTLS: for now assuming that read/writes are blocking */
997 pitem *item;
998 hm_fragment *frag;
999 unsigned long header_length;
1000 unsigned char seq64be[8];
1001 struct dtls1_retransmit_state saved_state;
1002
1003 /*
1004 OPENSSL_assert(s->init_num == 0);
1005 OPENSSL_assert(s->init_off == 0);
1006 */
1007
1008 /* XDTLS: the requested message ought to be found, otherwise error */
1009 memset(seq64be, 0, sizeof(seq64be));
1010 seq64be[6] = (unsigned char)(seq >> 8);
1011 seq64be[7] = (unsigned char)seq;
1012
1013 item = pqueue_find(s->d1->sent_messages, seq64be);
1014 if (item == NULL) {
1015#ifdef DEBUG
1016 fprintf(stderr, "retransmit: message %d non-existent\n", seq);
1017#endif
1018 *found = 0;
1019 return 0;
1020 }
1021
1022 *found = 1;
1023 frag = (hm_fragment *)item->data;
1024
1025 if (frag->msg_header.is_ccs)
1026 header_length = DTLS1_CCS_HEADER_LENGTH;
1027 else
1028 header_length = DTLS1_HM_HEADER_LENGTH;
1029
1030 memcpy(s->init_buf->data, frag->fragment,
1031 frag->msg_header.msg_len + header_length);
1032 s->init_num = frag->msg_header.msg_len + header_length;
1033
1034 dtls1_set_message_header_int(s, frag->msg_header.type,
1035 frag->msg_header.msg_len, frag->msg_header.seq, 0,
1036 frag->msg_header.frag_len);
1037
1038 /* save current state */
1039 saved_state.session = s->session;
1040 saved_state.epoch = tls12_record_layer_write_epoch(s->rl);
1041
1042 s->d1->retransmitting = 1;
1043
1044 /* restore state in which the message was originally sent */
1045 s->session = frag->msg_header.saved_retransmit_state.session;
1046 if (!tls12_record_layer_use_write_epoch(s->rl,
1047 frag->msg_header.saved_retransmit_state.epoch))
1048 return 0;
1049
1050 ret = dtls1_do_write(s, frag->msg_header.is_ccs ?
1051 SSL3_RT_CHANGE_CIPHER_SPEC : SSL3_RT_HANDSHAKE);
1052
1053 /* restore current state */
1054 s->session = saved_state.session;
1055 if (!tls12_record_layer_use_write_epoch(s->rl,
1056 saved_state.epoch))
1057 return 0;
1058
1059 s->d1->retransmitting = 0;
1060
1061 (void)BIO_flush(SSL_get_wbio(s));
1062 return ret;
1063}
1064
1065/* call this function when the buffered messages are no longer needed */ 1041/* call this function when the buffered messages are no longer needed */
1066void 1042void
1067dtls1_clear_record_buffer(SSL *s) 1043dtls1_clear_record_buffer(SSL *s)
@@ -1074,7 +1050,7 @@ dtls1_clear_record_buffer(SSL *s)
1074 frag = item->data; 1050 frag = item->data;
1075 if (frag->msg_header.is_ccs) 1051 if (frag->msg_header.is_ccs)
1076 tls12_record_layer_write_epoch_done(s->rl, 1052 tls12_record_layer_write_epoch_done(s->rl,
1077 frag->msg_header.saved_retransmit_state.epoch); 1053 frag->msg_header.epoch);
1078 dtls1_hm_fragment_free(frag); 1054 dtls1_hm_fragment_free(frag);
1079 pitem_free(item); 1055 pitem_free(item);
1080 } 1056 }
@@ -1082,21 +1058,6 @@ dtls1_clear_record_buffer(SSL *s)
1082 1058
1083void 1059void
1084dtls1_set_message_header(SSL *s, unsigned char mt, unsigned long len, 1060dtls1_set_message_header(SSL *s, unsigned char mt, unsigned long len,
1085 unsigned long frag_off, unsigned long frag_len)
1086{
1087 /* Don't change sequence numbers while listening */
1088 if (frag_off == 0 && !s->d1->listen) {
1089 s->d1->handshake_write_seq = s->d1->next_handshake_write_seq;
1090 s->d1->next_handshake_write_seq++;
1091 }
1092
1093 dtls1_set_message_header_int(s, mt, len, s->d1->handshake_write_seq,
1094 frag_off, frag_len);
1095}
1096
1097/* don't actually do the writing, wait till the MTU has been retrieved */
1098void
1099dtls1_set_message_header_int(SSL *s, unsigned char mt, unsigned long len,
1100 unsigned short seq_num, unsigned long frag_off, unsigned long frag_len) 1061 unsigned short seq_num, unsigned long frag_off, unsigned long frag_len)
1101{ 1062{
1102 struct hm_header_st *msg_hdr = &s->d1->w_msg_hdr; 1063 struct hm_header_st *msg_hdr = &s->d1->w_msg_hdr;
@@ -1108,15 +1069,6 @@ dtls1_set_message_header_int(SSL *s, unsigned char mt, unsigned long len,
1108 msg_hdr->frag_len = frag_len; 1069 msg_hdr->frag_len = frag_len;
1109} 1070}
1110 1071
1111static void
1112dtls1_fix_message_header(SSL *s, unsigned long frag_off, unsigned long frag_len)
1113{
1114 struct hm_header_st *msg_hdr = &s->d1->w_msg_hdr;
1115
1116 msg_hdr->frag_off = frag_off;
1117 msg_hdr->frag_len = frag_len;
1118}
1119
1120static int 1072static int
1121dtls1_write_message_header(const struct hm_header_st *msg_hdr, 1073dtls1_write_message_header(const struct hm_header_st *msg_hdr,
1122 unsigned long frag_off, unsigned long frag_len, unsigned char *p) 1074 unsigned long frag_off, unsigned long frag_len, unsigned char *p)
@@ -1196,3 +1148,47 @@ dtls1_get_message_header(CBS *header, struct hm_header_st *msg_hdr)
1196 1148
1197 return 1; 1149 return 1;
1198} 1150}
1151
1152int
1153dtls12_ccs_built(SSL *s)
1154{
1155 dtls1_set_message_header(s, SSL3_MT_CCS, 0, 0, 0, 0);
1156
1157 if (!dtls1_buffer_message(s, 1))
1158 return 0;
1159
1160 return 1;
1161}
1162
1163int
1164dtls12_handshake_msg_built(SSL *s)
1165{
1166 unsigned long len;
1167 uint8_t msg_type;
1168 CBS cbs;
1169
1170 CBS_init(&cbs, s->init_buf->data, s->init_num);
1171 if (!CBS_get_u8(&cbs, &msg_type))
1172 return 0;
1173
1174 if (s->init_off != 0)
1175 return 0;
1176 if (s->init_num < DTLS1_HM_HEADER_LENGTH)
1177 return 0;
1178
1179 len = s->init_num - DTLS1_HM_HEADER_LENGTH;
1180
1181 /* Do not change sequence numbers while listening. */
1182 if (!s->d1->listen) {
1183 s->d1->handshake_write_seq = s->d1->next_handshake_write_seq;
1184 s->d1->next_handshake_write_seq++;
1185 }
1186
1187 dtls1_set_message_header(s, msg_type, len, s->d1->handshake_write_seq,
1188 0, len);
1189
1190 if (!dtls1_buffer_message(s, 0))
1191 return 0;
1192
1193 return 1;
1194}
diff --git a/src/lib/libssl/d1_lib.c b/src/lib/libssl/d1_lib.c
index 69db8a0df4..7f6dd1d1c5 100644
--- a/src/lib/libssl/d1_lib.c
+++ b/src/lib/libssl/d1_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_lib.c,v 1.65 2024/07/23 14:40:53 jsing Exp $ */ 1/* $OpenBSD: d1_lib.c,v 1.67 2026/08/30 12:23:16 kenjiro Exp $ */
2/* 2/*
3 * DTLS implementation written by Nagendra Modadugu 3 * DTLS implementation written by Nagendra Modadugu
4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
@@ -179,6 +179,8 @@ dtls1_free(SSL *s)
179 pqueue_free(s->d1->sent_messages); 179 pqueue_free(s->d1->sent_messages);
180 pqueue_free(s->d1->buffered_app_data.q); 180 pqueue_free(s->d1->buffered_app_data.q);
181 181
182 dtls12_handshake_msg_free(s->d1->hs_msg);
183
182 freezero(s->d1, sizeof(*s->d1)); 184 freezero(s->d1, sizeof(*s->d1));
183 s->d1 = NULL; 185 s->d1 = NULL;
184} 186}
@@ -199,6 +201,9 @@ dtls1_clear(SSL *s)
199 buffered_app_data = s->d1->buffered_app_data.q; 201 buffered_app_data = s->d1->buffered_app_data.q;
200 mtu = s->d1->mtu; 202 mtu = s->d1->mtu;
201 203
204 dtls12_handshake_msg_free(s->d1->hs_msg);
205 s->d1->hs_msg = NULL;
206
202 dtls1_clear_queues(s); 207 dtls1_clear_queues(s);
203 208
204 memset(s->d1, 0, sizeof(*s->d1)); 209 memset(s->d1, 0, sizeof(*s->d1));
@@ -228,7 +233,7 @@ dtls1_clear(SSL *s)
228long 233long
229dtls1_ctrl(SSL *s, int cmd, long larg, void *parg) 234dtls1_ctrl(SSL *s, int cmd, long larg, void *parg)
230{ 235{
231 int ret = 0; 236 long ret = 0;
232 237
233 switch (cmd) { 238 switch (cmd) {
234 case DTLS_CTRL_GET_TIMEOUT: 239 case DTLS_CTRL_GET_TIMEOUT:
diff --git a/src/lib/libssl/dtls12_handshake_msg.c b/src/lib/libssl/dtls12_handshake_msg.c
new file mode 100644
index 0000000000..7874aa8598
--- /dev/null
+++ b/src/lib/libssl/dtls12_handshake_msg.c
@@ -0,0 +1,231 @@
1/* $OpenBSD: dtls12_handshake_msg.c,v 1.1 2026/05/16 08:20:41 jsing Exp $ */
2/*
3 * Copyright (c) 2026 Joel Sing <jsing@openbsd.org>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#include <stdint.h>
19#include <stdlib.h>
20#include <string.h>
21
22#include "bytestring.h"
23#include "dtls12_internal.h"
24
25#define DTLS12_HANDSHAKE_MSG_HEADER_LEN 12
26#define DTLS12_HANDSHAKE_MSG_INITIAL_LEN 256
27
28#define DTLS12_HANDSHAKE_MSG_FRAGMENT_LENGTH_OFFSET 9
29
30struct dtls12_handshake_msg {
31 uint8_t msg_type;
32 uint32_t msg_len;
33 uint16_t msg_seq;
34
35 uint32_t fragment_offset;
36 uint32_t fragment_len;
37 uint8_t *fragment_data;
38 size_t fragment_data_len;
39 int fragment_pending;
40
41 uint8_t *data;
42 size_t data_len;
43
44 CBS cbs;
45 CBB cbb;
46};
47
48struct dtls12_handshake_msg *
49dtls12_handshake_msg_new(void)
50{
51 struct dtls12_handshake_msg *msg = NULL;
52
53 if ((msg = calloc(1, sizeof(struct dtls12_handshake_msg))) == NULL)
54 return NULL;
55
56 return msg;
57}
58
59void
60dtls12_handshake_msg_free(struct dtls12_handshake_msg *msg)
61{
62 if (msg == NULL)
63 return;
64
65 CBB_cleanup(&msg->cbb);
66
67 freezero(msg->data, msg->data_len);
68 freezero(msg->fragment_data, msg->fragment_data_len);
69
70 freezero(msg, sizeof(struct dtls12_handshake_msg));
71}
72
73void
74dtls12_handshake_msg_data(struct dtls12_handshake_msg *msg, CBS *cbs)
75{
76 CBS_init(cbs, msg->data, msg->data_len);
77}
78
79uint8_t
80dtls12_handshake_msg_type(struct dtls12_handshake_msg *msg)
81{
82 return msg->msg_type;
83}
84
85int
86dtls12_handshake_msg_content(struct dtls12_handshake_msg *msg, CBS *cbs)
87{
88 dtls12_handshake_msg_data(msg, cbs);
89
90 return CBS_skip(cbs, DTLS12_HANDSHAKE_MSG_HEADER_LEN);
91}
92
93int
94dtls12_handshake_msg_start(struct dtls12_handshake_msg *msg, CBB *body,
95 uint8_t msg_type, size_t msg_seq)
96{
97 msg->msg_type = msg_type;
98 msg->msg_seq = msg_seq;
99
100 msg->msg_len = 0;
101 msg->fragment_offset = 0;
102
103 if (!CBB_init(&msg->cbb, DTLS12_HANDSHAKE_MSG_INITIAL_LEN))
104 return 0;
105 if (!CBB_add_u8(&msg->cbb, msg->msg_type))
106 return 0;
107 if (!CBB_add_u24(&msg->cbb, msg->msg_len))
108 return 0;
109 if (!CBB_add_u16(&msg->cbb, msg->msg_seq))
110 return 0;
111 if (!CBB_add_u24(&msg->cbb, msg->fragment_offset))
112 return 0;
113 if (!CBB_add_u24_length_prefixed(&msg->cbb, body))
114 return 0;
115
116 return 1;
117}
118
119int
120dtls12_handshake_msg_finish(struct dtls12_handshake_msg *msg)
121{
122 CBS cbs;
123
124 if (!CBB_finish(&msg->cbb, &msg->data, &msg->data_len))
125 return 0;
126
127 /* Update message length to match fragment length. */
128 CBS_init(&cbs, msg->data, msg->data_len);
129 if (!CBS_skip(&cbs, DTLS12_HANDSHAKE_MSG_FRAGMENT_LENGTH_OFFSET))
130 return 0;
131 if (!CBS_get_u24(&cbs, &msg->msg_len))
132 return 0;
133
134 if (!CBB_init_fixed(&msg->cbb, msg->data, msg->data_len))
135 return 0;
136 if (!CBB_add_u8(&msg->cbb, msg->msg_type))
137 return 0;
138 if (!CBB_add_u24(&msg->cbb, msg->msg_len))
139 return 0;
140 if (!CBB_finish(&msg->cbb, NULL, NULL))
141 return 0;
142
143 dtls12_handshake_msg_fragment_reset(msg);
144
145 return 1;
146}
147
148int
149dtls12_handshake_msg_fragment_reset(struct dtls12_handshake_msg *msg)
150{
151 freezero(msg->fragment_data, msg->fragment_data_len);
152 msg->fragment_data = NULL;
153 msg->fragment_data_len = 0;
154
155 msg->fragment_offset = 0;
156 msg->fragment_pending = 1;
157
158 return dtls12_handshake_msg_content(msg, &msg->cbs);
159}
160
161int
162dtls12_handshake_msg_fragment_build(struct dtls12_handshake_msg *msg,
163 size_t max_fragment_len, CBS *cbs)
164{
165 CBB body;
166
167 CBS_init(cbs, NULL, 0);
168
169 if (msg->fragment_offset > msg->msg_len)
170 return 0;
171 if (msg->msg_len - msg->fragment_offset > CBS_len(&msg->cbs))
172 return 0;
173
174 freezero(msg->fragment_data, msg->fragment_data_len);
175 msg->fragment_data = NULL;
176 msg->fragment_data_len = 0;
177
178 if ((msg->fragment_len = CBS_len(&msg->cbs)) > max_fragment_len)
179 msg->fragment_len = max_fragment_len;
180
181 /* Build the fragment. */
182 if (!CBB_init(&msg->cbb, DTLS12_HANDSHAKE_MSG_INITIAL_LEN))
183 goto err;
184 if (!CBB_add_u8(&msg->cbb, msg->msg_type))
185 goto err;
186 if (!CBB_add_u24(&msg->cbb, msg->msg_len))
187 goto err;
188 if (!CBB_add_u16(&msg->cbb, msg->msg_seq))
189 goto err;
190 if (!CBB_add_u24(&msg->cbb, msg->fragment_offset))
191 goto err;
192 if (!CBB_add_u24_length_prefixed(&msg->cbb, &body))
193 goto err;
194 if (!CBB_add_bytes(&body, CBS_data(&msg->cbs), msg->fragment_len))
195 goto err;
196 if (!CBB_finish(&msg->cbb, &msg->fragment_data, &msg->fragment_data_len))
197 goto err;
198
199 CBS_init(cbs, msg->fragment_data, msg->fragment_data_len);
200
201 return 1;
202
203 err:
204 CBB_cleanup(&msg->cbb);
205
206 return 0;
207}
208
209int
210dtls12_handshake_msg_fragment_next(struct dtls12_handshake_msg *msg)
211{
212 if (msg->fragment_offset > msg->msg_len)
213 return 0;
214 if (msg->msg_len - msg->fragment_offset < msg->fragment_len)
215 return 0;
216
217 if (!CBS_skip(&msg->cbs, msg->fragment_len))
218 return 0;
219
220 msg->fragment_offset += msg->fragment_len;
221
222 msg->fragment_pending = (CBS_len(&msg->cbs) > 0);
223
224 return 1;
225}
226
227int
228dtls12_handshake_msg_fragment_pending(struct dtls12_handshake_msg *msg)
229{
230 return msg->fragment_pending;
231}
diff --git a/src/lib/libssl/dtls12_internal.h b/src/lib/libssl/dtls12_internal.h
new file mode 100644
index 0000000000..f3fa9b7490
--- /dev/null
+++ b/src/lib/libssl/dtls12_internal.h
@@ -0,0 +1,46 @@
1/* $OpenBSD: dtls12_internal.h,v 1.1 2026/05/16 08:20:41 jsing Exp $ */
2/*
3 * Copyright (c) 2026 Joel Sing <jsing@openbsd.org>
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
12 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
14 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
15 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#ifndef HEADER_DTLS12_INTERNAL_H
19#define HEADER_DTLS12_INTERNAL_H
20
21#include <stddef.h>
22#include <stdint.h>
23
24#include "bytestring.h"
25
26__BEGIN_HIDDEN_DECLS
27
28struct dtls12_handshake_msg;
29
30struct dtls12_handshake_msg *dtls12_handshake_msg_new(void);
31void dtls12_handshake_msg_free(struct dtls12_handshake_msg *msg);
32void dtls12_handshake_msg_data(struct dtls12_handshake_msg *msg, CBS *cbs);
33uint8_t dtls12_handshake_msg_type(struct dtls12_handshake_msg *msg);
34int dtls12_handshake_msg_content(struct dtls12_handshake_msg *msg, CBS *cbs);
35int dtls12_handshake_msg_start(struct dtls12_handshake_msg *msg, CBB *body,
36 uint8_t msg_type, size_t msg_seq);
37int dtls12_handshake_msg_finish(struct dtls12_handshake_msg *msg);
38int dtls12_handshake_msg_fragment_build(struct dtls12_handshake_msg *msg,
39 size_t max_fragment_len, CBS *cbs);
40int dtls12_handshake_msg_fragment_next(struct dtls12_handshake_msg *msg);
41int dtls12_handshake_msg_fragment_pending(struct dtls12_handshake_msg *msg);
42int dtls12_handshake_msg_fragment_reset(struct dtls12_handshake_msg *msg);
43
44__END_HIDDEN_DECLS
45
46#endif
diff --git a/src/lib/libssl/dtls_local.h b/src/lib/libssl/dtls_local.h
index c7c413fef4..c1ac35055a 100644
--- a/src/lib/libssl/dtls_local.h
+++ b/src/lib/libssl/dtls_local.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: dtls_local.h,v 1.2 2022/11/26 17:23:18 tb Exp $ */ 1/* $OpenBSD: dtls_local.h,v 1.9 2026/07/16 14:37:21 jsing Exp $ */
2/* 2/*
3 * DTLS implementation written by Nagendra Modadugu 3 * DTLS implementation written by Nagendra Modadugu
4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
@@ -65,6 +65,7 @@
65#include <openssl/dtls1.h> 65#include <openssl/dtls1.h>
66 66
67#include "ssl_local.h" 67#include "ssl_local.h"
68#include "dtls12_internal.h"
68#include "tls_content.h" 69#include "tls_content.h"
69 70
70__BEGIN_HIDDEN_DECLS 71__BEGIN_HIDDEN_DECLS
@@ -77,19 +78,14 @@ typedef struct dtls1_bitmap_st {
77 encoding */ 78 encoding */
78} DTLS1_BITMAP; 79} DTLS1_BITMAP;
79 80
80struct dtls1_retransmit_state {
81 SSL_SESSION *session;
82 unsigned short epoch;
83};
84
85struct hm_header_st { 81struct hm_header_st {
82 uint16_t epoch;
86 unsigned char type; 83 unsigned char type;
87 unsigned long msg_len; 84 unsigned long msg_len;
88 unsigned short seq; 85 unsigned short seq;
89 unsigned long frag_off; 86 unsigned long frag_off;
90 unsigned long frag_len; 87 unsigned long frag_len;
91 unsigned int is_ccs; 88 unsigned int is_ccs;
92 struct dtls1_retransmit_state saved_retransmit_state;
93}; 89};
94 90
95struct dtls1_timeout_st { 91struct dtls1_timeout_st {
@@ -184,13 +180,13 @@ struct dtls1_state_st {
184 180
185 unsigned int retransmitting; 181 unsigned int retransmitting;
186 unsigned int change_cipher_spec_ok; 182 unsigned int change_cipher_spec_ok;
183
184 struct dtls12_handshake_msg *hs_msg;
187}; 185};
188 186
189int dtls1_do_write(SSL *s, int type); 187int dtls1_do_write(SSL *s, int type);
190int dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek); 188int dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek);
191void dtls1_set_message_header(SSL *s, unsigned char mt, unsigned long len, 189void dtls1_set_message_header(SSL *s, unsigned char mt,
192 unsigned long frag_off, unsigned long frag_len);
193void dtls1_set_message_header_int(SSL *s, unsigned char mt,
194 unsigned long len, unsigned short seq_num, unsigned long frag_off, 190 unsigned long len, unsigned short seq_num, unsigned long frag_off,
195 unsigned long frag_len); 191 unsigned long frag_len);
196 192
@@ -202,8 +198,6 @@ int dtls1_write_bytes(SSL *s, int type, const void *buf, int len);
202 198
203int dtls1_read_failed(SSL *s, int code); 199int dtls1_read_failed(SSL *s, int code);
204int dtls1_buffer_message(SSL *s, int ccs); 200int dtls1_buffer_message(SSL *s, int ccs);
205int dtls1_retransmit_message(SSL *s, unsigned short seq,
206 unsigned long frag_off, int *found);
207int dtls1_get_queue_priority(unsigned short seq, int is_ccs); 201int dtls1_get_queue_priority(unsigned short seq, int is_ccs);
208int dtls1_retransmit_buffered_messages(SSL *s); 202int dtls1_retransmit_buffered_messages(SSL *s);
209void dtls1_clear_record_buffer(SSL *s); 203void dtls1_clear_record_buffer(SSL *s);
@@ -212,7 +206,6 @@ void dtls1_reset_read_seq_numbers(SSL *s);
212struct timeval* dtls1_get_timeout(SSL *s, struct timeval* timeleft); 206struct timeval* dtls1_get_timeout(SSL *s, struct timeval* timeleft);
213int dtls1_check_timeout_num(SSL *s); 207int dtls1_check_timeout_num(SSL *s);
214int dtls1_handle_timeout(SSL *s); 208int dtls1_handle_timeout(SSL *s);
215const SSL_CIPHER *dtls1_get_cipher(unsigned int u);
216void dtls1_start_timer(SSL *s); 209void dtls1_start_timer(SSL *s);
217void dtls1_stop_timer(SSL *s); 210void dtls1_stop_timer(SSL *s);
218int dtls1_is_timer_expired(SSL *s); 211int dtls1_is_timer_expired(SSL *s);
@@ -227,6 +220,8 @@ long dtls1_ctrl(SSL *s, int cmd, long larg, void *parg);
227int dtls1_get_message(SSL *s, int st1, int stn, int mt, long max); 220int dtls1_get_message(SSL *s, int st1, int stn, int mt, long max);
228int dtls1_get_record(SSL *s); 221int dtls1_get_record(SSL *s);
229 222
223int dtls12_ccs_built(SSL *s);
224int dtls12_handshake_msg_built(SSL *s);
230__END_HIDDEN_DECLS 225__END_HIDDEN_DECLS
231 226
232#endif /* !HEADER_DTLS_LOCL_H */ 227#endif /* !HEADER_DTLS_LOCL_H */
diff --git a/src/lib/libssl/man/Makefile b/src/lib/libssl/man/Makefile
index c8f6e28541..fa2935e5da 100644
--- a/src/lib/libssl/man/Makefile
+++ b/src/lib/libssl/man/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.77 2022/07/13 20:52:36 schwarze Exp $ 1# $OpenBSD: Makefile,v 1.78 2026/09/01 06:48:34 jsg Exp $
2 2
3.include <bsd.own.mk> 3.include <bsd.own.mk>
4 4
@@ -38,6 +38,7 @@ MAN = BIO_f_ssl.3 \
38 SSL_CTX_set_min_proto_version.3 \ 38 SSL_CTX_set_min_proto_version.3 \
39 SSL_CTX_set_mode.3 \ 39 SSL_CTX_set_mode.3 \
40 SSL_CTX_set_msg_callback.3 \ 40 SSL_CTX_set_msg_callback.3 \
41 SSL_CTX_set_num_tickets.3 \
41 SSL_CTX_set_options.3 \ 42 SSL_CTX_set_options.3 \
42 SSL_CTX_set_quiet_shutdown.3 \ 43 SSL_CTX_set_quiet_shutdown.3 \
43 SSL_CTX_set_read_ahead.3 \ 44 SSL_CTX_set_read_ahead.3 \
diff --git a/src/lib/libssl/man/SSL_CTX_sess_set_get_cb.3 b/src/lib/libssl/man/SSL_CTX_sess_set_get_cb.3
index 62a6698399..164d39bf3d 100644
--- a/src/lib/libssl/man/SSL_CTX_sess_set_get_cb.3
+++ b/src/lib/libssl/man/SSL_CTX_sess_set_get_cb.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_sess_set_get_cb.3,v 1.8 2025/06/08 22:52:00 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_sess_set_get_cb.3,v 1.9 2026/08/25 00:08:28 jsg Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -49,7 +49,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: June 8 2025 $ 52.Dd $Mdocdate: August 25 2026 $
53.Dt SSL_CTX_SESS_SET_GET_CB 3 53.Dt SSL_CTX_SESS_SET_GET_CB 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
@@ -123,7 +123,7 @@ removed by the SSL engine (because it is considered faulty or the session has
123become obsolete because of exceeding the timeout value). 123become obsolete because of exceeding the timeout value).
124.Pp 124.Pp
125.Fn SSL_CTX_sess_set_get_cb 125.Fn SSL_CTX_sess_set_get_cb
126sets the callback function which is called whenever a SSL/TLS client proposes 126sets the callback function which is called whenever an SSL/TLS client proposes
127to resume a session but the session cannot be found in the internal session 127to resume a session but the session cannot be found in the internal session
128cache (see 128cache (see
129.Xr SSL_CTX_set_session_cache_mode 3 ) . 129.Xr SSL_CTX_set_session_cache_mode 3 ) .
diff --git a/src/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3 b/src/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3
index 2e2beac850..e07c71e266 100644
--- a/src/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3
+++ b/src/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_cert_verify_callback.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_set_cert_verify_callback.3,v 1.7 2026/08/25 00:08:28 jsg Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 8 2025 $ 51.Dd $Mdocdate: August 25 2026 $
52.Dt SSL_CTX_SET_CERT_VERIFY_CALLBACK 3 52.Dt SSL_CTX_SET_CERT_VERIFY_CALLBACK 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -74,7 +74,7 @@ inherit the setting valid at the time when
74.Xr SSL_new 3 74.Xr SSL_new 3
75is called. 75is called.
76.Pp 76.Pp
77Whenever a certificate is verified during a SSL/TLS handshake, 77Whenever a certificate is verified during an SSL/TLS handshake,
78a verification function is called. 78a verification function is called.
79If the application does not explicitly specify a verification callback 79If the application does not explicitly specify a verification callback
80function, the built-in verification function is used. 80function, the built-in verification function is used.
diff --git a/src/lib/libssl/man/SSL_CTX_set_keylog_callback.3 b/src/lib/libssl/man/SSL_CTX_set_keylog_callback.3
index 0cb36b07c6..70ea0ff486 100644
--- a/src/lib/libssl/man/SSL_CTX_set_keylog_callback.3
+++ b/src/lib/libssl/man/SSL_CTX_set_keylog_callback.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_keylog_callback.3,v 1.4 2025/06/08 22:52:00 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_set_keylog_callback.3,v 1.5 2026/09/01 05:51:25 jsg Exp $
2.\" OpenSSL pod checked up to: 61f805c1 Jan 16 01:01:46 2018 +0800 2.\" OpenSSL pod checked up to: 61f805c1 Jan 16 01:01:46 2018 +0800
3.\" 3.\"
4.\" Copyright (c) 2021 Bob Beck <beck@openbsd.org> 4.\" Copyright (c) 2021 Bob Beck <beck@openbsd.org>
@@ -15,7 +15,7 @@
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\" 17.\"
18.Dd $Mdocdate: June 8 2025 $ 18.Dd $Mdocdate: September 1 2026 $
19.Dt SSL_CTX_SET_KEYLOG_CALLBACK 3 19.Dt SSL_CTX_SET_KEYLOG_CALLBACK 3
20.Os 20.Os
21.Sh NAME 21.Sh NAME
@@ -52,6 +52,6 @@ if no callback has been set.
52.Xr ssl 3 , 52.Xr ssl 3 ,
53.Xr SSL_CTX_new 3 53.Xr SSL_CTX_new 3
54.Sh HISTORY 54.Sh HISTORY
55These function first appeared in OpenSSL 1.1.1 55These functions first appeared in OpenSSL 1.1.1
56and have been available since 56and have been available since
57.Ox 7.1 . 57.Ox 7.1 .
diff --git a/src/lib/libssl/man/SSL_CTX_set_num_tickets.3 b/src/lib/libssl/man/SSL_CTX_set_num_tickets.3
index 093387725a..f5b7a9c5b3 100644
--- a/src/lib/libssl/man/SSL_CTX_set_num_tickets.3
+++ b/src/lib/libssl/man/SSL_CTX_set_num_tickets.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_num_tickets.3,v 1.3 2025/06/08 22:52:00 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_set_num_tickets.3,v 1.4 2026/09/01 05:51:25 jsg Exp $
2.\" OpenSSL pod checked up to: 5402f96a Sep 11 09:58:52 2021 +0100 2.\" OpenSSL pod checked up to: 5402f96a Sep 11 09:58:52 2021 +0100
3.\" 3.\"
4.\" Copyright (c) 2021 Bob Beck <beck@openbsd.org> 4.\" Copyright (c) 2021 Bob Beck <beck@openbsd.org>
@@ -15,7 +15,7 @@
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\" 17.\"
18.Dd $Mdocdate: June 8 2025 $ 18.Dd $Mdocdate: September 1 2026 $
19.Dt SSL_CTX_SET_NUM_TICKETS 3 19.Dt SSL_CTX_SET_NUM_TICKETS 3
20.Os 20.Os
21.Sh NAME 21.Sh NAME
@@ -59,6 +59,6 @@ return the previously set number of tickets, or 0 if it has not been set.
59.Xr ssl 3 , 59.Xr ssl 3 ,
60.Xr SSL_CTX_new 3 60.Xr SSL_CTX_new 3
61.Sh HISTORY 61.Sh HISTORY
62These function first appeared in OpenSSL 1.1.1 62These functions first appeared in OpenSSL 1.1.1
63and have been available since 63and have been available since
64.Ox 7.1 . 64.Ox 7.1 .
diff --git a/src/lib/libssl/man/SSL_CTX_set_options.3 b/src/lib/libssl/man/SSL_CTX_set_options.3
index 5e81c978bd..4f486b1945 100644
--- a/src/lib/libssl/man/SSL_CTX_set_options.3
+++ b/src/lib/libssl/man/SSL_CTX_set_options.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_options.3,v 1.17 2025/06/08 22:52:00 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_set_options.3,v 1.19 2026/07/17 12:34:25 kenjiro Exp $
2.\" full merge up to: OpenSSL 7946ab33 Dec 6 17:56:41 2015 +0100 2.\" full merge up to: OpenSSL 7946ab33 Dec 6 17:56:41 2015 +0100
3.\" selective merge up to: OpenSSL edb79c3a Mar 29 10:07:14 2017 +1000 3.\" selective merge up to: OpenSSL edb79c3a Mar 29 10:07:14 2017 +1000
4.\" 4.\"
@@ -52,7 +52,7 @@
52.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 52.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
53.\" OF THE POSSIBILITY OF SUCH DAMAGE. 53.\" OF THE POSSIBILITY OF SUCH DAMAGE.
54.\" 54.\"
55.Dd $Mdocdate: June 8 2025 $ 55.Dd $Mdocdate: July 17 2026 $
56.Dt SSL_CTX_SET_OPTIONS 3 56.Dt SSL_CTX_SET_OPTIONS 3
57.Os 57.Os
58.Sh NAME 58.Sh NAME
@@ -151,14 +151,8 @@ The following
151.Em bug workaround 151.Em bug workaround
152options are available: 152options are available:
153.Bl -tag -width Ds 153.Bl -tag -width Ds
154.It Dv SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS
155Disables a countermeasure against a TLS 1.0 protocol vulnerability
156affecting CBC ciphers, which cannot be handled by some broken SSL
157implementations.
158This option has no effect for connections using other ciphers.
159.It Dv SSL_OP_ALL 154.It Dv SSL_OP_ALL
160This is currently an alias for 155This currently does nothing.
161.Dv SSL_OP_LEGACY_SERVER_CONNECT .
162.El 156.El
163.Pp 157.Pp
164It is usually safe to use 158It is usually safe to use
@@ -179,12 +173,8 @@ When set, the server will choose following its own preferences.
179Turn on Cookie Exchange as described in RFC 4347 Section 4.2.1. 173Turn on Cookie Exchange as described in RFC 4347 Section 4.2.1.
180Only affects DTLS connections. 174Only affects DTLS connections.
181.It Dv SSL_OP_LEGACY_SERVER_CONNECT 175.It Dv SSL_OP_LEGACY_SERVER_CONNECT
182Allow legacy insecure renegotiation between OpenSSL and unpatched servers 176Allow connections to legacy servers that do not support secure renegotiation.
183.Em only : 177This option is not set by default.
184this option is currently set by default.
185See the
186.Sx SECURE RENEGOTIATION
187section for more details.
188.It Dv SSL_OP_NO_DTLSv1 178.It Dv SSL_OP_NO_DTLSv1
189Do not use the DTLSv1 protocol. 179Do not use the DTLSv1 protocol.
190Deprecated; use 180Deprecated; use
@@ -229,6 +219,7 @@ instead.
229The following options used to be supported at some point in the past 219The following options used to be supported at some point in the past
230and no longer have any effect: 220and no longer have any effect:
231.Dv SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION , 221.Dv SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION ,
222.Dv SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS ,
232.Dv SSL_OP_EPHEMERAL_RSA , 223.Dv SSL_OP_EPHEMERAL_RSA ,
233.Dv SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER , 224.Dv SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER ,
234.Dv SSL_OP_MICROSOFT_SESS_ID_BUG , 225.Dv SSL_OP_MICROSOFT_SESS_ID_BUG ,
@@ -250,83 +241,6 @@ and no longer have any effect:
250.Dv SSL_OP_TLS_D5_BUG , 241.Dv SSL_OP_TLS_D5_BUG ,
251.Dv SSL_OP_TLS_ROLLBACK_BUG , 242.Dv SSL_OP_TLS_ROLLBACK_BUG ,
252.Dv SSL_OP_TLSEXT_PADDING . 243.Dv SSL_OP_TLSEXT_PADDING .
253.Sh SECURE RENEGOTIATION
254OpenSSL 0.9.8m and later always attempts to use secure renegotiation as
255described in RFC 5746.
256This counters the prefix attack described in CVE-2009-3555 and elsewhere.
257.Pp
258This attack has far-reaching consequences which application writers should be
259aware of.
260In the description below an implementation supporting secure renegotiation is
261referred to as
262.Dq patched .
263A server not supporting secure
264renegotiation is referred to as
265.Dq unpatched .
266.Pp
267The following sections describe the operations permitted by OpenSSL's secure
268renegotiation implementation.
269.Ss Patched client and server
270Connections and renegotiation are always permitted by OpenSSL implementations.
271.Ss Unpatched client and patched OpenSSL server
272The initial connection succeeds but client renegotiation is denied by the
273server with a
274.Em no_renegotiation
275warning alert.
276.Pp
277If the patched OpenSSL server attempts to renegotiate, a fatal
278.Em handshake_failure
279alert is sent.
280This is because the server code may be unaware of the unpatched nature of the
281client.
282.Pp
283Note that a bug in OpenSSL clients earlier than 0.9.8m (all of which
284are unpatched) will result in the connection hanging if it receives a
285.Em no_renegotiation
286alert.
287OpenSSL versions 0.9.8m and later will regard a
288.Em no_renegotiation
289alert as fatal and respond with a fatal
290.Em handshake_failure
291alert.
292This is because the OpenSSL API currently has no provision to indicate to an
293application that a renegotiation attempt was refused.
294.Ss Patched OpenSSL client and unpatched server
295If the option
296.Dv SSL_OP_LEGACY_SERVER_CONNECT
297is set then initial connections and renegotiation between patched OpenSSL
298clients and unpatched servers succeeds.
299If neither option is set then initial connections to unpatched servers will
300fail.
301.Pp
302The option
303.Dv SSL_OP_LEGACY_SERVER_CONNECT
304is currently set by default even though it has security implications:
305otherwise it would be impossible to connect to unpatched servers (i.e., all of
306them initially) and this is clearly not acceptable.
307Renegotiation is permitted because this does not add any additional security
308issues: during an attack clients do not see any renegotiations anyway.
309.Pp
310As more servers become patched, the option
311.Dv SSL_OP_LEGACY_SERVER_CONNECT
312will
313.Em not
314be set by default in a future version of OpenSSL.
315.Pp
316OpenSSL client applications wishing to ensure they can connect to unpatched
317servers should always
318.Em set
319.Dv SSL_OP_LEGACY_SERVER_CONNECT .
320.Pp
321OpenSSL client applications that want to ensure they can
322.Em not
323connect to unpatched servers (and thus avoid any security issues) should always
324.Em clear
325.Dv SSL_OP_LEGACY_SERVER_CONNECT
326using
327.Fn SSL_CTX_clear_options
328or
329.Fn SSL_clear_options .
330.Sh RETURN VALUES 244.Sh RETURN VALUES
331.Fn SSL_CTX_set_options 245.Fn SSL_CTX_set_options
332and 246and
diff --git a/src/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3 b/src/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3
index 20b882167b..eafa8fc642 100644
--- a/src/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3
+++ b/src/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_CTX_set_quiet_shutdown.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $ 1.\" $OpenBSD: SSL_CTX_set_quiet_shutdown.3,v 1.8 2026/08/25 00:08:28 jsg Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 8 2025 $ 51.Dd $Mdocdate: August 25 2026 $
52.Dt SSL_CTX_SET_QUIET_SHUTDOWN 3 52.Dt SSL_CTX_SET_QUIET_SHUTDOWN 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -119,7 +119,7 @@ returns the
119setting of 119setting of
120.Fa ssl . 120.Fa ssl .
121.Pp 121.Pp
122Normally when a SSL connection is finished, the parties must send out 122Normally when an SSL connection is finished, the parties must send out
123.Dq close notify 123.Dq close notify
124alert messages using 124alert messages using
125.Xr SSL_shutdown 3 125.Xr SSL_shutdown 3
diff --git a/src/lib/libssl/man/SSL_alert_type_string.3 b/src/lib/libssl/man/SSL_alert_type_string.3
index 0f051cc0a6..9d3c03555c 100644
--- a/src/lib/libssl/man/SSL_alert_type_string.3
+++ b/src/lib/libssl/man/SSL_alert_type_string.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_alert_type_string.3,v 1.8 2025/06/08 22:52:00 schwarze Exp $ 1.\" $OpenBSD: SSL_alert_type_string.3,v 1.9 2026/06/22 14:07:17 tb Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 8 2025 $ 51.Dd $Mdocdate: June 22 2026 $
52.Dt SSL_ALERT_TYPE_STRING 3 52.Dt SSL_ALERT_TYPE_STRING 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -78,9 +78,8 @@ returns a string indicating the type of the alert specified by
78.Fa value . 78.Fa value .
79.Pp 79.Pp
80.Fn SSL_alert_desc_string 80.Fn SSL_alert_desc_string
81returns a two letter string as a short form describing the reason of the alert 81always returns the two letter string
82specified by 82.Qq !! .
83.Fa value .
84.Pp 83.Pp
85.Fn SSL_alert_desc_string_long 84.Fn SSL_alert_desc_string_long
86returns a string describing the reason of the alert specified by 85returns a string describing the reason of the alert specified by
@@ -114,9 +113,9 @@ The following strings can occur for
114or 113or
115.Fn SSL_alert_type_string_long : 114.Fn SSL_alert_type_string_long :
116.Bl -tag -width Ds 115.Bl -tag -width Ds
117.It \(dqW\(dq/\(dqwarning\(dq 116.It Qo W Qc Ns / Ns Qq warning
118.It \(dqF\(dq/\(dqfatal\(dq 117.It Qo F Qc Ns / Ns Qq fatal
119.It \(dqU\(dq/\(dqunknown\(dq 118.It Qo U Qc Ns / Ns Qq unknown
120This indicates that no support is available for this alert type. 119This indicates that no support is available for this alert type.
121Probably 120Probably
122.Fa value 121.Fa value
@@ -124,102 +123,100 @@ does not contain a correct alert message.
124.El 123.El
125.Pp 124.Pp
126The following strings can occur for 125The following strings can occur for
127.Fn SSL_alert_desc_string
128or
129.Fn SSL_alert_desc_string_long : 126.Fn SSL_alert_desc_string_long :
130.Bl -tag -width Ds 127.Bl -tag -width Ds
131.It \(dqCN\(dq/\(dqclose notify\(dq 128.It Qq close notify
132The connection shall be closed. 129The connection shall be closed.
133This is a warning alert. 130This is a warning alert.
134.It \(dqUM\(dq/\(dqunexpected message\(dq 131.It Qq unexpected message
135An inappropriate message was received. 132An inappropriate message was received.
136This alert is always fatal and should never be observed in communication 133This alert is always fatal and should never be observed in communication
137between proper implementations. 134between proper implementations.
138.It \(dqBM\(dq/\(dqbad record mac\(dq 135.It Qq bad record mac
139This alert is returned if a record is received with an incorrect MAC. 136This alert is returned if a record is received with an incorrect MAC.
140This message is always fatal. 137This message is always fatal.
141.It \(dqDF\(dq/\(dqdecompression failure\(dq 138.It Qq decompression failure
142The decompression function received improper input 139The decompression function received improper input
143(e.g., data that would expand to excessive length). 140(e.g., data that would expand to excessive length).
144This message is always fatal. 141This message is always fatal.
145.It \(dqHF\(dq/\(dqhandshake failure\(dq 142.It Qq handshake failure
146Reception of a handshake_failure alert message indicates that the sender was 143Reception of a handshake_failure alert message indicates that the sender was
147unable to negotiate an acceptable set of security parameters given the options 144unable to negotiate an acceptable set of security parameters given the options
148available. 145available.
149This is a fatal error. 146This is a fatal error.
150.It \(dqNC\(dq/\(dqno certificate\(dq 147.It Qq no certificate
151A client, that was asked to send a certificate, does not send a certificate 148A client, that was asked to send a certificate, does not send a certificate
152(SSLv3 only). 149(SSLv3 only).
153.It \(dqBC\(dq/\(dqbad certificate\(dq 150.It Qq bad certificate
154A certificate was corrupt, contained signatures that did not verify correctly, 151A certificate was corrupt, contained signatures that did not verify correctly,
155etc. 152etc.
156.It \(dqUC\(dq/\(dqunsupported certificate\(dq 153.It Qq unsupported certificate
157A certificate was of an unsupported type. 154A certificate was of an unsupported type.
158.It \(dqCR\(dq/\(dqcertificate revoked\(dq 155.It Qq certificate revoked
159A certificate was revoked by its signer. 156A certificate was revoked by its signer.
160.It \(dqCE\(dq/\(dqcertificate expired\(dq 157.It Qq certificate expired
161A certificate has expired or is not currently valid. 158A certificate has expired or is not currently valid.
162.It \(dqCU\(dq/\(dqcertificate unknown\(dq 159.It Qq certificate unknown
163Some other (unspecified) issue arose in processing the certificate, 160Some other (unspecified) issue arose in processing the certificate,
164rendering it unacceptable. 161rendering it unacceptable.
165.It \(dqIP\(dq/\(dqillegal parameter\(dq 162.It Qq illegal parameter
166A field in the handshake was out of range or inconsistent with other fields. 163A field in the handshake was out of range or inconsistent with other fields.
167This is always fatal. 164This is always fatal.
168.It \(dqDC\(dq/\(dqdecryption failed\(dq 165.It Qq decryption failed
169A TLSCiphertext decrypted in an invalid way: either it wasn't an even multiple 166A TLSCiphertext decrypted in an invalid way: either it wasn't an even multiple
170of the block length or its padding values, when checked, weren't correct. 167of the block length or its padding values, when checked, weren't correct.
171This message is always fatal. 168This message is always fatal.
172.It \(dqRO\(dq/\(dqrecord overflow\(dq 169.It Qq record overflow
173A TLSCiphertext record was received which had a length more than 170A TLSCiphertext record was received which had a length more than
1742^14+2048 bytes, or a record decrypted to a TLSCompressed record with more than 1712^14+2048 bytes, or a record decrypted to a TLSCompressed record with more than
1752^14+1024 bytes. 1722^14+1024 bytes.
176This message is always fatal. 173This message is always fatal.
177.It \(dqCA\(dq/\(dqunknown CA\(dq 174.It Qq unknown CA
178A valid certificate chain or partial chain was received, 175A valid certificate chain or partial chain was received,
179but the certificate was not accepted because the CA certificate could not be 176but the certificate was not accepted because the CA certificate could not be
180located or couldn't be matched with a known, trusted CA. 177located or couldn't be matched with a known, trusted CA.
181This message is always fatal. 178This message is always fatal.
182.It \(dqAD\(dq/\(dqaccess denied\(dq 179.It Qq access denied
183A valid certificate was received, but when access control was applied, 180A valid certificate was received, but when access control was applied,
184the sender decided not to proceed with negotiation. 181the sender decided not to proceed with negotiation.
185This message is always fatal. 182This message is always fatal.
186.It \(dqDE\(dq/\(dqdecode error\(dq 183.It Qq decode error
187A message could not be decoded because some field was out of the specified 184A message could not be decoded because some field was out of the specified
188range or the length of the message was incorrect. 185range or the length of the message was incorrect.
189This message is always fatal. 186This message is always fatal.
190.It \(dqCY\(dq/\(dqdecrypt error\(dq 187.It Qq decrypt error
191A handshake cryptographic operation failed, including being unable to correctly 188A handshake cryptographic operation failed, including being unable to correctly
192verify a signature, decrypt a key exchange, or validate a finished message. 189verify a signature, decrypt a key exchange, or validate a finished message.
193.It \(dqER\(dq/\(dqexport restriction\(dq 190.It Qq export restriction
194A negotiation not in compliance with export restrictions was detected; 191A negotiation not in compliance with export restrictions was detected;
195for example, attempting to transfer a 1024 bit ephemeral RSA key for the 192for example, attempting to transfer a 1024 bit ephemeral RSA key for the
196RSA_EXPORT handshake method. 193RSA_EXPORT handshake method.
197This message is always fatal. 194This message is always fatal.
198.It \(dqPV\(dq/\(dqprotocol version\(dq 195.It Qq protocol version
199The protocol version the client has attempted to negotiate is recognized, 196The protocol version the client has attempted to negotiate is recognized,
200but not supported. 197but not supported.
201(For example, old protocol versions might be avoided for security reasons.) 198(For example, old protocol versions might be avoided for security reasons.)
202This message is always fatal. 199This message is always fatal.
203.It \(dqIS\(dq/\(dqinsufficient security\(dq 200.It Qq insufficient security
204Returned instead of handshake_failure when a negotiation has failed 201Returned instead of handshake_failure when a negotiation has failed
205specifically because the server requires ciphers more secure than those 202specifically because the server requires ciphers more secure than those
206supported by the client. 203supported by the client.
207This message is always fatal. 204This message is always fatal.
208.It \(dqIE\(dq/\(dqinternal error\(dq 205.It Qq internal error
209An internal error unrelated to the peer or the correctness of the protocol 206An internal error unrelated to the peer or the correctness of the protocol
210makes it impossible to continue (such as a memory allocation failure). 207makes it impossible to continue (such as a memory allocation failure).
211This message is always fatal. 208This message is always fatal.
212.It \(dqIF\(dq/\(dqinappropriate fallback\(dq 209.It Qq inappropriate fallback
213Sent by a server in response to an invalid connection retry attempt from 210Sent by a server in response to an invalid connection retry attempt from
214a client (see RFC 7507). 211a client (see RFC 7507).
215.It \(dqUS\(dq/\(dquser canceled\(dq 212.It Qq user canceled
216This handshake is being canceled for some reason unrelated to a protocol 213This handshake is being canceled for some reason unrelated to a protocol
217failure. 214failure.
218If the user cancels an operation after the handshake is complete, 215If the user cancels an operation after the handshake is complete,
219just closing the connection by sending a close_notify is more appropriate. 216just closing the connection by sending a close_notify is more appropriate.
220This alert should be followed by a close_notify. 217This alert should be followed by a close_notify.
221This message is generally a warning. 218This message is generally a warning.
222.It \(dqNR\(dq/\(dqno renegotiation\(dq 219.It Qq no renegotiation
223Sent by the client in response to a hello request or by the server in response 220Sent by the client in response to a hello request or by the server in response
224to a client hello after initial handshaking. 221to a client hello after initial handshaking.
225Either of these would normally lead to renegotiation; when that is not 222Either of these would normally lead to renegotiation; when that is not
@@ -230,16 +227,16 @@ process to satisfy a request; the process might receive security parameters
230(key length, authentication, etc.) at startup and it might be difficult to 227(key length, authentication, etc.) at startup and it might be difficult to
231communicate changes to these parameters after that point. 228communicate changes to these parameters after that point.
232This message is always a warning. 229This message is always a warning.
233.It \(dqUP\(dq/\(dqunknown PSK identity\(dq 230.It Qq unknown PSK identity
234Sent by the server to indicate that it does not recognize a PSK identity or an 231Sent by the server to indicate that it does not recognize a PSK identity or an
235SRP identity. 232SRP identity.
236.It \(dqCQ\(dq/\(dqcertificate required\(dq 233.It Qq certificate required
237Sent by servers when a client certificate is desired but none was provided 234Sent by servers when a client certificate is desired but none was provided
238by the client. 235by the client.
239.It \(dqAP\(dq/\(dqno application protocol\(dq 236.It Qq no application protocol
240Sent by servers when a client ALPN extension advertises only protocols that 237Sent by servers when a client ALPN extension advertises only protocols that
241the server does not support (see RFC 7301). 238the server does not support (see RFC 7301).
242.It \(dqUK\(dq/\(dqunknown\(dq 239.It Qq unknown
243This indicates that no description is available for this alert type. 240This indicates that no description is available for this alert type.
244Probably 241Probably
245.Fa value 242.Fa value
diff --git a/src/lib/libssl/man/SSL_do_handshake.3 b/src/lib/libssl/man/SSL_do_handshake.3
index 78b41db2f4..cf104b10aa 100644
--- a/src/lib/libssl/man/SSL_do_handshake.3
+++ b/src/lib/libssl/man/SSL_do_handshake.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_do_handshake.3,v 1.7 2025/06/08 22:52:00 schwarze Exp $ 1.\" $OpenBSD: SSL_do_handshake.3,v 1.8 2026/08/25 00:08:28 jsg Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Martin Sjoegren <martin@strakt.com>. 4.\" This file was written by Martin Sjoegren <martin@strakt.com>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 8 2025 $ 51.Dd $Mdocdate: August 25 2026 $
52.Dt SSL_DO_HANDSHAKE 3 52.Dt SSL_DO_HANDSHAKE 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -61,7 +61,7 @@
61.Fn SSL_do_handshake "SSL *ssl" 61.Fn SSL_do_handshake "SSL *ssl"
62.Sh DESCRIPTION 62.Sh DESCRIPTION
63.Fn SSL_do_handshake 63.Fn SSL_do_handshake
64will wait for a SSL/TLS handshake to take place. 64will wait for an SSL/TLS handshake to take place.
65If the connection is in client mode, the handshake will be started. 65If the connection is in client mode, the handshake will be started.
66The handshake routines may have to be explicitly set in advance using either 66The handshake routines may have to be explicitly set in advance using either
67.Xr SSL_set_connect_state 3 67.Xr SSL_set_connect_state 3
diff --git a/src/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3 b/src/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3
index 234034ac2d..1b1656e097 100644
--- a/src/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3
+++ b/src/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_get_ex_data_X509_STORE_CTX_idx.3,v 1.6 2025/06/08 22:52:00 schwarze Exp $ 1.\" $OpenBSD: SSL_get_ex_data_X509_STORE_CTX_idx.3,v 1.7 2026/08/25 00:08:28 jsg Exp $
2.\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400 2.\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400
3.\" 3.\"
4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: June 8 2025 $ 51.Dd $Mdocdate: August 25 2026 $
52.Dt SSL_GET_EX_DATA_X509_STORE_CTX_IDX 3 52.Dt SSL_GET_EX_DATA_X509_STORE_CTX_IDX 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -67,7 +67,7 @@ object is stored into the
67.Vt X509_STORE_CTX 67.Vt X509_STORE_CTX
68object. 68object.
69.Pp 69.Pp
70Whenever a 70Whenever an
71.Vt X509_STORE_CTX 71.Vt X509_STORE_CTX
72object is created for the verification of the peer's certificate during a 72object is created for the verification of the peer's certificate during a
73handshake, a pointer to the 73handshake, a pointer to the
diff --git a/src/lib/libssl/man/SSL_get_finished.3 b/src/lib/libssl/man/SSL_get_finished.3
index e5c8a36cf6..bf3913f7f0 100644
--- a/src/lib/libssl/man/SSL_get_finished.3
+++ b/src/lib/libssl/man/SSL_get_finished.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_get_finished.3,v 1.3 2025/06/08 22:52:00 schwarze Exp $ 1.\" $OpenBSD: SSL_get_finished.3,v 1.5 2026/08/21 17:15:22 tb Exp $
2.\" 2.\"
3.\" Copyright (c) 2020 Theo Buehler <tb@openbsd.org> 3.\" Copyright (c) 2020 Theo Buehler <tb@openbsd.org>
4.\" 4.\"
@@ -14,7 +14,7 @@
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" 16.\"
17.Dd $Mdocdate: June 8 2025 $ 17.Dd $Mdocdate: August 21 2026 $
18.Dt SSL_GET_FINISHED 3 18.Dt SSL_GET_FINISHED 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -49,8 +49,6 @@ i.e., 64 bytes.
49.\" which is currently either 32 bytes for SHA-256 or 48 bytes for SHA-384. 49.\" which is currently either 32 bytes for SHA-256 or 48 bytes for SHA-384.
50.\" In TLSv1.2 the length defaults to 12 bytes, but it can explicitly be 50.\" In TLSv1.2 the length defaults to 12 bytes, but it can explicitly be
51.\" specified by the ciphersuite to be longer. 51.\" specified by the ciphersuite to be longer.
52.\" In TLS versions 1.1 and 1.0, the finished message has a fixed length
53.\" of 12 bytes.
54.Sh RETURN VALUES 52.Sh RETURN VALUES
55.Fn SSL_get_finished 53.Fn SSL_get_finished
56and 54and
@@ -64,8 +62,8 @@ finished message.
64.Xr SSL_get_session 3 , 62.Xr SSL_get_session 3 ,
65.Xr SSL_set_session 3 63.Xr SSL_set_session 3
66.Sh STANDARDS 64.Sh STANDARDS
67RFC 8446: The Transport Layer Security (TLS) Protocol Version 1.3, 65RFC 9846: The Transport Layer Security (TLS) Protocol Version 1.3,
68section 4.4.4: Finished. 66section 4.5.3: Finished.
69.Pp 67.Pp
70RFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2, 68RFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2,
71section 7.4.9: Finished. 69section 7.4.9: Finished.
diff --git a/src/lib/libssl/man/SSL_read_early_data.3 b/src/lib/libssl/man/SSL_read_early_data.3
index d36b1e49f7..5ad0dc1d9d 100644
--- a/src/lib/libssl/man/SSL_read_early_data.3
+++ b/src/lib/libssl/man/SSL_read_early_data.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: SSL_read_early_data.3,v 1.5 2025/06/08 22:52:00 schwarze Exp $ 1.\" $OpenBSD: SSL_read_early_data.3,v 1.6 2026/08/21 17:15:22 tb Exp $
2.\" content checked up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200 2.\" content checked up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200
3.\" 3.\"
4.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> 4.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org>
@@ -15,7 +15,7 @@
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\" 17.\"
18.Dd $Mdocdate: June 8 2025 $ 18.Dd $Mdocdate: August 21 2026 $
19.Dt SSL_READ_EARLY_DATA 3 19.Dt SSL_READ_EARLY_DATA 3
20.Os 20.Os
21.Sh NAME 21.Sh NAME
@@ -158,15 +158,15 @@ or
158.Xr SSL_read 3 , 158.Xr SSL_read 3 ,
159.Xr SSL_write 3 159.Xr SSL_write 3
160.Sh STANDARDS 160.Sh STANDARDS
161RFC 8446: The Transport Layer Security (TLS) Protocol Version 1.3: 161RFC 9846: The Transport Layer Security (TLS) Protocol Version 1.3:
162.Bl -tag -width "section 4.2.10" -compact 162.Bl -tag -width "section 4.3.10" -compact
163.It Section 2.3 163.It Section 2.3
1640-RTT data 1640-RTT data
165.It Section 4.2.10 165.It Section 4.3.10
166Early Data Indication 166Early Data Indication
167.It Section 8 167.It Section 8
1680-RTT and Anti-Replay 1680-RTT and Anti-Replay
169.It Appendix E.5 169.It Appendix F.5
170Replay Attacks on 0-RTT 170Replay Attacks on 0-RTT
171.El 171.El
172.Sh HISTORY 172.Sh HISTORY
diff --git a/src/lib/libssl/s3_lib.c b/src/lib/libssl/s3_lib.c
index bcf26bec40..9a5e8cd2cc 100644
--- a/src/lib/libssl/s3_lib.c
+++ b/src/lib/libssl/s3_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s3_lib.c,v 1.258 2025/12/04 21:16:17 beck Exp $ */ 1/* $OpenBSD: s3_lib.c,v 1.262 2026/08/21 17:15:22 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 *
@@ -722,7 +722,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
722 722
723#ifdef LIBRESSL_HAS_TLS1_3 723#ifdef LIBRESSL_HAS_TLS1_3
724 /* 724 /*
725 * TLSv1.3 cipher suites (RFC 8446). 725 * TLSv1.3 cipher suites (RFC 9846).
726 */ 726 */
727 { 727 {
728 .value = 0x1301, 728 .value = 0x1301,
@@ -1163,13 +1163,6 @@ ssl3_pending(const SSL *s)
1163} 1163}
1164 1164
1165int 1165int
1166ssl3_handshake_msg_hdr_len(SSL *s)
1167{
1168 return (SSL_is_dtls(s) ? DTLS1_HM_HEADER_LENGTH :
1169 SSL3_HM_HEADER_LENGTH);
1170}
1171
1172int
1173ssl3_handshake_msg_start(SSL *s, CBB *handshake, CBB *body, uint8_t msg_type) 1166ssl3_handshake_msg_start(SSL *s, CBB *handshake, CBB *body, uint8_t msg_type)
1174{ 1167{
1175 int ret = 0; 1168 int ret = 0;
@@ -1216,18 +1209,8 @@ ssl3_handshake_msg_finish(SSL *s, CBB *handshake)
1216 s->init_off = 0; 1209 s->init_off = 0;
1217 1210
1218 if (SSL_is_dtls(s)) { 1211 if (SSL_is_dtls(s)) {
1219 unsigned long len; 1212 if (!dtls12_handshake_msg_built(s))
1220 uint8_t msg_type;
1221 CBS cbs;
1222
1223 CBS_init(&cbs, data, outlen);
1224 if (!CBS_get_u8(&cbs, &msg_type))
1225 goto err; 1213 goto err;
1226
1227 len = outlen - ssl3_handshake_msg_hdr_len(s);
1228
1229 dtls1_set_message_header(s, msg_type, len, 0, len);
1230 dtls1_buffer_message(s, 0);
1231 } 1214 }
1232 1215
1233 ret = 1; 1216 ret = 1;
@@ -1396,7 +1379,7 @@ ssl3_clear(SSL *s)
1396 s->s3->hs.state = SSL_ST_BEFORE|((s->server) ? SSL_ST_ACCEPT : SSL_ST_CONNECT); 1379 s->s3->hs.state = SSL_ST_BEFORE|((s->server) ? SSL_ST_ACCEPT : SSL_ST_CONNECT);
1397} 1380}
1398 1381
1399long 1382static long
1400_SSL_get_shared_group(SSL *s, long n) 1383_SSL_get_shared_group(SSL *s, long n)
1401{ 1384{
1402 size_t count; 1385 size_t count;
@@ -1429,7 +1412,7 @@ _SSL_get_shared_group(SSL *s, long n)
1429 return nid; 1412 return nid;
1430} 1413}
1431 1414
1432long 1415static long
1433_SSL_get_peer_tmp_key(SSL *s, EVP_PKEY **key) 1416_SSL_get_peer_tmp_key(SSL *s, EVP_PKEY **key)
1434{ 1417{
1435 EVP_PKEY *pkey = NULL; 1418 EVP_PKEY *pkey = NULL;
diff --git a/src/lib/libssl/ssl.h b/src/lib/libssl/ssl.h
index 4ad73af722..28ee7f56bc 100644
--- a/src/lib/libssl/ssl.h
+++ b/src/lib/libssl/ssl.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl.h,v 1.250 2026/04/03 13:11:00 jsing Exp $ */ 1/* $OpenBSD: ssl.h,v 1.251 2026/06/14 14:25:55 jsing 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 *
@@ -402,8 +402,7 @@ typedef int (*tls_session_secret_cb_fn)(SSL *s, void *secret, int *secret_len,
402#define SSL_OP_NO_DTLSv1_2 0x80000000L 402#define SSL_OP_NO_DTLSv1_2 0x80000000L
403 403
404/* SSL_OP_ALL: various bug workarounds that should be rather harmless. */ 404/* SSL_OP_ALL: various bug workarounds that should be rather harmless. */
405#define SSL_OP_ALL \ 405#define SSL_OP_ALL 0x0
406 (SSL_OP_LEGACY_SERVER_CONNECT)
407 406
408/* Obsolete flags kept for compatibility. No sane code should use them. */ 407/* Obsolete flags kept for compatibility. No sane code should use them. */
409#define SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION 0x0 408#define SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION 0x0
diff --git a/src/lib/libssl/ssl_clnt.c b/src/lib/libssl/ssl_clnt.c
index 6ef81a1706..37684aba91 100644
--- a/src/lib/libssl/ssl_clnt.c
+++ b/src/lib/libssl/ssl_clnt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_clnt.c,v 1.171 2026/04/03 12:58:19 jsing Exp $ */ 1/* $OpenBSD: ssl_clnt.c,v 1.177 2026/08/29 08:41: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 *
@@ -893,7 +893,7 @@ ssl3_get_server_hello(SSL *s)
893 if (s->s3->hs.our_max_tls_version >= TLS1_2_VERSION && 893 if (s->s3->hs.our_max_tls_version >= TLS1_2_VERSION &&
894 s->s3->hs.negotiated_tls_version < s->s3->hs.our_max_tls_version) { 894 s->s3->hs.negotiated_tls_version < s->s3->hs.our_max_tls_version) {
895 /* 895 /*
896 * RFC 8446 section 4.1.3. We must not downgrade if the server 896 * RFC 9846 section 4.2.3. We must not downgrade if the server
897 * random value contains the TLS 1.2 or TLS 1.1 magical value. 897 * random value contains the TLS 1.2 or TLS 1.1 magical value.
898 */ 898 */
899 if (!CBS_skip(&server_random, 899 if (!CBS_skip(&server_random,
@@ -1003,16 +1003,17 @@ ssl3_get_server_hello(SSL *s)
1003 goto fatal_err; 1003 goto fatal_err;
1004 } 1004 }
1005 1005
1006 /* TLS v1.2 only ciphersuites require v1.2 or later. */ 1006 if (!ssl_cipher_in_list(SSL_get_ciphers(s), cipher)) {
1007 if ((cipher->algorithm_ssl & SSL_TLSV1_2) && 1007 /* we did not say we would use this cipher */
1008 s->s3->hs.negotiated_tls_version < TLS1_2_VERSION) {
1009 al = SSL_AD_ILLEGAL_PARAMETER; 1008 al = SSL_AD_ILLEGAL_PARAMETER;
1010 SSLerror(s, SSL_R_WRONG_CIPHER_RETURNED); 1009 SSLerror(s, SSL_R_WRONG_CIPHER_RETURNED);
1011 goto fatal_err; 1010 goto fatal_err;
1012 } 1011 }
1013 1012
1014 if (!ssl_cipher_in_list(SSL_get_ciphers(s), cipher)) { 1013 /* Require a ciphersuite that can be used with TLSv1.2. */
1015 /* we did not say we would use this cipher */ 1014 if (cipher->algorithm_ssl != SSL_SSLV3 &&
1015 cipher->algorithm_ssl != SSL_TLSV1 &&
1016 cipher->algorithm_ssl != SSL_TLSV1_2) {
1016 al = SSL_AD_ILLEGAL_PARAMETER; 1017 al = SSL_AD_ILLEGAL_PARAMETER;
1017 SSLerror(s, SSL_R_WRONG_CIPHER_RETURNED); 1018 SSLerror(s, SSL_R_WRONG_CIPHER_RETURNED);
1018 goto fatal_err; 1019 goto fatal_err;
@@ -1034,13 +1035,6 @@ ssl3_get_server_hello(SSL *s)
1034 if (!tls1_transcript_hash_init(s)) 1035 if (!tls1_transcript_hash_init(s))
1035 goto err; 1036 goto err;
1036 1037
1037 /*
1038 * Don't digest cached records if no sigalgs: we may need them for
1039 * client authentication.
1040 */
1041 if (!SSL_USE_SIGALGS(s))
1042 tls1_transcript_free(s);
1043
1044 if (!CBS_get_u8(&cbs, &compression_method)) 1038 if (!CBS_get_u8(&cbs, &compression_method))
1045 goto decode_err; 1039 goto decode_err;
1046 1040
@@ -1384,10 +1378,9 @@ ssl3_get_server_key_exchange(SSL *s)
1384 goto fatal_err; 1378 goto fatal_err;
1385 } 1379 }
1386 1380
1387 if (SSL_USE_SIGALGS(s)) { 1381 if (!CBS_get_u16(&cbs, &sigalg_value))
1388 if (!CBS_get_u16(&cbs, &sigalg_value)) 1382 goto decode_err;
1389 goto decode_err; 1383
1390 }
1391 if (!CBS_get_u16_length_prefixed(&cbs, &signature)) 1384 if (!CBS_get_u16_length_prefixed(&cbs, &signature))
1392 goto decode_err; 1385 goto decode_err;
1393 if (CBS_len(&signature) > EVP_PKEY_size(pkey)) { 1386 if (CBS_len(&signature) > EVP_PKEY_size(pkey)) {
@@ -1448,7 +1441,7 @@ ssl3_get_server_key_exchange(SSL *s)
1448static int 1441static int
1449ssl3_get_certificate_request(SSL *s) 1442ssl3_get_certificate_request(SSL *s)
1450{ 1443{
1451 CBS cert_request, cert_types, rdn_list; 1444 CBS cert_request, cert_types, rdn_list, sigalgs;
1452 X509_NAME *xn = NULL; 1445 X509_NAME *xn = NULL;
1453 const unsigned char *q; 1446 const unsigned char *q;
1454 STACK_OF(X509_NAME) *ca_sk = NULL; 1447 STACK_OF(X509_NAME) *ca_sk = NULL;
@@ -1497,27 +1490,23 @@ ssl3_get_certificate_request(SSL *s)
1497 if (!CBS_get_u8_length_prefixed(&cert_request, &cert_types)) 1490 if (!CBS_get_u8_length_prefixed(&cert_request, &cert_types))
1498 goto decode_err; 1491 goto decode_err;
1499 1492
1500 if (SSL_USE_SIGALGS(s)) { 1493 if (CBS_len(&cert_request) < 2) {
1501 CBS sigalgs; 1494 SSLerror(s, SSL_R_DATA_LENGTH_TOO_LONG);
1502 1495 goto err;
1503 if (CBS_len(&cert_request) < 2) { 1496 }
1504 SSLerror(s, SSL_R_DATA_LENGTH_TOO_LONG); 1497 if (!CBS_get_u16_length_prefixed(&cert_request, &sigalgs)) {
1505 goto err; 1498 ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_DECODE_ERROR);
1506 } 1499 SSLerror(s, SSL_R_DATA_LENGTH_TOO_LONG);
1507 if (!CBS_get_u16_length_prefixed(&cert_request, &sigalgs)) { 1500 goto err;
1508 ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_DECODE_ERROR); 1501 }
1509 SSLerror(s, SSL_R_DATA_LENGTH_TOO_LONG); 1502 if (CBS_len(&sigalgs) % 2 != 0 || CBS_len(&sigalgs) > 64) {
1510 goto err; 1503 ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_DECODE_ERROR);
1511 } 1504 SSLerror(s, SSL_R_SIGNATURE_ALGORITHMS_ERROR);
1512 if (CBS_len(&sigalgs) % 2 != 0 || CBS_len(&sigalgs) > 64) { 1505 goto err;
1513 ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_DECODE_ERROR);
1514 SSLerror(s, SSL_R_SIGNATURE_ALGORITHMS_ERROR);
1515 goto err;
1516 }
1517 if (!CBS_stow(&sigalgs, &s->s3->hs.sigalgs,
1518 &s->s3->hs.sigalgs_len))
1519 goto err;
1520 } 1506 }
1507 if (!CBS_stow(&sigalgs, &s->s3->hs.sigalgs,
1508 &s->s3->hs.sigalgs_len))
1509 goto err;
1521 1510
1522 /* get the CA RDNs */ 1511 /* get the CA RDNs */
1523 if (CBS_len(&cert_request) < 2) { 1512 if (CBS_len(&cert_request) < 2) {
@@ -2035,77 +2024,6 @@ ssl3_send_client_verify_sigalgs(SSL *s, EVP_PKEY *pkey,
2035} 2024}
2036 2025
2037static int 2026static int
2038ssl3_send_client_verify_rsa(SSL *s, EVP_PKEY *pkey, CBB *cert_verify)
2039{
2040 CBB cbb_signature;
2041 RSA *rsa;
2042 unsigned char data[EVP_MAX_MD_SIZE];
2043 unsigned char *signature = NULL;
2044 unsigned int signature_len;
2045 size_t data_len;
2046 int ret = 0;
2047
2048 if (!tls1_transcript_hash_value(s, data, sizeof(data), &data_len))
2049 goto err;
2050 if ((signature = calloc(1, EVP_PKEY_size(pkey))) == NULL)
2051 goto err;
2052 if ((rsa = EVP_PKEY_get0_RSA(pkey)) == NULL)
2053 goto err;
2054 if (RSA_sign(NID_md5_sha1, data, data_len, signature, &signature_len,
2055 rsa) <= 0 ) {
2056 SSLerror(s, ERR_R_RSA_LIB);
2057 goto err;
2058 }
2059
2060 if (!CBB_add_u16_length_prefixed(cert_verify, &cbb_signature))
2061 goto err;
2062 if (!CBB_add_bytes(&cbb_signature, signature, signature_len))
2063 goto err;
2064 if (!CBB_flush(cert_verify))
2065 goto err;
2066
2067 ret = 1;
2068 err:
2069 free(signature);
2070 return ret;
2071}
2072
2073static int
2074ssl3_send_client_verify_ec(SSL *s, EVP_PKEY *pkey, CBB *cert_verify)
2075{
2076 CBB cbb_signature;
2077 EC_KEY *eckey;
2078 unsigned char data[EVP_MAX_MD_SIZE];
2079 unsigned char *signature = NULL;
2080 unsigned int signature_len;
2081 int ret = 0;
2082
2083 if (!tls1_transcript_hash_value(s, data, sizeof(data), NULL))
2084 goto err;
2085 if ((signature = calloc(1, EVP_PKEY_size(pkey))) == NULL)
2086 goto err;
2087 if ((eckey = EVP_PKEY_get0_EC_KEY(pkey)) == NULL)
2088 goto err;
2089 if (!ECDSA_sign(0, &data[MD5_DIGEST_LENGTH], SHA_DIGEST_LENGTH,
2090 signature, &signature_len, eckey)) {
2091 SSLerror(s, ERR_R_ECDSA_LIB);
2092 goto err;
2093 }
2094
2095 if (!CBB_add_u16_length_prefixed(cert_verify, &cbb_signature))
2096 goto err;
2097 if (!CBB_add_bytes(&cbb_signature, signature, signature_len))
2098 goto err;
2099 if (!CBB_flush(cert_verify))
2100 goto err;
2101
2102 ret = 1;
2103 err:
2104 free(signature);
2105 return ret;
2106}
2107
2108static int
2109ssl3_send_client_verify(SSL *s) 2027ssl3_send_client_verify(SSL *s)
2110{ 2028{
2111 const struct ssl_sigalg *sigalg; 2029 const struct ssl_sigalg *sigalg;
@@ -2130,20 +2048,9 @@ ssl3_send_client_verify(SSL *s)
2130 * For TLS v1.2 send signature algorithm and signature using 2048 * For TLS v1.2 send signature algorithm and signature using
2131 * agreed digest and cached handshake records. 2049 * agreed digest and cached handshake records.
2132 */ 2050 */
2133 if (SSL_USE_SIGALGS(s)) { 2051 if (!ssl3_send_client_verify_sigalgs(s, pkey, sigalg,
2134 if (!ssl3_send_client_verify_sigalgs(s, pkey, sigalg, 2052 &cert_verify))
2135 &cert_verify))
2136 goto err;
2137 } else if (EVP_PKEY_id(pkey) == EVP_PKEY_RSA) {
2138 if (!ssl3_send_client_verify_rsa(s, pkey, &cert_verify))
2139 goto err;
2140 } else if (EVP_PKEY_id(pkey) == EVP_PKEY_EC) {
2141 if (!ssl3_send_client_verify_ec(s, pkey, &cert_verify))
2142 goto err;
2143 } else {
2144 SSLerror(s, ERR_R_INTERNAL_ERROR);
2145 goto err; 2053 goto err;
2146 }
2147 2054
2148 tls1_transcript_free(s); 2055 tls1_transcript_free(s);
2149 2056
@@ -2352,11 +2259,8 @@ ssl3_send_client_change_cipher_spec(SSL *s)
2352 s->init_off = 0; 2259 s->init_off = 0;
2353 2260
2354 if (SSL_is_dtls(s)) { 2261 if (SSL_is_dtls(s)) {
2355 s->d1->handshake_write_seq = 2262 if (!dtls12_ccs_built(s))
2356 s->d1->next_handshake_write_seq; 2263 goto err;
2357 dtls1_set_message_header_int(s, SSL3_MT_CCS, 0,
2358 s->d1->handshake_write_seq, 0, 0);
2359 dtls1_buffer_message(s, 1);
2360 } 2264 }
2361 2265
2362 s->s3->hs.state = SSL3_ST_CW_CHANGE_B; 2266 s->s3->hs.state = SSL3_ST_CW_CHANGE_B;
@@ -2444,7 +2348,8 @@ ssl3_get_server_finished(SSL *s)
2444 goto fatal_err; 2348 goto fatal_err;
2445 } 2349 }
2446 2350
2447 if (!CBS_mem_equal(&cbs, s->s3->hs.peer_finished, CBS_len(&cbs))) { 2351 if (!CBS_mem_equal(&cbs,
2352 s->s3->hs.peer_finished, s->s3->hs.peer_finished_len)) {
2448 al = SSL_AD_DECRYPT_ERROR; 2353 al = SSL_AD_DECRYPT_ERROR;
2449 SSLerror(s, SSL_R_DIGEST_CHECK_FAILED); 2354 SSLerror(s, SSL_R_DIGEST_CHECK_FAILED);
2450 goto fatal_err; 2355 goto fatal_err;
diff --git a/src/lib/libssl/ssl_kex.c b/src/lib/libssl/ssl_kex.c
index fa420a35a3..a7d02892bc 100644
--- a/src/lib/libssl/ssl_kex.c
+++ b/src/lib/libssl/ssl_kex.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_kex.c,v 1.12 2023/07/28 16:02:34 tb Exp $ */ 1/* $OpenBSD: ssl_kex.c,v 1.15 2026/06/08 11:52:43 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2020, 2021 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2020, 2021 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -24,6 +24,7 @@
24#include <openssl/objects.h> 24#include <openssl/objects.h>
25 25
26#include "bytestring.h" 26#include "bytestring.h"
27#include "ssl_local.h"
27 28
28#define DHE_MINIMUM_BITS 1024 29#define DHE_MINIMUM_BITS 1024
29 30
@@ -354,13 +355,32 @@ ssl_kex_public_ecdhe_ecp(EC_KEY *ecdh, CBB *cbb)
354 return ret; 355 return ret;
355} 356}
356 357
358#define EC_POINT_UNCOMPRESSED 0x04
359#define EC_POINT_CONVERSION_MASK 0x06
360
357int 361int
358ssl_kex_peer_public_ecdhe_ecp(EC_KEY *ecdh, int nid, CBS *cbs) 362ssl_kex_peer_public_ecdhe_ecp(EC_KEY *ecdh, int nid, CBS *cbs,
363 int *decode_error)
359{ 364{
360 EC_GROUP *group = NULL; 365 EC_GROUP *group = NULL;
361 EC_POINT *point = NULL; 366 EC_POINT *point = NULL;
367 uint8_t form;
362 int ret = 0; 368 int ret = 0;
363 369
370 /*
371 * Check that the peer's public key uses uncompressed encoding.
372 * This ensures that the public key is not the point at infinity
373 * and enforces correct point encoding via EC_POINT_oct2point().
374 */
375 if (!CBS_peek_u8(cbs, &form)) {
376 *decode_error = 1;
377 goto err;
378 }
379 if ((form & EC_POINT_CONVERSION_MASK) != EC_POINT_UNCOMPRESSED) {
380 *decode_error = 1;
381 goto err;
382 }
383
364 if ((group = EC_GROUP_new_by_curve_name(nid)) == NULL) 384 if ((group = EC_GROUP_new_by_curve_name(nid)) == NULL)
365 goto err; 385 goto err;
366 386
@@ -370,8 +390,10 @@ ssl_kex_peer_public_ecdhe_ecp(EC_KEY *ecdh, int nid, CBS *cbs)
370 if ((point = EC_POINT_new(group)) == NULL) 390 if ((point = EC_POINT_new(group)) == NULL)
371 goto err; 391 goto err;
372 if (EC_POINT_oct2point(group, point, CBS_data(cbs), CBS_len(cbs), 392 if (EC_POINT_oct2point(group, point, CBS_data(cbs), CBS_len(cbs),
373 NULL) == 0) 393 NULL) == 0) {
394 *decode_error = 1;
374 goto err; 395 goto err;
396 }
375 if (!EC_KEY_set_public_key(ecdh, point)) 397 if (!EC_KEY_set_public_key(ecdh, point))
376 goto err; 398 goto err;
377 399
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c
index 630724e670..23757caef3 100644
--- a/src/lib/libssl/ssl_lib.c
+++ b/src/lib/libssl/ssl_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_lib.c,v 1.333 2025/06/09 10:14:38 tb Exp $ */ 1/* $OpenBSD: ssl_lib.c,v 1.336 2026/08/14 06:44:53 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 *
@@ -752,7 +752,6 @@ SSL_set_rfd(SSL *s, int fd)
752} 752}
753LSSL_ALIAS(SSL_set_rfd); 753LSSL_ALIAS(SSL_set_rfd);
754 754
755
756/* return length of latest Finished message we sent, copy to 'buf' */ 755/* return length of latest Finished message we sent, copy to 'buf' */
757size_t 756size_t
758SSL_get_finished(const SSL *s, void *buf, size_t count) 757SSL_get_finished(const SSL *s, void *buf, size_t count)
@@ -781,7 +780,6 @@ SSL_get_peer_finished(const SSL *s, void *buf, size_t count)
781} 780}
782LSSL_ALIAS(SSL_get_peer_finished); 781LSSL_ALIAS(SSL_get_peer_finished);
783 782
784
785int 783int
786SSL_get_verify_mode(const SSL *s) 784SSL_get_verify_mode(const SSL *s)
787{ 785{
@@ -2169,7 +2167,7 @@ SSL_CTX_new(const SSL_METHOD *meth)
2169 2167
2170 ret->max_send_fragment = SSL3_RT_MAX_PLAIN_LENGTH; 2168 ret->max_send_fragment = SSL3_RT_MAX_PLAIN_LENGTH;
2171 2169
2172 ret->tlsext_servername_callback = 0; 2170 ret->tlsext_servername_callback = NULL;
2173 ret->tlsext_servername_arg = NULL; 2171 ret->tlsext_servername_arg = NULL;
2174 2172
2175 /* Setup RFC4507 ticket keys */ 2173 /* Setup RFC4507 ticket keys */
@@ -2177,14 +2175,10 @@ SSL_CTX_new(const SSL_METHOD *meth)
2177 arc4random_buf(ret->tlsext_tick_hmac_key, 16); 2175 arc4random_buf(ret->tlsext_tick_hmac_key, 16);
2178 arc4random_buf(ret->tlsext_tick_aes_key, 16); 2176 arc4random_buf(ret->tlsext_tick_aes_key, 16);
2179 2177
2180 ret->tlsext_status_cb = 0; 2178 ret->tlsext_status_cb = NULL;
2181 ret->tlsext_status_arg = NULL; 2179 ret->tlsext_status_arg = NULL;
2182 2180
2183 /* 2181 ret->options = 0;
2184 * Default is to connect to non-RI servers. When RI is more widely
2185 * deployed might change this.
2186 */
2187 ret->options |= SSL_OP_LEGACY_SERVER_CONNECT;
2188 2182
2189 return (ret); 2183 return (ret);
2190 err: 2184 err:
@@ -3498,7 +3492,6 @@ SSL_set_tmp_ecdh_callback(SSL *ssl, EC_KEY *(*ecdh)(SSL *ssl, int is_export,
3498} 3492}
3499LSSL_ALIAS(SSL_set_tmp_ecdh_callback); 3493LSSL_ALIAS(SSL_set_tmp_ecdh_callback);
3500 3494
3501
3502void 3495void
3503SSL_CTX_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p, int version, 3496SSL_CTX_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p, int version,
3504 int content_type, const void *buf, size_t len, SSL *ssl, void *arg)) 3497 int content_type, const void *buf, size_t len, SSL *ssl, void *arg))
@@ -3570,6 +3563,7 @@ SSL_set_min_proto_version(SSL *ssl, uint16_t version)
3570 &ssl->min_proto_version); 3563 &ssl->min_proto_version);
3571} 3564}
3572LSSL_ALIAS(SSL_set_min_proto_version); 3565LSSL_ALIAS(SSL_set_min_proto_version);
3566
3573int 3567int
3574SSL_get_max_proto_version(SSL *ssl) 3568SSL_get_max_proto_version(SSL *ssl)
3575{ 3569{
diff --git a/src/lib/libssl/ssl_local.h b/src/lib/libssl/ssl_local.h
index 6484c8dea3..67ca4a5511 100644
--- a/src/lib/libssl/ssl_local.h
+++ b/src/lib/libssl/ssl_local.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_local.h,v 1.37 2026/04/03 13:11:00 jsing Exp $ */ 1/* $OpenBSD: ssl_local.h,v 1.43 2026/08/21 17:15:22 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 *
@@ -263,10 +263,6 @@ __BEGIN_HIDDEN_DECLS
263 */ 263 */
264#define SSL_C_PKEYLENGTH(c) 1024 264#define SSL_C_PKEYLENGTH(c) 1024
265 265
266/* See if we use signature algorithms extension. */
267#define SSL_USE_SIGALGS(s) \
268 (s->method->enc_flags & SSL_ENC_FLAG_SIGALGS)
269
270/* Allow TLS 1.2 ciphersuites: applies to DTLS 1.2 as well as TLS 1.2. */ 266/* Allow TLS 1.2 ciphersuites: applies to DTLS 1.2 as well as TLS 1.2. */
271#define SSL_USE_TLS1_2_CIPHERS(s) \ 267#define SSL_USE_TLS1_2_CIPHERS(s) \
272 (s->method->enc_flags & SSL_ENC_FLAG_TLS1_2_CIPHERS) 268 (s->method->enc_flags & SSL_ENC_FLAG_TLS1_2_CIPHERS)
@@ -432,7 +428,7 @@ struct ssl_session_st {
432 428
433 char *tlsext_hostname; 429 char *tlsext_hostname;
434 430
435 /* Session resumption - RFC 5077 and RFC 8446. */ 431 /* Session resumption - RFC 5077 and RFC 9846. */
436 unsigned char *tlsext_tick; /* Session ticket */ 432 unsigned char *tlsext_tick; /* Session ticket */
437 size_t tlsext_ticklen; /* Session ticket length */ 433 size_t tlsext_ticklen; /* Session ticket length */
438 uint32_t tlsext_tick_lifetime_hint; /* Session lifetime hint in seconds */ 434 uint32_t tlsext_tick_lifetime_hint; /* Session lifetime hint in seconds */
@@ -1163,9 +1159,6 @@ typedef struct ssl3_state_st {
1163 * Flag values for enc_flags. 1159 * Flag values for enc_flags.
1164 */ 1160 */
1165 1161
1166/* Uses signature algorithms extension. */
1167#define SSL_ENC_FLAG_SIGALGS (1 << 1)
1168
1169/* Allow TLS 1.2 ciphersuites: applies to DTLS 1.2 as well as TLS 1.2. */ 1162/* Allow TLS 1.2 ciphersuites: applies to DTLS 1.2 as well as TLS 1.2. */
1170#define SSL_ENC_FLAG_TLS1_2_CIPHERS (1 << 4) 1163#define SSL_ENC_FLAG_TLS1_2_CIPHERS (1 << 4)
1171 1164
@@ -1174,10 +1167,8 @@ typedef struct ssl3_state_st {
1174 1167
1175#define TLSV1_ENC_FLAGS 0 1168#define TLSV1_ENC_FLAGS 0
1176#define TLSV1_1_ENC_FLAGS 0 1169#define TLSV1_1_ENC_FLAGS 0
1177#define TLSV1_2_ENC_FLAGS (SSL_ENC_FLAG_SIGALGS | \ 1170#define TLSV1_2_ENC_FLAGS SSL_ENC_FLAG_TLS1_2_CIPHERS
1178 SSL_ENC_FLAG_TLS1_2_CIPHERS) 1171#define TLSV1_3_ENC_FLAGS SSL_ENC_FLAG_TLS1_3_CIPHERS
1179#define TLSV1_3_ENC_FLAGS (SSL_ENC_FLAG_SIGALGS | \
1180 SSL_ENC_FLAG_TLS1_3_CIPHERS)
1181 1172
1182extern const SSL_CIPHER ssl3_ciphers[]; 1173extern const SSL_CIPHER ssl3_ciphers[];
1183 1174
@@ -1186,15 +1177,17 @@ int ssl_version_set_min(const SSL_METHOD *meth, uint16_t proto_ver,
1186 uint16_t max_tls_ver, uint16_t *out_tls_ver, uint16_t *out_proto_ver); 1177 uint16_t max_tls_ver, uint16_t *out_tls_ver, uint16_t *out_proto_ver);
1187int ssl_version_set_max(const SSL_METHOD *meth, uint16_t proto_ver, 1178int ssl_version_set_max(const SSL_METHOD *meth, uint16_t proto_ver,
1188 uint16_t min_tls_ver, uint16_t *out_tls_ver, uint16_t *out_proto_ver); 1179 uint16_t min_tls_ver, uint16_t *out_tls_ver, uint16_t *out_proto_ver);
1189int ssl_enabled_tls_version_range(SSL *s, uint16_t *min_ver, uint16_t *max_ver); 1180int ssl_enabled_tls_version_range(const SSL *s, uint16_t *min_ver,
1190int ssl_supported_tls_version_range(SSL *s, uint16_t *min_ver, uint16_t *max_ver); 1181 uint16_t *max_ver);
1182int ssl_supported_tls_version_range(const SSL *s, uint16_t *min_ver,
1183 uint16_t *max_ver);
1191uint16_t ssl_tls_version(uint16_t version); 1184uint16_t ssl_tls_version(uint16_t version);
1192uint16_t ssl_effective_tls_version(SSL *s); 1185uint16_t ssl_effective_tls_version(const SSL *s);
1193int ssl_max_supported_version(SSL *s, uint16_t *max_ver); 1186int ssl_max_supported_version(const SSL *s, uint16_t *max_ver);
1194int ssl_max_legacy_version(SSL *s, uint16_t *max_ver); 1187int ssl_max_legacy_version(const SSL *s, uint16_t *max_ver);
1195int ssl_max_shared_version(SSL *s, uint16_t peer_ver, uint16_t *max_ver); 1188int ssl_max_shared_version(const SSL *s, uint16_t peer_ver, uint16_t *max_ver);
1196int ssl_check_version_from_server(SSL *s, uint16_t server_version); 1189int ssl_check_version_from_server(const SSL *s, uint16_t server_version);
1197int ssl_legacy_stack_version(SSL *s, uint16_t version); 1190int ssl_legacy_stack_version(const SSL *s, uint16_t version);
1198int ssl_cipher_in_list(STACK_OF(SSL_CIPHER) *ciphers, const SSL_CIPHER *cipher); 1191int ssl_cipher_in_list(STACK_OF(SSL_CIPHER) *ciphers, const SSL_CIPHER *cipher);
1199int ssl_cipher_allowed_in_tls_version_range(const SSL_CIPHER *cipher, 1192int ssl_cipher_allowed_in_tls_version_range(const SSL_CIPHER *cipher,
1200 uint16_t min_ver, uint16_t max_ver); 1193 uint16_t min_ver, uint16_t max_ver);
@@ -1316,7 +1309,6 @@ long ssl3_callback_ctrl(SSL *s, int cmd, void (*fp)(void));
1316long ssl3_ctx_callback_ctrl(SSL_CTX *s, int cmd, void (*fp)(void)); 1309long ssl3_ctx_callback_ctrl(SSL_CTX *s, int cmd, void (*fp)(void));
1317int ssl3_pending(const SSL *s); 1310int ssl3_pending(const SSL *s);
1318 1311
1319int ssl3_handshake_msg_hdr_len(SSL *s);
1320int ssl3_handshake_msg_start(SSL *s, CBB *handshake, CBB *body, 1312int ssl3_handshake_msg_start(SSL *s, CBB *handshake, CBB *body,
1321 uint8_t msg_type); 1313 uint8_t msg_type);
1322int ssl3_handshake_msg_finish(SSL *s, CBB *handshake); 1314int ssl3_handshake_msg_finish(SSL *s, CBB *handshake);
@@ -1327,7 +1319,6 @@ int ssl3_do_change_cipher_spec(SSL *ssl);
1327 1319
1328int ssl3_packet_read(SSL *s, int plen); 1320int ssl3_packet_read(SSL *s, int plen);
1329int ssl3_packet_extend(SSL *s, int plen); 1321int ssl3_packet_extend(SSL *s, int plen);
1330int ssl_server_legacy_first_packet(SSL *s);
1331int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, 1322int ssl3_write_pending(SSL *s, int type, const unsigned char *buf,
1332 unsigned int len); 1323 unsigned int len);
1333 1324
@@ -1345,7 +1336,8 @@ int ssl_kex_derive_dhe(DH *dh, DH *dh_peer,
1345int ssl_kex_dummy_ecdhe_x25519(EVP_PKEY *pkey); 1336int ssl_kex_dummy_ecdhe_x25519(EVP_PKEY *pkey);
1346int ssl_kex_generate_ecdhe_ecp(EC_KEY *ecdh, int nid); 1337int ssl_kex_generate_ecdhe_ecp(EC_KEY *ecdh, int nid);
1347int ssl_kex_public_ecdhe_ecp(EC_KEY *ecdh, CBB *cbb); 1338int ssl_kex_public_ecdhe_ecp(EC_KEY *ecdh, CBB *cbb);
1348int ssl_kex_peer_public_ecdhe_ecp(EC_KEY *ecdh, int nid, CBS *cbs); 1339int ssl_kex_peer_public_ecdhe_ecp(EC_KEY *ecdh, int nid, CBS *cbs,
1340 int *decode_error);
1349int ssl_kex_derive_ecdhe_ecp(EC_KEY *ecdh, EC_KEY *ecdh_peer, 1341int ssl_kex_derive_ecdhe_ecp(EC_KEY *ecdh, EC_KEY *ecdh_peer,
1350 uint8_t **shared_key, size_t *shared_key_len); 1342 uint8_t **shared_key, size_t *shared_key_len);
1351 1343
diff --git a/src/lib/libssl/ssl_sigalgs.c b/src/lib/libssl/ssl_sigalgs.c
index ee4088f6ab..779d47985a 100644
--- a/src/lib/libssl/ssl_sigalgs.c
+++ b/src/lib/libssl/ssl_sigalgs.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_sigalgs.c,v 1.53 2026/03/30 06:20:08 tb Exp $ */ 1/* $OpenBSD: ssl_sigalgs.c,v 1.54 2026/05/31 14:34:44 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2018-2020 Bob Beck <beck@openbsd.org> 3 * Copyright (c) 2018-2020 Bob Beck <beck@openbsd.org>
4 * Copyright (c) 2021 Joel Sing <jsing@openbsd.org> 4 * Copyright (c) 2021 Joel Sing <jsing@openbsd.org>
@@ -134,12 +134,6 @@ const struct ssl_sigalg sigalgs[] = {
134 .security_level = 1, 134 .security_level = 1,
135 }, 135 },
136 { 136 {
137 .value = SIGALG_RSA_PKCS1_MD5_SHA1,
138 .key_type = EVP_PKEY_RSA,
139 .md = EVP_md5_sha1,
140 .security_level = 1,
141 },
142 {
143 .value = SIGALG_NONE, 137 .value = SIGALG_NONE,
144 }, 138 },
145}; 139};
@@ -237,9 +231,6 @@ ssl_sigalgs_build(uint16_t tls_version, CBB *cbb, int security_level)
237 231
238 /* Add values in order as long as they are supported. */ 232 /* Add values in order as long as they are supported. */
239 for (i = 0; i < len; i++) { 233 for (i = 0; i < len; i++) {
240 /* Do not allow the legacy value for < 1.2 to be used. */
241 if (values[i] == SIGALG_RSA_PKCS1_MD5_SHA1)
242 return 0;
243 if ((sigalg = ssl_sigalg_lookup(values[i])) == NULL) 234 if ((sigalg = ssl_sigalg_lookup(values[i])) == NULL)
244 return 0; 235 return 0;
245 if (sigalg->security_level < security_level) 236 if (sigalg->security_level < security_level)
@@ -262,8 +253,6 @@ ssl_sigalg_for_legacy(SSL *s, EVP_PKEY *pkey)
262 /* Default signature algorithms used for TLSv1.2 and earlier. */ 253 /* Default signature algorithms used for TLSv1.2 and earlier. */
263 switch (EVP_PKEY_id(pkey)) { 254 switch (EVP_PKEY_id(pkey)) {
264 case EVP_PKEY_RSA: 255 case EVP_PKEY_RSA:
265 if (s->s3->hs.negotiated_tls_version < TLS1_2_VERSION)
266 return ssl_sigalg_lookup(SIGALG_RSA_PKCS1_MD5_SHA1);
267 return ssl_sigalg_lookup(SIGALG_RSA_PKCS1_SHA1); 256 return ssl_sigalg_lookup(SIGALG_RSA_PKCS1_SHA1);
268 case EVP_PKEY_EC: 257 case EVP_PKEY_EC:
269 return ssl_sigalg_lookup(SIGALG_ECDSA_SHA1); 258 return ssl_sigalg_lookup(SIGALG_ECDSA_SHA1);
@@ -317,9 +306,6 @@ ssl_sigalg_select(SSL *s, EVP_PKEY *pkey)
317{ 306{
318 CBS cbs; 307 CBS cbs;
319 308
320 if (!SSL_USE_SIGALGS(s))
321 return ssl_sigalg_for_legacy(s, pkey);
322
323 /* 309 /*
324 * RFC 5246 allows a TLS 1.2 client to send no sigalgs extension, 310 * RFC 5246 allows a TLS 1.2 client to send no sigalgs extension,
325 * in which case the server must use the default. 311 * in which case the server must use the default.
@@ -353,9 +339,6 @@ ssl_sigalg_for_peer(SSL *s, EVP_PKEY *pkey, uint16_t sigalg_value)
353{ 339{
354 const struct ssl_sigalg *sigalg; 340 const struct ssl_sigalg *sigalg;
355 341
356 if (!SSL_USE_SIGALGS(s))
357 return ssl_sigalg_for_legacy(s, pkey);
358
359 if ((sigalg = ssl_sigalg_from_value(s, sigalg_value)) == NULL) { 342 if ((sigalg = ssl_sigalg_from_value(s, sigalg_value)) == NULL) {
360 SSLerror(s, SSL_R_UNKNOWN_DIGEST); 343 SSLerror(s, SSL_R_UNKNOWN_DIGEST);
361 return NULL; 344 return NULL;
diff --git a/src/lib/libssl/ssl_sigalgs.h b/src/lib/libssl/ssl_sigalgs.h
index 5211ec6b62..e435ccc287 100644
--- a/src/lib/libssl/ssl_sigalgs.h
+++ b/src/lib/libssl/ssl_sigalgs.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_sigalgs.h,v 1.27 2024/02/03 15:58:34 beck Exp $ */ 1/* $OpenBSD: ssl_sigalgs.h,v 1.29 2026/08/21 17:15:22 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2018-2019 Bob Beck <beck@openbsd.org> 3 * Copyright (c) 2018-2019 Bob Beck <beck@openbsd.org>
4 * 4 *
@@ -23,8 +23,8 @@ __BEGIN_HIDDEN_DECLS
23#define SIGALG_NONE 0x0000 23#define SIGALG_NONE 0x0000
24 24
25/* 25/*
26 * RFC 8446 Section 4.2.3 26 * RFC 9846 section 4.3.3
27 * RFC 5246 Section 7.4.1.4.1 27 * RFC 5246 section 7.4.1.4.1
28 */ 28 */
29#define SIGALG_RSA_PKCS1_SHA224 0x0301 29#define SIGALG_RSA_PKCS1_SHA224 0x0301
30#define SIGALG_RSA_PKCS1_SHA256 0x0401 30#define SIGALG_RSA_PKCS1_SHA256 0x0401
@@ -47,9 +47,6 @@ __BEGIN_HIDDEN_DECLS
47#define SIGALG_PRIVATE_START 0xFE00 47#define SIGALG_PRIVATE_START 0xFE00
48#define SIGALG_PRIVATE_END 0xFFFF 48#define SIGALG_PRIVATE_END 0xFFFF
49 49
50/* Legacy sigalg for < TLSv1.2 same value as BoringSSL uses. */
51#define SIGALG_RSA_PKCS1_MD5_SHA1 0xFF01
52
53#define SIGALG_FLAG_RSA_PSS 0x00000001 50#define SIGALG_FLAG_RSA_PSS 0x00000001
54 51
55struct ssl_sigalg { 52struct ssl_sigalg {
diff --git a/src/lib/libssl/ssl_srvr.c b/src/lib/libssl/ssl_srvr.c
index af4b20f6ce..a12f552bea 100644
--- a/src/lib/libssl/ssl_srvr.c
+++ b/src/lib/libssl/ssl_srvr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_srvr.c,v 1.168 2026/04/03 12:58:19 jsing Exp $ */ 1/* $OpenBSD: ssl_srvr.c,v 1.172 2026/08/29 08:41: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 *
@@ -568,33 +568,14 @@ ssl3_accept(SSL *s)
568 } 568 }
569 569
570 alg_k = s->s3->hs.cipher->algorithm_mkey; 570 alg_k = s->s3->hs.cipher->algorithm_mkey;
571 if (SSL_USE_SIGALGS(s)) { 571 s->s3->hs.state = SSL3_ST_SR_CERT_VRFY_A;
572 s->s3->hs.state = SSL3_ST_SR_CERT_VRFY_A; 572 s->init_num = 0;
573 s->init_num = 0; 573 if (s->session->peer_cert != NULL) {
574 if (!s->session->peer_cert)
575 break;
576 /* 574 /*
577 * Freeze the transcript for use during client 575 * Freeze the transcript for use during client
578 * certificate verification. 576 * certificate verification.
579 */ 577 */
580 tls1_transcript_freeze(s); 578 tls1_transcript_freeze(s);
581 } else {
582 s->s3->hs.state = SSL3_ST_SR_CERT_VRFY_A;
583 s->init_num = 0;
584
585 tls1_transcript_free(s);
586
587 /*
588 * We need to get hashes here so if there is
589 * a client cert, it can be verified.
590 */
591 if (!tls1_transcript_hash_value(s,
592 s->s3->hs.tls12.cert_verify,
593 sizeof(s->s3->hs.tls12.cert_verify),
594 NULL)) {
595 ret = -1;
596 goto end;
597 }
598 } 579 }
599 break; 580 break;
600 581
@@ -1046,7 +1027,7 @@ ssl3_get_client_hello(SSL *s)
1046 if (s->s3->hs.our_max_tls_version >= TLS1_2_VERSION && 1027 if (s->s3->hs.our_max_tls_version >= TLS1_2_VERSION &&
1047 s->s3->hs.negotiated_tls_version < s->s3->hs.our_max_tls_version) { 1028 s->s3->hs.negotiated_tls_version < s->s3->hs.our_max_tls_version) {
1048 /* 1029 /*
1049 * RFC 8446 section 4.1.3. If we are downgrading from TLS 1.3 1030 * RFC 9846 section 4.2.3. If we are downgrading from TLS 1.3
1050 * we must set the last 8 bytes of the server random to magical 1031 * we must set the last 8 bytes of the server random to magical
1051 * values to indicate we meant to downgrade. For TLS 1.2 it is 1032 * values to indicate we meant to downgrade. For TLS 1.2 it is
1052 * recommended that we do the same. 1033 * recommended that we do the same.
@@ -1142,7 +1123,7 @@ ssl3_get_client_hello(SSL *s)
1142 if (!tls1_transcript_hash_init(s)) 1123 if (!tls1_transcript_hash_init(s))
1143 goto err; 1124 goto err;
1144 1125
1145 if (!SSL_USE_SIGALGS(s) || !(s->verify_mode & SSL_VERIFY_PEER)) 1126 if (!(s->verify_mode & SSL_VERIFY_PEER))
1146 tls1_transcript_free(s); 1127 tls1_transcript_free(s);
1147 1128
1148 /* 1129 /*
@@ -1501,12 +1482,10 @@ ssl3_send_server_key_exchange(SSL *s)
1501 s->s3->hs.our_sigalg = sigalg; 1482 s->s3->hs.our_sigalg = sigalg;
1502 1483
1503 /* Send signature algorithm. */ 1484 /* Send signature algorithm. */
1504 if (SSL_USE_SIGALGS(s)) { 1485 if (!CBB_add_u16(&server_kex, sigalg->value)) {
1505 if (!CBB_add_u16(&server_kex, sigalg->value)) { 1486 al = SSL_AD_INTERNAL_ERROR;
1506 al = SSL_AD_INTERNAL_ERROR; 1487 SSLerror(s, ERR_R_INTERNAL_ERROR);
1507 SSLerror(s, ERR_R_INTERNAL_ERROR); 1488 goto fatal_err;
1508 goto fatal_err;
1509 }
1510 } 1489 }
1511 1490
1512 if (!EVP_DigestSignInit(md_ctx, &pctx, md, NULL, pkey)) { 1491 if (!EVP_DigestSignInit(md_ctx, &pctx, md, NULL, pkey)) {
@@ -1591,14 +1570,11 @@ ssl3_send_certificate_request(SSL *s)
1591 if (!ssl3_get_req_cert_types(s, &cert_types)) 1570 if (!ssl3_get_req_cert_types(s, &cert_types))
1592 goto err; 1571 goto err;
1593 1572
1594 if (SSL_USE_SIGALGS(s)) { 1573 if (!CBB_add_u16_length_prefixed(&cert_request, &sigalgs))
1595 if (!CBB_add_u16_length_prefixed(&cert_request, 1574 goto err;
1596 &sigalgs)) 1575 if (!ssl_sigalgs_build(s->s3->hs.negotiated_tls_version,
1597 goto err; 1576 &sigalgs, SSL_get_security_level(s)))
1598 if (!ssl_sigalgs_build(s->s3->hs.negotiated_tls_version, 1577 goto err;
1599 &sigalgs, SSL_get_security_level(s)))
1600 goto err;
1601 }
1602 1578
1603 if (!CBB_add_u16_length_prefixed(&cert_request, &cert_auth)) 1579 if (!CBB_add_u16_length_prefixed(&cert_request, &cert_auth))
1604 goto err; 1580 goto err;
@@ -1879,7 +1855,8 @@ ssl3_get_cert_verify(SSL *s)
1879 EVP_PKEY *pkey; 1855 EVP_PKEY *pkey;
1880 X509 *peer_cert = NULL; 1856 X509 *peer_cert = NULL;
1881 EVP_MD_CTX *mctx = NULL; 1857 EVP_MD_CTX *mctx = NULL;
1882 int al, verify; 1858 EVP_PKEY_CTX *pctx;
1859 int al;
1883 const unsigned char *hdata; 1860 const unsigned char *hdata;
1884 size_t hdatalen; 1861 size_t hdatalen;
1885 int type = 0; 1862 int type = 0;
@@ -1932,10 +1909,9 @@ ssl3_get_cert_verify(SSL *s)
1932 goto fatal_err; 1909 goto fatal_err;
1933 } 1910 }
1934 1911
1935 if (SSL_USE_SIGALGS(s)) { 1912 if (!CBS_get_u16(&cbs, &sigalg_value))
1936 if (!CBS_get_u16(&cbs, &sigalg_value)) 1913 goto decode_err;
1937 goto decode_err; 1914
1938 }
1939 if (!CBS_get_u16_length_prefixed(&cbs, &signature)) 1915 if (!CBS_get_u16_length_prefixed(&cbs, &signature))
1940 goto err; 1916 goto err;
1941 if (CBS_len(&cbs) != 0) { 1917 if (CBS_len(&cbs) != 0) {
@@ -1957,74 +1933,26 @@ ssl3_get_cert_verify(SSL *s)
1957 } 1933 }
1958 s->s3->hs.peer_sigalg = sigalg; 1934 s->s3->hs.peer_sigalg = sigalg;
1959 1935
1960 if (SSL_USE_SIGALGS(s)) { 1936 if (!tls1_transcript_data(s, &hdata, &hdatalen)) {
1961 EVP_PKEY_CTX *pctx;
1962
1963 if (!tls1_transcript_data(s, &hdata, &hdatalen)) {
1964 SSLerror(s, ERR_R_INTERNAL_ERROR);
1965 al = SSL_AD_INTERNAL_ERROR;
1966 goto fatal_err;
1967 }
1968 if (!EVP_DigestVerifyInit(mctx, &pctx, sigalg->md(),
1969 NULL, pkey)) {
1970 SSLerror(s, ERR_R_EVP_LIB);
1971 al = SSL_AD_INTERNAL_ERROR;
1972 goto fatal_err;
1973 }
1974 if ((sigalg->flags & SIGALG_FLAG_RSA_PSS) &&
1975 (!EVP_PKEY_CTX_set_rsa_padding(pctx,
1976 RSA_PKCS1_PSS_PADDING) ||
1977 !EVP_PKEY_CTX_set_rsa_pss_saltlen(pctx, -1))) {
1978 al = SSL_AD_INTERNAL_ERROR;
1979 goto fatal_err;
1980 }
1981 if (EVP_DigestVerify(mctx, CBS_data(&signature),
1982 CBS_len(&signature), hdata, hdatalen) <= 0) {
1983 SSLerror(s, ERR_R_EVP_LIB);
1984 al = SSL_AD_INTERNAL_ERROR;
1985 goto fatal_err;
1986 }
1987 } else if (EVP_PKEY_id(pkey) == EVP_PKEY_RSA) {
1988 RSA *rsa;
1989
1990 if ((rsa = EVP_PKEY_get0_RSA(pkey)) == NULL) {
1991 al = SSL_AD_INTERNAL_ERROR;
1992 SSLerror(s, ERR_R_EVP_LIB);
1993 goto fatal_err;
1994 }
1995 verify = RSA_verify(NID_md5_sha1, s->s3->hs.tls12.cert_verify,
1996 MD5_DIGEST_LENGTH + SHA_DIGEST_LENGTH, CBS_data(&signature),
1997 CBS_len(&signature), rsa);
1998 if (verify < 0) {
1999 al = SSL_AD_DECRYPT_ERROR;
2000 SSLerror(s, SSL_R_BAD_RSA_DECRYPT);
2001 goto fatal_err;
2002 }
2003 if (verify == 0) {
2004 al = SSL_AD_DECRYPT_ERROR;
2005 SSLerror(s, SSL_R_BAD_RSA_SIGNATURE);
2006 goto fatal_err;
2007 }
2008 } else if (EVP_PKEY_id(pkey) == EVP_PKEY_EC) {
2009 EC_KEY *eckey;
2010
2011 if ((eckey = EVP_PKEY_get0_EC_KEY(pkey)) == NULL) {
2012 al = SSL_AD_INTERNAL_ERROR;
2013 SSLerror(s, ERR_R_EVP_LIB);
2014 goto fatal_err;
2015 }
2016 verify = ECDSA_verify(0,
2017 &(s->s3->hs.tls12.cert_verify[MD5_DIGEST_LENGTH]),
2018 SHA_DIGEST_LENGTH, CBS_data(&signature),
2019 CBS_len(&signature), eckey);
2020 if (verify <= 0) {
2021 al = SSL_AD_DECRYPT_ERROR;
2022 SSLerror(s, SSL_R_BAD_ECDSA_SIGNATURE);
2023 goto fatal_err;
2024 }
2025 } else {
2026 SSLerror(s, ERR_R_INTERNAL_ERROR); 1937 SSLerror(s, ERR_R_INTERNAL_ERROR);
2027 al = SSL_AD_UNSUPPORTED_CERTIFICATE; 1938 al = SSL_AD_INTERNAL_ERROR;
1939 goto fatal_err;
1940 }
1941 if (!EVP_DigestVerifyInit(mctx, &pctx, sigalg->md(), NULL, pkey)) {
1942 SSLerror(s, ERR_R_EVP_LIB);
1943 al = SSL_AD_INTERNAL_ERROR;
1944 goto fatal_err;
1945 }
1946 if ((sigalg->flags & SIGALG_FLAG_RSA_PSS) &&
1947 (!EVP_PKEY_CTX_set_rsa_padding(pctx, RSA_PKCS1_PSS_PADDING) ||
1948 !EVP_PKEY_CTX_set_rsa_pss_saltlen(pctx, -1))) {
1949 al = SSL_AD_INTERNAL_ERROR;
1950 goto fatal_err;
1951 }
1952 if (EVP_DigestVerify(mctx, CBS_data(&signature), CBS_len(&signature),
1953 hdata, hdatalen) <= 0) {
1954 SSLerror(s, ERR_R_EVP_LIB);
1955 al = SSL_AD_INTERNAL_ERROR;
2028 goto fatal_err; 1956 goto fatal_err;
2029 } 1957 }
2030 1958
@@ -2393,11 +2321,8 @@ ssl3_send_server_change_cipher_spec(SSL *s)
2393 s->init_off = 0; 2321 s->init_off = 0;
2394 2322
2395 if (SSL_is_dtls(s)) { 2323 if (SSL_is_dtls(s)) {
2396 s->d1->handshake_write_seq = 2324 if (!dtls12_ccs_built(s))
2397 s->d1->next_handshake_write_seq; 2325 goto err;
2398 dtls1_set_message_header_int(s, SSL3_MT_CCS, 0,
2399 s->d1->handshake_write_seq, 0, 0);
2400 dtls1_buffer_message(s, 1);
2401 } 2326 }
2402 2327
2403 s->s3->hs.state = SSL3_ST_SW_CHANGE_B; 2328 s->s3->hs.state = SSL3_ST_SW_CHANGE_B;
@@ -2448,7 +2373,8 @@ ssl3_get_client_finished(SSL *s)
2448 goto fatal_err; 2373 goto fatal_err;
2449 } 2374 }
2450 2375
2451 if (!CBS_mem_equal(&cbs, s->s3->hs.peer_finished, CBS_len(&cbs))) { 2376 if (!CBS_mem_equal(&cbs,
2377 s->s3->hs.peer_finished, s->s3->hs.peer_finished_len)) {
2452 al = SSL_AD_DECRYPT_ERROR; 2378 al = SSL_AD_DECRYPT_ERROR;
2453 SSLerror(s, SSL_R_DIGEST_CHECK_FAILED); 2379 SSLerror(s, SSL_R_DIGEST_CHECK_FAILED);
2454 goto fatal_err; 2380 goto fatal_err;
diff --git a/src/lib/libssl/ssl_tlsext.c b/src/lib/libssl/ssl_tlsext.c
index d879b3304e..e3dbfd82cf 100644
--- a/src/lib/libssl/ssl_tlsext.c
+++ b/src/lib/libssl/ssl_tlsext.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_tlsext.c,v 1.159 2025/12/04 21:16:17 beck Exp $ */ 1/* $OpenBSD: ssl_tlsext.c,v 1.168 2026/08/29 05:12:51 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2016, 2017, 2019 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2016, 2017, 2019 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2017 Doug Hogan <doug@openbsd.org> 4 * Copyright (c) 2017 Doug Hogan <doug@openbsd.org>
@@ -163,28 +163,42 @@ tlsext_alpn_server_build(SSL *s, uint16_t msg_type, CBB *cbb)
163static int 163static int
164tlsext_alpn_client_process(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) 164tlsext_alpn_client_process(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
165{ 165{
166 CBS list, proto; 166 CBS server_list, supported_list;
167 CBS selected, proto;
167 168
168 if (s->alpn_client_proto_list == NULL) { 169 if (s->alpn_client_proto_list == NULL) {
169 *alert = SSL_AD_UNSUPPORTED_EXTENSION; 170 *alert = SSL_AD_UNSUPPORTED_EXTENSION;
170 return 0; 171 return 0;
171 } 172 }
172 173
173 if (!CBS_get_u16_length_prefixed(cbs, &list)) 174 if (!CBS_get_u16_length_prefixed(cbs, &server_list))
174 return 0; 175 return 0;
175 176 if (!CBS_get_u8_length_prefixed(&server_list, &selected))
176 if (!CBS_get_u8_length_prefixed(&list, &proto))
177 return 0; 177 return 0;
178 178
179 if (CBS_len(&list) != 0) 179 if (CBS_len(&server_list) != 0)
180 return 0; 180 return 0;
181 if (CBS_len(&proto) == 0) 181 if (CBS_len(&selected) == 0)
182 return 0; 182 return 0;
183 183
184 if (!CBS_stow(&proto, &s->s3->alpn_selected, &s->s3->alpn_selected_len)) 184 /*
185 return 0; 185 * Check the server selected a protocol that we advertised as supported.
186 */
186 187
187 return 1; 188 CBS_init(&supported_list, s->alpn_client_proto_list,
189 s->alpn_client_proto_list_len);
190
191 while (CBS_len(&supported_list) > 0) {
192 if (!CBS_get_u8_length_prefixed(&supported_list, &proto))
193 return 0;
194 if (CBS_mem_equal(&selected, CBS_data(&proto), CBS_len(&proto)))
195 return CBS_stow(&selected,
196 &s->s3->alpn_selected, &s->s3->alpn_selected_len);
197 }
198
199 *alert = SSL_AD_ILLEGAL_PARAMETER;
200
201 return 0;
188} 202}
189 203
190/* 204/*
@@ -193,6 +207,10 @@ tlsext_alpn_client_process(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
193static int 207static int
194tlsext_supportedgroups_client_needs(SSL *s, uint16_t msg_type) 208tlsext_supportedgroups_client_needs(SSL *s, uint16_t msg_type)
195{ 209{
210 /*
211 * XXX - Don't send an empty named_group_list. For TLSv1.3 we error
212 * earlier; for TLSv1.2 ensure we don't send the extension.
213 */
196 return ssl_has_ecc_ciphers(s) || 214 return ssl_has_ecc_ciphers(s) ||
197 (s->s3->hs.our_max_tls_version >= TLS1_3_VERSION); 215 (s->s3->hs.our_max_tls_version >= TLS1_3_VERSION);
198} 216}
@@ -215,7 +233,7 @@ tlsext_supportedgroups_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
215 return 0; 233 return 0;
216 234
217 for (i = 0; i < groups_len; i++) { 235 for (i = 0; i < groups_len; i++) {
218 if (!ssl_security_supported_group(s, groups[i])) 236 if (!tls1_check_group(s, groups[i]))
219 continue; 237 continue;
220 if (!CBB_add_u16(&grouplist, groups[i])) 238 if (!CBB_add_u16(&grouplist, groups[i]))
221 return 0; 239 return 0;
@@ -277,10 +295,8 @@ tlsext_supportedgroups_server_process(SSL *s, uint16_t msg_type, CBS *cbs,
277 if (!CBS_get_u16(&grouplist, &groups[i])) 295 if (!CBS_get_u16(&grouplist, &groups[i]))
278 goto err; 296 goto err;
279 /* 297 /*
280 * Do not allow duplicate groups to be sent. This is not 298 * RFC 9846 section 4.3.7: The "named_group_list" MUST NOT
281 * currently specified in RFC 8446 or earlier, but there is no 299 * contain any duplicate entries.
282 * legitimate justification for this to occur in TLS 1.2 or TLS
283 * 1.3.
284 */ 300 */
285 for (j = 0; j < i; j++) { 301 for (j = 0; j < i; j++) {
286 if (groups[i] == groups[j]) { 302 if (groups[i] == groups[j]) {
@@ -332,7 +348,7 @@ tlsext_supportedgroups_client_process(SSL *s, uint16_t msg_type, CBS *cbs,
332 return 0; 348 return 0;
333 349
334 /* 350 /*
335 * RFC 8446, section 4.2.7: TLSv1.3 servers can send this extension but 351 * RFC 9846 section 4.3.7: TLSv1.3 servers can send this extension but
336 * clients must not act on it during the handshake. This allows servers 352 * clients must not act on it during the handshake. This allows servers
337 * to advertise their preferences for subsequent handshakes. We ignore 353 * to advertise their preferences for subsequent handshakes. We ignore
338 * this complication. 354 * this complication.
@@ -382,6 +398,8 @@ tlsext_ecpf_process(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
382 if (CBS_len(&ecpf) == 0) 398 if (CBS_len(&ecpf) == 0)
383 return 0; 399 return 0;
384 400
401 /* XXX - tighten this to reject anything but uncompressed format? */
402
385 /* Must contain uncompressed (0) - RFC 8422, section 5.1.2. */ 403 /* Must contain uncompressed (0) - RFC 8422, section 5.1.2. */
386 if (!CBS_contains_zero_byte(&ecpf)) { 404 if (!CBS_contains_zero_byte(&ecpf)) {
387 SSLerror(s, SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST); 405 SSLerror(s, SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST);
@@ -1058,7 +1076,7 @@ tlsext_ocsp_client_process(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
1058 if (ssl_effective_tls_version(s) >= TLS1_3_VERSION) { 1076 if (ssl_effective_tls_version(s) >= TLS1_3_VERSION) {
1059 if (msg_type == SSL_TLSEXT_MSG_CR) { 1077 if (msg_type == SSL_TLSEXT_MSG_CR) {
1060 /* 1078 /*
1061 * RFC 8446, 4.4.2.1 - the server may request an OCSP 1079 * RFC 9846, 4.5.1.1 - the server may request an OCSP
1062 * response with an empty status_request. 1080 * response with an empty status_request.
1063 */ 1081 */
1064 if (CBS_len(cbs) == 0) 1082 if (CBS_len(cbs) == 0)
@@ -1434,7 +1452,7 @@ tlsext_srtp_client_process(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
1434#endif /* OPENSSL_NO_SRTP */ 1452#endif /* OPENSSL_NO_SRTP */
1435 1453
1436/* 1454/*
1437 * TLSv1.3 Key Share - RFC 8446 section 4.2.8. 1455 * TLSv1.3 Key Share - RFC 9846 section 4.3.8.
1438 */ 1456 */
1439static int 1457static int
1440tlsext_keyshare_client_needs(SSL *s, uint16_t msg_type) 1458tlsext_keyshare_client_needs(SSL *s, uint16_t msg_type)
@@ -1495,14 +1513,14 @@ tlsext_keyshare_server_process(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
1495 const uint16_t *client_groups = NULL, *server_groups = NULL; 1513 const uint16_t *client_groups = NULL, *server_groups = NULL;
1496 size_t client_groups_len = 0, server_groups_len = 0; 1514 size_t client_groups_len = 0, server_groups_len = 0;
1497 size_t i, j, client_groups_index; 1515 size_t i, j, client_groups_index;
1498 int preferred_group_found = 0; 1516 int shared_group_found = 0;
1499 int decode_error; 1517 int decode_error;
1500 uint16_t client_preferred_group = 0; 1518 uint16_t client_preferred_group = 0;
1501 uint16_t group; 1519 uint16_t group;
1502 CBS client_shares, key_exchange; 1520 CBS client_shares, key_exchange;
1503 1521
1504 /* 1522 /*
1505 * RFC 8446 section 4.2.8: 1523 * RFC 9846 section 4.3.8:
1506 * 1524 *
1507 * Each KeyShareEntry value MUST correspond to a group offered in the 1525 * Each KeyShareEntry value MUST correspond to a group offered in the
1508 * "supported_groups" extension and MUST appear in the same order. 1526 * "supported_groups" extension and MUST appear in the same order.
@@ -1511,7 +1529,7 @@ tlsext_keyshare_server_process(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
1511 */ 1529 */
1512 1530
1513 if (!tlsext_extension_seen(s, TLSEXT_TYPE_supported_groups)) { 1531 if (!tlsext_extension_seen(s, TLSEXT_TYPE_supported_groups)) {
1514 *alert = SSL_AD_ILLEGAL_PARAMETER; 1532 *alert = SSL_AD_MISSING_EXTENSION;
1515 return 0; 1533 return 0;
1516 } 1534 }
1517 if (!tlsext_extension_processed(s, TLSEXT_TYPE_supported_groups)) { 1535 if (!tlsext_extension_processed(s, TLSEXT_TYPE_supported_groups)) {
@@ -1571,21 +1589,32 @@ tlsext_keyshare_server_process(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
1571 1589
1572 /* 1590 /*
1573 * Find the group that is most preferred by the client that 1591 * Find the group that is most preferred by the client that
1574 * we also support. 1592 * is also supported by the server.
1575 */ 1593 */
1576 for (i = 0; i < client_groups_len && !preferred_group_found; i++) { 1594 for (i = 0; i < client_groups_len && !shared_group_found; i++) {
1577 if (!ssl_security_supported_group(s, client_groups[i])) 1595 if (!ssl_security_supported_group(s, client_groups[i]))
1578 continue; 1596 continue;
1579 for (j = 0; j < server_groups_len; j++) { 1597 for (j = 0; j < server_groups_len; j++) {
1580 if (server_groups[j] == client_groups[i]) { 1598 if (server_groups[j] == client_groups[i]) {
1599 /* XXX - this should be equivalent to tls1_check_group() */
1581 client_preferred_group = client_groups[i]; 1600 client_preferred_group = client_groups[i];
1582 s->s3->hs.tls13.server_group = client_preferred_group; 1601 s->s3->hs.tls13.server_group = client_preferred_group;
1583 preferred_group_found = 1; 1602 shared_group_found = 1;
1584 break; 1603 break;
1585 } 1604 }
1586 } 1605 }
1587 } 1606 }
1588 1607
1608 if (!shared_group_found) {
1609 /*
1610 * There are no supported groups that are shared between the
1611 * client and server - this is treated as a handshake failure
1612 * or as insufficient security - see RFC 9846 section 4.2.1.
1613 */
1614 *alert = TLS13_ALERT_HANDSHAKE_FAILURE;
1615 return 0;
1616 }
1617
1589 if (!CBS_get_u16_length_prefixed(cbs, &client_shares)) 1618 if (!CBS_get_u16_length_prefixed(cbs, &client_shares))
1590 return 0; 1619 return 0;
1591 1620
@@ -1631,7 +1660,7 @@ tlsext_keyshare_server_process(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
1631 * less preferred, and we choose to to use it instead of 1660 * less preferred, and we choose to to use it instead of
1632 * requesting the more preferred group. 1661 * requesting the more preferred group.
1633 */ 1662 */
1634 if (!preferred_group_found || group != client_preferred_group) 1663 if (group != client_preferred_group)
1635 continue; 1664 continue;
1636 1665
1637 /* Decode and store the selected key share. */ 1666 /* Decode and store the selected key share. */
@@ -1749,7 +1778,7 @@ tlsext_keyshare_client_process(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
1749} 1778}
1750 1779
1751/* 1780/*
1752 * Supported Versions - RFC 8446 section 4.2.1. 1781 * Supported Versions - RFC 9846 section 4.3.1.
1753 */ 1782 */
1754static int 1783static int
1755tlsext_versions_client_needs(SSL *s, uint16_t msg_type) 1784tlsext_versions_client_needs(SSL *s, uint16_t msg_type)
@@ -1851,7 +1880,7 @@ tlsext_versions_client_process(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
1851 1880
1852 1881
1853/* 1882/*
1854 * Cookie - RFC 8446 section 4.2.2. 1883 * Cookie - RFC 9846 section 4.3.2.
1855 */ 1884 */
1856 1885
1857static int 1886static int
@@ -1963,7 +1992,7 @@ tlsext_cookie_client_process(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
1963} 1992}
1964 1993
1965/* 1994/*
1966 * Pre-Shared Key Exchange Modes - RFC 8446, 4.2.9. 1995 * Pre-Shared Key Exchange Modes - RFC 9846 section 4.3.9.
1967 */ 1996 */
1968 1997
1969static int 1998static int
@@ -2033,7 +2062,7 @@ tlsext_psk_kex_modes_client_process(SSL *s, uint16_t msg_type, CBS *cbs,
2033} 2062}
2034 2063
2035/* 2064/*
2036 * Pre-Shared Key Extension - RFC 8446, 4.2.11 2065 * Pre-Shared Key Extension - RFC 9846 section 4.3.11
2037 */ 2066 */
2038 2067
2039static int 2068static int
@@ -2467,7 +2496,7 @@ tlsext_randomize_build_order(SSL *s)
2467 return 0; 2496 return 0;
2468 s->tlsext_build_order_len = N_TLS_EXTENSIONS; 2497 s->tlsext_build_order_len = N_TLS_EXTENSIONS;
2469 2498
2470 /* RFC 8446, section 4.2 - PSK MUST be the last extension in the CH. */ 2499 /* RFC 9846 section 4.3 - PSK MUST be the last extension in the CH. */
2471 if ((psk_ext = tls_extension_find(TLSEXT_TYPE_pre_shared_key, 2500 if ((psk_ext = tls_extension_find(TLSEXT_TYPE_pre_shared_key,
2472 NULL)) == NULL) 2501 NULL)) == NULL)
2473 return 0; 2502 return 0;
@@ -2521,7 +2550,7 @@ tlsext_build(SSL *s, int is_server, uint16_t msg_type, CBB *cbb)
2521 tlsext = s->tlsext_build_order[i]; 2550 tlsext = s->tlsext_build_order[i];
2522 ext = tlsext_funcs(tlsext, is_server); 2551 ext = tlsext_funcs(tlsext, is_server);
2523 2552
2524 /* RFC 8446 Section 4.2 */ 2553 /* RFC 9846 section 4.3 */
2525 if (tls_version >= TLS1_3_VERSION && 2554 if (tls_version >= TLS1_3_VERSION &&
2526 !(tlsext->messages & msg_type)) 2555 !(tlsext->messages & msg_type))
2527 continue; 2556 continue;
@@ -2550,14 +2579,15 @@ tlsext_build(SSL *s, int is_server, uint16_t msg_type, CBB *cbb)
2550 return 1; 2579 return 1;
2551} 2580}
2552 2581
2553int 2582static int
2554tlsext_clienthello_hash_extension(SSL *s, uint16_t type, CBS *cbs) 2583tlsext_clienthello_hash_extension(SSL *s, uint16_t type, CBS *cbs)
2555{ 2584{
2556 /* 2585 /*
2557 * RFC 8446 4.1.2. For subsequent CH, early data will be removed, 2586 * RFC 9846, 4.2.2. For subsequent CH, early data will be removed,
2558 * cookie may be added, padding may be removed. 2587 * cookie may be added, padding may be removed.
2559 */ 2588 */
2560 struct tls13_ctx *ctx = s->tls13; 2589 struct tls13_ctx *ctx = s->tls13;
2590 uint16_t len = CBS_len(cbs);
2561 2591
2562 if (type == TLSEXT_TYPE_early_data || type == TLSEXT_TYPE_cookie || 2592 if (type == TLSEXT_TYPE_early_data || type == TLSEXT_TYPE_cookie ||
2563 type == TLSEXT_TYPE_padding) 2593 type == TLSEXT_TYPE_padding)
@@ -2571,6 +2601,8 @@ tlsext_clienthello_hash_extension(SSL *s, uint16_t type, CBS *cbs)
2571 */ 2601 */
2572 if (type == TLSEXT_TYPE_pre_shared_key || type == TLSEXT_TYPE_key_share) 2602 if (type == TLSEXT_TYPE_pre_shared_key || type == TLSEXT_TYPE_key_share)
2573 return 1; 2603 return 1;
2604 if (!tls13_clienthello_hash_update_bytes(ctx, (void *)&len, sizeof(len)))
2605 return 0;
2574 if (!tls13_clienthello_hash_update(ctx, cbs)) 2606 if (!tls13_clienthello_hash_update(ctx, cbs))
2575 return 0; 2607 return 0;
2576 2608
@@ -2624,7 +2656,7 @@ tlsext_parse(SSL *s, struct tlsext_data *td, int is_server, uint16_t msg_type,
2624 goto err; 2656 goto err;
2625 } 2657 }
2626 2658
2627 /* RFC 8446 Section 4.2 */ 2659 /* RFC 9846 section 4.3 */
2628 if (tls_version >= TLS1_3_VERSION && 2660 if (tls_version >= TLS1_3_VERSION &&
2629 !(tlsext->messages & msg_type)) { 2661 !(tlsext->messages & msg_type)) {
2630 alert_desc = SSL_AD_ILLEGAL_PARAMETER; 2662 alert_desc = SSL_AD_ILLEGAL_PARAMETER;
diff --git a/src/lib/libssl/ssl_tlsext.h b/src/lib/libssl/ssl_tlsext.h
index 4fd2ec05a0..e1fc2634c2 100644
--- a/src/lib/libssl/ssl_tlsext.h
+++ b/src/lib/libssl/ssl_tlsext.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_tlsext.h,v 1.34 2024/03/26 03:44:11 beck Exp $ */ 1/* $OpenBSD: ssl_tlsext.h,v 1.35 2026/08/21 17:15:22 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2016, 2017 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2016, 2017 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2017 Doug Hogan <doug@openbsd.org> 4 * Copyright (c) 2017 Doug Hogan <doug@openbsd.org>
@@ -20,7 +20,7 @@
20#ifndef HEADER_SSL_TLSEXT_H 20#ifndef HEADER_SSL_TLSEXT_H
21#define HEADER_SSL_TLSEXT_H 21#define HEADER_SSL_TLSEXT_H
22 22
23/* TLSv1.3 - RFC 8446 Section 4.2. */ 23/* TLSv1.3 - RFC 9846 section 4.3. */
24#define SSL_TLSEXT_MSG_CH 0x0001 /* ClientHello */ 24#define SSL_TLSEXT_MSG_CH 0x0001 /* ClientHello */
25#define SSL_TLSEXT_MSG_SH 0x0002 /* ServerHello */ 25#define SSL_TLSEXT_MSG_SH 0x0002 /* ServerHello */
26#define SSL_TLSEXT_MSG_EE 0x0004 /* EncryptedExtension */ 26#define SSL_TLSEXT_MSG_EE 0x0004 /* EncryptedExtension */
diff --git a/src/lib/libssl/ssl_versions.c b/src/lib/libssl/ssl_versions.c
index 8273546062..edd077b166 100644
--- a/src/lib/libssl/ssl_versions.c
+++ b/src/lib/libssl/ssl_versions.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_versions.c,v 1.27 2023/07/02 17:21:32 beck Exp $ */ 1/* $OpenBSD: ssl_versions.c,v 1.28 2026/06/04 12:05:57 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2016, 2017 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2016, 2017 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -125,7 +125,7 @@ ssl_version_set_max(const SSL_METHOD *meth, uint16_t proto_ver,
125} 125}
126 126
127int 127int
128ssl_enabled_tls_version_range(SSL *s, uint16_t *min_ver, uint16_t *max_ver) 128ssl_enabled_tls_version_range(const SSL *s, uint16_t *min_ver, uint16_t *max_ver)
129{ 129{
130 uint16_t min_version, max_version; 130 uint16_t min_version, max_version;
131 unsigned long options; 131 unsigned long options;
@@ -186,7 +186,8 @@ ssl_enabled_tls_version_range(SSL *s, uint16_t *min_ver, uint16_t *max_ver)
186} 186}
187 187
188int 188int
189ssl_supported_tls_version_range(SSL *s, uint16_t *min_ver, uint16_t *max_ver) 189ssl_supported_tls_version_range(const SSL *s, uint16_t *min_ver,
190 uint16_t *max_ver)
190{ 191{
191 uint16_t min_version, max_version; 192 uint16_t min_version, max_version;
192 193
@@ -222,7 +223,7 @@ ssl_tls_version(uint16_t version)
222} 223}
223 224
224uint16_t 225uint16_t
225ssl_effective_tls_version(SSL *s) 226ssl_effective_tls_version(const SSL *s)
226{ 227{
227 if (s->s3->hs.negotiated_tls_version > 0) 228 if (s->s3->hs.negotiated_tls_version > 0)
228 return s->s3->hs.negotiated_tls_version; 229 return s->s3->hs.negotiated_tls_version;
@@ -231,7 +232,7 @@ ssl_effective_tls_version(SSL *s)
231} 232}
232 233
233int 234int
234ssl_max_supported_version(SSL *s, uint16_t *max_ver) 235ssl_max_supported_version(const SSL *s, uint16_t *max_ver)
235{ 236{
236 uint16_t max_version; 237 uint16_t max_version;
237 238
@@ -251,7 +252,7 @@ ssl_max_supported_version(SSL *s, uint16_t *max_ver)
251} 252}
252 253
253int 254int
254ssl_max_legacy_version(SSL *s, uint16_t *max_ver) 255ssl_max_legacy_version(const SSL *s, uint16_t *max_ver)
255{ 256{
256 uint16_t max_version; 257 uint16_t max_version;
257 258
@@ -269,7 +270,7 @@ ssl_max_legacy_version(SSL *s, uint16_t *max_ver)
269} 270}
270 271
271int 272int
272ssl_max_shared_version(SSL *s, uint16_t peer_ver, uint16_t *max_ver) 273ssl_max_shared_version(const SSL *s, uint16_t peer_ver, uint16_t *max_ver)
273{ 274{
274 uint16_t min_version, max_version, peer_tls_version, shared_version; 275 uint16_t min_version, max_version, peer_tls_version, shared_version;
275 276
@@ -338,7 +339,7 @@ ssl_max_shared_version(SSL *s, uint16_t peer_ver, uint16_t *max_ver)
338} 339}
339 340
340int 341int
341ssl_check_version_from_server(SSL *s, uint16_t server_version) 342ssl_check_version_from_server(const SSL *s, uint16_t server_version)
342{ 343{
343 uint16_t min_tls_version, max_tls_version, server_tls_version; 344 uint16_t min_tls_version, max_tls_version, server_tls_version;
344 345
@@ -363,7 +364,7 @@ ssl_check_version_from_server(SSL *s, uint16_t server_version)
363} 364}
364 365
365int 366int
366ssl_legacy_stack_version(SSL *s, uint16_t version) 367ssl_legacy_stack_version(const SSL *s, uint16_t version)
367{ 368{
368 if (SSL_is_dtls(s)) 369 if (SSL_is_dtls(s))
369 return version == DTLS1_VERSION || version == DTLS1_2_VERSION; 370 return version == DTLS1_VERSION || version == DTLS1_2_VERSION;
diff --git a/src/lib/libssl/t1_lib.c b/src/lib/libssl/t1_lib.c
index 912bea592a..9dfcc0c0f3 100644
--- a/src/lib/libssl/t1_lib.c
+++ b/src/lib/libssl/t1_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: t1_lib.c,v 1.207 2025/12/04 21:16:17 beck Exp $ */ 1/* $OpenBSD: t1_lib.c,v 1.209 2026/06/06 08:45:41 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 *
@@ -154,6 +154,7 @@ struct supported_group {
154 uint16_t group_id; 154 uint16_t group_id;
155 int nid; 155 int nid;
156 int bits; 156 int bits;
157 uint16_t min_version;
157}; 158};
158 159
159/* 160/*
@@ -310,6 +311,7 @@ static const struct supported_group nid_list[] = {
310 .group_id = 4588, 311 .group_id = 4588,
311 .nid = NID_X25519MLKEM768, 312 .nid = NID_X25519MLKEM768,
312 .bits = 128, 313 .bits = 128,
314 .min_version = TLS1_3_VERSION,
313 }, 315 },
314}; 316};
315 317
@@ -512,6 +514,17 @@ tls1_group_id_present(uint16_t group_id, const uint16_t *list, size_t list_len)
512 return 0; 514 return 0;
513} 515}
514 516
517static int
518tls1_group_id_allowed(const SSL *ssl, uint16_t group_id)
519{
520 const struct supported_group *sg;
521
522 if ((sg = tls1_supported_group_by_id(group_id)) == NULL)
523 return 0;
524
525 return ssl_effective_tls_version(ssl) >= sg->min_version;
526}
527
515int 528int
516tls1_count_shared_groups(const SSL *ssl, size_t *out_count) 529tls1_count_shared_groups(const SSL *ssl, size_t *out_count)
517{ 530{
@@ -529,6 +542,9 @@ tls1_count_shared_groups(const SSL *ssl, size_t *out_count)
529 if (!ssl_security_shared_group(ssl, pref[i])) 542 if (!ssl_security_shared_group(ssl, pref[i]))
530 continue; 543 continue;
531 544
545 if (!tls1_group_id_allowed(ssl, pref[i]))
546 continue;
547
532 count++; 548 count++;
533 } 549 }
534 550
@@ -555,6 +571,9 @@ tls1_group_by_index(const SSL *ssl, size_t n, int *out_nid,
555 if (!ssl_security_fn(ssl, pref[i])) 571 if (!ssl_security_fn(ssl, pref[i]))
556 continue; 572 continue;
557 573
574 if (!tls1_group_id_allowed(ssl, pref[i]))
575 continue;
576
558 if (count++ == n) 577 if (count++ == n)
559 return tls1_ec_group_id2nid(pref[i], out_nid); 578 return tls1_ec_group_id2nid(pref[i], out_nid);
560 } 579 }
@@ -659,6 +678,10 @@ tls1_check_group(SSL *s, uint16_t group_id)
659 for (i = 0; i < groupslen; i++) { 678 for (i = 0; i < groupslen; i++) {
660 if (!ssl_security_supported_group(s, groups[i])) 679 if (!ssl_security_supported_group(s, groups[i]))
661 continue; 680 continue;
681
682 if (!tls1_group_id_allowed(s, groups[i]))
683 continue;
684
662 if (groups[i] == group_id) 685 if (groups[i] == group_id)
663 return 1; 686 return 1;
664 } 687 }
@@ -788,7 +811,7 @@ int
788ssl_check_clienthello_tlsext_late(SSL *s) 811ssl_check_clienthello_tlsext_late(SSL *s)
789{ 812{
790 int ret = SSL_TLSEXT_ERR_OK; 813 int ret = SSL_TLSEXT_ERR_OK;
791 int al = 0; /* XXX gcc3 */ 814 int al;
792 815
793 /* If status request then ask callback what to do. 816 /* If status request then ask callback what to do.
794 * Note: this must be called after servername callbacks in case 817 * Note: this must be called after servername callbacks in case
diff --git a/src/lib/libssl/tls1.h b/src/lib/libssl/tls1.h
index 2d5dffc6cf..42451a4214 100644
--- a/src/lib/libssl/tls1.h
+++ b/src/lib/libssl/tls1.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls1.h,v 1.61 2025/04/18 07:34:01 tb Exp $ */ 1/* $OpenBSD: tls1.h,v 1.62 2026/08/21 17:15:22 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 *
@@ -240,7 +240,7 @@ extern "C" {
240/* ExtensionType value from RFC 5054. */ 240/* ExtensionType value from RFC 5054. */
241#define TLSEXT_TYPE_srp 12 241#define TLSEXT_TYPE_srp 12
242 242
243/* ExtensionType value from RFC 5246/RFC 8446. */ 243/* ExtensionType value from RFC 5246/RFC 9846. */
244#define TLSEXT_TYPE_signature_algorithms 13 244#define TLSEXT_TYPE_signature_algorithms 13
245 245
246/* ExtensionType value from RFC 5764. */ 246/* ExtensionType value from RFC 5764. */
@@ -258,7 +258,7 @@ extern "C" {
258/* ExtensionType value from RFC 4507. */ 258/* ExtensionType value from RFC 4507. */
259#define TLSEXT_TYPE_session_ticket 35 259#define TLSEXT_TYPE_session_ticket 35
260 260
261/* ExtensionType values from RFC 8446 section 4.2 */ 261/* ExtensionType values from RFC 9846 section 4.3 */
262#if defined(LIBRESSL_HAS_TLS1_3) || defined(LIBRESSL_INTERNAL) 262#if defined(LIBRESSL_HAS_TLS1_3) || defined(LIBRESSL_INTERNAL)
263#define TLSEXT_TYPE_pre_shared_key 41 263#define TLSEXT_TYPE_pre_shared_key 41
264#define TLSEXT_TYPE_early_data 42 264#define TLSEXT_TYPE_early_data 42
@@ -279,7 +279,7 @@ extern "C" {
279 279
280/* 280/*
281 * TLS 1.3 extension names from OpenSSL, where they decided to use a different 281 * TLS 1.3 extension names from OpenSSL, where they decided to use a different
282 * name from that given in RFC 8446. 282 * name from that given in RFC 9846.
283 */ 283 */
284#if defined(LIBRESSL_HAS_TLS1_3) 284#if defined(LIBRESSL_HAS_TLS1_3)
285#define TLSEXT_TYPE_psk TLSEXT_TYPE_pre_shared_key 285#define TLSEXT_TYPE_psk TLSEXT_TYPE_pre_shared_key
@@ -486,7 +486,7 @@ SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB,(void (*)(void))cb)
486#define TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 0x030000C4 486#define TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 0x030000C4
487#define TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA256 0x030000C5 487#define TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA256 0x030000C5
488 488
489/* TLS 1.3 cipher suites from RFC 8446 appendix B.4. */ 489/* TLS 1.3 cipher suites from RFC 9846 appendix B.4. */
490#if defined(LIBRESSL_HAS_TLS1_3) || defined(LIBRESSL_INTERNAL) 490#if defined(LIBRESSL_HAS_TLS1_3) || defined(LIBRESSL_INTERNAL)
491#define TLS1_3_CK_AES_128_GCM_SHA256 0x03001301 491#define TLS1_3_CK_AES_128_GCM_SHA256 0x03001301
492#define TLS1_3_CK_AES_256_GCM_SHA384 0x03001302 492#define TLS1_3_CK_AES_256_GCM_SHA384 0x03001302
@@ -725,7 +725,7 @@ SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB,(void (*)(void))cb)
725#define TLS1_TXT_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 "ECDHE-ECDSA-CHACHA20-POLY1305" 725#define TLS1_TXT_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 "ECDHE-ECDSA-CHACHA20-POLY1305"
726#define TLS1_TXT_DHE_RSA_WITH_CHACHA20_POLY1305 "DHE-RSA-CHACHA20-POLY1305" 726#define TLS1_TXT_DHE_RSA_WITH_CHACHA20_POLY1305 "DHE-RSA-CHACHA20-POLY1305"
727 727
728/* TLS 1.3 cipher suites from RFC 8446 appendix B.4. */ 728/* TLS 1.3 cipher suites from RFC 9846 appendix B.4. */
729#if defined(LIBRESSL_HAS_TLS1_3) || defined(LIBRESSL_INTERNAL) 729#if defined(LIBRESSL_HAS_TLS1_3) || defined(LIBRESSL_INTERNAL)
730#define TLS1_3_TXT_AES_128_GCM_SHA256 "AEAD-AES128-GCM-SHA256" 730#define TLS1_3_TXT_AES_128_GCM_SHA256 "AEAD-AES128-GCM-SHA256"
731#define TLS1_3_TXT_AES_256_GCM_SHA384 "AEAD-AES256-GCM-SHA384" 731#define TLS1_3_TXT_AES_256_GCM_SHA384 "AEAD-AES256-GCM-SHA384"
diff --git a/src/lib/libssl/tls13_client.c b/src/lib/libssl/tls13_client.c
index 21d3960796..8abfdbdd1f 100644
--- a/src/lib/libssl/tls13_client.c
+++ b/src/lib/libssl/tls13_client.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_client.c,v 1.106 2025/12/04 21:16:17 beck Exp $ */ 1/* $OpenBSD: tls13_client.c,v 1.109 2026/08/21 17:15:22 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -73,8 +73,8 @@ tls13_client_init(struct tls13_ctx *ctx)
73 /* 73 /*
74 * The legacy session identifier should either be set to an 74 * The legacy session identifier should either be set to an
75 * unpredictable 32-byte value or zero length... a non-zero length 75 * unpredictable 32-byte value or zero length... a non-zero length
76 * legacy session identifier triggers compatibility mode (see RFC 8446 76 * legacy session identifier triggers compatibility mode (see RFC 9846
77 * Appendix D.4). In the pre-TLSv1.3 case a zero length value is used. 77 * Appendix E.4). In the pre-TLSv1.3 case a zero length value is used.
78 */ 78 */
79 if (ctx->middlebox_compat && 79 if (ctx->middlebox_compat &&
80 ctx->hs->our_max_tls_version >= TLS1_3_VERSION) { 80 ctx->hs->our_max_tls_version >= TLS1_3_VERSION) {
@@ -242,7 +242,7 @@ tls13_server_hello_process(struct tls13_ctx *ctx, CBS *cbs)
242 if (tls13_server_hello_is_legacy(cbs)) { 242 if (tls13_server_hello_is_legacy(cbs)) {
243 if (ctx->hs->our_max_tls_version >= TLS1_3_VERSION) { 243 if (ctx->hs->our_max_tls_version >= TLS1_3_VERSION) {
244 /* 244 /*
245 * RFC 8446 section 4.1.3: we must not downgrade if 245 * RFC 9846 section 4.2.3: we must not downgrade if
246 * the server random value contains the TLS 1.2 or 1.1 246 * the server random value contains the TLS 1.2 or 1.1
247 * magical value. 247 * magical value.
248 */ 248 */
@@ -285,7 +285,7 @@ tls13_server_hello_process(struct tls13_ctx *ctx, CBS *cbs)
285 /* 285 /*
286 * The supported versions extension indicated 0x0304 or greater. 286 * The supported versions extension indicated 0x0304 or greater.
287 * Ensure that it was 0x0304 and that legacy version is set to 0x0303 287 * Ensure that it was 0x0304 and that legacy version is set to 0x0303
288 * (RFC 8446 section 4.2.1). 288 * (RFC 9846 section 4.3.1).
289 */ 289 */
290 if (ctx->hs->tls13.server_version != TLS1_3_VERSION || 290 if (ctx->hs->tls13.server_version != TLS1_3_VERSION ||
291 legacy_version != TLS1_2_VERSION) { 291 legacy_version != TLS1_2_VERSION) {
@@ -318,7 +318,7 @@ tls13_server_hello_process(struct tls13_ctx *ctx, CBS *cbs)
318 if (!(ctx->handshake_stage.hs_type & WITHOUT_HRR) && !ctx->hs->tls13.hrr) { 318 if (!(ctx->handshake_stage.hs_type & WITHOUT_HRR) && !ctx->hs->tls13.hrr) {
319 /* 319 /*
320 * A ServerHello following a HelloRetryRequest MUST use the same 320 * A ServerHello following a HelloRetryRequest MUST use the same
321 * cipher suite (RFC 8446 section 4.1.4). 321 * cipher suite (RFC 9846 section 4.2.4).
322 */ 322 */
323 if (ctx->hs->cipher != cipher) { 323 if (ctx->hs->cipher != cipher) {
324 ctx->alert = TLS13_ALERT_ILLEGAL_PARAMETER; 324 ctx->alert = TLS13_ALERT_ILLEGAL_PARAMETER;
@@ -450,15 +450,29 @@ tls13_client_hello_retry_send(struct tls13_ctx *ctx, CBB *cbb)
450 /* 450 /*
451 * Ensure that the server supported group is one that we listed in our 451 * Ensure that the server supported group is one that we listed in our
452 * supported groups and is not the same as the key share we previously 452 * supported groups and is not the same as the key share we previously
453 * offered. 453 * offered. See RFC 9846 section 4.3.8.
454 */ 454 */
455 if (!tls1_check_group(ctx->ssl, ctx->hs->tls13.server_group)) 455 if (!tls1_check_group(ctx->ssl, ctx->hs->tls13.server_group)) {
456 return 0; /* XXX alert */ 456 ctx->alert = TLS13_ALERT_ILLEGAL_PARAMETER;
457 if (ctx->hs->tls13.server_group == tls_key_share_group(ctx->hs->key_share)) 457 return 0;
458 return 0; /* XXX alert */ 458 }
459 if (ctx->hs->tls13.server_group == tls_key_share_group(ctx->hs->key_share)) {
460 ctx->alert = TLS13_ALERT_ILLEGAL_PARAMETER;
461 return 0;
462 }
463 if (ctx->hs->tls13.key_share != NULL &&
464 ctx->hs->tls13.server_group == tls_key_share_group(ctx->hs->tls13.key_share)) {
465 ctx->alert = TLS13_ALERT_ILLEGAL_PARAMETER;
466 return 0;
467 }
459 468
460 /* Switch to new key share. */ 469 /* Free original key shares. */
461 tls_key_share_free(ctx->hs->key_share); 470 tls_key_share_free(ctx->hs->key_share);
471 ctx->hs->key_share = NULL;
472 tls_key_share_free(ctx->hs->tls13.key_share);
473 ctx->hs->tls13.key_share = NULL;
474
475 /* Create new key share for server selected group. */
462 if ((ctx->hs->key_share = 476 if ((ctx->hs->key_share =
463 tls_key_share_new(ctx->hs->tls13.server_group)) == NULL) 477 tls_key_share_new(ctx->hs->tls13.server_group)) == NULL)
464 return 0; 478 return 0;
@@ -841,8 +855,8 @@ tls13_client_select_certificate(struct tls13_ctx *ctx, SSL_CERT_PKEY **out_cpk,
841 *out_sigalg = NULL; 855 *out_sigalg = NULL;
842 856
843 /* 857 /*
844 * XXX - RFC 8446, 4.4.2.3: the server can communicate preferences 858 * XXX - RFC 9846, 4.5.1.2: the server can communicate preferences
845 * with the certificate_authorities (4.2.4) and oid_filters (4.2.5) 859 * with the certificate_authorities (4.3.4) and oid_filters (4.3.5)
846 * extensions. We should honor the former and must apply the latter. 860 * extensions. We should honor the former and must apply the latter.
847 */ 861 */
848 862
diff --git a/src/lib/libssl/tls13_handshake.c b/src/lib/libssl/tls13_handshake.c
index 0dc2333708..24178a3396 100644
--- a/src/lib/libssl/tls13_handshake.c
+++ b/src/lib/libssl/tls13_handshake.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_handshake.c,v 1.73 2024/02/03 19:57:14 tb Exp $ */ 1/* $OpenBSD: tls13_handshake.c,v 1.74 2026/08/21 17:15:22 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2018-2021 Theo Buehler <tb@openbsd.org> 3 * Copyright (c) 2018-2021 Theo Buehler <tb@openbsd.org>
4 * Copyright (c) 2019 Joel Sing <jsing@openbsd.org> 4 * Copyright (c) 2019 Joel Sing <jsing@openbsd.org>
@@ -22,7 +22,7 @@
22#include "tls13_handshake.h" 22#include "tls13_handshake.h"
23#include "tls13_internal.h" 23#include "tls13_internal.h"
24 24
25/* Based on RFC 8446 and inspired by s2n's TLS 1.2 state machine. */ 25/* Based on RFC 9846 and inspired by s2n's TLS 1.2 state machine. */
26 26
27struct tls13_handshake_action { 27struct tls13_handshake_action {
28 uint8_t handshake_type; 28 uint8_t handshake_type;
diff --git a/src/lib/libssl/tls13_internal.h b/src/lib/libssl/tls13_internal.h
index 7a7f8abc63..d3d7ddb9b3 100644
--- a/src/lib/libssl/tls13_internal.h
+++ b/src/lib/libssl/tls13_internal.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_internal.h,v 1.105 2025/03/09 15:12:18 tb Exp $ */ 1/* $OpenBSD: tls13_internal.h,v 1.106 2026/08/21 17:15:22 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2018 Bob Beck <beck@openbsd.org> 3 * Copyright (c) 2018 Bob Beck <beck@openbsd.org>
4 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> 4 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org>
@@ -114,7 +114,7 @@ struct tls13_secret {
114 size_t len; 114 size_t len;
115}; 115};
116 116
117/* RFC 8446 Section 7.1 Page 92 */ 117/* RFC 9846 section 7.1 */
118struct tls13_secrets { 118struct tls13_secrets {
119 const EVP_MD *digest; 119 const EVP_MD *digest;
120 int resumption; 120 int resumption;
@@ -339,7 +339,7 @@ int tls13_legacy_shutdown(SSL *ssl);
339int tls13_legacy_servername_process(struct tls13_ctx *ctx, uint8_t *alert); 339int tls13_legacy_servername_process(struct tls13_ctx *ctx, uint8_t *alert);
340 340
341/* 341/*
342 * Message Types - RFC 8446, Section B.3. 342 * Message Types - RFC 9846 section B.3.
343 * 343 *
344 * Values listed as "_RESERVED" were used in previous versions of TLS and are 344 * Values listed as "_RESERVED" were used in previous versions of TLS and are
345 * listed here for completeness. TLS 1.3 implementations MUST NOT send them but 345 * listed here for completeness. TLS 1.3 implementations MUST NOT send them but
diff --git a/src/lib/libssl/tls13_key_schedule.c b/src/lib/libssl/tls13_key_schedule.c
index 05bcf0f006..01fbe6603e 100644
--- a/src/lib/libssl/tls13_key_schedule.c
+++ b/src/lib/libssl/tls13_key_schedule.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_key_schedule.c,v 1.18 2022/11/26 16:08:56 tb Exp $ */ 1/* $OpenBSD: tls13_key_schedule.c,v 1.19 2026/08/21 17:15:22 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2018, Bob Beck <beck@openbsd.org> 3 * Copyright (c) 2018, Bob Beck <beck@openbsd.org>
4 * 4 *
@@ -47,7 +47,7 @@ tls13_secret_cleanup(struct tls13_secret *secret)
47 47
48/* 48/*
49 * Allocate a set of secrets for a key schedule using 49 * Allocate a set of secrets for a key schedule using
50 * a size of hash_length from RFC 8446 section 7.1. 50 * a size of hash_length from RFC 9846 section 7.1.
51 */ 51 */
52struct tls13_secrets * 52struct tls13_secrets *
53tls13_secrets_create(const EVP_MD *digest, int resumption) 53tls13_secrets_create(const EVP_MD *digest, int resumption)
@@ -256,7 +256,7 @@ tls13_derive_early_secrets(struct tls13_secrets *secrets,
256 &secrets->empty_hash)) 256 &secrets->empty_hash))
257 return 0; 257 return 0;
258 258
259 /* RFC 8446 recommends */ 259 /* RFC 9846 recommends */
260 if (!secrets->insecure) 260 if (!secrets->insecure)
261 explicit_bzero(secrets->extracted_early.data, 261 explicit_bzero(secrets->extracted_early.data,
262 secrets->extracted_early.len); 262 secrets->extracted_early.len);
@@ -300,7 +300,7 @@ tls13_derive_handshake_secrets(struct tls13_secrets *secrets,
300 &secrets->empty_hash)) 300 &secrets->empty_hash))
301 return 0; 301 return 0;
302 302
303 /* RFC 8446 recommends */ 303 /* RFC 9846 recommends */
304 if (!secrets->insecure) 304 if (!secrets->insecure)
305 explicit_bzero(secrets->extracted_handshake.data, 305 explicit_bzero(secrets->extracted_handshake.data,
306 secrets->extracted_handshake.len); 306 secrets->extracted_handshake.len);
@@ -349,7 +349,7 @@ tls13_derive_application_secrets(struct tls13_secrets *secrets,
349 context)) 349 context))
350 return 0; 350 return 0;
351 351
352 /* RFC 8446 recommends */ 352 /* RFC 9846 recommends */
353 if (!secrets->insecure) 353 if (!secrets->insecure)
354 explicit_bzero(secrets->extracted_master.data, 354 explicit_bzero(secrets->extracted_master.data,
355 secrets->extracted_master.len); 355 secrets->extracted_master.len);
@@ -400,7 +400,7 @@ tls13_exporter(struct tls13_ctx *ctx, const uint8_t *label, size_t label_len,
400 int ret = 0; 400 int ret = 0;
401 401
402 /* 402 /*
403 * RFC 8446 Section 7.5. 403 * RFC 9846 section 7.5.
404 */ 404 */
405 405
406 memset(&context, 0, sizeof(context)); 406 memset(&context, 0, sizeof(context));
diff --git a/src/lib/libssl/tls13_legacy.c b/src/lib/libssl/tls13_legacy.c
index 6a06330b22..e42600b2cd 100644
--- a/src/lib/libssl/tls13_legacy.c
+++ b/src/lib/libssl/tls13_legacy.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_legacy.c,v 1.45 2026/04/03 07:17:36 jsing Exp $ */ 1/* $OpenBSD: tls13_legacy.c,v 1.46 2026/08/21 08:50:34 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -317,51 +317,34 @@ static int
317tls13_use_legacy_stack(struct tls13_ctx *ctx) 317tls13_use_legacy_stack(struct tls13_ctx *ctx)
318{ 318{
319 SSL *s = ctx->ssl; 319 SSL *s = ctx->ssl;
320 CBB cbb, fragment;
321 CBS cbs; 320 CBS cbs;
322 321
323 memset(&cbb, 0, sizeof(cbb));
324
325 if (!ssl3_setup_init_buffer(s)) 322 if (!ssl3_setup_init_buffer(s))
326 goto err; 323 return 0;
327 if (!ssl3_setup_buffers(s)) 324 if (!ssl3_setup_buffers(s))
328 goto err; 325 return 0;
329 if (!ssl_init_wbio_buffer(s, 1)) 326 if (!ssl_init_wbio_buffer(s, 1))
330 goto err; 327 return 0;
331 328
332 /* Stash any unprocessed data from the last record. */ 329 /* Stash any unprocessed data from the last record. */
333 tls13_record_layer_rcontent(ctx->rl, &cbs); 330 tls13_record_layer_rcontent(ctx->rl, &cbs);
334 if (CBS_len(&cbs) > 0) { 331 if (CBS_len(&cbs) > 0) {
335 if (!CBB_init_fixed(&cbb, s->s3->rbuf.buf, 332 if (s->s3->rcontent != NULL)
336 s->s3->rbuf.len)) 333 return 0;
337 goto err; 334 if ((s->s3->rcontent = tls_content_new()) == NULL)
338 if (!CBB_add_u8(&cbb, SSL3_RT_HANDSHAKE)) 335 return 0;
339 goto err; 336 if (!tls_content_dup_data(s->s3->rcontent,
340 if (!CBB_add_u16(&cbb, TLS1_2_VERSION)) 337 SSL3_RT_HANDSHAKE, CBS_data(&cbs), CBS_len(&cbs)))
341 goto err; 338 return 0;
342 if (!CBB_add_u16_length_prefixed(&cbb, &fragment))
343 goto err;
344 if (!CBB_add_bytes(&fragment, CBS_data(&cbs), CBS_len(&cbs)))
345 goto err;
346 if (!CBB_finish(&cbb, NULL, NULL))
347 goto err;
348
349 s->s3->rbuf.offset = SSL3_RT_HEADER_LENGTH;
350 s->s3->rbuf.left = CBS_len(&cbs);
351 s->s3->rrec.type = SSL3_RT_HANDSHAKE;
352 s->s3->rrec.length = CBS_len(&cbs);
353 s->rstate = SSL_ST_READ_BODY;
354 s->packet = s->s3->rbuf.buf;
355 s->packet_length = SSL3_RT_HEADER_LENGTH;
356 } 339 }
357 340
358 /* Stash the current handshake message. */ 341 /* Stash the current handshake message. */
359 tls13_handshake_msg_data(ctx->hs_msg, &cbs); 342 tls13_handshake_msg_data(ctx->hs_msg, &cbs);
360 if (!BUF_MEM_grow_clean(s->init_buf, CBS_len(&cbs))) 343 if (!BUF_MEM_grow_clean(s->init_buf, CBS_len(&cbs)))
361 goto err; 344 return 0;
362 if (!CBS_write_bytes(&cbs, s->init_buf->data, 345 if (!CBS_write_bytes(&cbs, s->init_buf->data,
363 s->init_buf->length, NULL)) 346 s->init_buf->length, NULL))
364 goto err; 347 return 0;
365 348
366 s->s3->hs.tls12.reuse_message = 1; 349 s->s3->hs.tls12.reuse_message = 1;
367 s->s3->hs.tls12.message_type = tls13_handshake_msg_type(ctx->hs_msg); 350 s->s3->hs.tls12.message_type = tls13_handshake_msg_type(ctx->hs_msg);
@@ -374,11 +357,6 @@ tls13_use_legacy_stack(struct tls13_ctx *ctx)
374 s->method = tls_legacy_method(); 357 s->method = tls_legacy_method();
375 358
376 return 1; 359 return 1;
377
378 err:
379 CBB_cleanup(&cbb);
380
381 return 0;
382} 360}
383 361
384int 362int
diff --git a/src/lib/libssl/tls13_lib.c b/src/lib/libssl/tls13_lib.c
index c3470b2931..f93452402f 100644
--- a/src/lib/libssl/tls13_lib.c
+++ b/src/lib/libssl/tls13_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_lib.c,v 1.78 2025/06/07 10:25:12 tb Exp $ */ 1/* $OpenBSD: tls13_lib.c,v 1.79 2026/08/21 17:15:22 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2019 Bob Beck <beck@openbsd.org> 4 * Copyright (c) 2019 Bob Beck <beck@openbsd.org>
@@ -25,14 +25,14 @@
25#include "tls13_internal.h" 25#include "tls13_internal.h"
26 26
27/* 27/*
28 * RFC 8446, section 4.6.1. Servers must not indicate a lifetime longer than 28 * RFC 9846 section 4.7.1. Servers must not indicate a lifetime longer than
29 * 7 days and clients must not cache tickets for longer than 7 days. 29 * 7 days and clients must not cache tickets for longer than 7 days.
30 */ 30 */
31 31
32#define TLS13_MAX_TICKET_LIFETIME (7 * 24 * 3600) 32#define TLS13_MAX_TICKET_LIFETIME (7 * 24 * 3600)
33 33
34/* 34/*
35 * Downgrade sentinels - RFC 8446 section 4.1.3, magic values which must be set 35 * Downgrade sentinels - RFC 9846 section 4.2.3, magic values which must be set
36 * by the server in server random if it is willing to downgrade but supports 36 * by the server in server random if it is willing to downgrade but supports
37 * TLSv1.3 37 * TLSv1.3
38 */ 38 */
@@ -44,7 +44,7 @@ const uint8_t tls13_downgrade_11[8] = {
44}; 44};
45 45
46/* 46/*
47 * HelloRetryRequest hash - RFC 8446 section 4.1.3. 47 * HelloRetryRequest hash - RFC 9846 section 4.2.3.
48 */ 48 */
49const uint8_t tls13_hello_retry_request_hash[32] = { 49const uint8_t tls13_hello_retry_request_hash[32] = {
50 0xcf, 0x21, 0xad, 0x74, 0xe5, 0x9a, 0x61, 0x11, 50 0xcf, 0x21, 0xad, 0x74, 0xe5, 0x9a, 0x61, 0x11,
@@ -54,7 +54,7 @@ const uint8_t tls13_hello_retry_request_hash[32] = {
54}; 54};
55 55
56/* 56/*
57 * Certificate Verify padding - RFC 8446 section 4.4.3. 57 * Certificate Verify padding - RFC 9846 section 4.5.2.
58 */ 58 */
59const uint8_t tls13_cert_verify_pad[64] = { 59const uint8_t tls13_cert_verify_pad[64] = {
60 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 60 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
@@ -156,7 +156,7 @@ tls13_alert_received_cb(uint8_t alert_level, uint8_t alert_desc, void *arg)
156 if (alert_desc == TLS13_ALERT_USER_CANCELED) { 156 if (alert_desc == TLS13_ALERT_USER_CANCELED) {
157 /* 157 /*
158 * We treat this as advisory, since a close_notify alert 158 * We treat this as advisory, since a close_notify alert
159 * SHOULD follow this alert (RFC 8446 section 6.1). 159 * MUST follow this alert (RFC 9846 section 6.1).
160 */ 160 */
161 return; 161 return;
162 } 162 }
@@ -369,7 +369,7 @@ tls13_key_update_recv(struct tls13_ctx *ctx, CBS *cbs)
369 return tls13_send_alert(ctx->rl, alert); 369 return tls13_send_alert(ctx->rl, alert);
370} 370}
371 371
372/* RFC 8446 section 4.6.1 */ 372/* RFC 9846 section 4.7.1 */
373static ssize_t 373static ssize_t
374tls13_new_session_ticket_recv(struct tls13_ctx *ctx, CBS *cbs) 374tls13_new_session_ticket_recv(struct tls13_ctx *ctx, CBS *cbs)
375{ 375{
@@ -628,7 +628,7 @@ tls13_synthetic_handshake_message(struct tls13_ctx *ctx)
628 628
629 /* 629 /*
630 * Replace ClientHello with synthetic handshake message - see 630 * Replace ClientHello with synthetic handshake message - see
631 * RFC 8446 section 4.4.1. 631 * RFC 9846 section 4.1.
632 */ 632 */
633 if (!tls1_transcript_hash_init(s)) 633 if (!tls1_transcript_hash_init(s))
634 goto err; 634 goto err;
diff --git a/src/lib/libssl/tls13_record.c b/src/lib/libssl/tls13_record.c
index dbc835c546..0723fa3b0a 100644
--- a/src/lib/libssl/tls13_record.c
+++ b/src/lib/libssl/tls13_record.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_record.c,v 1.10 2022/07/22 19:33:53 jsing Exp $ */ 1/* $OpenBSD: tls13_record.c,v 1.11 2026/08/21 02:23:33 kenjiro Exp $ */
2/* 2/*
3 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -32,19 +32,7 @@ struct tls13_record {
32struct tls13_record * 32struct tls13_record *
33tls13_record_new(void) 33tls13_record_new(void)
34{ 34{
35 struct tls13_record *rec = NULL; 35 return calloc(1, sizeof(struct tls13_record));
36
37 if ((rec = calloc(1, sizeof(struct tls13_record))) == NULL)
38 goto err;
39 if ((rec->buf = tls_buffer_new(TLS13_RECORD_MAX_LEN)) == NULL)
40 goto err;
41
42 return rec;
43
44 err:
45 tls13_record_free(rec);
46
47 return NULL;
48} 36}
49 37
50void 38void
@@ -129,6 +117,11 @@ tls13_record_recv(struct tls13_record *rec, tls_read_cb wire_read,
129 if (rec->data != NULL) 117 if (rec->data != NULL)
130 return TLS13_IO_FAILURE; 118 return TLS13_IO_FAILURE;
131 119
120 if (rec->buf == NULL)
121 rec->buf = tls_buffer_new(TLS13_RECORD_HEADER_LEN);
122 if (rec->buf == NULL)
123 return TLS13_IO_FAILURE;
124
132 if (rec->content_type == 0) { 125 if (rec->content_type == 0) {
133 if ((ret = tls_buffer_extend(rec->buf, 126 if ((ret = tls_buffer_extend(rec->buf,
134 TLS13_RECORD_HEADER_LEN, wire_read, wire_arg)) <= 0) 127 TLS13_RECORD_HEADER_LEN, wire_read, wire_arg)) <= 0)
diff --git a/src/lib/libssl/tls13_record.h b/src/lib/libssl/tls13_record.h
index 18e4fa1aba..e9bcae6efd 100644
--- a/src/lib/libssl/tls13_record.h
+++ b/src/lib/libssl/tls13_record.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_record.h,v 1.5 2021/10/23 13:12:14 jsing Exp $ */ 1/* $OpenBSD: tls13_record.h,v 1.6 2026/08/21 17:15:22 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2019 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2019 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -23,7 +23,7 @@
23__BEGIN_HIDDEN_DECLS 23__BEGIN_HIDDEN_DECLS
24 24
25/* 25/*
26 * TLSv1.3 Record Protocol - RFC 8446 section 5. 26 * TLSv1.3 Record Protocol - RFC 9846 section 5.
27 * 27 *
28 * The maximum plaintext is 2^14, however for inner plaintext an additional 28 * The maximum plaintext is 2^14, however for inner plaintext an additional
29 * byte is allowed for the content type. A maximum AEAD overhead of 255-bytes 29 * byte is allowed for the content type. A maximum AEAD overhead of 255-bytes
@@ -41,7 +41,7 @@ __BEGIN_HIDDEN_DECLS
41 (TLS13_RECORD_HEADER_LEN + TLS13_RECORD_MAX_CIPHERTEXT_LEN) 41 (TLS13_RECORD_HEADER_LEN + TLS13_RECORD_MAX_CIPHERTEXT_LEN)
42 42
43/* 43/*
44 * TLSv1.3 Per-Record Nonces and Sequence Numbers - RFC 8446 section 5.3. 44 * TLSv1.3 Per-Record Nonces and Sequence Numbers - RFC 9846 section 5.3.
45 */ 45 */
46#define TLS13_RECORD_SEQ_NUM_LEN 8 46#define TLS13_RECORD_SEQ_NUM_LEN 8
47 47
diff --git a/src/lib/libssl/tls13_record_layer.c b/src/lib/libssl/tls13_record_layer.c
index f5604adbeb..e573b50760 100644
--- a/src/lib/libssl/tls13_record_layer.c
+++ b/src/lib/libssl/tls13_record_layer.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_record_layer.c,v 1.74 2024/09/09 03:32:29 tb Exp $ */ 1/* $OpenBSD: tls13_record_layer.c,v 1.76 2026/08/21 17:15:22 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -31,13 +31,13 @@ struct tls13_record_protection {
31 uint8_t seq_num[TLS13_RECORD_SEQ_NUM_LEN]; 31 uint8_t seq_num[TLS13_RECORD_SEQ_NUM_LEN];
32}; 32};
33 33
34struct tls13_record_protection * 34static struct tls13_record_protection *
35tls13_record_protection_new(void) 35tls13_record_protection_new(void)
36{ 36{
37 return calloc(1, sizeof(struct tls13_record_protection)); 37 return calloc(1, sizeof(struct tls13_record_protection));
38} 38}
39 39
40void 40static void
41tls13_record_protection_clear(struct tls13_record_protection *rp) 41tls13_record_protection_clear(struct tls13_record_protection *rp)
42{ 42{
43 EVP_AEAD_CTX_free(rp->aead_ctx); 43 EVP_AEAD_CTX_free(rp->aead_ctx);
@@ -48,7 +48,7 @@ tls13_record_protection_clear(struct tls13_record_protection *rp)
48 memset(rp, 0, sizeof(*rp)); 48 memset(rp, 0, sizeof(*rp));
49} 49}
50 50
51void 51static void
52tls13_record_protection_free(struct tls13_record_protection *rp) 52tls13_record_protection_free(struct tls13_record_protection *rp)
53{ 53{
54 if (rp == NULL) 54 if (rp == NULL)
@@ -95,7 +95,7 @@ struct tls13_record_layer {
95 uint8_t alert_level; 95 uint8_t alert_level;
96 uint8_t alert_desc; 96 uint8_t alert_desc;
97 97
98 /* Pending post-handshake handshake messages (RFC 8446, section 4.6). */ 98 /* Pending post-handshake handshake messages (RFC 9846, section 4.7). */
99 CBS phh_cbs; 99 CBS phh_cbs;
100 uint8_t *phh_data; 100 uint8_t *phh_data;
101 size_t phh_len; 101 size_t phh_len;
@@ -200,7 +200,7 @@ tls13_record_layer_inc_seq_num(uint8_t *seq_num)
200{ 200{
201 int i; 201 int i;
202 202
203 /* RFC 8446 section 5.3 - sequence numbers must not wrap. */ 203 /* RFC 9846 section 5.3 - sequence numbers must not wrap. */
204 if (memcmp(seq_num, tls13_max_seq_num, TLS13_RECORD_SEQ_NUM_LEN) == 0) 204 if (memcmp(seq_num, tls13_max_seq_num, TLS13_RECORD_SEQ_NUM_LEN) == 0)
205 return 0; 205 return 0;
206 206
@@ -222,7 +222,7 @@ tls13_record_layer_update_nonce(struct tls13_secret *nonce,
222 return 0; 222 return 0;
223 223
224 /* 224 /*
225 * RFC 8446 section 5.3 - sequence number is zero padded and XOR'd 225 * RFC 9846 section 5.3 - sequence number is zero padded and XOR'd
226 * with the IV to produce a per-record nonce. The IV will also be 226 * with the IV to produce a per-record nonce. The IV will also be
227 * at least 8-bytes in length. 227 * at least 8-bytes in length.
228 */ 228 */
@@ -284,7 +284,7 @@ tls13_record_layer_process_alert(struct tls13_record_layer *rl)
284 ssize_t ret = TLS13_IO_FAILURE; 284 ssize_t ret = TLS13_IO_FAILURE;
285 285
286 /* 286 /*
287 * RFC 8446 - sections 5.1 and 6. 287 * RFC 9846 - sections 5.1 and 6.
288 * 288 *
289 * A TLSv1.3 alert record can only contain a single alert - this means 289 * A TLSv1.3 alert record can only contain a single alert - this means
290 * that processing the alert must consume all of the record. The alert 290 * that processing the alert must consume all of the record. The alert
@@ -305,8 +305,8 @@ tls13_record_layer_process_alert(struct tls13_record_layer *rl)
305 tls_content_clear(rl->rcontent); 305 tls_content_clear(rl->rcontent);
306 306
307 /* 307 /*
308 * Alert level is ignored for closure alerts (RFC 8446 section 6.1), 308 * Alert level is ignored for closure alerts (RFC 9846 section 6.1),
309 * however for error alerts (RFC 8446 section 6.2), the alert level 309 * however for error alerts (RFC 9846 section 6.2), the alert level
310 * must be specified as fatal. 310 * must be specified as fatal.
311 */ 311 */
312 if (alert_desc == TLS13_ALERT_CLOSE_NOTIFY) { 312 if (alert_desc == TLS13_ALERT_CLOSE_NOTIFY) {
@@ -344,7 +344,7 @@ tls13_record_layer_send_alert(struct tls13_record_layer *rl)
344{ 344{
345 ssize_t ret; 345 ssize_t ret;
346 346
347 /* This has to fit into a single record, per RFC 8446 section 5.1. */ 347 /* This has to fit into a single record, per RFC 9846 section 5.1. */
348 if ((ret = tls13_record_layer_write_record(rl, SSL3_RT_ALERT, 348 if ((ret = tls13_record_layer_write_record(rl, SSL3_RT_ALERT,
349 rl->alert_data, rl->alert_len)) != rl->alert_len) { 349 rl->alert_data, rl->alert_len)) != rl->alert_len) {
350 if (ret == TLS13_IO_EOF) 350 if (ret == TLS13_IO_EOF)
@@ -604,7 +604,7 @@ tls13_record_layer_open_record_protected(struct tls13_record_layer *rl)
604 break; 604 break;
605 } 605 }
606 if (content_type == 0) { 606 if (content_type == 0) {
607 /* Unexpected message per RFC 8446 section 5.4. */ 607 /* Unexpected message per RFC 9846 section 5.4. */
608 rl->alert = TLS13_ALERT_UNEXPECTED_MESSAGE; 608 rl->alert = TLS13_ALERT_UNEXPECTED_MESSAGE;
609 goto err; 609 goto err;
610 } 610 }
@@ -835,7 +835,7 @@ tls13_record_layer_read_record(struct tls13_record_layer *rl)
835 /* 835 /*
836 * In response to a client hello we may receive an alert in a 836 * In response to a client hello we may receive an alert in a
837 * record with a legacy version. Otherwise enforce that the 837 * record with a legacy version. Otherwise enforce that the
838 * legacy record version is 0x0303 per RFC 8446, section 5.1. 838 * legacy record version is 0x0303 per RFC 9846, section 5.1.
839 */ 839 */
840 if (rl->legacy_version == TLS1_2_VERSION && 840 if (rl->legacy_version == TLS1_2_VERSION &&
841 tls13_record_version(rl->rrec) != TLS1_2_VERSION && 841 tls13_record_version(rl->rrec) != TLS1_2_VERSION &&
@@ -846,7 +846,7 @@ tls13_record_layer_read_record(struct tls13_record_layer *rl)
846 * Bag of hacks ahead... after the first ClientHello message has been 846 * Bag of hacks ahead... after the first ClientHello message has been
847 * sent or received and before the peer's Finished message has been 847 * sent or received and before the peer's Finished message has been
848 * received, we may receive an unencrypted ChangeCipherSpec record 848 * received, we may receive an unencrypted ChangeCipherSpec record
849 * (see RFC 8446 section 5 and appendix D.4). This record must be 849 * (see RFC 9846 section 5 and appendix E.4). This record must be
850 * ignored. 850 * ignored.
851 */ 851 */
852 if (content_type == SSL3_RT_CHANGE_CIPHER_SPEC) { 852 if (content_type == SSL3_RT_CHANGE_CIPHER_SPEC) {
@@ -881,7 +881,7 @@ tls13_record_layer_read_record(struct tls13_record_layer *rl)
881 /* 881 /*
882 * On receiving a handshake or alert record with empty inner plaintext, 882 * On receiving a handshake or alert record with empty inner plaintext,
883 * we must terminate the connection with an unexpected_message alert. 883 * we must terminate the connection with an unexpected_message alert.
884 * See RFC 8446 section 5.4. 884 * See RFC 9846 section 5.4.
885 */ 885 */
886 if (tls_content_remaining(rl->rcontent) == 0 && 886 if (tls_content_remaining(rl->rcontent) == 0 &&
887 (tls_content_type(rl->rcontent) == SSL3_RT_ALERT || 887 (tls_content_type(rl->rcontent) == SSL3_RT_ALERT ||
diff --git a/src/lib/libssl/tls13_server.c b/src/lib/libssl/tls13_server.c
index 604dab4cba..8b0dc8a26b 100644
--- a/src/lib/libssl/tls13_server.c
+++ b/src/lib/libssl/tls13_server.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_server.c,v 1.112 2025/12/04 21:03:42 beck Exp $ */ 1/* $OpenBSD: tls13_server.c,v 1.114 2026/08/21 17:15:22 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2019, 2020 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2019, 2020 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2020 Bob Beck <beck@openbsd.org> 4 * Copyright (c) 2020 Bob Beck <beck@openbsd.org>
@@ -96,19 +96,19 @@ tls13_client_hello_is_legacy(CBS *cbs)
96 return (max_version < TLS1_3_VERSION); 96 return (max_version < TLS1_3_VERSION);
97} 97}
98 98
99int 99static int
100tls13_client_hello_required_extensions(struct tls13_ctx *ctx) 100tls13_client_hello_required_extensions(struct tls13_ctx *ctx)
101{ 101{
102 SSL *s = ctx->ssl; 102 SSL *s = ctx->ssl;
103 103
104 /* 104 /*
105 * RFC 8446, section 9.2. If the ClientHello has supported_versions 105 * RFC 9846 section 9.2. If the ClientHello has supported_versions
106 * containing TLSv1.3, presence or absence of some extensions requires 106 * containing TLSv1.3, presence or absence of some extensions requires
107 * presence or absence of others. 107 * presence or absence of others.
108 */ 108 */
109 109
110 /* 110 /*
111 * RFC 8446 section 4.2.9 - if we received a pre_shared_key, then we 111 * RFC 9846 section 4.3.9 - if we received a pre_shared_key, then we
112 * also need psk_key_exchange_modes. Otherwise, section 9.2 specifies 112 * also need psk_key_exchange_modes. Otherwise, section 9.2 specifies
113 * that we need both signature_algorithms and supported_groups. 113 * that we need both signature_algorithms and supported_groups.
114 */ 114 */
@@ -133,7 +133,7 @@ tls13_client_hello_required_extensions(struct tls13_ctx *ctx)
133 133
134 /* 134 /*
135 * XXX - Require server_name from client? If so, we SHOULD enforce 135 * XXX - Require server_name from client? If so, we SHOULD enforce
136 * this here - RFC 8446, 9.2. 136 * this here - RFC 9846, 9.2.
137 */ 137 */
138 138
139 return 1; 139 return 1;
@@ -246,7 +246,7 @@ tls13_client_hello_process(struct tls13_ctx *ctx, CBS *cbs)
246 /* 246 /*
247 * The legacy session identifier must either be zero length or a 32 byte 247 * The legacy session identifier must either be zero length or a 32 byte
248 * value (in which case the client is requesting middlebox compatibility 248 * value (in which case the client is requesting middlebox compatibility
249 * mode), as per RFC 8446 section 4.1.2. If it is valid, store the value 249 * mode), as per RFC 9846 section 4.2.2. If it is valid, store the value
250 * so that we can echo it back to the client. 250 * so that we can echo it back to the client.
251 */ 251 */
252 if (CBS_len(&session_id) != 0 && 252 if (CBS_len(&session_id) != 0 &&
@@ -459,7 +459,7 @@ tls13_server_hello_retry_request_sent(struct tls13_ctx *ctx)
459 /* 459 /*
460 * If the client has requested middlebox compatibility mode, 460 * If the client has requested middlebox compatibility mode,
461 * we MUST send a dummy CCS following our first handshake message. 461 * we MUST send a dummy CCS following our first handshake message.
462 * See RFC 8446 Appendix D.4. 462 * See RFC 9846 Appendix E.4.
463 */ 463 */
464 if (ctx->hs->tls13.legacy_session_id_len > 0) 464 if (ctx->hs->tls13.legacy_session_id_len > 0)
465 ctx->send_dummy_ccs_after = 1; 465 ctx->send_dummy_ccs_after = 1;
@@ -519,7 +519,7 @@ tls13_server_hello_sent(struct tls13_ctx *ctx)
519 /* 519 /*
520 * If the client has requested middlebox compatibility mode, 520 * If the client has requested middlebox compatibility mode,
521 * we MUST send a dummy CCS following our first handshake message. 521 * we MUST send a dummy CCS following our first handshake message.
522 * See RFC 8446 Appendix D.4. 522 * See RFC 9846 Appendix E.4.
523 */ 523 */
524 if ((ctx->handshake_stage.hs_type & WITHOUT_HRR) && 524 if ((ctx->handshake_stage.hs_type & WITHOUT_HRR) &&
525 ctx->hs->tls13.legacy_session_id_len > 0) 525 ctx->hs->tls13.legacy_session_id_len > 0)
@@ -572,7 +572,7 @@ tls13_server_check_certificate(struct tls13_ctx *ctx, SSL_CERT_PKEY *cpk,
572 572
573 /* 573 /*
574 * The digitalSignature bit MUST be set if the Key Usage extension is 574 * The digitalSignature bit MUST be set if the Key Usage extension is
575 * present as per RFC 8446 section 4.4.2.2. 575 * present as per RFC 9846 section 4.5.1.2.
576 */ 576 */
577 if (!(X509_get_key_usage(cpk->x509) & X509v3_KU_DIGITAL_SIGNATURE)) 577 if (!(X509_get_key_usage(cpk->x509) & X509v3_KU_DIGITAL_SIGNATURE))
578 goto done; 578 goto done;
diff --git a/src/lib/libssl/tls_key_share.c b/src/lib/libssl/tls_key_share.c
index 9e04cb7b75..adaf147584 100644
--- a/src/lib/libssl/tls_key_share.c
+++ b/src/lib/libssl/tls_key_share.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls_key_share.c,v 1.10 2026/01/01 12:47:52 tb Exp $ */ 1/* $OpenBSD: tls_key_share.c,v 1.12 2026/06/08 11:38:04 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2020, 2021 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2020, 2021 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -469,6 +469,9 @@ int
469tls_key_share_peer_params(struct tls_key_share *ks, CBS *cbs, 469tls_key_share_peer_params(struct tls_key_share *ks, CBS *cbs,
470 int *decode_error, int *invalid_params) 470 int *decode_error, int *invalid_params)
471{ 471{
472 *decode_error = 0;
473 *invalid_params = 0;
474
472 if (ks->nid != NID_dhKeyAgreement) 475 if (ks->nid != NID_dhKeyAgreement)
473 return 0; 476 return 0;
474 477
@@ -488,7 +491,8 @@ tls_key_share_peer_public_dhe(struct tls_key_share *ks, CBS *cbs,
488} 491}
489 492
490static int 493static int
491tls_key_share_peer_public_ecdhe_ecp(struct tls_key_share *ks, CBS *cbs) 494tls_key_share_peer_public_ecdhe_ecp(struct tls_key_share *ks, CBS *cbs,
495 int *decode_error)
492{ 496{
493 EC_KEY *ecdhe = NULL; 497 EC_KEY *ecdhe = NULL;
494 int ret = 0; 498 int ret = 0;
@@ -498,7 +502,7 @@ tls_key_share_peer_public_ecdhe_ecp(struct tls_key_share *ks, CBS *cbs)
498 502
499 if ((ecdhe = EC_KEY_new()) == NULL) 503 if ((ecdhe = EC_KEY_new()) == NULL)
500 goto err; 504 goto err;
501 if (!ssl_kex_peer_public_ecdhe_ecp(ecdhe, ks->nid, cbs)) 505 if (!ssl_kex_peer_public_ecdhe_ecp(ecdhe, ks->nid, cbs, decode_error))
502 goto err; 506 goto err;
503 507
504 ks->ecdhe_peer = ecdhe; 508 ks->ecdhe_peer = ecdhe;
@@ -518,8 +522,6 @@ tls_key_share_peer_public_x25519(struct tls_key_share *ks, CBS *cbs,
518{ 522{
519 size_t out_len; 523 size_t out_len;
520 524
521 *decode_error = 0;
522
523 if (ks->x25519_peer_public != NULL) 525 if (ks->x25519_peer_public != NULL)
524 return 0; 526 return 0;
525 527
@@ -570,8 +572,6 @@ tls_key_share_server_peer_public_mlkem768x25519(struct tls_key_share *ks,
570 CBS x25519_cbs, mlkem768_cbs; 572 CBS x25519_cbs, mlkem768_cbs;
571 size_t out_len; 573 size_t out_len;
572 574
573 *decode_error = 0;
574
575 /* The server should not have an mlkem private key */ 575 /* The server should not have an mlkem private key */
576 if (ks->mlkem_private != NULL) 576 if (ks->mlkem_private != NULL)
577 return 0; 577 return 0;
@@ -619,11 +619,6 @@ static int
619tls_key_share_peer_public(struct tls_key_share *ks, CBS *cbs, int *decode_error, 619tls_key_share_peer_public(struct tls_key_share *ks, CBS *cbs, int *decode_error,
620 int *invalid_key) 620 int *invalid_key)
621{ 621{
622 *decode_error = 0;
623
624 if (invalid_key != NULL)
625 *invalid_key = 0;
626
627 if (ks->nid == NID_dhKeyAgreement) 622 if (ks->nid == NID_dhKeyAgreement)
628 return tls_key_share_peer_public_dhe(ks, cbs, decode_error, 623 return tls_key_share_peer_public_dhe(ks, cbs, decode_error,
629 invalid_key); 624 invalid_key);
@@ -631,7 +626,7 @@ tls_key_share_peer_public(struct tls_key_share *ks, CBS *cbs, int *decode_error,
631 if (ks->nid == NID_X25519) 626 if (ks->nid == NID_X25519)
632 return tls_key_share_peer_public_x25519(ks, cbs, decode_error); 627 return tls_key_share_peer_public_x25519(ks, cbs, decode_error);
633 628
634 return tls_key_share_peer_public_ecdhe_ecp(ks, cbs); 629 return tls_key_share_peer_public_ecdhe_ecp(ks, cbs, decode_error);
635} 630}
636 631
637/* Called from client to process a server peer */ 632/* Called from client to process a server peer */
@@ -639,6 +634,11 @@ int
639tls_key_share_client_peer_public(struct tls_key_share *ks, CBS *cbs, 634tls_key_share_client_peer_public(struct tls_key_share *ks, CBS *cbs,
640 int *decode_error, int *invalid_key) 635 int *decode_error, int *invalid_key)
641{ 636{
637 *decode_error = 0;
638
639 if (invalid_key != NULL)
640 *invalid_key = 0;
641
642 if (ks->nid == NID_X25519MLKEM768) 642 if (ks->nid == NID_X25519MLKEM768)
643 return tls_key_share_client_peer_public_mlkem768x25519(ks, cbs, 643 return tls_key_share_client_peer_public_mlkem768x25519(ks, cbs,
644 decode_error); 644 decode_error);
@@ -651,6 +651,11 @@ int
651tls_key_share_server_peer_public(struct tls_key_share *ks, CBS *cbs, 651tls_key_share_server_peer_public(struct tls_key_share *ks, CBS *cbs,
652 int *decode_error, int *invalid_key) 652 int *decode_error, int *invalid_key)
653{ 653{
654 *decode_error = 0;
655
656 if (invalid_key != NULL)
657 *invalid_key = 0;
658
654 if (ks->nid == NID_X25519MLKEM768) 659 if (ks->nid == NID_X25519MLKEM768)
655 return tls_key_share_server_peer_public_mlkem768x25519(ks, cbs, 660 return tls_key_share_server_peer_public_mlkem768x25519(ks, cbs,
656 decode_error); 661 decode_error);
diff --git a/src/lib/libtls/man/tls_config_set_protocols.3 b/src/lib/libtls/man/tls_config_set_protocols.3
index 403bc10b82..b9ef27ee6a 100644
--- a/src/lib/libtls/man/tls_config_set_protocols.3
+++ b/src/lib/libtls/man/tls_config_set_protocols.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: tls_config_set_protocols.3,v 1.13 2025/07/07 10:54:00 schwarze Exp $ 1.\" $OpenBSD: tls_config_set_protocols.3,v 1.14 2026/06/06 16:23:30 sthen Exp $
2.\" 2.\"
3.\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> 3.\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org>
4.\" Copyright (c) 2015, 2016 Joel Sing <jsing@openbsd.org> 4.\" Copyright (c) 2015, 2016 Joel Sing <jsing@openbsd.org>
@@ -16,7 +16,7 @@
16.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18.\" 18.\"
19.Dd $Mdocdate: July 7 2025 $ 19.Dd $Mdocdate: June 6 2026 $
20.Dt TLS_CONFIG_SET_PROTOCOLS 3 20.Dt TLS_CONFIG_SET_PROTOCOLS 3
21.Os 21.Os
22.Sh NAME 22.Sh NAME
@@ -174,8 +174,8 @@ which disables DHE key exchange.
174specifies the names of the elliptic curves that may be used during Elliptic 174specifies the names of the elliptic curves that may be used during Elliptic
175Curve Diffie-Hellman Ephemeral (ECDHE) key exchange. 175Curve Diffie-Hellman Ephemeral (ECDHE) key exchange.
176This is a comma separated list, given in order of preference. 176This is a comma separated list, given in order of preference.
177The special value of "default" will use the default curves (currently X25519, 177The special value of "default" will use the default curves (currently
178P-256 and P-384). 178X25519MLKEM768, X25519, P-256 and P-384).
179This function replaces 179This function replaces
180.Fn tls_config_set_ecdhecurve , 180.Fn tls_config_set_ecdhecurve ,
181which is deprecated. 181which is deprecated.
diff --git a/src/lib/libtls/man/tls_conn_version.3 b/src/lib/libtls/man/tls_conn_version.3
index 3a386cf11f..f88f2cf260 100644
--- a/src/lib/libtls/man/tls_conn_version.3
+++ b/src/lib/libtls/man/tls_conn_version.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: tls_conn_version.3,v 1.12 2025/07/07 10:54:00 schwarze Exp $ 1.\" $OpenBSD: tls_conn_version.3,v 1.13 2026/06/07 12:06:30 tb Exp $
2.\" 2.\"
3.\" Copyright (c) 2015 Bob Beck <beck@openbsd.org> 3.\" Copyright (c) 2015 Bob Beck <beck@openbsd.org>
4.\" Copyright (c) 2016, 2018 Joel Sing <jsing@openbsd.org> 4.\" Copyright (c) 2016, 2018 Joel Sing <jsing@openbsd.org>
@@ -15,7 +15,7 @@
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\" 17.\"
18.Dd $Mdocdate: July 7 2025 $ 18.Dd $Mdocdate: June 7 2026 $
19.Dt TLS_CONN_VERSION 3 19.Dt TLS_CONN_VERSION 3
20.Os 20.Os
21.Sh NAME 21.Sh NAME
@@ -218,6 +218,7 @@ appeared in
218.Fn tls_conn_cipher_strength 218.Fn tls_conn_cipher_strength
219appeared in 219appeared in
220.Ox 6.7 . 220.Ox 6.7 .
221.Pp
221.Fn tls_peer_cert_common_name 222.Fn tls_peer_cert_common_name
222appeared in 223appeared in
223.Ox 7.7 . 224.Ox 7.7 .
diff --git a/src/lib/libtls/tls_internal.h b/src/lib/libtls/tls_internal.h
index 8e566a34e0..434efc196a 100644
--- a/src/lib/libtls/tls_internal.h
+++ b/src/lib/libtls/tls_internal.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls_internal.h,v 1.86 2024/12/10 08:40:30 tb Exp $ */ 1/* $OpenBSD: tls_internal.h,v 1.87 2026/06/06 16:23:30 sthen Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Jeremie Courreges-Anglas <jca@openbsd.org> 3 * Copyright (c) 2014 Jeremie Courreges-Anglas <jca@openbsd.org>
4 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> 4 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
@@ -37,7 +37,7 @@ __BEGIN_HIDDEN_DECLS
37#define TLS_CIPHERS_LEGACY "HIGH:MEDIUM:!aNULL" 37#define TLS_CIPHERS_LEGACY "HIGH:MEDIUM:!aNULL"
38#define TLS_CIPHERS_ALL "ALL:!aNULL:!eNULL" 38#define TLS_CIPHERS_ALL "ALL:!aNULL:!eNULL"
39 39
40#define TLS_ECDHE_CURVES "X25519,P-256,P-384" 40#define TLS_ECDHE_CURVES "X25519MLKEM768,X25519,P-256,P-384"
41 41
42union tls_addr { 42union tls_addr {
43 struct in_addr ip4; 43 struct in_addr ip4;
diff --git a/src/lib/libtls/tls_verify.c b/src/lib/libtls/tls_verify.c
index de95ab8117..edf2bcdae3 100644
--- a/src/lib/libtls/tls_verify.c
+++ b/src/lib/libtls/tls_verify.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls_verify.c,v 1.33 2026/03/28 11:33:33 tb Exp $ */ 1/* $OpenBSD: tls_verify.c,v 1.34 2026/05/30 17:06:09 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Jeremie Courreges-Anglas <jca@openbsd.org> 3 * Copyright (c) 2014 Jeremie Courreges-Anglas <jca@openbsd.org>
4 * 4 *
@@ -59,6 +59,9 @@ tls_match_name(const char *cert_name, const char *name)
59 /* Disallow "*.bar" */ 59 /* Disallow "*.bar" */
60 if (next_dot == NULL) 60 if (next_dot == NULL)
61 return -1; 61 return -1;
62 /* Disallow "*.bar." */
63 if (next_dot[1] == '\0')
64 return -1;
62 /* Disallow "*.bar.." */ 65 /* Disallow "*.bar.." */
63 if (next_dot[1] == '.') 66 if (next_dot[1] == '.')
64 return -1; 67 return -1;
diff --git a/src/regress/lib/libc/Makefile b/src/regress/lib/libc/Makefile
index 7a8db225ef..c43cb5aa6c 100644
--- a/src/regress/lib/libc/Makefile
+++ b/src/regress/lib/libc/Makefile
@@ -1,13 +1,13 @@
1# $OpenBSD: Makefile,v 1.62 2025/08/04 06:10:40 tb Exp $ 1# $OpenBSD: Makefile,v 1.65 2026/08/31 15:17:51 deraadt Exp $
2 2
3SUBDIR+= _setjmp 3SUBDIR+= _setjmp
4SUBDIR+= alloca arc4random-fork atexit 4SUBDIR+= alloca arc4random-fork atexit
5SUBDIR+= basename 5SUBDIR+= basename
6SUBDIR+= cephes cxa-atexit 6SUBDIR+= cephes cxa-atexit
7SUBDIR+= db dirname 7SUBDIR+= db dirname
8SUBDIR+= elf_aux_info 8SUBDIR+= elf_aux_info getexecpath
9SUBDIR+= env explicit_bzero 9SUBDIR+= env explicit_bzero
10SUBDIR+= ffs fmemopen fnmatch fpclassify fread 10SUBDIR+= ffs fmemopen fnmatch fpclassify fread freeaddrinfo
11SUBDIR+= gcvt getaddrinfo getcap getopt getopt_long glob 11SUBDIR+= gcvt getaddrinfo getcap getopt getopt_long glob
12SUBDIR+= hash 12SUBDIR+= hash
13SUBDIR+= hsearch 13SUBDIR+= hsearch
@@ -15,7 +15,7 @@ SUBDIR+= ieeefp ifnameindex illumos
15SUBDIR+= ldexp locale longjmp 15SUBDIR+= ldexp locale longjmp
16SUBDIR+= malloc mkstemp modf 16SUBDIR+= malloc mkstemp modf
17SUBDIR+= netdb 17SUBDIR+= netdb
18SUBDIR+= open_memstream orientation 18SUBDIR+= open_memstream orientation open_wmemstream
19SUBDIR+= popen printf 19SUBDIR+= popen printf
20SUBDIR+= qsort 20SUBDIR+= qsort
21SUBDIR+= regex 21SUBDIR+= regex
diff --git a/src/regress/lib/libc/asr/bin/Makefile.inc b/src/regress/lib/libc/asr/bin/Makefile.inc
index 80b4805136..c515546808 100644
--- a/src/regress/lib/libc/asr/bin/Makefile.inc
+++ b/src/regress/lib/libc/asr/bin/Makefile.inc
@@ -1,8 +1,9 @@
1# $OpenBSD: Makefile.inc,v 1.2 2012/09/05 21:21:13 eric Exp $ 1# $OpenBSD: Makefile.inc,v 1.3 2026/05/08 04:02:24 tb Exp $
2 2
3NOMAN= noman 3NOMAN= noman
4 4
5SRCS+= common.c 5SRCS+= common.c
6CFLAGS+= -Wall -Wstrict-prototypes -Werror -Wundef -g 6CFLAGS+= -Wall -Wstrict-prototypes -Werror -Wundef -g
7CFLAGS+= -Wno-unused-but-set-variable
7LDSTATIC= ${STATIC} 8LDSTATIC= ${STATIC}
8PROG:= ${PROG}${EXT} 9PROG:= ${PROG}${EXT}
diff --git a/src/regress/lib/libc/asr/bin/threads.c b/src/regress/lib/libc/asr/bin/threads.c
index f296f1d6f7..3bc0fc250e 100644
--- a/src/regress/lib/libc/asr/bin/threads.c
+++ b/src/regress/lib/libc/asr/bin/threads.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: threads.c,v 1.1.1.1 2012/07/13 17:49:53 eric Exp $ */ 1/* $OpenBSD: threads.c,v 1.2 2026/05/08 04:01:04 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2012 Eric Faurot <eric@openbsd.org> 3 * Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
4 * 4 *
@@ -34,9 +34,9 @@ char **av;
34int loop; 34int loop;
35int nthreads; 35int nthreads;
36 36
37int long_err; 37extern int long_err;
38int gai_errno; 38extern int gai_errno;
39int rrset_errno; 39extern int rrset_errno;
40 40
41void async_resolver_done(void *); 41void async_resolver_done(void *);
42 42
diff --git a/src/regress/lib/libc/asr/regress.sh b/src/regress/lib/libc/asr/regress.sh
index a0950cefde..d6ced49d6b 100644
--- a/src/regress/lib/libc/asr/regress.sh
+++ b/src/regress/lib/libc/asr/regress.sh
@@ -1,6 +1,6 @@
1# $OpenBSD: regress.sh,v 1.7 2017/03/10 17:23:48 eric Exp $ 1# $OpenBSD: regress.sh,v 1.8 2026/05/08 04:13:44 tb Exp $
2 2
3. regress.subr 3. ${PWD}/regress.subr
4 4
5test_res_mkquery() 5test_res_mkquery()
6{ 6{
diff --git a/src/regress/lib/libc/asr/regress.subr b/src/regress/lib/libc/asr/regress.subr
index 6ce645bc33..731b9741c5 100644
--- a/src/regress/lib/libc/asr/regress.subr
+++ b/src/regress/lib/libc/asr/regress.subr
@@ -1,5 +1,5 @@
1#!/bin/sh 1#!/bin/sh
2# $OpenBSD: regress.subr,v 1.4 2017/03/14 20:22:06 eric Exp $ 2# $OpenBSD: regress.subr,v 1.5 2026/05/08 04:02:59 tb Exp $
3 3
4set -e 4set -e
5 5
@@ -65,7 +65,6 @@ regress_setenv()
65 cp /etc/hosts "${ROOTDIR}/etc/" 65 cp /etc/hosts "${ROOTDIR}/etc/"
66 cp /etc/resolv.conf "${ROOTDIR}/etc/" 66 cp /etc/resolv.conf "${ROOTDIR}/etc/"
67 cp /etc/protocols "${ROOTDIR}/etc/" 67 cp /etc/protocols "${ROOTDIR}/etc/"
68 cp /etc/networks "${ROOTDIR}/etc/"
69 cp /etc/services "${ROOTDIR}/etc/" 68 cp /etc/services "${ROOTDIR}/etc/"
70 69
71 case $_name in 70 case $_name in
diff --git a/src/regress/lib/libc/freeaddrinfo/Makefile b/src/regress/lib/libc/freeaddrinfo/Makefile
new file mode 100644
index 0000000000..f5ccd611eb
--- /dev/null
+++ b/src/regress/lib/libc/freeaddrinfo/Makefile
@@ -0,0 +1,5 @@
1# $OpenBSD: Makefile,v 1.1 2026/06/27 17:52:29 jca Exp $
2
3PROG = freeaddrinfo
4
5.include <bsd.regress.mk>
diff --git a/src/regress/lib/libc/freeaddrinfo/freeaddrinfo.c b/src/regress/lib/libc/freeaddrinfo/freeaddrinfo.c
new file mode 100644
index 0000000000..520ba6251e
--- /dev/null
+++ b/src/regress/lib/libc/freeaddrinfo/freeaddrinfo.c
@@ -0,0 +1,22 @@
1/* $OpenBSD: freeaddrinfo.c,v 1.1 2026/06/27 17:52:29 jca Exp $ */
2
3/* Public Domain */
4
5#include <sys/types.h>
6#include <sys/socket.h>
7
8#include <netdb.h>
9
10#include <stddef.h>
11
12int
13main(void)
14{
15 /*
16 * The behavior of freeaddrinfo(NULL) isn't specified,
17 * but we want to gracefully handle it (ie avoid a crash).
18 */
19 freeaddrinfo(NULL);
20
21 return 0;
22}
diff --git a/src/regress/lib/libc/getaddrinfo/gaitest.c b/src/regress/lib/libc/getaddrinfo/gaitest.c
index 2508c05e02..86967e3e24 100644
--- a/src/regress/lib/libc/getaddrinfo/gaitest.c
+++ b/src/regress/lib/libc/getaddrinfo/gaitest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: gaitest.c,v 1.7 2020/02/14 19:17:33 schwarze Exp $ */ 1/* $OpenBSD: gaitest.c,v 1.9 2026/06/27 17:33:50 jca Exp $ */
2/* $NetBSD: gaitest.c,v 1.3 2002/07/05 15:47:43 itojun Exp $ */ 2/* $NetBSD: gaitest.c,v 1.3 2002/07/05 15:47:43 itojun Exp $ */
3 3
4/* 4/*
@@ -55,20 +55,15 @@ int vflag = 0;
55 55
56static void usage(void); 56static void usage(void);
57static void print1(const char *, const struct addrinfo *, char *, char *); 57static void print1(const char *, const struct addrinfo *, char *, char *);
58int main(int, char *[]);
59 58
60static void 59static void
61usage() 60usage(void)
62{ 61{
63 fprintf(stderr, "usage: test [-f family] [-s socktype] [-p proto] [-DPRSv46] host serv\n"); 62 fprintf(stderr, "usage: test [-f family] [-s socktype] [-p proto] [-DPRSv46] host serv\n");
64} 63}
65 64
66static void 65static void
67print1(title, res, h, s) 66print1(const char *title, const struct addrinfo *res, char *h, char *s)
68 const char *title;
69 const struct addrinfo *res;
70 char *h;
71 char *s;
72{ 67{
73 char *start, *end; 68 char *start, *end;
74 int error; 69 int error;
@@ -112,9 +107,7 @@ print1(title, res, h, s)
112} 107}
113 108
114int 109int
115main(argc, argv) 110main(int argc, char *argv[])
116 int argc;
117 char *argv[];
118{ 111{
119 struct addrinfo *res; 112 struct addrinfo *res;
120 int error, i; 113 int error, i;
diff --git a/src/regress/lib/libc/getexecpath/Makefile b/src/regress/lib/libc/getexecpath/Makefile
new file mode 100644
index 0000000000..c952c5cb38
--- /dev/null
+++ b/src/regress/lib/libc/getexecpath/Makefile
@@ -0,0 +1,8 @@
1PROG=getexecpath
2
3WARNINGS=yes
4
5run-regress-${PROG}: ${PROG}
6 ./${PROG} `cd ${.OBJDIR} && pwd -P`/${PROG}
7
8.include <bsd.regress.mk>
diff --git a/src/regress/lib/libc/getexecpath/getexecpath.c b/src/regress/lib/libc/getexecpath/getexecpath.c
new file mode 100644
index 0000000000..c0ee005ca2
--- /dev/null
+++ b/src/regress/lib/libc/getexecpath/getexecpath.c
@@ -0,0 +1,24 @@
1#include <sys/types.h>
2#include <sys/auxv.h>
3#include <stdlib.h>
4#include <string.h>
5#include <unistd.h>
6#include <limits.h>
7#include <stdio.h>
8#include <err.h>
9
10int
11main(int argc, char *argv[])
12{
13 char path[PATH_MAX];
14
15 if (argc < 1)
16 errx(1, "usage: getexecpath expected-path");
17
18 if (getexecpath(path, sizeof path) == -1)
19 err(1, "getexepath: on path");
20 if (strcmp(path, argv[1]) != 0)
21 exit(1);
22 printf("getexecpath(3) is working\n");
23 exit(0);
24}
diff --git a/src/regress/lib/libc/illumos/oclo/Makefile b/src/regress/lib/libc/illumos/oclo/Makefile
index 284e49dc73..24d939da15 100644
--- a/src/regress/lib/libc/illumos/oclo/Makefile
+++ b/src/regress/lib/libc/illumos/oclo/Makefile
@@ -1,7 +1,9 @@
1# $OpenBSD: Makefile,v 1.2 2025/08/09 18:17:42 anton Exp $ 1# $OpenBSD: Makefile,v 1.3 2026/06/24 12:24:04 bluhm Exp $
2 2
3.if exists(/usr/local/share/illumos-os-tests) 3.if exists(/usr/local/share/illumos-os-tests)
4 4
5MAKE := ulimit -n 256; ${MAKE}
6
5PROGS = oclo 7PROGS = oclo
6PROGS += oclo_errors 8PROGS += oclo_errors
7PROGS += ocloexec_verify 9PROGS += ocloexec_verify
diff --git a/src/regress/lib/libc/open_wmemstream/Makefile b/src/regress/lib/libc/open_wmemstream/Makefile
new file mode 100644
index 0000000000..232bc4a176
--- /dev/null
+++ b/src/regress/lib/libc/open_wmemstream/Makefile
@@ -0,0 +1,5 @@
1# $OpenBSD: Makefile,v 1.1 2026/05/08 14:37:16 millert Exp $
2
3PROG= open_wmemstreamtest
4
5.include <bsd.regress.mk>
diff --git a/src/regress/lib/libc/open_wmemstream/open_wmemstreamtest.c b/src/regress/lib/libc/open_wmemstream/open_wmemstreamtest.c
new file mode 100644
index 0000000000..fa2a17d33c
--- /dev/null
+++ b/src/regress/lib/libc/open_wmemstream/open_wmemstreamtest.c
@@ -0,0 +1,189 @@
1/* $OpenBSD: open_wmemstreamtest.c,v 1.1 2026/05/08 14:37:16 millert Exp $ */
2
3/*
4 * Copyright (c) 2011 Martin Pieuchot <mpi@openbsd.org>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#include <err.h>
20#include <stdio.h>
21#include <stdlib.h>
22#include <string.h>
23#include <wchar.h>
24#include <unistd.h>
25
26#define OFFSET 16384
27
28const wchar_t start[] = { 's', 't', 'a', 'r', 't', 0 };
29const wchar_t hello[] = { 'h', 'e', 'l', 'l', 'o', 0 };
30
31int
32main(void)
33{
34 FILE *fp;
35 wchar_t *buf = (wchar_t *)0xff;
36 size_t size = 0;
37 off_t off;
38 int i, failures = 0;
39
40 if ((fp = open_wmemstream(&buf, &size)) == NULL) {
41 warn("open_wmemstream failed");
42 return (1);
43 }
44
45 off = ftello(fp);
46 if (off != 0) {
47 warnx("ftello failed. (1)");
48 failures++;
49 }
50
51 if (fflush(fp) != 0) {
52 warnx("fflush failed. (2)");
53 failures++;
54 }
55
56 if (size != 0) {
57 warnx("string should be empty. (3)");
58 failures++;
59 }
60
61 if (buf == (wchar_t *)0xff) {
62 warnx("buf not updated. (4)");
63 failures++;
64 }
65
66 if (fseek(fp, OFFSET, SEEK_SET) != 0) {
67 warnx("failed to fseek. (5)");
68 failures++;
69 }
70
71 if (fwprintf(fp, hello) == EOF) {
72 warnx("fwprintf failed. (6)");
73 failures++;
74 }
75
76 if (fflush(fp) == EOF) {
77 warnx("fflush failed. (7)");
78 failures++;
79 }
80
81 if (size != OFFSET + wcslen(hello)) {
82 warnx("failed, size %zu should be %zu. (8)",
83 size, OFFSET + wcslen(hello));
84 failures++;
85 }
86
87 if (fseek(fp, 0, SEEK_SET) != 0) {
88 warnx("failed to fseek. (9)");
89 failures++;
90 }
91
92 if (fwprintf(fp, start) == EOF) {
93 warnx("fwprintf failed. (10)");
94 failures++;
95 }
96
97 if (fflush(fp) == EOF) {
98 warnx("fflush failed. (11)");
99 failures++;
100 }
101
102 if (size != wcslen(start)) {
103 warnx("failed, size %zu should be %zu. (12)",
104 size, wcslen(start));
105 failures++;
106 }
107
108 /* Needed for sparse files */
109 if (wcsncmp(buf, start, wcslen(start)) != 0) {
110 char buf[sizeof(start)];
111 wcstombs(buf, start, sizeof(buf));
112 warnx("failed, buffer didn't start with '%s'. (13)", buf);
113 failures++;
114 }
115 for (i = wcslen(start); i < OFFSET; i++)
116 if (buf[i] != '\0') {
117 warnx("failed, buffer non zero (offset %d). (14)", i);
118 failures++;
119 break;
120 }
121
122 if (memcmp(buf + OFFSET, hello, wcslen(hello)) != 0) {
123 warnx("written string incorrect. (15)");
124 failures++;
125 }
126
127 /* verify that simply seeking past the end doesn't increase the size */
128 if (fseek(fp, 100, SEEK_END) != 0) {
129 warnx("failed to fseek. (16)");
130 failures++;
131 }
132
133 if (fflush(fp) == EOF) {
134 warnx("fflush failed. (17)");
135 failures++;
136 }
137
138 if (size != OFFSET + wcslen(hello)) {
139 warnx("failed, size %zu should be %zu. (18)",
140 size, OFFSET + wcslen(hello));
141 failures++;
142 }
143
144 if (fseek(fp, -1, SEEK_END) != 0) {
145 warnx("failed to fseek. (19)");
146 failures++;
147 }
148
149 if (fseek(fp, 8, SEEK_SET) != 0) {
150 warnx("failed to fseek. (20)");
151 failures++;
152 }
153
154 if (ftell(fp) != 8) {
155 warnx("failed seek test. (21)");
156 failures++;
157 }
158
159 /* Try to seek backward */
160 if (fseek(fp, -1, SEEK_CUR) != 0) {
161 warnx("failed to fseek. (22)");
162 failures++;
163 }
164
165 if (ftell(fp) != 7) {
166 warnx("failed seeking backward. (23)");
167 failures++;
168 }
169
170 if (fseek(fp, 5, SEEK_CUR) != 0) {
171 warnx("failed to fseek. (24)");
172 failures++;
173 }
174
175 if (fclose(fp) == EOF) {
176 warnx("fclose failed. (25)");
177 failures++;
178 }
179
180 if (size != 12) {
181 warnx("failed, size %zu should be %u. (26)",
182 size, 12);
183 failures++;
184 }
185
186 free(buf);
187
188 return (failures);
189}
diff --git a/src/regress/lib/libc/strlcpy/Makefile b/src/regress/lib/libc/strlcpy/Makefile
index 921354432b..a6678102ba 100644
--- a/src/regress/lib/libc/strlcpy/Makefile
+++ b/src/regress/lib/libc/strlcpy/Makefile
@@ -1,5 +1,7 @@
1# $OpenBSD: Makefile,v 1.1 2014/12/02 20:23:05 millert Exp $ 1# $OpenBSD: Makefile,v 1.2 2026/05/30 05:07:03 anton Exp $
2 2
3PROG= strlcpytest 3PROG= strlcpytest
4 4
5CFLAGS+=-fno-builtin
6
5.include <bsd.regress.mk> 7.include <bsd.regress.mk>
diff --git a/src/regress/lib/libc/sys/Makefile b/src/regress/lib/libc/sys/Makefile
index 5ff237d4e7..b9772fed89 100644
--- a/src/regress/lib/libc/sys/Makefile
+++ b/src/regress/lib/libc/sys/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.18 2023/10/31 08:00:33 claudio Exp $ 1# $OpenBSD: Makefile,v 1.19 2026/07/09 05:30:32 anton Exp $
2 2
3# Copyright (c) 2019 Moritz Buhl <openbsd@moritzbuhl.de> 3# Copyright (c) 2019 Moritz Buhl <openbsd@moritzbuhl.de>
4# Copyright (c) 2019 Alexander Bluhm <bluhm@openbsd.org> 4# Copyright (c) 2019 Alexander Bluhm <bluhm@openbsd.org>
@@ -77,7 +77,6 @@ PROGS += t_write
77# failing tests 77# failing tests
78REGRESS_EXPECTED_FAILURES = 78REGRESS_EXPECTED_FAILURES =
79REGRESS_EXPECTED_FAILURES += run-t_mlock-4 79REGRESS_EXPECTED_FAILURES += run-t_mlock-4
80REGRESS_EXPECTED_FAILURES += run-t_msgrcv-3
81 80
82. for t in run-t_fork-{3,4,5} 81. for t in run-t_fork-{3,4,5}
83${t}: 82${t}:
diff --git a/src/regress/lib/libc/time/time_conversion/timetest.c b/src/regress/lib/libc/time/time_conversion/timetest.c
index 1405f1c6a5..9a83a6397d 100644
--- a/src/regress/lib/libc/time/time_conversion/timetest.c
+++ b/src/regress/lib/libc/time/time_conversion/timetest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: timetest.c,v 1.5 2025/08/17 08:43:03 phessler Exp $ */ 1/* $OpenBSD: timetest.c,v 1.6 2026/07/17 18:56:42 millert Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2022 Bob Beck <beck@openbsd.org> 4 * Copyright (c) 2022 Bob Beck <beck@openbsd.org>
@@ -462,14 +462,14 @@ struct timetest timetests[] = {
462 .tm_year=138, 462 .tm_year=138,
463 .tm_mon=0, 463 .tm_mon=0,
464 .tm_mday=18, 464 .tm_mday=18,
465 .tm_hour=20, 465 .tm_hour=21,
466 .tm_min=14, 466 .tm_min=14,
467 .tm_sec=7, 467 .tm_sec=7,
468 .tm_wday=1, 468 .tm_wday=1,
469 .tm_yday=17, 469 .tm_yday=17,
470 .tm_isdst=0, 470 .tm_isdst=0,
471 .tm_gmtoff=-25200, 471 .tm_gmtoff=-21600,
472 .tm_zone="MST" 472 .tm_zone="CST"
473 }, 473 },
474 .gmt_tm= { 474 .gmt_tm= {
475 .tm_year=138, 475 .tm_year=138,
@@ -524,14 +524,14 @@ struct timetest timetests[] = {
524 .tm_year=138, 524 .tm_year=138,
525 .tm_mon=0, 525 .tm_mon=0,
526 .tm_mday=18, 526 .tm_mday=18,
527 .tm_hour=20, 527 .tm_hour=21,
528 .tm_min=14, 528 .tm_min=14,
529 .tm_sec=8, 529 .tm_sec=8,
530 .tm_wday=1, 530 .tm_wday=1,
531 .tm_yday=17, 531 .tm_yday=17,
532 .tm_isdst=0, 532 .tm_isdst=0,
533 .tm_gmtoff=-25200, 533 .tm_gmtoff=-21600,
534 .tm_zone="MST" 534 .tm_zone="CST"
535 }, 535 },
536 .gmt_tm= { 536 .gmt_tm= {
537 .tm_year=138, 537 .tm_year=138,
@@ -772,14 +772,14 @@ struct timetest timetests[] = {
772 .tm_year=2147481747, 772 .tm_year=2147481747,
773 .tm_mon=0, 773 .tm_mon=0,
774 .tm_mday=31, 774 .tm_mday=31,
775 .tm_hour=16, 775 .tm_hour=17,
776 .tm_min=59, 776 .tm_min=59,
777 .tm_sec=32, 777 .tm_sec=32,
778 .tm_wday=4, 778 .tm_wday=4,
779 .tm_yday=30, 779 .tm_yday=30,
780 .tm_isdst=0, 780 .tm_isdst=0,
781 .tm_gmtoff=-25200, 781 .tm_gmtoff=-21600,
782 .tm_zone="MST" 782 .tm_zone="CST"
783 }, 783 },
784 .gmt_tm= { 784 .gmt_tm= {
785 .tm_year=2147481747, 785 .tm_year=2147481747,
@@ -989,14 +989,14 @@ struct timetest timetests[] = {
989 .tm_year=8099, 989 .tm_year=8099,
990 .tm_mon=11, 990 .tm_mon=11,
991 .tm_mday=31, 991 .tm_mday=31,
992 .tm_hour=16, 992 .tm_hour=17,
993 .tm_min=59, 993 .tm_min=59,
994 .tm_sec=59, 994 .tm_sec=59,
995 .tm_wday=5, 995 .tm_wday=5,
996 .tm_yday=364, 996 .tm_yday=364,
997 .tm_isdst=0, 997 .tm_isdst=0,
998 .tm_gmtoff=-25200, 998 .tm_gmtoff=-21600,
999 .tm_zone="MST" 999 .tm_zone="CST"
1000 }, 1000 },
1001 .gmt_tm= { 1001 .gmt_tm= {
1002 .tm_year=8099, 1002 .tm_year=8099,
@@ -1051,14 +1051,14 @@ struct timetest timetests[] = {
1051 .tm_year=8099, 1051 .tm_year=8099,
1052 .tm_mon=11, 1052 .tm_mon=11,
1053 .tm_mday=31, 1053 .tm_mday=31,
1054 .tm_hour=16, 1054 .tm_hour=17,
1055 .tm_min=59, 1055 .tm_min=59,
1056 .tm_sec=32, 1056 .tm_sec=32,
1057 .tm_wday=5, 1057 .tm_wday=5,
1058 .tm_yday=364, 1058 .tm_yday=364,
1059 .tm_isdst=0, 1059 .tm_isdst=0,
1060 .tm_gmtoff=-25200, 1060 .tm_gmtoff=-21600,
1061 .tm_zone="MST" 1061 .tm_zone="CST"
1062 }, 1062 },
1063 .gmt_tm= { 1063 .gmt_tm= {
1064 .tm_year=8099, 1064 .tm_year=8099,
@@ -1830,7 +1830,7 @@ int main() {
1830 if (stat("/usr/share/zoneinfo/posix", &sb) == -1 || 1830 if (stat("/usr/share/zoneinfo/posix", &sb) == -1 ||
1831 stat("/usr/share/zoneinfo/right", &sb) == -1) { 1831 stat("/usr/share/zoneinfo/right", &sb) == -1) {
1832 fprintf(stderr, "POSIX time zones missing, run the following command:\n\n" 1832 fprintf(stderr, "POSIX time zones missing, run the following command:\n\n"
1833 "\tmake -C ../../../../../share/zoneinfo other_two\n\n" 1833 "\tmake -C ../../../../share/zoneinfo other_two\n\n"
1834 "SKIPPED\n"); 1834 "SKIPPED\n");
1835 exit(0); 1835 exit(0);
1836 } 1836 }
diff --git a/src/regress/lib/libc/timingsafe/timingsafe.c b/src/regress/lib/libc/timingsafe/timingsafe.c
index d768a808b6..6e3461cd27 100644
--- a/src/regress/lib/libc/timingsafe/timingsafe.c
+++ b/src/regress/lib/libc/timingsafe/timingsafe.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: timingsafe.c,v 1.4 2024/02/04 20:51:21 tb Exp $ */ 1/* $OpenBSD: timingsafe.c,v 1.5 2026/07/29 02:16:37 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Google Inc. 3 * Copyright (c) 2014 Google Inc.
4 * 4 *
@@ -27,7 +27,7 @@ enum {
27 27
28static unsigned char bufone[N], buftwo[N]; 28static unsigned char bufone[N], buftwo[N];
29 29
30void 30static void
31check(void) 31check(void)
32{ 32{
33 int cmp = memcmp(bufone, buftwo, N); 33 int cmp = memcmp(bufone, buftwo, N);
diff --git a/src/regress/lib/libcrypto/bn/bn_mul_div.c b/src/regress/lib/libcrypto/bn/bn_mul_div.c
index dbad01004e..41280e385c 100644
--- a/src/regress/lib/libcrypto/bn/bn_mul_div.c
+++ b/src/regress/lib/libcrypto/bn/bn_mul_div.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_mul_div.c,v 1.8 2025/08/12 10:29:35 jsing Exp $ */ 1/* $OpenBSD: bn_mul_div.c,v 1.9 2026/07/21 04:55:34 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -399,7 +399,7 @@ benchmark_run(const struct benchmark *bm, int seconds)
399 timespecsub(&end, &start, &duration); 399 timespecsub(&end, &start, &duration);
400 fprintf(stderr, "%d iterations in %f seconds - %llu op/s\n", i, 400 fprintf(stderr, "%d iterations in %f seconds - %llu op/s\n", i,
401 duration.tv_sec + duration.tv_nsec / 1000000000.0, 401 duration.tv_sec + duration.tv_nsec / 1000000000.0,
402 (uint64_t)i * 1000000000 / 402 (unsigned long long)i * 1000000000 /
403 (duration.tv_sec * 1000000000 + duration.tv_nsec)); 403 (duration.tv_sec * 1000000000 + duration.tv_nsec));
404 404
405 BN_CTX_end(bn_ctx); 405 BN_CTX_end(bn_ctx);
diff --git a/src/regress/lib/libcrypto/c2sp/Makefile b/src/regress/lib/libcrypto/c2sp/Makefile
index 73ee0b8c22..6da6a8d29e 100644
--- a/src/regress/lib/libcrypto/c2sp/Makefile
+++ b/src/regress/lib/libcrypto/c2sp/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.7 2025/07/23 07:35:21 tb Exp $ 1# $OpenBSD: Makefile,v 1.8 2026/06/12 08:19:44 tb Exp $
2 2
3C2SP_TESTVECTORS = /usr/local/share/c2sp-testvectors/ 3C2SP_TESTVECTORS = /usr/local/share/c2sp-testvectors/
4 4
@@ -18,7 +18,7 @@ cctv: cctv.go
18OSSL_LIB = /usr/local/lib/eopenssl 18OSSL_LIB = /usr/local/lib/eopenssl
19OSSL_INC = /usr/local/include/eopenssl 19OSSL_INC = /usr/local/include/eopenssl
20 20
21. for V in 35 21. for V in 35 40
22. if exists(/usr/local/bin/eopenssl$V) 22. if exists(/usr/local/bin/eopenssl$V)
23PROGS += cctv-openssl$V 23PROGS += cctv-openssl$V
24SRCS_cctv-openssl$V = 24SRCS_cctv-openssl$V =
diff --git a/src/regress/lib/libcrypto/certs/README b/src/regress/lib/libcrypto/certs/README
index 93165249ec..26a3c477ce 100644
--- a/src/regress/lib/libcrypto/certs/README
+++ b/src/regress/lib/libcrypto/certs/README
@@ -124,3 +124,9 @@ intermediate certificates are contained in a bundle.pem file.
12413a. A leaf certificate signed by an intermediate, that is signed by an 12413a. A leaf certificate signed by an intermediate, that is signed by an
125 expired root certificate and cross signed as an intermediate, by a 125 expired root certificate and cross signed as an intermediate, by a
126 second root (should verify with one chain). 126 second root (should verify with one chain).
127
12814a. Deep chain with 32 certificates including root and leaf
129 (should verify with one chain).
130
13114b. Deep chain with 33 certificates including root and leaf
132 (should fail to verify).
diff --git a/src/regress/lib/libcrypto/dsa/dsatest.c b/src/regress/lib/libcrypto/dsa/dsatest.c
index 3a761961f0..79c83e04bc 100644
--- a/src/regress/lib/libcrypto/dsa/dsatest.c
+++ b/src/regress/lib/libcrypto/dsa/dsatest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dsatest.c,v 1.11 2024/02/29 20:04:43 tb Exp $ */ 1/* $OpenBSD: dsatest.c,v 1.12 2026/08/30 12:19:37 kenjiro 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 *
@@ -193,11 +193,10 @@ end:
193 if (!ret) 193 if (!ret)
194 ERR_print_errors(bio_err); 194 ERR_print_errors(bio_err);
195 DSA_free(dsa); 195 DSA_free(dsa);
196 CRYPTO_cleanup_all_ex_data();
197 ERR_remove_thread_state(NULL);
198 ERR_free_strings();
199 BIO_free(bio_err); 196 BIO_free(bio_err);
200 bio_err = NULL; 197 bio_err = NULL;
198 ERR_remove_thread_state(NULL);
199 OPENSSL_cleanup();
201 200
202 return !ret; 201 return !ret;
203} 202}
diff --git a/src/regress/lib/libcrypto/ec/ectest.c b/src/regress/lib/libcrypto/ec/ectest.c
index 3e81954174..edfc9ada46 100644
--- a/src/regress/lib/libcrypto/ec/ectest.c
+++ b/src/regress/lib/libcrypto/ec/ectest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ectest.c,v 1.36 2025/07/23 07:40:07 tb Exp $ */ 1/* $OpenBSD: ectest.c,v 1.37 2026/08/30 12:19:37 kenjiro Exp $ */
2/* 2/*
3 * Originally written by Bodo Moeller for the OpenSSL project. 3 * Originally written by Bodo Moeller for the OpenSSL project.
4 */ 4 */
@@ -668,9 +668,8 @@ main(int argc, char *argv[])
668 668
669 prime_field_tests(); 669 prime_field_tests();
670 670
671 CRYPTO_cleanup_all_ex_data();
672 ERR_free_strings();
673 ERR_remove_thread_state(NULL); 671 ERR_remove_thread_state(NULL);
672 OPENSSL_cleanup();
674 673
675 return 0; 674 return 0;
676} 675}
diff --git a/src/regress/lib/libcrypto/ecdsa/ecdsatest.c b/src/regress/lib/libcrypto/ecdsa/ecdsatest.c
index ef724c74b5..cfc1317bda 100644
--- a/src/regress/lib/libcrypto/ecdsa/ecdsatest.c
+++ b/src/regress/lib/libcrypto/ecdsa/ecdsatest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ecdsatest.c,v 1.18 2023/11/19 13:11:06 tb Exp $ */ 1/* $OpenBSD: ecdsatest.c,v 1.19 2026/08/30 12:19:37 kenjiro Exp $ */
2/* 2/*
3 * Written by Nils Larsch for the OpenSSL project. 3 * Written by Nils Larsch for the OpenSSL project.
4 */ 4 */
@@ -337,9 +337,8 @@ main(void)
337 ERR_print_errors_fp(stdout); 337 ERR_print_errors_fp(stdout);
338 } 338 }
339 339
340 CRYPTO_cleanup_all_ex_data();
341 ERR_remove_thread_state(NULL); 340 ERR_remove_thread_state(NULL);
342 ERR_free_strings(); 341 OPENSSL_cleanup();
343 342
344 return failed; 343 return failed;
345} 344}
diff --git a/src/regress/lib/libcrypto/evp/evptest.c b/src/regress/lib/libcrypto/evp/evptest.c
index 6c47e38a5f..b83ef33ce9 100644
--- a/src/regress/lib/libcrypto/evp/evptest.c
+++ b/src/regress/lib/libcrypto/evp/evptest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: evptest.c,v 1.15 2024/03/30 09:49:59 tb Exp $ */ 1/* $OpenBSD: evptest.c,v 1.16 2026/08/30 12:19:37 kenjiro Exp $ */
2/* Written by Ben Laurie, 2001 */ 2/* Written by Ben Laurie, 2001 */
3/* 3/*
4 * Copyright (c) 2001 The OpenSSL Project. All rights reserved. 4 * Copyright (c) 2001 The OpenSSL Project. All rights reserved.
@@ -431,10 +431,8 @@ main(int argc, char **argv)
431 } 431 }
432 fclose(f); 432 fclose(f);
433 433
434 EVP_cleanup();
435 CRYPTO_cleanup_all_ex_data();
436 ERR_remove_thread_state(NULL); 434 ERR_remove_thread_state(NULL);
437 ERR_free_strings(); 435 OPENSSL_cleanup();
438 436
439 return 0; 437 return 0;
440} 438}
diff --git a/src/regress/lib/libcrypto/exdata/exdata_test.c b/src/regress/lib/libcrypto/exdata/exdata_test.c
index a82cb4a66c..7c283470f1 100644
--- a/src/regress/lib/libcrypto/exdata/exdata_test.c
+++ b/src/regress/lib/libcrypto/exdata/exdata_test.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: exdata_test.c,v 1.3 2024/10/02 14:12:21 jsing Exp $ */ 1/* $OpenBSD: exdata_test.c,v 1.4 2026/08/30 12:19:37 kenjiro Exp $ */
2/* 2/*
3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -264,8 +264,7 @@ main(int argc, char **argv)
264 failed |= ex_data_test(); 264 failed |= ex_data_test();
265 failed |= ex_new_index_test(); 265 failed |= ex_new_index_test();
266 266
267 /* Force a clean up. */ 267 OPENSSL_cleanup();
268 CRYPTO_cleanup_all_ex_data();
269 268
270 return failed; 269 return failed;
271} 270}
diff --git a/src/regress/lib/libcrypto/free/freenull.awk b/src/regress/lib/libcrypto/free/freenull.awk
index 3a10d99ebb..fb2addc400 100644
--- a/src/regress/lib/libcrypto/free/freenull.awk
+++ b/src/regress/lib/libcrypto/free/freenull.awk
@@ -1,4 +1,4 @@
1# $OpenBSD: freenull.awk,v 1.4 2023/11/19 13:11:06 tb Exp $ 1# $OpenBSD: freenull.awk,v 1.5 2026/09/04 16:47:02 tb Exp $
2# Copyright (c) 2018 Theo Buehler <tb@openbsd.org> 2# Copyright (c) 2018 Theo Buehler <tb@openbsd.org>
3# 3#
4# Permission to use, copy, modify, and distribute this software for any 4# Permission to use, copy, modify, and distribute this software for any
@@ -15,30 +15,12 @@
15 15
16# usage: awk -f freenull.awk < Symbols.list > freenull.c.body 16# usage: awk -f freenull.awk < Symbols.list > freenull.c.body
17 17
18# Skip this function because it calls abort(3).
19/^CRYPTO_dbg_free/ {
20 next
21}
22
23# Skip *_free functions that take more than one or no argument. 18# Skip *_free functions that take more than one or no argument.
24/^ASN1_item_ex_free$/ || 19/^ASN1_item_ex_free$/ ||
25/^ASN1_item_free$/ || 20/^ASN1_item_free$/ ||
26/^CONF_modules_free$/ || 21/^CONF_modules_free$/ ||
27/^EVP_PKEY_asn1_set_free$/ ||
28/^X509V3_section_free$/ ||
29/^X509V3_string_free$/ ||
30/^sk_pop_free$/ {
31 next
32}
33
34# Skip functions that are prototyped in a .c file.
35/^BIO_CONNECT_free$/ ||
36/^CRYPTO_free$/ || 22/^CRYPTO_free$/ ||
37/^EC_PRIVATEKEY_free$/ || 23/^sk_pop_free$/ {
38/^ECPARAMETERS_free$/ ||
39/^ECPKPARAMETERS_free$/ ||
40/^X9_62_CHARACTERISTIC_TWO_free$/ ||
41/^X9_62_PENTANOMIAL_free$/ {
42 next 24 next
43} 25}
44 26
diff --git a/src/regress/lib/libcrypto/pbkdf2/pbkdf2.c b/src/regress/lib/libcrypto/pbkdf2/pbkdf2.c
index 33b683f0a0..4a11126c34 100644
--- a/src/regress/lib/libcrypto/pbkdf2/pbkdf2.c
+++ b/src/regress/lib/libcrypto/pbkdf2/pbkdf2.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pbkdf2.c,v 1.3 2023/11/19 13:11:06 tb Exp $ */ 1/* $OpenBSD: pbkdf2.c,v 1.4 2026/08/30 12:19:37 kenjiro Exp $ */
2/* Written by Christian Heimes, 2013 */ 2/* Written by Christian Heimes, 2013 */
3/* 3/*
4 * Copyright (c) 2013 The OpenSSL Project. All rights reserved. 4 * Copyright (c) 2013 The OpenSSL Project. All rights reserved.
@@ -196,9 +196,7 @@ main(int argc,char **argv)
196 test_p5_pbkdf2(n, "sha512", test, sha512_results[n]); 196 test_p5_pbkdf2(n, "sha512", test, sha512_results[n]);
197 } 197 }
198 198
199 EVP_cleanup();
200 CRYPTO_cleanup_all_ex_data();
201 ERR_remove_thread_state(NULL); 199 ERR_remove_thread_state(NULL);
202 ERR_free_strings(); 200 OPENSSL_cleanup();
203 return 0; 201 return 0;
204} 202}
diff --git a/src/regress/lib/libcrypto/pkcs7/pkcs7test.c b/src/regress/lib/libcrypto/pkcs7/pkcs7test.c
index 88126ea082..fc4af436af 100644
--- a/src/regress/lib/libcrypto/pkcs7/pkcs7test.c
+++ b/src/regress/lib/libcrypto/pkcs7/pkcs7test.c
@@ -1,6 +1,7 @@
1/* $OpenBSD: pkcs7test.c,v 1.6 2026/04/21 05:18:35 tb Exp $ */ 1/* $OpenBSD: pkcs7test.c,v 1.11 2026/08/31 09:18:25 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2026 Theo Buehler <tb@openbsd.org>
4 * 5 *
5 * Permission to use, copy, modify, and distribute this software for any 6 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above 7 * purpose with or without fee is hereby granted, provided that the above
@@ -16,13 +17,16 @@
16 */ 17 */
17 18
18#include <err.h> 19#include <err.h>
20#include <stdarg.h>
21#include <stdio.h>
19#include <stdlib.h> 22#include <stdlib.h>
20#include <string.h> 23#include <string.h>
21#include <unistd.h>
22 24
25#include <openssl/asn1.h>
23#include <openssl/bio.h> 26#include <openssl/bio.h>
24#include <openssl/err.h> 27#include <openssl/err.h>
25#include <openssl/evp.h> 28#include <openssl/evp.h>
29#include <openssl/objects.h>
26#include <openssl/pem.h> 30#include <openssl/pem.h>
27#include <openssl/pkcs7.h> 31#include <openssl/pkcs7.h>
28#include <openssl/x509.h> 32#include <openssl/x509.h>
@@ -100,9 +104,13 @@ x509_store_callback(int ok, X509_STORE_CTX *ctx)
100} 104}
101 105
102static void 106static void
103fatal(const char *msg) 107fatal(const char *msg, ...)
104{ 108{
105 warnx("%s", msg); 109 va_list ap;
110
111 va_start(ap, msg);
112 vwarnx(msg, ap);
113 va_end(ap);
106 ERR_print_errors_fp(stderr); 114 ERR_print_errors_fp(stderr);
107 exit(1); 115 exit(1);
108} 116}
@@ -300,12 +308,165 @@ pkcs7_basics(void)
300 return 0; 308 return 0;
301} 309}
302 310
311static int
312pkcs7_stream_missing_content_nid(int nid)
313{
314 PKCS7 *p7 = NULL;
315 const unsigned char *p, *name;
316 unsigned char **boundary = NULL;
317 unsigned char *der = NULL;
318 int der_len = 0;
319 int ret;
320 int failed = 1;
321
322 name = OBJ_nid2sn(nid);
323
324 /*
325 * Create a PKCS7 object with Content Type corresponding to nid
326 * and omit the optional content.
327 */
328
329 if ((p7 = PKCS7_new()) == NULL)
330 fatal("PKCS7_new NID %d (%s)", nid, name);
331 ASN1_OBJECT_free(p7->type);
332 if ((p7->type = OBJ_nid2obj(nid)) == NULL)
333 fatal("OBJ_nid2obj NID %d (%s)", nid, name);
334
335 /*
336 * Round trip this through DER.
337 */
338
339 if ((der_len = i2d_PKCS7(p7, &der)) <= 0)
340 fatal("i2d_PKCS7 NID %d (%s)", nid, name);
341
342 PKCS7_free(p7);
343 p7 = NULL;
344
345 p = der;
346 if ((p7 = d2i_PKCS7(NULL, &p, der_len)) == NULL)
347 fatal("d2i_PKCS7 NID %d (%s)", nid, name);
348
349 /*
350 * It deserialized, so we can safely stream it, right?
351 */
352
353 if ((ret = PKCS7_stream(&boundary, p7)) != 0) {
354 fprintf(stderr, "FAILURE: PKCS7_stream for NID %d (%s) "
355 "want 0, got %d\n", nid, name, ret);
356 goto out;
357 }
358
359 failed = 0;
360
361 out:
362 PKCS7_free(p7);
363 freezero(der, der_len);
364
365 return failed;
366}
367
368/*
369 * For each Content Type OID (RFC 2315, section 14), create a PKCS7 object that
370 * d2i_PKCS7() accepts. For x in [1..6] we use an object that encodes to
371 *
372 * SEQUENCE {
373 * OBJECT_IDENTIFIER { 1.2.840.113549.1.7.x }
374 * }
375 *
376 * This works because RFC 2315 section 7 marks the content optional:
377 *
378 * ContentInfo ::= SEQUENCE {
379 * contentType ContentType,
380 * content
381 * [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL }
382 *
383 * reflected in the ASN1_TFLG_OPTIONAL in pk7_asn1.c's p7default_tt.
384 */
385
386static int
387pkcs7_stream_missing_content(void)
388{
389 int failed = 0;
390
391 /* NID naming consistency is king. */
392 failed |= pkcs7_stream_missing_content_nid(NID_pkcs7_data);
393 failed |= pkcs7_stream_missing_content_nid(NID_pkcs7_signed);
394 failed |= pkcs7_stream_missing_content_nid(NID_pkcs7_enveloped);
395 failed |= pkcs7_stream_missing_content_nid(NID_pkcs7_signedAndEnveloped);
396 failed |= pkcs7_stream_missing_content_nid(NID_pkcs7_digest);
397 failed |= pkcs7_stream_missing_content_nid(NID_pkcs7_encrypted);
398
399 return failed;
400}
401
402/*
403 * SEQUENCE {
404 * # signedData
405 * OBJECT_IDENTIFIER { 1.2.840.113549.1.7.2 }
406 * [0] {
407 * SEQUENCE {
408 * INTEGER { 1 }
409 * SET {}
410 * SEQUENCE {
411 * # id-ct-TSTInfo
412 * OBJECT_IDENTIFIER { 1.2.840.113549.1.9.16.1.4 }
413 * [0] {
414 * SEQUENCE {
415 * INTEGER { 1 }
416 * OCTET_STRING { `deadbeef` }
417 * }
418 * }
419 * }
420 * SET {}
421 * }
422 * }
423 * }
424 */
425static const uint8_t pkcs7_malformed_der[] = {
426 0x30, 0x32, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
427 0xf7, 0x0d, 0x01, 0x07, 0x02, 0xa0, 0x25, 0x30,
428 0x23, 0x02, 0x01, 0x01, 0x31, 0x00, 0x30, 0x1a,
429 0x06, 0x0b, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
430 0x01, 0x09, 0x10, 0x01, 0x04, 0xa0, 0x0b, 0x30,
431 0x09, 0x02, 0x01, 0x01, 0x04, 0x04, 0xde, 0xad,
432 0xbe, 0xef, 0x31, 0x00,
433};
434static int pkcs7_malformed_der_len = sizeof(pkcs7_malformed_der);
435
436static int
437pkcs7_stream_signedData_oob(void)
438{
439 PKCS7 *p7 = NULL;
440 const unsigned char *p;
441 unsigned char **boundary = NULL;
442 int ret;
443 int failed = 1;
444
445 p = pkcs7_malformed_der;
446 if ((p7 = d2i_PKCS7(NULL, &p, pkcs7_malformed_der_len)) == NULL)
447 fatal("d2i_PKCS7 malformed");
448
449 if ((ret = PKCS7_stream(&boundary, p7)) != 0) {
450 fprintf(stderr, "FAILURE: PKCS7_stream want 0, got %d\n", ret);
451 goto out;
452 }
453
454 failed = 0;
455
456 out:
457 PKCS7_free(p7);
458
459 return failed;
460}
461
303int 462int
304main(int argc, char **argv) 463main(int argc, char **argv)
305{ 464{
306 int failed = 0; 465 int failed = 0;
307 466
308 failed |= pkcs7_basics(); 467 failed |= pkcs7_basics();
468 failed |= pkcs7_stream_missing_content();
469 failed |= pkcs7_stream_signedData_oob();
309 470
310 return failed; 471 return failed;
311} 472}
diff --git a/src/regress/lib/libcrypto/rsa/rsa_padding_test.c b/src/regress/lib/libcrypto/rsa/rsa_padding_test.c
index 1b3a0ba1e5..45d4a3fefa 100644
--- a/src/regress/lib/libcrypto/rsa/rsa_padding_test.c
+++ b/src/regress/lib/libcrypto/rsa/rsa_padding_test.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_padding_test.c,v 1.2 2024/03/30 02:20:39 jsing Exp $ */ 1/* $OpenBSD: rsa_padding_test.c,v 1.3 2026/05/10 14:08:02 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -174,7 +174,7 @@ test_pkcs1_type1(void)
174 err = ERR_peek_error(); 174 err = ERR_peek_error();
175 if (pt->want == -1 && ERR_GET_REASON(err) != pt->want_error) { 175 if (pt->want == -1 && ERR_GET_REASON(err) != pt->want_error) {
176 fprintf(stderr, "FAIL: test %zu - PKCS1 type 1 padding " 176 fprintf(stderr, "FAIL: test %zu - PKCS1 type 1 padding "
177 "check failed with error reason %i, want %i\n", 177 "check failed with error reason %d, want %d\n",
178 i, ERR_GET_REASON(err), pt->want_error); 178 i, ERR_GET_REASON(err), pt->want_error);
179 ERR_print_errors_fp(stderr); 179 ERR_print_errors_fp(stderr);
180 goto failed; 180 goto failed;
@@ -310,7 +310,7 @@ test_pkcs1_type2(void)
310 err = ERR_peek_error(); 310 err = ERR_peek_error();
311 if (pt->want == -1 && ERR_GET_REASON(err) != pt->want_error) { 311 if (pt->want == -1 && ERR_GET_REASON(err) != pt->want_error) {
312 fprintf(stderr, "FAIL: test %zu - PKCS1 type 2 padding " 312 fprintf(stderr, "FAIL: test %zu - PKCS1 type 2 padding "
313 "check failed with error reason %i, want %i\n", 313 "check failed with error reason %d, want %d\n",
314 i, ERR_GET_REASON(err), pt->want_error); 314 i, ERR_GET_REASON(err), pt->want_error);
315 ERR_print_errors_fp(stderr); 315 ERR_print_errors_fp(stderr);
316 goto failed; 316 goto failed;
diff --git a/src/regress/lib/libcrypto/wycheproof/Makefile b/src/regress/lib/libcrypto/wycheproof/Makefile
index 133de436df..4c4a321a80 100644
--- a/src/regress/lib/libcrypto/wycheproof/Makefile
+++ b/src/regress/lib/libcrypto/wycheproof/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.12 2026/01/22 11:40:25 tb Exp $ 1# $OpenBSD: Makefile,v 1.13 2026/05/05 12:56:12 tb Exp $
2 2
3WYCHEPROOF_TESTVECTORS = /usr/local/share/wycheproof/testvectors_v1/ 3WYCHEPROOF_TESTVECTORS = /usr/local/share/wycheproof/testvectors_v1/
4 4
@@ -13,7 +13,7 @@ REGRESS_TARGETS += regress-wycheproof-primes
13 13
14. if exists(/usr/local/bin/go) 14. if exists(/usr/local/bin/go)
15 15
16REGRESS_TARGETS += regress-wycheproof 16REGRESS_TARGETS += regress-wycheproof regress-fmt-wycheproof
17 17
18CLEANFILES += wycheproof 18CLEANFILES += wycheproof
19 19
@@ -23,6 +23,9 @@ wycheproof: wycheproof.go
23regress-wycheproof: wycheproof 23regress-wycheproof: wycheproof
24 ./wycheproof 24 ./wycheproof
25 25
26regress-fmt-wycheproof:
27 gofmt -d ${.CURDIR}/wycheproof.go
28
26REGRESS_CLEANUP = clean-go-cache 29REGRESS_CLEANUP = clean-go-cache
27 30
28clean-go-cache: 31clean-go-cache:
diff --git a/src/regress/lib/libcrypto/wycheproof/wycheproof.go b/src/regress/lib/libcrypto/wycheproof/wycheproof.go
index d36cd18de4..7f000b454f 100644
--- a/src/regress/lib/libcrypto/wycheproof/wycheproof.go
+++ b/src/regress/lib/libcrypto/wycheproof/wycheproof.go
@@ -1,4 +1,4 @@
1/* $OpenBSD: wycheproof.go,v 1.202 2026/04/21 20:55:21 tb Exp $ */ 1/* $OpenBSD: wycheproof.go,v 1.205 2026/08/11 18:25:42 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2018,2023 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2018,2023 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2018,2019,2022-2025 Theo Buehler <tb@openbsd.org> 4 * Copyright (c) 2018,2019,2022-2025 Theo Buehler <tb@openbsd.org>
@@ -2393,7 +2393,7 @@ func runMLKEMTestGroup(rank C.int, wt *wycheproofTestMLKEM) bool {
2393 if C.MLKEM_private_key_from_seed(privKey, (*C.uchar)(unsafe.Pointer(&seed[0])), C.size_t(seedLen)) != 1 { 2393 if C.MLKEM_private_key_from_seed(privKey, (*C.uchar)(unsafe.Pointer(&seed[0])), C.size_t(seedLen)) != 1 {
2394 if wt.Result != "invalid" { 2394 if wt.Result != "invalid" {
2395 fmt.Printf("%s - MLKEM_private_key_from_seed failed\n", wt) 2395 fmt.Printf("%s - MLKEM_private_key_from_seed failed\n", wt)
2396 return false; 2396 return false
2397 } 2397 }
2398 return true 2398 return true
2399 } 2399 }
@@ -2453,7 +2453,7 @@ func runMLKEMEncapsTestGroup(rank C.int, wt *wycheproofTestMLKEM) bool {
2453 if C.MLKEM_parse_public_key(pubKey, (*C.uchar)(unsafe.Pointer(&ek[0])), (C.size_t)(ekLen)) != 1 { 2453 if C.MLKEM_parse_public_key(pubKey, (*C.uchar)(unsafe.Pointer(&ek[0])), (C.size_t)(ekLen)) != 1 {
2454 if wt.Result != "invalid" { 2454 if wt.Result != "invalid" {
2455 fmt.Printf("FAIL: %s: MLKEM_parse_public_key failed !!!\n", wt) 2455 fmt.Printf("FAIL: %s: MLKEM_parse_public_key failed !!!\n", wt)
2456 return false; 2456 return false
2457 } 2457 }
2458 return true 2458 return true
2459 } 2459 }
@@ -2544,9 +2544,9 @@ func runMLKEMKeyGenTest(rank C.int, wt *wycheproofTestMLKEM) bool {
2544 2544
2545 dK, _ := mustDecodeHexString(wt.Dk, "dK") 2545 dK, _ := mustDecodeHexString(wt.Dk, "dK")
2546 eK, _ := mustDecodeHexString(wt.Ek, "eK") 2546 eK, _ := mustDecodeHexString(wt.Ek, "eK")
2547 2547
2548 if (bytes.Equal(dK, gotDk) && bytes.Equal(eK, gotEk)) != (wt.Result != "invalid") { 2548 if (bytes.Equal(dK, gotDk) && bytes.Equal(eK, gotEk)) != (wt.Result != "invalid") {
2549 fmt.Printf("FAIL: %s - encoded keys differ", wt); 2549 fmt.Printf("FAIL: %s - encoded keys differ", wt)
2550 return false 2550 return false
2551 } 2551 }
2552 2552
@@ -3085,6 +3085,8 @@ func testGroupFromTestVector(wtv *wycheproofTestVectorsV1) (wycheproofTestGroupR
3085 return nil, Skip 3085 return nil, Skip
3086 case "CHACHA20-POLY1305", "XCHACHA20-POLY1305": 3086 case "CHACHA20-POLY1305", "XCHACHA20-POLY1305":
3087 return &wycheproofTestGroupChaCha{}, variant 3087 return &wycheproofTestGroupChaCha{}, variant
3088 case "Cobblestone-128", "Cobblestone-256":
3089 return nil, Skip
3088 case "DSA": 3090 case "DSA":
3089 if wtv.Schema == "dsa_p1363_verify_schema_v1.json" { 3091 if wtv.Schema == "dsa_p1363_verify_schema_v1.json" {
3090 variant = P1363 3092 variant = P1363
@@ -3192,7 +3194,7 @@ func runTestVectors(path string) bool {
3192 return wtg.run(wtv.Algorithm, variant) 3194 return wtg.run(wtv.Algorithm, variant)
3193 }) 3195 })
3194 } 3196 }
3195 for _ = range wtv.TestGroups { 3197 for range wtv.TestGroups {
3196 result := <-testc.resultCh 3198 result := <-testc.resultCh
3197 if !result { 3199 if !result {
3198 success = false 3200 success = false
diff --git a/src/regress/lib/libcrypto/x509/Makefile b/src/regress/lib/libcrypto/x509/Makefile
index 94e9e476a0..7e593f7274 100644
--- a/src/regress/lib/libcrypto/x509/Makefile
+++ b/src/regress/lib/libcrypto/x509/Makefile
@@ -1,8 +1,8 @@
1# $OpenBSD: Makefile,v 1.25 2025/05/05 06:33:34 tb Exp $ 1# $OpenBSD: Makefile,v 1.29 2026/06/26 06:08:08 tb Exp $
2 2
3PROGS = constraints verify x509attribute x509req_ext callback 3PROGS = constraints verify x509attribute x509req_ext callback
4PROGS += expirecallback callbackfailures x509_asn1 x509_extensions_test 4PROGS += expirecallback callbackfailures x509_asn1 x509_extensions_test
5PROGS += x509_name_test 5PROGS += x509_crl x509_name_test
6LDADD = -lcrypto 6LDADD = -lcrypto
7DPADD = ${LIBCRYPTO} 7DPADD = ${LIBCRYPTO}
8 8
diff --git a/src/regress/lib/libcrypto/x509/bettertls/verify.c b/src/regress/lib/libcrypto/x509/bettertls/verify.c
index e1d97d42ef..3911369cc2 100644
--- a/src/regress/lib/libcrypto/x509/bettertls/verify.c
+++ b/src/regress/lib/libcrypto/x509/bettertls/verify.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: verify.c,v 1.9 2020/10/26 12:11:47 beck Exp $ */ 1/* $OpenBSD: verify.c,v 1.10 2026/05/29 13:21:15 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2020 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2020 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2020 Bob Beck <beck@openbsd.org> 4 * Copyright (c) 2020 Bob Beck <beck@openbsd.org>
@@ -29,7 +29,7 @@
29#include <openssl/x509_vfy.h> 29#include <openssl/x509_vfy.h>
30 30
31static int verbose = 0; 31static int verbose = 0;
32static int json = 0; /* print out json like bettertls expects resuls in */ 32static int json = 0; /* print out json like bettertls expects results in */
33 33
34static int 34static int
35passwd_cb(char *buf, int size, int rwflag, void *u) 35passwd_cb(char *buf, int size, int rwflag, void *u)
diff --git a/src/regress/lib/libcrypto/x509/callback.c b/src/regress/lib/libcrypto/x509/callback.c
index a3717bca24..a021115531 100644
--- a/src/regress/lib/libcrypto/x509/callback.c
+++ b/src/regress/lib/libcrypto/x509/callback.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: callback.c,v 1.6 2026/03/31 13:39:48 jsing Exp $ */ 1/* $OpenBSD: callback.c,v 1.8 2026/05/04 13:52:39 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2020 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2020 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2020-2021 Bob Beck <beck@openbsd.org> 4 * Copyright (c) 2020-2021 Bob Beck <beck@openbsd.org>
@@ -110,7 +110,7 @@ verify_cert_cb(int ok, X509_STORE_CTX *xsc)
110 110
111static void 111static void
112verify_cert(const char *roots_dir, const char *roots_file, 112verify_cert(const char *roots_dir, const char *roots_file,
113 const char *bundle_file, int *chains, int mode) 113 const char *bundle_file, int *chains, int set_depth, int mode)
114{ 114{
115 STACK_OF(X509) *roots = NULL, *bundle = NULL; 115 STACK_OF(X509) *roots = NULL, *bundle = NULL;
116 X509_STORE_CTX *xsc = NULL; 116 X509_STORE_CTX *xsc = NULL;
@@ -141,6 +141,10 @@ verify_cert(const char *roots_dir, const char *roots_file,
141 if (!X509_STORE_load_locations(store, NULL, roots_dir)) 141 if (!X509_STORE_load_locations(store, NULL, roots_dir))
142 errx(1, "failed to set by_dir directory of %s", roots_dir); 142 errx(1, "failed to set by_dir directory of %s", roots_dir);
143 } 143 }
144 if (set_depth > 0) {
145 X509_VERIFY_PARAM_set_depth(X509_STORE_CTX_get0_param(xsc),
146 set_depth);
147 }
144 if (mode == MODE_LEGACY_VFY) 148 if (mode == MODE_LEGACY_VFY)
145 X509_STORE_CTX_set_flags(xsc, X509_V_FLAG_LEGACY_VERIFY); 149 X509_STORE_CTX_set_flags(xsc, X509_V_FLAG_LEGACY_VERIFY);
146 else 150 else
@@ -173,7 +177,9 @@ verify_cert(const char *roots_dir, const char *roots_file,
173} 177}
174 178
175struct verify_cert_test { 179struct verify_cert_test {
180 const char *desc;
176 const char *id; 181 const char *id;
182 int set_depth;
177 int want_chains; 183 int want_chains;
178 int failing; 184 int failing;
179}; 185};
@@ -188,6 +194,24 @@ struct verify_cert_test verify_cert_tests[] = {
188 .want_chains = 1, 194 .want_chains = 1,
189 }, 195 },
190 { 196 {
197 .desc = "2a with depth 2",
198 .id = "2a",
199 .set_depth = 2,
200 .want_chains = 1,
201 },
202 {
203 .desc = "2a with depth 1",
204 .id = "2a",
205 .set_depth = 1,
206 .want_chains = 0,
207 },
208 {
209 .desc = "2a with depth 1",
210 .id = "2a",
211 .set_depth = 1,
212 .want_chains = 0,
213 },
214 {
191 .id = "2b", 215 .id = "2b",
192 .want_chains = 0, 216 .want_chains = 0,
193 }, 217 },
@@ -375,10 +399,12 @@ verify_cert_test(const char *certs_path, int mode)
375 if (asprintf(&roots_dir, "./%s/roots", vct->id) == -1) 399 if (asprintf(&roots_dir, "./%s/roots", vct->id) == -1)
376 errx(1, "asprintf"); 400 errx(1, "asprintf");
377 401
378 fprintf(output, "== Test %zu (%s)\n", i, vct->id); 402 fprintf(output, "== Test %zu (%s)\n", i,
403 vct->desc != NULL ? vct->desc : vct->id);
379 fprintf(output, "== Legacy:\n"); 404 fprintf(output, "== Legacy:\n");
380 mode = MODE_LEGACY_VFY; 405 mode = MODE_LEGACY_VFY;
381 verify_cert(roots_dir, roots_file, bundle_file, &chains, mode); 406 verify_cert(roots_dir, roots_file, bundle_file, &chains,
407 vct->set_depth, mode);
382 if ((mode == MODE_VERIFY && chains == vct->want_chains) || 408 if ((mode == MODE_VERIFY && chains == vct->want_chains) ||
383 (chains == 0 && vct->want_chains == 0) || 409 (chains == 0 && vct->want_chains == 0) ||
384 (chains == 1 && vct->want_chains > 0)) { 410 (chains == 1 && vct->want_chains > 0)) {
@@ -395,7 +421,8 @@ verify_cert_test(const char *certs_path, int mode)
395 fprintf(output, "\n"); 421 fprintf(output, "\n");
396 fprintf(output, "== Modern:\n"); 422 fprintf(output, "== Modern:\n");
397 mode = MODE_MODERN_VFY; 423 mode = MODE_MODERN_VFY;
398 verify_cert(roots_dir, roots_file, bundle_file, &chains, mode); 424 verify_cert(roots_dir, roots_file, bundle_file, &chains,
425 vct->set_depth, mode);
399 if ((mode == MODE_VERIFY && chains == vct->want_chains) || 426 if ((mode == MODE_VERIFY && chains == vct->want_chains) ||
400 (chains == 0 && vct->want_chains == 0) || 427 (chains == 0 && vct->want_chains == 0) ||
401 (chains == 1 && vct->want_chains > 0)) { 428 (chains == 1 && vct->want_chains > 0)) {
diff --git a/src/regress/lib/libcrypto/x509/callbackfailures.c b/src/regress/lib/libcrypto/x509/callbackfailures.c
index 9230122146..112f936fcb 100644
--- a/src/regress/lib/libcrypto/x509/callbackfailures.c
+++ b/src/regress/lib/libcrypto/x509/callbackfailures.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: callbackfailures.c,v 1.3 2024/08/23 12:56:26 anton Exp $ */ 1/* $OpenBSD: callbackfailures.c,v 1.4 2026/07/31 06:32:34 kenjiro Exp $ */
2/* 2/*
3 * Copyright (c) 2020 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2020 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2020-2021 Bob Beck <beck@openbsd.org> 4 * Copyright (c) 2020-2021 Bob Beck <beck@openbsd.org>
@@ -214,9 +214,9 @@ struct verify_cert_test verify_cert_tests[] = {
214 (sizeof(verify_cert_tests) / sizeof(*verify_cert_tests)) 214 (sizeof(verify_cert_tests) / sizeof(*verify_cert_tests))
215 215
216static int 216static int
217verify_cert_test(const char *certs_path, int mode) 217verify_cert_test(const char *certs_path, const char *roots_file, int mode)
218{ 218{
219 char *roots_file, *bundle_file, *bundle_file2, *roots_dir; 219 char *bundle_file, *bundle_file2, *roots_dir;
220 struct verify_cert_test *vct; 220 struct verify_cert_test *vct;
221 int failed = 0; 221 int failed = 0;
222 int chains; 222 int chains;
@@ -225,8 +225,6 @@ verify_cert_test(const char *certs_path, int mode)
225 for (i = 0; i < N_VERIFY_CERT_TESTS; i++) { 225 for (i = 0; i < N_VERIFY_CERT_TESTS; i++) {
226 vct = &verify_cert_tests[i]; 226 vct = &verify_cert_tests[i];
227 227
228 if (asprintf(&roots_file, "/etc/ssl/cert.pem") == -1)
229 errx(1, "asprintf");
230 if (asprintf(&bundle_file, "%s/%s/bundle.pem", certs_path, 228 if (asprintf(&bundle_file, "%s/%s/bundle.pem", certs_path,
231 vct->id) == -1) 229 vct->id) == -1)
232 errx(1, "asprintf"); 230 errx(1, "asprintf");
@@ -270,7 +268,6 @@ verify_cert_test(const char *certs_path, int mode)
270 } 268 }
271 fprintf(stderr, "\n"); 269 fprintf(stderr, "\n");
272 270
273 free(roots_file);
274 free(bundle_file); 271 free(bundle_file);
275 free(bundle_file2); 272 free(bundle_file2);
276 free(roots_dir); 273 free(roots_dir);
@@ -282,17 +279,21 @@ verify_cert_test(const char *certs_path, int mode)
282int 279int
283main(int argc, char **argv) 280main(int argc, char **argv)
284{ 281{
282 const char *roots_file = "/etc/ssl/cert.pem";
285 int failed = 0; 283 int failed = 0;
286 284
287 if (argc != 2) { 285 if (argc < 2 || argc > 3) {
288 fprintf(stderr, "usage: %s <certs_path>\n", argv[0]); 286 fprintf(stderr, "usage: %s <certs_path> [roots_file]\n",
287 argv[0]);
289 exit(1); 288 exit(1);
290 } 289 }
290 if (argc == 3)
291 roots_file = argv[2];
291 292
292 fprintf(stderr, "\n\nTesting legacy x509_vfy\n"); 293 fprintf(stderr, "\n\nTesting legacy x509_vfy\n");
293 failed |= verify_cert_test(argv[1], MODE_LEGACY_VFY); 294 failed |= verify_cert_test(argv[1], roots_file, MODE_LEGACY_VFY);
294 fprintf(stderr, "\n\nTesting modern x509_vfy\n"); 295 fprintf(stderr, "\n\nTesting modern x509_vfy\n");
295 failed |= verify_cert_test(argv[1], MODE_MODERN_VFY); 296 failed |= verify_cert_test(argv[1], roots_file, MODE_MODERN_VFY);
296 297
297 return (failed); 298 return (failed);
298} 299}
diff --git a/src/regress/lib/libcrypto/x509/constraints.c b/src/regress/lib/libcrypto/x509/constraints.c
index 54bb654a31..136dd07f6e 100644
--- a/src/regress/lib/libcrypto/x509/constraints.c
+++ b/src/regress/lib/libcrypto/x509/constraints.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: constraints.c,v 1.19 2026/04/13 17:04:23 beck Exp $ */ 1/* $OpenBSD: constraints.c,v 1.21 2026/07/14 15:54:14 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2020 Bob Beck <beck@openbsd.org> 3 * Copyright (c) 2020 Bob Beck <beck@openbsd.org>
4 * 4 *
@@ -160,6 +160,10 @@ unsigned char *invaliduri[] = {
160 "https://192.168..1.1/", 160 "https://192.168..1.1/",
161 "https://.2001:0DB8:AC10:FE01::/", 161 "https://.2001:0DB8:AC10:FE01::/",
162 "https://.2001:0DB8:AC10:FE01::|/", 162 "https://.2001:0DB8:AC10:FE01::|/",
163 "https://2001:0DB8:AC10:FE01::1/",
164 "https://beck@openbsd.org@example.com",
165 "https://beck:password@openbsd.org:4433:example.com/",
166 "//:/",
163 "///", 167 "///",
164 "//", 168 "//",
165 "/", 169 "/",
@@ -167,13 +171,47 @@ unsigned char *invaliduri[] = {
167 NULL, 171 NULL,
168}; 172};
169 173
170unsigned char *validuri[] = { 174struct uri_test {
171 "https://www.openbsd.org/meep/meep/meep/", 175 unsigned char *uri;
172 "https://192.168.1.1/", 176 unsigned char *hostpart;
173 "https://2001:0DB8:AC10:FE01::/", 177};
174 "https://192.168.1/", /* Not an IP, but valid component */ 178
175 "https://999.999.999.999/", /* Not an IP, but valid component */ 179static const struct uri_test validuri[] = {
176 NULL, 180 {
181 .uri = "https://www.openbsd.org/meep/meep/meep/",
182 .hostpart = "www.openbsd.org",
183 },
184 {
185 .uri = "https://beck:password@openbsd.org:4433/",
186 .hostpart = "openbsd.org",
187 },
188 {
189 .uri = "https://192.168.1.1/",
190 .hostpart = "192.168.1.1",
191 },
192 {
193 .uri = "https://[2001:0DB8:AC10:FE01::1]/",
194 .hostpart = "[2001:0DB8:AC10:FE01::1]",
195 },
196 {
197 .uri = "https://[2001:0DB8:AC10:FE01::1]:443/",
198 .hostpart = "[2001:0DB8:AC10:FE01::1]",
199 },
200 {
201 .uri = "https://beck:password@[2001:0DB8:AC10:FE01::1]:443/",
202 .hostpart = "[2001:0DB8:AC10:FE01::1]",
203 },
204 {
205 .uri = "https://192.168.1/", /* Not an IP, but valid component */
206 .hostpart = "192.168.1",
207 },
208 {
209 .uri = "https://999.999.999.999/", /* Not an IP, but valid component */
210 .hostpart = "999.999.999.999",
211 },
212 {
213 .uri = NULL,
214 },
177}; 215};
178 216
179static int 217static int
@@ -395,11 +433,17 @@ test_valid_uri(void)
395 int j, failure = 0; 433 int j, failure = 0;
396 char *hostpart = NULL; 434 char *hostpart = NULL;
397 435
398 for (j = 0; validuri[j] != NULL; j++) { 436 for (j = 0; validuri[j].uri != NULL; j++) {
399 if (x509_constraints_uri_host(validuri[j], 437 if (x509_constraints_uri_host(validuri[j].uri,
400 strlen(invaliduri[j]), &hostpart) == 0) { 438 strlen(validuri[j].uri), &hostpart) == 0) {
401 FAIL("Valid URI '%s' NOT accepted\n", 439 FAIL("Valid URI '%s' NOT accepted\n",
402 validuri[j]); 440 validuri[j].uri);
441 failure = 1;
442 goto done;
443 }
444 if (strcmp(hostpart, validuri[j].hostpart) != 0) {
445 FAIL("Valid URI hostpart '%s' != '%s'\n",
446 hostpart, validuri[j].hostpart);
403 failure = 1; 447 failure = 1;
404 goto done; 448 goto done;
405 } 449 }
@@ -452,6 +496,7 @@ test_constraints1(void)
452 "https://www.openbsd.net?", 496 "https://www.openbsd.net?",
453 "https://org#", 497 "https://org#",
454 "herp://beck@org:", 498 "herp://beck@org:",
499 "https://openbsd.org:password@example.com/path",
455 "///", 500 "///",
456 "//", 501 "//",
457 "/", 502 "/",
diff --git a/src/regress/lib/libcrypto/x509/rfc3779/rfc3779.c b/src/regress/lib/libcrypto/x509/rfc3779/rfc3779.c
index 61556f096f..f9cc24122c 100644
--- a/src/regress/lib/libcrypto/x509/rfc3779/rfc3779.c
+++ b/src/regress/lib/libcrypto/x509/rfc3779/rfc3779.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rfc3779.c,v 1.12 2026/03/13 06:47:34 tb Exp $ */ 1/* $OpenBSD: rfc3779.c,v 1.17 2026/06/04 12:01:55 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2021 Theo Buehler <tb@openbsd.org> 3 * Copyright (c) 2021 Theo Buehler <tb@openbsd.org>
4 * 4 *
@@ -41,9 +41,10 @@ report_hexdump(const char *func, const char *description, const char *msg,
41 const unsigned char *want, size_t want_len, 41 const unsigned char *want, size_t want_len,
42 const unsigned char *got, size_t got_len) 42 const unsigned char *got, size_t got_len)
43{ 43{
44 fprintf(stderr, "%s: \"%s\" %s\nwant:\n", func, description, msg); 44 fprintf(stderr, "%s: \"%s\" %s\nwant %zu bytes:\n",
45 func, description, msg, want_len);
45 hexdump(want, want_len); 46 hexdump(want, want_len);
46 fprintf(stderr, "got:\n"); 47 fprintf(stderr, "got %zu bytes:\n", got_len);
47 hexdump(got, got_len); 48 hexdump(got, got_len);
48} 49}
49 50
@@ -228,7 +229,7 @@ const struct IPAddressOrRange_test IPAddressOrRange_test_data[] = {
228 0x03, 0x04, 0x06, 0xc4, 0x01, 0x00, 229 0x03, 0x04, 0x06, 0xc4, 0x01, 0x00,
229 }, 230 },
230 .der_len = 14, 231 .der_len = 14,
231 .afi = IANA_AFI_IPV4, 232 .afi = IANA_AFI_IPV4,
232 .min = { 233 .min = {
233 0xc4, 0x01, 0x07, 0x00, 234 0xc4, 0x01, 0x07, 0x00,
234 }, 235 },
@@ -331,8 +332,7 @@ run_IPAddressOrRange_tests(void)
331 int failed = 0; 332 int failed = 0;
332 333
333 for (i = 0; i < N_IPADDRESSORRANGE_TESTS; i++) 334 for (i = 0; i < N_IPADDRESSORRANGE_TESTS; i++)
334 failed |= 335 failed |= test_IPAddressOrRange(&IPAddressOrRange_test_data[i]);
335 test_IPAddressOrRange(&IPAddressOrRange_test_data[i]);
336 336
337 return failed; 337 return failed;
338} 338}
@@ -986,7 +986,7 @@ build_addr_block_test(const struct build_addr_block_test_data *test)
986 " failed\n", __func__, test->description); 986 " failed\n", __func__, test->description);
987 goto err; 987 goto err;
988 } 988 }
989 if (test->afis[i] != afi){ 989 if (test->afis[i] != afi) {
990 fprintf(stderr, "%s: \"%s\" afi[%d] mismatch. " 990 fprintf(stderr, "%s: \"%s\" afi[%d] mismatch. "
991 "want: %u, got: %u\n", __func__, 991 "want: %u, got: %u\n", __func__,
992 test->description, i, test->afis[i], afi); 992 test->description, i, test->afis[i], afi);
@@ -1527,7 +1527,6 @@ build_asid_test(const struct ASIdentifiers_build_test *test)
1527 goto err; 1527 goto err;
1528 } 1528 }
1529 1529
1530
1531 memcmp_failed = (size_t)out_len != test->der_len; 1530 memcmp_failed = (size_t)out_len != test->der_len;
1532 if (!memcmp_failed) 1531 if (!memcmp_failed)
1533 memcmp_failed = memcmp(out, test->der, test->der_len); 1532 memcmp_failed = memcmp(out, test->der, test->der_len);
@@ -2006,6 +2005,188 @@ run_ASIdentifiers_subset_test(void)
2006 return failed; 2005 return failed;
2007} 2006}
2008 2007
2008/*
2009 * IPAddressFamily_cmp() is well exercised with mostly valid data via canonize
2010 * and is_canonical. Squeeze invalid inheriting address families between valid
2011 * ones, then sort. This would previously call memcmp() on NULL.
2012 */
2013
2014static const uint8_t invalid_block[] = {
2015 0x30, 0x26,
2016 0x30, 0x04, 0x04, 0x00, 0x05, 0x00, /* Invalid empty AF. */
2017 0x30, 0x06, 0x04, 0x02, 0x00, 0x01, 0x05, 0x00, /* IPv4 */
2018 0x30, 0x06, 0x04, 0x02, 0x00, 0x02, 0x05, 0x00, /* IPv6 */
2019 0x30, 0x07, 0x04, 0x03, 0x00, 0x02, 0x04, 0x05, 0x00, /* IPv6 NLRI */
2020 0x30, 0x05, 0x04, 0x01, 0x01, 0x05, 0x00, /* invalid AF 0x01 */
2021};
2022static const size_t invalid_block_len = sizeof(invalid_block);
2023
2024static int
2025run_IPAddressFamily_cmp_ub_test(void)
2026{
2027 IPAddrBlocks *addrs;
2028 IPAddressFamily *af = NULL;
2029 const unsigned char *p;
2030 unsigned char *out = NULL;
2031 int out_len = 0;
2032 unsigned int nlri_safi = 4;
2033 int memcmp_failed;
2034 int failed = 1;
2035
2036 if ((addrs = IPAddrBlocks_new()) == NULL) {
2037 fprintf(stderr, "%s: IPAddrBlocks_new\n", __func__);
2038 goto err;
2039 }
2040
2041 /*
2042 * Add IPv6 NLRI, inheriting
2043 */
2044
2045 if (!X509v3_addr_add_inherit(addrs, IANA_AFI_IPV6, &nlri_safi)) {
2046 fprintf(stderr, "%s: X509v3_addr_add_inherit IPv6\n", __func__);
2047 goto err;
2048 }
2049
2050 /*
2051 * Add IPv6, inheriting
2052 */
2053
2054 if (!X509v3_addr_add_inherit(addrs, IANA_AFI_IPV6, NULL)) {
2055 fprintf(stderr, "%s: X509v3_addr_add_inherit IPv6\n", __func__);
2056 goto err;
2057 }
2058
2059 /*
2060 * Add an inheriting IPAddressFamily with invalid empty addressFamily.
2061 */
2062
2063 if ((af = IPAddressFamily_new()) == NULL) {
2064 fprintf(stderr, "%s: IPAddressFamily_new\n", __func__);
2065 goto err;
2066 }
2067 if ((af->ipAddressChoice->u.inherit = ASN1_NULL_new()) == NULL) {
2068 fprintf(stderr, "%s: ASN1_NULL_new()\n", __func__);
2069 goto err;
2070 }
2071 af->ipAddressChoice->type = IPAddressChoice_inherit;
2072
2073 if (sk_IPAddressFamily_push(addrs, af) <= 0) {
2074 fprintf(stderr, "%s: sk_IPAddressFamily_push\n", __func__);
2075 goto err;
2076 }
2077 af = NULL;
2078
2079 /*
2080 * Add an inheriting IPAddressFamily with invalid addressFamily 0x01.
2081 */
2082
2083 if ((af = IPAddressFamily_new()) == NULL) {
2084 fprintf(stderr, "%s: IPAddressFamily_new\n", __func__);
2085 goto err;
2086 }
2087 if (!ASN1_OCTET_STRING_set(af->addressFamily, "\x01", 1)) {
2088 fprintf(stderr, "%s: ASN1_OCTET_STRING_set\n", __func__);
2089 goto err;
2090 }
2091 if ((af->ipAddressChoice->u.inherit = ASN1_NULL_new()) == NULL) {
2092 fprintf(stderr, "%s: ASN1_NULL_new()\n", __func__);
2093 goto err;
2094 }
2095 af->ipAddressChoice->type = IPAddressChoice_inherit;
2096
2097 if (sk_IPAddressFamily_push(addrs, af) <= 0) {
2098 fprintf(stderr, "%s: sk_IPAddressFamily_push\n", __func__);
2099 goto err;
2100 }
2101 af = NULL;
2102
2103 /*
2104 * Add IPv4, inheriting
2105 */
2106
2107 if (!X509v3_addr_add_inherit(addrs, IANA_AFI_IPV4, NULL)) {
2108 fprintf(stderr, "%s: X509v3_addr_add_inherit IPv4\n", __func__);
2109 goto err;
2110 }
2111
2112 /*
2113 * Sort the thing.
2114 */
2115
2116 sk_IPAddressFamily_sort(addrs);
2117
2118 /*
2119 * Since addrs contains two invalid AFIs, X509v3_addr_is_canonical()
2120 * should reject it. Serializing works nevertheless.
2121 */
2122
2123 if (X509v3_addr_is_canonical(addrs)) {
2124 fprintf(stderr, "%s: X509v3_addr_is_canonical\n", __func__);
2125 goto err;
2126 }
2127
2128 if ((out_len = i2d_IPAddrBlocks(addrs, &out)) <= 0) {
2129 fprintf(stderr, "%s: i2d_IPAddrBlocks failed\n", __func__);
2130 out_len = 0;
2131 goto err;
2132 }
2133
2134 memcmp_failed = 0;
2135 if (invalid_block_len != (size_t)out_len)
2136 memcmp_failed = 1;
2137 if (!memcmp_failed)
2138 memcmp_failed = memcmp(invalid_block, out, out_len) != 0;
2139
2140 if (memcmp_failed) {
2141 report_hexdump(__func__, "invalid IPAddrBlock", "memcmp DER failed",
2142 invalid_block, invalid_block_len, out, out_len);
2143 goto err;
2144 }
2145
2146 /*
2147 * We can also parse this garbage.
2148 */
2149
2150 IPAddrBlocks_free(addrs);
2151 addrs = NULL;
2152
2153 p = invalid_block;
2154 if ((addrs = d2i_IPAddrBlocks(NULL, &p, invalid_block_len)) == NULL) {
2155 fprintf(stderr, "%s: d2i_IPAddrBlocks\n", __func__);
2156 goto err;
2157 }
2158
2159 freezero(out, out_len);
2160 out = NULL;
2161
2162 if ((out_len = i2d_IPAddrBlocks(addrs, &out)) <= 0) {
2163 fprintf(stderr, "%s: i2d_IPAddrBlocks (2) failed\n", __func__);
2164 out_len = 0;
2165 goto err;
2166 }
2167
2168 memcmp_failed = 0;
2169 if (invalid_block_len != (size_t)out_len)
2170 memcmp_failed = 1;
2171 if (!memcmp_failed)
2172 memcmp_failed = memcmp(invalid_block, out, out_len) != 0;
2173
2174 if (memcmp_failed) {
2175 report_hexdump(__func__, "invalid IPAddrBlock (2)", "memcmp DER failed",
2176 invalid_block, invalid_block_len, out, out_len);
2177 goto err;
2178 }
2179
2180 failed = 0;
2181
2182 err:
2183 IPAddrBlocks_free(addrs);
2184 IPAddressFamily_free(af);
2185 freezero(out, out_len);
2186
2187 return failed;
2188}
2189
2009int 2190int
2010main(void) 2191main(void)
2011{ 2192{
@@ -2015,6 +2196,7 @@ main(void)
2015 failed |= run_IPAddrBlock_tests(); 2196 failed |= run_IPAddrBlock_tests();
2016 failed |= run_ASIdentifiers_build_test(); 2197 failed |= run_ASIdentifiers_build_test();
2017 failed |= run_ASIdentifiers_subset_test(); 2198 failed |= run_ASIdentifiers_subset_test();
2199 failed |= run_IPAddressFamily_cmp_ub_test();
2018 2200
2019 return failed; 2201 return failed;
2020} 2202}
diff --git a/src/regress/lib/libcrypto/x509/verify.c b/src/regress/lib/libcrypto/x509/verify.c
index 77cdbfd915..17e7251d0d 100644
--- a/src/regress/lib/libcrypto/x509/verify.c
+++ b/src/regress/lib/libcrypto/x509/verify.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: verify.c,v 1.14 2026/04/01 14:39:11 jsing Exp $ */ 1/* $OpenBSD: verify.c,v 1.17 2026/07/29 02:08:31 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2020 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2020 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2020-2021 Bob Beck <beck@openbsd.org> 4 * Copyright (c) 2020-2021 Bob Beck <beck@openbsd.org>
@@ -102,10 +102,45 @@ verify_cert_cb(int ok, X509_STORE_CTX *xsc)
102 return ok; 102 return ok;
103} 103}
104 104
105static int
106verify_cert_depth_cb(int ok, X509_STORE_CTX *xsc)
107{
108 int verify_err;
109
110 ok = verify_cert_cb(ok, xsc);
111
112 verify_err = X509_STORE_CTX_get_error(xsc);
113 if (verify_err == X509_V_ERR_CERT_CHAIN_TOO_LONG) {
114 fprintf(stderr, "overriding verify error at depth %d: %s\n",
115 X509_STORE_CTX_get_error_depth(xsc),
116 X509_verify_cert_error_string(verify_err));
117 ok = 1;
118 }
119
120 return ok;
121}
122
123static int
124verify_cert_yolo_cb(int ok, X509_STORE_CTX *xsc)
125{
126 int verify_err;
127
128 verify_cert_cb(ok, xsc);
129
130 verify_err = X509_STORE_CTX_get_error(xsc);
131 if (verify_err != X509_V_OK) {
132 fprintf(stderr, "overriding verify error at depth %d: %s\n",
133 X509_STORE_CTX_get_error_depth(xsc),
134 X509_verify_cert_error_string(verify_err));
135 }
136
137 return 1;
138}
139
105static void 140static void
106verify_cert(const char *roots_dir, const char *roots_file, 141verify_cert(const char *roots_dir, const char *roots_file,
107 const char *bundle_file, int *chains, int *error, int *error_depth, 142 const char *bundle_file, int *chains, int *error, int *error_depth,
108 int mode) 143 int set_depth, int (*verify_cb)(int, X509_STORE_CTX *), int mode)
109{ 144{
110 STACK_OF(X509) *roots = NULL, *bundle = NULL; 145 STACK_OF(X509) *roots = NULL, *bundle = NULL;
111 X509_STORE_CTX *xsc = NULL; 146 X509_STORE_CTX *xsc = NULL;
@@ -140,14 +175,21 @@ verify_cert(const char *roots_dir, const char *roots_file,
140 if (!X509_STORE_load_locations(store, NULL, roots_dir)) 175 if (!X509_STORE_load_locations(store, NULL, roots_dir))
141 errx(1, "failed to set by_dir directory of %s", roots_dir); 176 errx(1, "failed to set by_dir directory of %s", roots_dir);
142 } 177 }
178 if (set_depth > 0) {
179 X509_VERIFY_PARAM_set_depth(X509_STORE_CTX_get0_param(xsc),
180 set_depth);
181 }
143 if (mode == MODE_LEGACY_VFY) 182 if (mode == MODE_LEGACY_VFY)
144 X509_STORE_CTX_set_flags(xsc, X509_V_FLAG_LEGACY_VERIFY); 183 X509_STORE_CTX_set_flags(xsc, X509_V_FLAG_LEGACY_VERIFY);
145 else 184 else
146 X509_VERIFY_PARAM_clear_flags(X509_STORE_CTX_get0_param(xsc), 185 X509_VERIFY_PARAM_clear_flags(X509_STORE_CTX_get0_param(xsc),
147 X509_V_FLAG_LEGACY_VERIFY); 186 X509_V_FLAG_LEGACY_VERIFY);
148 187
149 if (verbose) 188 if (verbose && verify_cb == NULL)
150 X509_STORE_CTX_set_verify_cb(xsc, verify_cert_cb); 189 verify_cb = verify_cert_cb;
190 if (verify_cb != NULL)
191 X509_STORE_CTX_set_verify_cb(xsc, verify_cb);
192
151 if (!use_dir) 193 if (!use_dir)
152 X509_STORE_CTX_set0_trusted_stack(xsc, roots); 194 X509_STORE_CTX_set0_trusted_stack(xsc, roots);
153 195
@@ -176,7 +218,8 @@ verify_cert(const char *roots_dir, const char *roots_file,
176} 218}
177 219
178static void 220static void
179verify_cert_new(const char *roots_file, const char *bundle_file, int *chains) 221verify_cert_new(const char *roots_file, const char *bundle_file, int *chains,
222 int set_depth, int (*verify_cb)(int, X509_STORE_CTX *))
180{ 223{
181 STACK_OF(X509) *roots = NULL, *bundle = NULL; 224 STACK_OF(X509) *roots = NULL, *bundle = NULL;
182 X509_STORE_CTX *xsc = NULL; 225 X509_STORE_CTX *xsc = NULL;
@@ -199,16 +242,22 @@ verify_cert_new(const char *roots_file, const char *bundle_file, int *chains)
199 ERR_print_errors_fp(stderr); 242 ERR_print_errors_fp(stderr);
200 errx(1, "failed to init store context"); 243 errx(1, "failed to init store context");
201 } 244 }
202 if (verbose) 245 if (verbose && verify_cb == NULL)
203 X509_STORE_CTX_set_verify_cb(xsc, verify_cert_cb); 246 verify_cb = verify_cert_cb;
247 if (verify_cb != NULL)
248 X509_STORE_CTX_set_verify_cb(xsc, verify_cb);
204 249
205 if ((ctx = x509_verify_ctx_new(roots)) == NULL) 250 if ((ctx = x509_verify_ctx_new(roots)) == NULL)
206 errx(1, "failed to create ctx"); 251 errx(1, "failed to create ctx");
207 if (!x509_verify_ctx_set_intermediates(ctx, bundle)) 252 if (!x509_verify_ctx_set_intermediates(ctx, bundle))
208 errx(1, "failed to set intermediates"); 253 errx(1, "failed to set intermediates");
254 if (set_depth > 0) {
255 if (!x509_verify_ctx_set_max_depth(ctx, set_depth))
256 errx(1, "failed to set max depth");
257 }
209 258
210 if ((*chains = x509_verify(ctx, leaf, NULL)) == 0) { 259 if ((*chains = x509_verify(ctx, leaf, NULL)) == 0) {
211 fprintf(stderr, "failed to verify at %lu: %s\n", 260 fprintf(stderr, "failed to verify at %zu: %s\n",
212 x509_verify_ctx_error_depth(ctx), 261 x509_verify_ctx_error_depth(ctx),
213 x509_verify_ctx_error_string(ctx)); 262 x509_verify_ctx_error_string(ctx));
214 } else { 263 } else {
@@ -237,9 +286,12 @@ verify_cert_new(const char *roots_file, const char *bundle_file, int *chains)
237} 286}
238 287
239struct verify_cert_test { 288struct verify_cert_test {
289 const char *desc;
240 const char *id; 290 const char *id;
291 int (*verify_cb)(int, X509_STORE_CTX *);
241 int want_chains; 292 int want_chains;
242 int want_error; 293 int want_error;
294 int set_depth;
243 int want_error_depth; 295 int want_error_depth;
244 int want_legacy_error; 296 int want_legacy_error;
245 int want_legacy_error_depth; 297 int want_legacy_error_depth;
@@ -256,6 +308,32 @@ struct verify_cert_test verify_cert_tests[] = {
256 .want_chains = 1, 308 .want_chains = 1,
257 }, 309 },
258 { 310 {
311 .desc = "2a with depth 2",
312 .id = "2a",
313 .set_depth = 2,
314 .want_chains = 1,
315 },
316 {
317 .desc = "2a with depth 1",
318 .id = "2a",
319 .set_depth = 1,
320 .want_chains = 0,
321 .want_error = X509_V_ERR_CERT_CHAIN_TOO_LONG,
322 .want_error_depth = 1,
323 .want_legacy_error = X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY,
324 .want_legacy_error_depth = 1,
325 },
326 {
327 .desc = "2a with depth 1 and depth callback",
328 .id = "2a",
329 .verify_cb = verify_cert_depth_cb,
330 .set_depth = 1,
331 .want_chains = 1,
332 .want_legacy_error = X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY,
333 .want_legacy_error_depth = 1,
334 .failing = 1,
335 },
336 {
259 .id = "2b", 337 .id = "2b",
260 .want_chains = 0, 338 .want_chains = 0,
261 .want_error = X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY, 339 .want_error = X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY,
@@ -466,6 +544,13 @@ struct verify_cert_test verify_cert_tests[] = {
466 .want_error_depth = 0, 544 .want_error_depth = 0,
467 }, 545 },
468 { 546 {
547 .desc = "14a with yolo callback",
548 .id = "14a",
549 .verify_cb = verify_cert_yolo_cb,
550 .want_chains = 1,
551 .want_error_depth = 0,
552 },
553 {
469 .id = "14b", 554 .id = "14b",
470 .want_chains = 0, 555 .want_chains = 0,
471 .want_error = X509_V_ERR_CERT_CHAIN_TOO_LONG, 556 .want_error = X509_V_ERR_CERT_CHAIN_TOO_LONG,
@@ -474,6 +559,17 @@ struct verify_cert_test verify_cert_tests[] = {
474 .want_legacy_error_depth = 0, 559 .want_legacy_error_depth = 0,
475 .failing = 1, 560 .failing = 1,
476 }, 561 },
562 {
563 .desc = "14b with yolo callback",
564 .id = "14b",
565 .verify_cb = verify_cert_yolo_cb,
566 .want_chains = 0,
567 .want_error = X509_V_ERR_CERT_CHAIN_TOO_LONG,
568 .want_error_depth = 32,
569 .want_legacy_error = 0,
570 .want_legacy_error_depth = 0,
571 .failing = 1,
572 },
477}; 573};
478 574
479#define N_VERIFY_CERT_TESTS \ 575#define N_VERIFY_CERT_TESTS \
@@ -503,12 +599,15 @@ verify_cert_test(const char *certs_path, int mode)
503 error = 0; 599 error = 0;
504 error_depth = 0; 600 error_depth = 0;
505 601
506 fprintf(stderr, "== Test %zu (%s)\n", i, vct->id); 602 fprintf(stderr, "== Test %zu (%s)\n", i,
603 vct->desc != NULL ? vct->desc : vct->id);
507 if (mode == MODE_VERIFY) 604 if (mode == MODE_VERIFY)
508 verify_cert_new(roots_file, bundle_file, &chains); 605 verify_cert_new(roots_file, bundle_file, &chains,
606 vct->set_depth, vct->verify_cb);
509 else 607 else
510 verify_cert(roots_dir, roots_file, bundle_file, &chains, 608 verify_cert(roots_dir, roots_file, bundle_file, &chains,
511 &error, &error_depth, mode); 609 &error, &error_depth, vct->set_depth, vct->verify_cb,
610 mode);
512 611
513 if ((mode == MODE_VERIFY && chains == vct->want_chains) || 612 if ((mode == MODE_VERIFY && chains == vct->want_chains) ||
514 (chains == 0 && vct->want_chains == 0) || 613 (chains == 0 && vct->want_chains == 0) ||
diff --git a/src/regress/lib/libcrypto/x509/x509_crl.c b/src/regress/lib/libcrypto/x509/x509_crl.c
new file mode 100644
index 0000000000..941b865263
--- /dev/null
+++ b/src/regress/lib/libcrypto/x509/x509_crl.c
@@ -0,0 +1,362 @@
1/* $OpenBSD: x509_crl.c,v 1.2 2026/06/26 05:59:11 tb Exp $ */
2
3/*
4 * Copyright (c) 2015, Google Inc.
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
13 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
15 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#include <openssl/bio.h>
20#include <openssl/crypto.h>
21#include <openssl/err.h>
22#include <openssl/pem.h>
23#include <openssl/x509.h>
24
25#include <err.h>
26#include <stdio.h>
27#include <string.h>
28
29static const char *kCRLTestRoot =
30 "-----BEGIN CERTIFICATE-----\n"
31 "MIIDbzCCAlegAwIBAgIJAODri7v0dDUFMA0GCSqGSIb3DQEBCwUAME4xCzAJBgNV\n"
32 "BAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1Nb3VudGFpbiBW\n"
33 "aWV3MRIwEAYDVQQKDAlCb3JpbmdTU0wwHhcNMTYwOTI2MTUwNjI2WhcNMjYwOTI0\n"
34 "MTUwNjI2WjBOMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQG\n"
35 "A1UEBwwNTW91bnRhaW4gVmlldzESMBAGA1UECgwJQm9yaW5nU1NMMIIBIjANBgkq\n"
36 "hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAo16WiLWZuaymsD8n5SKPmxV1y6jjgr3B\n"
37 "S/dUBpbrzd1aeFzNlI8l2jfAnzUyp+I21RQ+nh/MhqjGElkTtK9xMn1Y+S9GMRh+\n"
38 "5R/Du0iCb1tCZIPY07Tgrb0KMNWe0v2QKVVruuYSgxIWodBfxlKO64Z8AJ5IbnWp\n"
39 "uRqO6rctN9qUoMlTIAB6dL4G0tDJ/PGFWOJYwOMEIX54bly2wgyYJVBKiRRt4f7n\n"
40 "8H922qmvPNA9idmX9G1VAtgV6x97XXi7ULORIQvn9lVQF6nTYDBJhyuPB+mLThbL\n"
41 "P2o9orxGx7aCtnnBZUIxUvHNOI0FaSaZH7Fi0xsZ/GkG2HZe7ImPJwIDAQABo1Aw\n"
42 "TjAdBgNVHQ4EFgQUWPt3N5cZ/CRvubbrkqfBnAqhq94wHwYDVR0jBBgwFoAUWPt3\n"
43 "N5cZ/CRvubbrkqfBnAqhq94wDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOC\n"
44 "AQEAORu6M0MOwXy+3VEBwNilfTxyqDfruQsc1jA4PT8Oe8zora1WxE1JB4q2FJOz\n"
45 "EAuM3H/NXvEnBuN+ITvKZAJUfm4NKX97qmjMJwLKWe1gVv+VQTr63aR7mgWJReQN\n"
46 "XdMztlVeZs2dppV6uEg3ia1X0G7LARxGpA9ETbMyCpb39XxlYuTClcbA5ftDN99B\n"
47 "3Xg9KNdd++Ew22O3HWRDvdDpTO/JkzQfzi3sYwUtzMEonENhczJhGf7bQMmvL/w5\n"
48 "24Wxj4Z7KzzWIHsNqE/RIs6RV3fcW61j/mRgW2XyoWnMVeBzvcJr9NXp4VQYmFPw\n"
49 "amd8GKMZQvP0ufGnUn7D7uartA==\n"
50 "-----END CERTIFICATE-----\n";
51
52static const char *kCRLTestLeaf =
53 "-----BEGIN CERTIFICATE-----\n"
54 "MIIDkDCCAnigAwIBAgICEAAwDQYJKoZIhvcNAQELBQAwTjELMAkGA1UEBhMCVVMx\n"
55 "EzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxEjAQ\n"
56 "BgNVBAoMCUJvcmluZ1NTTDAeFw0xNjA5MjYxNTA4MzFaFw0xNzA5MjYxNTA4MzFa\n"
57 "MEsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRIwEAYDVQQKDAlC\n"
58 "b3JpbmdTU0wxEzARBgNVBAMMCmJvcmluZy5zc2wwggEiMA0GCSqGSIb3DQEBAQUA\n"
59 "A4IBDwAwggEKAoIBAQDc5v1S1M0W+QWM+raWfO0LH8uvqEwuJQgODqMaGnSlWUx9\n"
60 "8iQcnWfjyPja3lWg9K62hSOFDuSyEkysKHDxijz5R93CfLcfnVXjWQDJe7EJTTDP\n"
61 "ozEvxN6RjAeYv7CF000euYr3QT5iyBjg76+bon1p0jHZBJeNPP1KqGYgyxp+hzpx\n"
62 "e0gZmTlGAXd8JQK4v8kpdYwD6PPifFL/jpmQpqOtQmH/6zcLjY4ojmqpEdBqIKIX\n"
63 "+saA29hMq0+NK3K+wgg31RU+cVWxu3tLOIiesETkeDgArjWRS1Vkzbi4v9SJxtNu\n"
64 "OZuAxWiynRJw3JwH/OFHYZIvQqz68ZBoj96cepjPAgMBAAGjezB5MAkGA1UdEwQC\n"
65 "MAAwLAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRl\n"
66 "MB0GA1UdDgQWBBTGn0OVVh/aoYt0bvEKG+PIERqnDzAfBgNVHSMEGDAWgBRY+3c3\n"
67 "lxn8JG+5tuuSp8GcCqGr3jANBgkqhkiG9w0BAQsFAAOCAQEAd2nM8gCQN2Dc8QJw\n"
68 "XSZXyuI3DBGGCHcay/3iXu0JvTC3EiQo8J6Djv7WLI0N5KH8mkm40u89fJAB2lLZ\n"
69 "ShuHVtcC182bOKnePgwp9CNwQ21p0rDEu/P3X46ZvFgdxx82E9xLa0tBB8PiPDWh\n"
70 "lV16jbaKTgX5AZqjnsyjR5o9/mbZVupZJXx5Syq+XA8qiJfstSYJs4KyKK9UOjql\n"
71 "ICkJVKpi2ahDBqX4MOH4SLfzVk8pqSpviS6yaA1RXqjpkxiN45WWaXDldVHMSkhC\n"
72 "5CNXsXi4b1nAntu89crwSLA3rEwzCWeYj+BX7e1T9rr3oJdwOU/2KQtW1js1yQUG\n"
73 "tjJMFw==\n"
74 "-----END CERTIFICATE-----\n";
75
76static const char *kBasicCRL =
77 "-----BEGIN X509 CRL-----\n"
78 "MIIBpzCBkAIBATANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJVUzETMBEGA1UE\n"
79 "CAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzESMBAGA1UECgwJ\n"
80 "Qm9yaW5nU1NMFw0xNjA5MjYxNTEwNTVaFw0xNjEwMjYxNTEwNTVaoA4wDDAKBgNV\n"
81 "HRQEAwIBATANBgkqhkiG9w0BAQsFAAOCAQEAnrBKKgvd9x9zwK9rtUvVeFeJ7+LN\n"
82 "ZEAc+a5oxpPNEsJx6hXoApYEbzXMxuWBQoCs5iEBycSGudct21L+MVf27M38KrWo\n"
83 "eOkq0a2siqViQZO2Fb/SUFR0k9zb8xl86Zf65lgPplALun0bV/HT7MJcl04Tc4os\n"
84 "dsAReBs5nqTGNEd5AlC1iKHvQZkM//MD51DspKnDpsDiUVi54h9C1SpfZmX8H2Vv\n"
85 "diyu0fZ/bPAM3VAGawatf/SyWfBMyKpoPXEG39oAzmjjOj8en82psn7m474IGaho\n"
86 "/vBbhl1ms5qQiLYPjm4YELtnXQoFyC72tBjbdFd/ZE9k4CNKDbxFUXFbkw==\n"
87 "-----END X509 CRL-----\n";
88
89static const char *kRevokedCRL =
90 "-----BEGIN X509 CRL-----\n"
91 "MIIBvjCBpwIBATANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJVUzETMBEGA1UE\n"
92 "CAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzESMBAGA1UECgwJ\n"
93 "Qm9yaW5nU1NMFw0xNjA5MjYxNTEyNDRaFw0xNjEwMjYxNTEyNDRaMBUwEwICEAAX\n"
94 "DTE2MDkyNjE1MTIyNlqgDjAMMAoGA1UdFAQDAgECMA0GCSqGSIb3DQEBCwUAA4IB\n"
95 "AQCUGaM4DcWzlQKrcZvI8TMeR8BpsvQeo5BoI/XZu2a8h//PyRyMwYeaOM+3zl0d\n"
96 "sjgCT8b3C1FPgT+P2Lkowv7rJ+FHJRNQkogr+RuqCSPTq65ha4WKlRGWkMFybzVH\n"
97 "NloxC+aU3lgp/NlX9yUtfqYmJek1CDrOOGPrAEAwj1l/BUeYKNGqfBWYJQtPJu+5\n"
98 "OaSvIYGpETCZJscUWODmLEb/O3DM438vLvxonwGqXqS0KX37+CHpUlyhnSovxXxp\n"
99 "Pz4aF+L7OtczxL0GYtD2fR9B7TDMqsNmHXgQrixvvOY7MUdLGbd4RfJL3yA53hyO\n"
100 "xzfKY2TzxLiOmctG0hXFkH5J\n"
101 "-----END X509 CRL-----\n";
102
103static const char *kBadIssuerCRL =
104 "-----BEGIN X509 CRL-----\n"
105 "MIIBwjCBqwIBATANBgkqhkiG9w0BAQsFADBSMQswCQYDVQQGEwJVUzETMBEGA1UE\n"
106 "CAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEWMBQGA1UECgwN\n"
107 "Tm90IEJvcmluZ1NTTBcNMTYwOTI2MTUxMjQ0WhcNMTYxMDI2MTUxMjQ0WjAVMBMC\n"
108 "AhAAFw0xNjA5MjYxNTEyMjZaoA4wDDAKBgNVHRQEAwIBAjANBgkqhkiG9w0BAQsF\n"
109 "AAOCAQEAlBmjOA3Fs5UCq3GbyPEzHkfAabL0HqOQaCP12btmvIf/z8kcjMGHmjjP\n"
110 "t85dHbI4Ak/G9wtRT4E/j9i5KML+6yfhRyUTUJKIK/kbqgkj06uuYWuFipURlpDB\n"
111 "cm81RzZaMQvmlN5YKfzZV/clLX6mJiXpNQg6zjhj6wBAMI9ZfwVHmCjRqnwVmCUL\n"
112 "TybvuTmkryGBqREwmSbHFFjg5ixG/ztwzON/Ly78aJ8Bql6ktCl9+/gh6VJcoZ0q\n"
113 "L8V8aT8+Ghfi+zrXM8S9BmLQ9n0fQe0wzKrDZh14EK4sb7zmOzFHSxm3eEXyS98g\n"
114 "Od4cjsc3ymNk88S4jpnLRtIVxZB+SQ==\n"
115 "-----END X509 CRL-----\n";
116
117/*
118 * This is kBasicCRL but with a critical issuing distribution point
119 * extension.
120 */
121static const char *kKnownCriticalCRL =
122 "-----BEGIN X509 CRL-----\n"
123 "MIIBujCBowIBATANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJVUzETMBEGA1UE\n"
124 "CAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzESMBAGA1UECgwJ\n"
125 "Qm9yaW5nU1NMFw0xNjA5MjYxNTEwNTVaFw0xNjEwMjYxNTEwNTVaoCEwHzAKBgNV\n"
126 "HRQEAwIBATARBgNVHRwBAf8EBzAFoQMBAf8wDQYJKoZIhvcNAQELBQADggEBAA+3\n"
127 "i+5e5Ub8sccfgOBs6WVJFI9c8gvJjrJ8/dYfFIAuCyeocs7DFXn1n13CRZ+URR/Q\n"
128 "mVWgU28+xeusuSPYFpd9cyYTcVyNUGNTI3lwgcE/yVjPaOmzSZKdPakApRxtpKKQ\n"
129 "NN/56aQz3bnT/ZSHQNciRB8U6jiD9V30t0w+FDTpGaG+7bzzUH3UVF9xf9Ctp60A\n"
130 "3mfLe0scas7owSt4AEFuj2SPvcE7yvdOXbu+IEv21cEJUVExJAbhvIweHXh6yRW+\n"
131 "7VVeiNzdIjkZjyTmAzoXGha4+wbxXyBRbfH+XWcO/H+8nwyG8Gktdu2QB9S9nnIp\n"
132 "o/1TpfOMSGhMyMoyPrk=\n"
133 "-----END X509 CRL-----\n";
134
135/*
136 * kUnknownCriticalCRL is kBasicCRL but with an unknown critical extension.
137 */
138static const char *kUnknownCriticalCRL =
139 "-----BEGIN X509 CRL-----\n"
140 "MIIBvDCBpQIBATANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJVUzETMBEGA1UE\n"
141 "CAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzESMBAGA1UECgwJ\n"
142 "Qm9yaW5nU1NMFw0xNjA5MjYxNTEwNTVaFw0xNjEwMjYxNTEwNTVaoCMwITAKBgNV\n"
143 "HRQEAwIBATATBgwqhkiG9xIEAYS3CQABAf8EADANBgkqhkiG9w0BAQsFAAOCAQEA\n"
144 "GvBP0xqL509InMj/3493YVRV+ldTpBv5uTD6jewzf5XdaxEQ/VjTNe5zKnxbpAib\n"
145 "Kf7cwX0PMSkZjx7k7kKdDlEucwVvDoqC+O9aJcqVmM6GDyNb9xENxd0XCXja6MZC\n"
146 "yVgP4AwLauB2vSiEprYJyI1APph3iAEeDm60lTXX/wBM/tupQDDujKh2GPyvBRfJ\n"
147 "+wEDwGg3ICwvu4gO4zeC5qnFR+bpL9t5tOMAQnVZ0NWv+k7mkd2LbHdD44dxrfXC\n"
148 "nhtfERx99SDmC/jtUAJrGhtCO8acr7exCeYcduN7KKCm91OeCJKK6OzWst0Og1DB\n"
149 "kwzzU2rL3G65CrZ7H0SZsQ==\n"
150 "-----END X509 CRL-----\n";
151
152/*
153 * kUnknownCriticalCRL2 is kBasicCRL but with a critical issuing distribution
154 * point extension followed by an unknown critical extension
155 */
156static const char *kUnknownCriticalCRL2 =
157 "-----BEGIN X509 CRL-----\n"
158 "MIIBzzCBuAIBATANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJVUzETMBEGA1UE\n"
159 "CAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzESMBAGA1UECgwJ\n"
160 "Qm9yaW5nU1NMFw0xNjA5MjYxNTEwNTVaFw0xNjEwMjYxNTEwNTVaoDYwNDAKBgNV\n"
161 "HRQEAwIBATARBgNVHRwBAf8EBzAFoQMBAf8wEwYMKoZIhvcSBAGEtwkAAQH/BAAw\n"
162 "DQYJKoZIhvcNAQELBQADggEBACTcpQC8jXL12JN5YzOcQ64ubQIe0XxRAd30p7qB\n"
163 "BTXGpgqBjrjxRfLms7EBYodEXB2oXMsDq3km0vT1MfYdsDD05S+SQ9CDsq/pUfaC\n"
164 "E2WNI5p8WircRnroYvbN2vkjlRbMd1+yNITohXYXCJwjEOAWOx3XIM10bwPYBv4R\n"
165 "rDobuLHoMgL3yHgMHmAkP7YpkBucNqeBV8cCdeAZLuhXFWi6yfr3r/X18yWbC/r2\n"
166 "2xXdkrSqXLFo7ToyP8YKTgiXpya4x6m53biEYwa2ULlas0igL6DK7wjYZX95Uy7H\n"
167 "GKljn9weIYiMPV/BzGymwfv2EW0preLwtyJNJPaxbdin6Jc=\n"
168 "-----END X509 CRL-----\n";
169
170static X509_CRL *
171X509_CRL_from_PEM(const char *pem)
172{
173 BIO *bio;
174 X509_CRL *crl;
175
176 if ((bio = BIO_new_mem_buf(pem, -1)) == NULL)
177 err(1, NULL);
178 if ((crl = PEM_read_bio_X509_CRL(bio, NULL, NULL, NULL)) == NULL)
179 errx(1, "PEM_read_bio_X509_CRL failed");
180 BIO_free(bio);
181
182 return crl;
183}
184
185static X509 *
186X509_from_PEM(const char *pem)
187{
188 BIO *bio;
189 X509 *x509;
190
191 if ((bio = BIO_new_mem_buf(pem, -1)) == NULL)
192 err(1, NULL);
193 if ((x509 = PEM_read_bio_X509(bio, NULL, NULL, NULL)) == NULL)
194 errx(1, "PEM_read_bio_X509 failed");
195 BIO_free(bio);
196
197 return x509;
198}
199
200/*
201 * Verify |leaf| certificate (chained up to |root|). |crls| if
202 * not NULL, is a list of CRLs to include in the verification. It is
203 * also free'd before returning, which is kinda yucky but convenient.
204 * Returns a value from X509_V_ERR_xxx or X509_V_OK.
205 */
206static int
207verify(X509 *leaf, X509 *root, STACK_OF(X509_CRL) *crls, unsigned long flags)
208{
209 X509_STORE_CTX *ctx;
210 X509_STORE *store;
211 X509_VERIFY_PARAM *param;
212 STACK_OF(X509) *roots;
213 int status = X509_V_ERR_UNSPECIFIED;
214
215 if ((ctx = X509_STORE_CTX_new()) == NULL)
216 errx(1, "X509_STORE_CTX_new");
217 if ((store = X509_STORE_new()) == NULL)
218 errx(1, "X509_STORE_new");
219 if ((param = X509_VERIFY_PARAM_new()) == NULL)
220 errx(1, "X509_VERIFY_PARAM_new");
221 if ((roots = sk_X509_new_null()) == NULL)
222 errx(1, "sk_X509_new_null");
223
224 /* Create a stack; upref the cert because we free it below. */
225 X509_up_ref(root);
226 if (!sk_X509_push(roots, root))
227 errx(1, "sk_X509_push");
228
229 if (!X509_STORE_CTX_init(ctx, store, leaf, NULL))
230 errx(1, "X509_STORE_CTX_init");
231
232 X509_STORE_CTX_set0_trusted_stack(ctx, roots);
233 X509_STORE_CTX_set0_crls(ctx, crls);
234 X509_VERIFY_PARAM_set_time(param, 1474934400 /* Sep 27th, 2016 */);
235 X509_VERIFY_PARAM_set_depth(param, 16);
236 X509_VERIFY_PARAM_set_flags(param, flags);
237 X509_STORE_CTX_set0_param(ctx, param);
238
239 ERR_clear_error();
240 status = X509_V_OK;
241 if (X509_verify_cert(ctx) != 1)
242 status = X509_STORE_CTX_get_error(ctx);
243
244 sk_X509_pop_free(roots, X509_free);
245 sk_X509_CRL_pop_free(crls, X509_CRL_free);
246 X509_STORE_CTX_free(ctx);
247 X509_STORE_free(store);
248
249 return status;
250}
251
252/*
253 * Create a stack of CRLs. Upref each one because we call pop_free on
254 * the stack and need to keep the CRLs around until the test exits.
255 * Yes this crashes on malloc failure; it forces us to debug.
256 */
257static STACK_OF(X509_CRL) *
258make_CRL_stack(X509_CRL *x1, X509_CRL *x2)
259{
260 STACK_OF(X509_CRL) *sk;
261
262 if ((sk = sk_X509_CRL_new_null()) == NULL)
263 errx(1, "sk_X509_CRL_new_null");
264
265 if (sk_X509_CRL_push(sk, x1) <= 0)
266 errx(1, "sk_X509_CRL_push");
267 X509_CRL_up_ref(x1);
268 if (x2 != NULL) {
269 if (sk_X509_CRL_push(sk, x2) <= 0)
270 errx(1, "sk_X509_CRL_push");
271 X509_CRL_up_ref(x2);
272 }
273
274 return sk;
275}
276
277int
278main(void)
279{
280 X509 *root, *leaf;
281 X509_CRL *basic_crl, *revoked_crl, *bad_issuer_crl, *known_critical_crl;
282 X509_CRL *unknown_critical_crl, *unknown_critical_crl2;
283 int status = 1;
284
285 if ((root = X509_from_PEM(kCRLTestRoot)) == NULL)
286 errx(1, "X509_from_PEM(kCRLTestRoot)");
287 if ((leaf = X509_from_PEM(kCRLTestLeaf)) == NULL)
288 errx(1, "X509_from_PEM(kCRLTestLeaf)");
289 if ((basic_crl = X509_CRL_from_PEM(kBasicCRL)) == NULL)
290 errx(1, "X509_CRL_from_PEM(kBasicCRL)");
291 if ((revoked_crl = X509_CRL_from_PEM(kRevokedCRL)) == NULL)
292 errx(1, "X509_CRL_from_PEM(kRevokedCRL)");
293 if ((bad_issuer_crl = X509_CRL_from_PEM(kBadIssuerCRL)) == NULL)
294 errx(1, "X509_CRL_from_PEM(kBadIssuerCRL)");
295 if ((known_critical_crl = X509_CRL_from_PEM(kKnownCriticalCRL)) == NULL)
296 errx(1, "X509_CRL_from_PEM(kKnownCriticalCRL)");
297 if ((unknown_critical_crl = X509_CRL_from_PEM(kUnknownCriticalCRL)) == NULL)
298 errx(1, "X509_CRL_from_PEM(kUnknownCriticalCRL)");
299 if ((unknown_critical_crl2 = X509_CRL_from_PEM(kUnknownCriticalCRL2)) == NULL)
300 errx(1, "X509_CRL_from_PEM(kUnknownCriticalCRL2)");
301
302 if (verify(leaf, root, make_CRL_stack(basic_crl, NULL),
303 X509_V_FLAG_CRL_CHECK) != X509_V_OK) {
304 fprintf(stderr, "Cert with CRL didn't verify.\n");
305 goto err;
306 }
307
308 if (verify(leaf, root, make_CRL_stack(basic_crl, revoked_crl),
309 X509_V_FLAG_CRL_CHECK) != X509_V_ERR_CERT_REVOKED) {
310 fprintf(stderr, "Revoked CRL wasn't checked.\n");
311 goto err;
312 }
313
314 if (verify(leaf, root, NULL,
315 X509_V_FLAG_CRL_CHECK) != X509_V_ERR_UNABLE_TO_GET_CRL) {
316 fprintf(stderr, "CRLs were not required.\n");
317 goto err;
318 }
319
320 if (verify(leaf, root, make_CRL_stack(bad_issuer_crl, NULL),
321 X509_V_FLAG_CRL_CHECK) != X509_V_ERR_UNABLE_TO_GET_CRL) {
322 fprintf(stderr, "Bad CRL issuer was unnoticed.\n");
323 goto err;
324 }
325
326 if (verify(leaf, root, make_CRL_stack(known_critical_crl, NULL),
327 X509_V_FLAG_CRL_CHECK) != X509_V_OK) {
328 fprintf(stderr,
329 "CRL with known critical extension was rejected.\n");
330 goto err;
331 }
332
333 if (verify(leaf, root, make_CRL_stack(unknown_critical_crl, NULL),
334 X509_V_FLAG_CRL_CHECK) !=
335 X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION) {
336 fprintf(stderr,
337 "CRL with unknown critical extension was accepted.\n");
338 goto err;
339 }
340
341 if (verify(leaf, root, make_CRL_stack(unknown_critical_crl2, NULL),
342 X509_V_FLAG_CRL_CHECK) !=
343 X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION) {
344 fprintf(stderr,
345 "CRL with unknown critical extension (2) was accepted.\n");
346 goto err;
347 }
348
349 status = 0;
350
351 err:
352 X509_free(root);
353 X509_free(leaf);
354 X509_CRL_free(basic_crl);
355 X509_CRL_free(revoked_crl);
356 X509_CRL_free(bad_issuer_crl);
357 X509_CRL_free(known_critical_crl);
358 X509_CRL_free(unknown_critical_crl);
359 X509_CRL_free(unknown_critical_crl2);
360
361 return status;
362}
diff --git a/src/regress/lib/libssl/dtls/Makefile b/src/regress/lib/libssl/dtls/Makefile
index b58dae61b6..739faf8b9e 100644
--- a/src/regress/lib/libssl/dtls/Makefile
+++ b/src/regress/lib/libssl/dtls/Makefile
@@ -1,6 +1,9 @@
1# $OpenBSD: Makefile,v 1.4 2024/03/20 10:38:05 jsing Exp $ 1# $OpenBSD: Makefile,v 1.6 2026/06/06 08:13:50 jsing Exp $
2
3PROGS += dtlstest
4PROGS += dtls_handshake_msg_test
5PROGS += dtls_wire_test
2 6
3PROG= dtlstest
4LDADD= ${SSL_INT} -lcrypto 7LDADD= ${SSL_INT} -lcrypto
5DPADD= ${LIBSSL} ${LIBCRYPTO} 8DPADD= ${LIBSSL} ${LIBCRYPTO}
6WARNINGS= Yes 9WARNINGS= Yes
@@ -9,13 +12,21 @@ CFLAGS+= -I${.CURDIR}/../../../../lib/libcrypto/bio
9CFLAGS+= -I${.CURDIR}/../../../../lib/libssl 12CFLAGS+= -I${.CURDIR}/../../../../lib/libssl
10 13
11REGRESS_TARGETS= \ 14REGRESS_TARGETS= \
12 regress-dtlstest 15 regress-dtlstest \
16 regress-dtls_handshake_msg_test \
17 regress-dtls_wire_test
13 18
14# XXX(jsing): use CA root and chain 19# XXX(jsing): use CA root and chain
15regress-dtlstest: ${PROG} 20regress-dtlstest: dtlstest
16 ./dtlstest \ 21 ./dtlstest \
17 ${.CURDIR}/../../libssl/certs/server1-rsa.pem \ 22 ${.CURDIR}/../../libssl/certs/server1-rsa.pem \
18 ${.CURDIR}/../../libssl/certs/server1-rsa.pem \ 23 ${.CURDIR}/../../libssl/certs/server1-rsa.pem \
19 ${.CURDIR}/../../libssl/certs/ca-int-rsa.pem 24 ${.CURDIR}/../../libssl/certs/ca-int-rsa.pem
20 25
26regress-dtls_handshake_msg_test: dtls_handshake_msg_test
27 ./dtls_handshake_msg_test
28
29regress-dtls_wire_test: dtls_wire_test
30 ./dtls_wire_test
31
21.include <bsd.regress.mk> 32.include <bsd.regress.mk>
diff --git a/src/regress/lib/libssl/dtls/dtls_handshake_msg_test.c b/src/regress/lib/libssl/dtls/dtls_handshake_msg_test.c
new file mode 100644
index 0000000000..4fbc8d8803
--- /dev/null
+++ b/src/regress/lib/libssl/dtls/dtls_handshake_msg_test.c
@@ -0,0 +1,369 @@
1/* $OpenBSD: dtls_handshake_msg_test.c,v 1.1 2026/06/06 08:13:50 jsing Exp $ */
2/*
3 * Copyright (c) 2026 Joel Sing <jsing@openbsd.org>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#include <stdio.h>
19#include <string.h>
20
21#include <openssl/ssl3.h>
22
23#include "bytestring.h"
24#include "dtls12_internal.h"
25
26static void
27hexdump(const unsigned char *buf, size_t len)
28{
29 size_t i;
30
31 for (i = 1; i <= len; i++)
32 fprintf(stderr, " 0x%02hhx,%s", buf[i - 1], i % 8 ? "" : "\n");
33
34 fprintf(stderr, "\n");
35}
36
37static const uint8_t dtls12_hs_msg_data[] = {
38 0x01, 0x00, 0x01, 0x00, 0xca, 0xfe, 0x00, 0x00,
39 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x02, 0x03,
40 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
41 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13,
42 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
43 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
44 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
45 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33,
46 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b,
47 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43,
48 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b,
49 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53,
50 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b,
51 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63,
52 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
53 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73,
54 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b,
55 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83,
56 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b,
57 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93,
58 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b,
59 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3,
60 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab,
61 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3,
62 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb,
63 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3,
64 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb,
65 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3,
66 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb,
67 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3,
68 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb,
69 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3,
70 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb,
71 0xfc, 0xfd, 0xfe, 0xff,
72};
73
74static const uint8_t dtls12_hm_content[] = {
75 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
76 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
77 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
78 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
79 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
80 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
81 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
82 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
83 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
84 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
85 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
86 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
87 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
88 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
89 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
90 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
91 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
92 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
93 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
94 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
95 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
96 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
97 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
98 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
99 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
100 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
101 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
102 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
103 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
104 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
105 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
106 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
107};
108
109static const uint8_t dtls12_hs_msg_frag_0[] = {
110 0x01, 0x00, 0x01, 0x00, 0xca, 0xfe, 0x00, 0x00,
111 0x00, 0x00, 0x00, 0x40, 0x00, 0x01, 0x02, 0x03,
112 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
113 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13,
114 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
115 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
116 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
117 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33,
118 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b,
119 0x3c, 0x3d, 0x3e, 0x3f,
120};
121
122static const uint8_t dtls12_hs_msg_frag_1[] = {
123 0x01, 0x00, 0x01, 0x00, 0xca, 0xfe, 0x00, 0x00,
124 0x00, 0x00, 0x00, 0x20, 0x00, 0x01, 0x02, 0x03,
125 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
126 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13,
127 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
128 0x1c, 0x1d, 0x1e, 0x1f,
129};
130
131static const uint8_t dtls12_hs_msg_frag_2[] = {
132 0x01, 0x00, 0x01, 0x00, 0xca, 0xfe, 0x00, 0x00,
133 0x20, 0x00, 0x00, 0x80, 0x20, 0x21, 0x22, 0x23,
134 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
135 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33,
136 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b,
137 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43,
138 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b,
139 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53,
140 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b,
141 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63,
142 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
143 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73,
144 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b,
145 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83,
146 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b,
147 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93,
148 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b,
149 0x9c, 0x9d, 0x9e, 0x9f,
150};
151
152static const uint8_t dtls12_hs_msg_frag_3[] = {
153 0x01, 0x00, 0x01, 0x00, 0xca, 0xfe, 0x00, 0x00,
154 0xa0, 0x00, 0x00, 0x60, 0xa0, 0xa1, 0xa2, 0xa3,
155 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab,
156 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3,
157 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb,
158 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3,
159 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb,
160 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3,
161 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb,
162 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3,
163 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb,
164 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3,
165 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb,
166 0xfc, 0xfd, 0xfe, 0xff,
167};
168
169static int
170dtls_handshake_msg_test(void)
171{
172 struct dtls12_handshake_msg *hs_msg = NULL;
173 uint8_t *p;
174 int i;
175 CBB cbb;
176 CBS cbs;
177 int failed = 1;
178
179 memset(&cbb, 0, sizeof(cbb));
180
181 if ((hs_msg = dtls12_handshake_msg_new()) == NULL) {
182 fprintf(stderr, "FAIL: dtls12_handshake_msg_new\n");
183 goto failure;
184 }
185 if (!dtls12_handshake_msg_start(hs_msg, &cbb, SSL3_MT_CLIENT_HELLO,
186 0xcafe)) {
187 fprintf(stderr, "FAIL: dtls12_handshake_msg_start\n");
188 goto failure;
189 }
190 if (!CBB_add_space(&cbb, &p, 256)) {
191 fprintf(stderr, "FAIL: CBB_add_space\n");
192 goto failure;
193 }
194 for (i = 0; i < 256; i++)
195 p[i] = i;
196 if (!dtls12_handshake_msg_finish(hs_msg)) {
197 fprintf(stderr, "FAIL: dtls12_handshake_msg_finish\n");
198 goto failure;
199 }
200
201 dtls12_handshake_msg_data(hs_msg, &cbs);
202 if (CBS_len(&cbs) != sizeof(dtls12_hs_msg_data)) {
203 fprintf(stderr, "FAIL: handshake message data length = %zu, want %zu\n",
204 CBS_len(&cbs), sizeof(dtls12_hs_msg_data));
205 goto failure;
206 }
207 if (memcmp(CBS_data(&cbs), dtls12_hs_msg_data, CBS_len(&cbs)) != 0) {
208 fprintf(stderr, "FAIL: got handshake message data:\n");
209 hexdump(CBS_data(&cbs), CBS_len(&cbs));
210 fprintf(stderr, "want handshake message data:\n");
211 hexdump(dtls12_hs_msg_data, CBS_len(&cbs));
212 }
213
214 dtls12_handshake_msg_content(hs_msg, &cbs);
215 if (CBS_len(&cbs) != sizeof(dtls12_hm_content)) {
216 fprintf(stderr, "FAIL: handshake message content length = %zu, want %zu\n",
217 CBS_len(&cbs), sizeof(dtls12_hm_content));
218 goto failure;
219 }
220 if (memcmp(CBS_data(&cbs), dtls12_hm_content, CBS_len(&cbs)) != 0) {
221 fprintf(stderr, "FAIL: got handshake message content:\n");
222 hexdump(CBS_data(&cbs), CBS_len(&cbs));
223 fprintf(stderr, "want handshake message content:\n");
224 hexdump(dtls12_hm_content, CBS_len(&cbs));
225 }
226
227 if (!dtls12_handshake_msg_fragment_pending(hs_msg)) {
228 fprintf(stderr, "FAIL: handshake message should have pending fragments\n");
229 goto failure;
230 }
231 if (!dtls12_handshake_msg_fragment_build(hs_msg, 64, &cbs)) {
232 fprintf(stderr, "FAIL: failed to build handshake message fragment 0\n");
233 goto failure;
234 }
235 if (CBS_len(&cbs) != sizeof(dtls12_hs_msg_frag_0)) {
236 fprintf(stderr, "FAIL: handshake message fragment 0 length = %zu, want %zu\n",
237 CBS_len(&cbs), sizeof(dtls12_hs_msg_frag_0));
238 goto failure;
239 }
240 if (memcmp(CBS_data(&cbs), dtls12_hs_msg_frag_0, CBS_len(&cbs)) != 0) {
241 fprintf(stderr, "FAIL: got handshake message fragment:\n");
242 hexdump(CBS_data(&cbs), CBS_len(&cbs));
243 fprintf(stderr, "want handshake message fragment:\n");
244 hexdump(dtls12_hs_msg_frag_0, CBS_len(&cbs));
245 }
246
247 if (!dtls12_handshake_msg_fragment_build(hs_msg, 32, &cbs)) {
248 fprintf(stderr, "FAIL: failed to build handshake message fragment 1\n");
249 goto failure;
250 }
251 if (CBS_len(&cbs) != sizeof(dtls12_hs_msg_frag_1)) {
252 fprintf(stderr, "FAIL: handshake message fragment 1 length = %zu, want %zu\n",
253 CBS_len(&cbs), sizeof(dtls12_hs_msg_frag_1));
254 goto failure;
255 }
256 if (memcmp(CBS_data(&cbs), dtls12_hs_msg_frag_1, CBS_len(&cbs)) != 0) {
257 fprintf(stderr, "FAIL: got handshake message 1 fragment:\n");
258 hexdump(CBS_data(&cbs), CBS_len(&cbs));
259 fprintf(stderr, "want handshake message 1 fragment:\n");
260 hexdump(dtls12_hs_msg_frag_1, CBS_len(&cbs));
261 }
262
263 if (!dtls12_handshake_msg_fragment_build(hs_msg, 32, &cbs)) {
264 fprintf(stderr, "FAIL: failed to rebuild handshake message fragment 1\n");
265 goto failure;
266 }
267 if (CBS_len(&cbs) != sizeof(dtls12_hs_msg_frag_1)) {
268 fprintf(stderr, "FAIL: handshake message fragment 1 length = %zu, want %zu\n",
269 CBS_len(&cbs), sizeof(dtls12_hs_msg_frag_1));
270 goto failure;
271 }
272 if (memcmp(CBS_data(&cbs), dtls12_hs_msg_frag_1, CBS_len(&cbs)) != 0) {
273 fprintf(stderr, "FAIL: got handshake message 1 fragment:\n");
274 hexdump(CBS_data(&cbs), CBS_len(&cbs));
275 fprintf(stderr, "want handshake message 1 fragment:\n");
276 hexdump(dtls12_hs_msg_frag_1, CBS_len(&cbs));
277 }
278
279 if (!dtls12_handshake_msg_fragment_next(hs_msg)) {
280 fprintf(stderr, "FAIL: failed to progress to next fragment\n");
281 goto failure;
282 }
283 if (!dtls12_handshake_msg_fragment_pending(hs_msg)) {
284 fprintf(stderr, "FAIL: handshake message should have pending fragments\n");
285 goto failure;
286 }
287
288 if (!dtls12_handshake_msg_fragment_build(hs_msg, 128, &cbs)) {
289 fprintf(stderr, "FAIL: failed to build handshake message fragment 2\n");
290 goto failure;
291 }
292 if (CBS_len(&cbs) != sizeof(dtls12_hs_msg_frag_2)) {
293 fprintf(stderr, "FAIL: handshake message fragment 2 length = %zu, want %zu\n",
294 CBS_len(&cbs), sizeof(dtls12_hs_msg_frag_2));
295 goto failure;
296 }
297 if (memcmp(CBS_data(&cbs), dtls12_hs_msg_frag_2, CBS_len(&cbs)) != 0) {
298 fprintf(stderr, "FAIL: got handshake message 2 fragment:\n");
299 hexdump(CBS_data(&cbs), CBS_len(&cbs));
300 fprintf(stderr, "want handshake message 2 fragment:\n");
301 hexdump(dtls12_hs_msg_frag_2, CBS_len(&cbs));
302 }
303
304 if (!dtls12_handshake_msg_fragment_next(hs_msg)) {
305 fprintf(stderr, "FAIL: failed to progress to next fragment\n");
306 goto failure;
307 }
308 if (!dtls12_handshake_msg_fragment_pending(hs_msg)) {
309 fprintf(stderr, "FAIL: handshake message should have pending fragments\n");
310 goto failure;
311 }
312
313 if (!dtls12_handshake_msg_fragment_build(hs_msg, 128, &cbs)) {
314 fprintf(stderr, "FAIL: failed to build handshake message fragment 3\n");
315 goto failure;
316 }
317 if (CBS_len(&cbs) != sizeof(dtls12_hs_msg_frag_3)) {
318 fprintf(stderr, "FAIL: handshake message fragment 3 length = %zu, want %zu\n",
319 CBS_len(&cbs), sizeof(dtls12_hs_msg_frag_3));
320 goto failure;
321 }
322 if (memcmp(CBS_data(&cbs), dtls12_hs_msg_frag_3, CBS_len(&cbs)) != 0) {
323 fprintf(stderr, "FAIL: got handshake message 3 fragment:\n");
324 hexdump(CBS_data(&cbs), CBS_len(&cbs));
325 fprintf(stderr, "want handshake message 3 fragment:\n");
326 hexdump(dtls12_hs_msg_frag_2, CBS_len(&cbs));
327 }
328
329 if (!dtls12_handshake_msg_fragment_next(hs_msg)) {
330 fprintf(stderr, "FAIL: failed to progress to next fragment\n");
331 goto failure;
332 }
333 if (dtls12_handshake_msg_fragment_pending(hs_msg)) {
334 fprintf(stderr, "FAIL: handshake message should not have pending fragments\n");
335 goto failure;
336 }
337 if (dtls12_handshake_msg_fragment_next(hs_msg)) {
338 fprintf(stderr, "FAIL: should have failed to progress to next fragment\n");
339 goto failure;
340 }
341
342 if (!dtls12_handshake_msg_fragment_reset(hs_msg)) {
343 fprintf(stderr, "FAIL: failed to reset handshake message fragments\n");
344 goto failure;
345 }
346 if (!dtls12_handshake_msg_fragment_pending(hs_msg)) {
347 fprintf(stderr, "FAIL: handshake message should have pending fragments after reset\n");
348 goto failure;
349 }
350
351 failed = 0;
352
353 failure:
354 dtls12_handshake_msg_free(hs_msg);
355
356 CBB_cleanup(&cbb);
357
358 return failed;
359}
360
361int
362main(int argc, char **argv)
363{
364 int failed = 0;
365
366 failed |= dtls_handshake_msg_test();
367
368 return failed;
369}
diff --git a/src/regress/lib/libssl/dtls/dtls_wire_test.c b/src/regress/lib/libssl/dtls/dtls_wire_test.c
new file mode 100644
index 0000000000..fa9717a3e1
--- /dev/null
+++ b/src/regress/lib/libssl/dtls/dtls_wire_test.c
@@ -0,0 +1,376 @@
1/* $OpenBSD: dtls_wire_test.c,v 1.1 2026/04/25 14:36:12 jsing Exp $ */
2/*
3 * Copyright (c) 2026 Joel Sing <jsing@openbsd.org>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#include <stdio.h>
19
20#include <openssl/bio.h>
21#include <openssl/ssl.h>
22
23#include "dtls_local.h"
24#include "ssl_local.h"
25
26static void
27hexdump(const unsigned char *buf, size_t len)
28{
29 size_t i;
30
31 for (i = 1; i <= len; i++)
32 fprintf(stderr, " 0x%02hhx,%s", buf[i - 1], i % 8 ? "" : "\n");
33
34 fprintf(stderr, "\n");
35}
36
37static const uint8_t dtls12_hm_wire_bytes[] = {
38 0x16, 0xfe, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
39 0x00, 0x00, 0x00, 0x01, 0xf3, 0x16, 0x00, 0x04,
40 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
41 0xe7, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
42 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
43 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
44 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
45 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
46 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
47 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
48 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
49 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
50 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
51 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
52 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
53 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
54 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
55 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
56 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
57 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
58 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
59 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
60 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
61 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
62 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
63 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
64 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
65 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
66 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
67 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
68 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
69 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
70 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
71 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
72 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
73 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
74 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
75 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
76 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
77 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
78 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
79 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
80 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
81 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
82 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
83 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
84 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
85 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
86 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
87 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
88 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
89 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
90 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
91 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
92 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
93 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
94 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
95 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
96 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
97 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
98 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
99 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
100 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
101 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
102 0x16, 0xfe, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
103 0x00, 0x00, 0x01, 0x01, 0xf3, 0x16, 0x00, 0x04,
104 0x00, 0x00, 0x00, 0x00, 0x01, 0xe7, 0x00, 0x01,
105 0xe7, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
106 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
107 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
108 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
109 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
110 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
111 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
112 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
113 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
114 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
115 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
116 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
117 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
118 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
119 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
120 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
121 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
122 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
123 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
124 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
125 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
126 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
127 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
128 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
129 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
130 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
131 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
132 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
133 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
134 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
135 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
136 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
137 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
138 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
139 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
140 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
141 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
142 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
143 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
144 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
145 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
146 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
147 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
148 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
149 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
150 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
151 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
152 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
153 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
154 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
155 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
156 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
157 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
158 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
159 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
160 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
161 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
162 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
163 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
164 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
165 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
166 0x16, 0xfe, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
167 0x00, 0x00, 0x02, 0x00, 0x3e, 0x16, 0x00, 0x04,
168 0x00, 0x00, 0x00, 0x00, 0x03, 0xce, 0x00, 0x00,
169 0x32, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
170 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
171 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
172 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
173 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
174 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
175 0x41, 0x41, 0x41,
176};
177
178static int
179dtls_send_handshake_message_test(void)
180{
181 BIO *rbio = NULL, *wbio = NULL;
182 char *wbuf, rbuf[1];
183 CBB handshake, body;
184 uint8_t *p;
185 SSL_CTX *ssl_ctx = NULL;
186 SSL *ssl = NULL;
187 long len;
188 int failed = 1;
189
190 if ((ssl_ctx = SSL_CTX_new(DTLS_client_method())) == NULL) {
191 fprintf(stderr, "FAIL: failed to create SSL_CTX\n");
192 goto failure;
193 }
194 if ((ssl = SSL_new(ssl_ctx)) == NULL) {
195 fprintf(stderr, "FAIL: failed to create SSL\n");
196 goto failure;
197 }
198
199 if ((rbio = BIO_new_mem_buf(rbuf, sizeof(rbuf))) == NULL) {
200 fprintf(stderr, "FAIL: failed to create rbio\n");
201 goto failure;
202 }
203 if ((wbio = BIO_new(BIO_s_mem())) == NULL) {
204 fprintf(stderr, "FAIL: failed to create wbio\n");
205 goto failure;
206 }
207
208 BIO_up_ref(rbio);
209 BIO_up_ref(wbio);
210 SSL_set_bio(ssl, rbio, wbio);
211
212 if (!ssl3_setup_init_buffer(ssl)) {
213 fprintf(stderr, "FAIL: failed to setup init buffer\n");
214 goto failure;
215 }
216 if (!ssl3_setup_write_buffer(ssl)) {
217 fprintf(stderr, "FAIL: failed to setup write buffer\n");
218 goto failure;
219 }
220 if (!ssl_get_new_session(ssl, 0)) {
221 fprintf(stderr, "FAIL: failed to create session\n");
222 goto failure;
223 }
224 if (!tls1_transcript_init(ssl)) {
225 fprintf(stderr, "FAIL: failed to init transcript\n");
226 goto failure;
227 }
228
229 ssl->s3->hs.cipher = ssl3_get_cipher_by_value(
230 TLS1_CK_ECDHE_RSA_WITH_AES_128_SHA256 & 0xffff);
231
232 ssl->s3->hs.state = SSL3_ST_CW_CLNT_HELLO_B;
233 ssl->d1->mtu = 512;
234
235 if (!ssl3_handshake_msg_start(ssl, &handshake, &body, SSL3_RT_HANDSHAKE)) {
236 fprintf(stderr, "FAIL: failed to start handshake message\n");
237 goto failure;
238 }
239 if (!CBB_add_space(&body, &p, 1024))
240 goto failure;
241 memset(p, 'A', 1024);
242 if (!ssl3_handshake_msg_finish(ssl, &handshake)) {
243 fprintf(stderr, "FAIL: failed to finish handshake message\n");
244 goto failure;
245 }
246
247 ssl3_connect(ssl);
248
249 if (ssl->s3->hs.state != SSL3_ST_CR_SRVR_HELLO_A) {
250 fprintf(stderr, "FAIL: got state 0x%x, want 0x%x\n",
251 ssl->s3->hs.state, SSL3_ST_CR_SRVR_HELLO_A);
252 goto failure;
253 }
254
255 if ((len = BIO_get_mem_data(wbio, &wbuf)) != sizeof(dtls12_hm_wire_bytes)) {
256 fprintf(stderr, "FAIL: got handshake message length = %ld, want %zu\n",
257 len, sizeof(dtls12_hm_wire_bytes));
258 goto failure;
259 }
260 if (memcmp(wbuf, dtls12_hm_wire_bytes, len) != 0) {
261 fprintf(stderr, "FAIL: got handshake message wire bytes:\n");
262 hexdump(wbuf, len);
263 fprintf(stderr, "want handshake message wire bytes:\n");
264 hexdump(dtls12_hm_wire_bytes, len);
265 }
266
267 failed = 0;
268
269 failure:
270 SSL_CTX_free(ssl_ctx);
271 SSL_free(ssl);
272
273 BIO_free(rbio);
274 BIO_free(wbio);
275
276 return failed;
277}
278
279static const uint8_t dtls12_ccs_wire_bytes[] = {
280 0x14, 0xfe, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
281 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
282};
283
284static int
285dtls_send_ccs_test(void)
286{
287 BIO *rbio = NULL, *wbio = NULL;
288 char *wbuf, rbuf[1];
289 SSL_CTX *ssl_ctx = NULL;
290 SSL *ssl = NULL;
291 long len;
292 int failed = 1;
293
294 if ((ssl_ctx = SSL_CTX_new(DTLS_client_method())) == NULL) {
295 fprintf(stderr, "FAIL: failed to create SSL_CTX\n");
296 goto failure;
297 }
298 if ((ssl = SSL_new(ssl_ctx)) == NULL) {
299 fprintf(stderr, "FAIL: failed to create SSL\n");
300 goto failure;
301 }
302
303 if ((rbio = BIO_new_mem_buf(rbuf, sizeof(rbuf))) == NULL) {
304 fprintf(stderr, "FAIL: failed to create rbio\n");
305 goto failure;
306 }
307 if ((wbio = BIO_new(BIO_s_mem())) == NULL) {
308 fprintf(stderr, "FAIL: failed to create wbio\n");
309 goto failure;
310 }
311
312 BIO_up_ref(rbio);
313 BIO_up_ref(wbio);
314 SSL_set_bio(ssl, rbio, wbio);
315
316 if (!ssl3_setup_init_buffer(ssl)) {
317 fprintf(stderr, "FAIL: failed to setup init buffer\n");
318 goto failure;
319 }
320 if (!ssl3_setup_write_buffer(ssl)) {
321 fprintf(stderr, "FAIL: failed to setup write buffer\n");
322 goto failure;
323 }
324 if (!ssl_get_new_session(ssl, 0)) {
325 fprintf(stderr, "FAIL: failed to create session\n");
326 goto failure;
327 }
328
329 ssl->s3->hs.cipher = ssl3_get_cipher_by_value(
330 TLS1_CK_ECDHE_RSA_WITH_AES_128_SHA256 & 0xffff);
331
332 ssl->s3->hs.state = SSL3_ST_CW_CHANGE_A;
333 ssl->d1->mtu = 512;
334
335 ssl3_connect(ssl);
336
337 if (ssl->s3->hs.state != SSL3_ST_CW_FINISHED_A) {
338 fprintf(stderr, "FAIL: got state 0x%x, want 0x%x\n",
339 ssl->s3->hs.state, SSL3_ST_CW_FINISHED_A);
340 goto failure;
341 }
342
343 if ((len = BIO_get_mem_data(wbio, &wbuf)) != sizeof(dtls12_ccs_wire_bytes)) {
344 fprintf(stderr, "FAIL: got CCS length = %ld, want %zu\n", len,
345 sizeof(dtls12_ccs_wire_bytes));
346 goto failure;
347 }
348 if (memcmp(wbuf, dtls12_ccs_wire_bytes, len) != 0) {
349 fprintf(stderr, "FAIL: got CCS wire bytes:\n");
350 hexdump(wbuf, len);
351 fprintf(stderr, "want CCS wire bytes:\n");
352 hexdump(dtls12_ccs_wire_bytes, len);
353 }
354
355 failed = 0;
356
357 failure:
358 SSL_CTX_free(ssl_ctx);
359 SSL_free(ssl);
360
361 BIO_free(rbio);
362 BIO_free(wbio);
363
364 return failed;
365}
366
367int
368main(int argc, char **argv)
369{
370 int failed = 0;
371
372 failed |= dtls_send_handshake_message_test();
373 failed |= dtls_send_ccs_test();
374
375 return failed;
376}
diff --git a/src/regress/lib/libssl/handshake/handshake_table.c b/src/regress/lib/libssl/handshake/handshake_table.c
index 8ebed9a73e..c1c83a75bb 100644
--- a/src/regress/lib/libssl/handshake/handshake_table.c
+++ b/src/regress/lib/libssl/handshake/handshake_table.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: handshake_table.c,v 1.18 2022/12/01 13:49:12 tb Exp $ */ 1/* $OpenBSD: handshake_table.c,v 1.19 2026/08/21 17:16:29 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2019 Theo Buehler <tb@openbsd.org> 3 * Copyright (c) 2019 Theo Buehler <tb@openbsd.org>
4 * 4 *
@@ -26,7 +26,7 @@
26#define MAX_FLAGS (UINT8_MAX + 1) 26#define MAX_FLAGS (UINT8_MAX + 1)
27 27
28/* 28/*
29 * From RFC 8446: 29 * From RFC 9846:
30 * 30 *
31 * Appendix A. State Machine 31 * Appendix A. State Machine
32 * 32 *
diff --git a/src/regress/lib/libssl/openssl-ruby/Makefile b/src/regress/lib/libssl/openssl-ruby/Makefile
index 19d2f2fc40..6e77ed963c 100644
--- a/src/regress/lib/libssl/openssl-ruby/Makefile
+++ b/src/regress/lib/libssl/openssl-ruby/Makefile
@@ -1,8 +1,8 @@
1# $OpenBSD: Makefile,v 1.17 2025/06/27 03:32:08 tb Exp $ 1# $OpenBSD: Makefile,v 1.19 2026/06/18 03:56:36 tb Exp $
2 2
3OPENSSL_RUBY_TESTS = /usr/local/share/openssl-ruby-tests 3OPENSSL_RUBY_TESTS = /usr/local/share/openssl-ruby-tests
4.if exists(/usr/local/bin/ruby33) 4.if exists(/usr/local/bin/ruby40)
5RUBY_BINREV = 33 5RUBY_BINREV = 40
6.else 6.else
7RUBY_BINREV = 34 7RUBY_BINREV = 34
8.endif 8.endif
diff --git a/src/regress/lib/libssl/renegotiation/Makefile b/src/regress/lib/libssl/renegotiation/Makefile
index 55f323e158..935586da62 100644
--- a/src/regress/lib/libssl/renegotiation/Makefile
+++ b/src/regress/lib/libssl/renegotiation/Makefile
@@ -1,10 +1,11 @@
1# $OpenBSD: Makefile,v 1.2 2025/02/01 12:26:50 jsing Exp $ 1# $OpenBSD: Makefile,v 1.3 2026/06/14 14:33:36 jsing Exp $
2 2
3PROG= renegotiation_test 3PROG= renegotiation_test
4LDADD= -lssl -lcrypto 4LDADD= ${SSL_INT} -lcrypto
5DPADD= ${LIBSSL} ${LIBCRYPTO} 5DPADD= ${LIBSSL} ${LIBCRYPTO}
6WARNINGS= Yes 6WARNINGS= Yes
7CFLAGS+= -DLIBRESSL_INTERNAL -Werror 7CFLAGS+= -DLIBRESSL_INTERNAL -Werror
8CFLAGS+= -I${.CURDIR}/../../../../lib/libssl
8 9
9REGRESS_TARGETS= \ 10REGRESS_TARGETS= \
10 regress-renegotiation-test 11 regress-renegotiation-test
diff --git a/src/regress/lib/libssl/renegotiation/renegotiation_test.c b/src/regress/lib/libssl/renegotiation/renegotiation_test.c
index 1c9f35237f..a94da93b9a 100644
--- a/src/regress/lib/libssl/renegotiation/renegotiation_test.c
+++ b/src/regress/lib/libssl/renegotiation/renegotiation_test.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: renegotiation_test.c,v 1.3 2025/03/12 14:07:35 jsing Exp $ */ 1/* $OpenBSD: renegotiation_test.c,v 1.4 2026/06/14 14:33:36 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2020,2025 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2020,2025 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -21,6 +21,8 @@
21#include <openssl/err.h> 21#include <openssl/err.h>
22#include <openssl/ssl.h> 22#include <openssl/ssl.h>
23 23
24#include "ssl_local.h"
25
24const char *server_ca_file; 26const char *server_ca_file;
25const char *server_cert_file; 27const char *server_cert_file;
26const char *server_key_file; 28const char *server_key_file;
@@ -28,7 +30,13 @@ const char *server_key_file;
28int debug = 0; 30int debug = 0;
29 31
30int tls_client_alert; 32int tls_client_alert;
33int tls_client_error;
34
31int tls_server_alert; 35int tls_server_alert;
36int tls_server_error;
37
38int tls_client_disable_ri;
39int tls_server_disable_ri;
32 40
33static void 41static void
34hexdump(const unsigned char *buf, size_t len) 42hexdump(const unsigned char *buf, size_t len)
@@ -101,7 +109,7 @@ tls_server(BIO *rbio, BIO *wbio)
101} 109}
102 110
103static int 111static int
104ssl_error(SSL *ssl, const char *name, const char *desc, int ssl_ret) 112ssl_error(SSL *ssl, const char *name, const char *desc, int ssl_ret, int *error)
105{ 113{
106 int ssl_err; 114 int ssl_err;
107 115
@@ -122,10 +130,11 @@ ssl_error(SSL *ssl, const char *name, const char *desc, int ssl_ret)
122 if (tls_client_alert >> 8 == SSL3_AL_WARNING || 130 if (tls_client_alert >> 8 == SSL3_AL_WARNING ||
123 tls_server_alert >> 8 == SSL3_AL_WARNING) { 131 tls_server_alert >> 8 == SSL3_AL_WARNING) {
124 ERR_clear_error(); 132 ERR_clear_error();
125 return 1; 133 return 0;
126 } 134 }
127 fprintf(stderr, "FAIL: %s %s failed - ssl err = %d, errno = %d\n", 135 fprintf(stderr, "INFO: %s %s failed - ssl err = %d, errno = %d\n",
128 name, desc, ssl_err, errno); 136 name, desc, ssl_err, errno);
137 *error = ERR_peek_error();
129 ERR_print_errors_fp(stderr); 138 ERR_print_errors_fp(stderr);
130 return 0; 139 return 0;
131 } 140 }
@@ -134,7 +143,7 @@ ssl_error(SSL *ssl, const char *name, const char *desc, int ssl_ret)
134} 143}
135 144
136static int 145static int
137do_connect(SSL *ssl, const char *name, int *done) 146do_connect(SSL *ssl, const char *name, int *done, int *error)
138{ 147{
139 int ssl_ret; 148 int ssl_ret;
140 149
@@ -144,11 +153,11 @@ do_connect(SSL *ssl, const char *name, int *done)
144 return 1; 153 return 1;
145 } 154 }
146 155
147 return ssl_error(ssl, name, "connect", ssl_ret); 156 return ssl_error(ssl, name, "connect", ssl_ret, error);
148} 157}
149 158
150static int 159static int
151do_accept(SSL *ssl, const char *name, int *done) 160do_accept(SSL *ssl, const char *name, int *done, int *error)
152{ 161{
153 int ssl_ret; 162 int ssl_ret;
154 163
@@ -158,11 +167,11 @@ do_accept(SSL *ssl, const char *name, int *done)
158 return 1; 167 return 1;
159 } 168 }
160 169
161 return ssl_error(ssl, name, "accept", ssl_ret); 170 return ssl_error(ssl, name, "accept", ssl_ret, error);
162} 171}
163 172
164static int 173static int
165do_read(SSL *ssl, const char *name, int *done) 174do_read(SSL *ssl, const char *name, int *done, int *error)
166{ 175{
167 uint8_t buf[512]; 176 uint8_t buf[512];
168 int ssl_ret; 177 int ssl_ret;
@@ -175,11 +184,11 @@ do_read(SSL *ssl, const char *name, int *done)
175 return 1; 184 return 1;
176 } 185 }
177 186
178 return ssl_error(ssl, name, "read", ssl_ret); 187 return ssl_error(ssl, name, "read", ssl_ret, error);
179} 188}
180 189
181static int 190static int
182do_write(SSL *ssl, const char *name, int *done) 191do_write(SSL *ssl, const char *name, int *done, int *error)
183{ 192{
184 const uint8_t buf[] = "Hello, World!\n"; 193 const uint8_t buf[] = "Hello, World!\n";
185 int ssl_ret; 194 int ssl_ret;
@@ -190,11 +199,11 @@ do_write(SSL *ssl, const char *name, int *done)
190 return 1; 199 return 1;
191 } 200 }
192 201
193 return ssl_error(ssl, name, "write", ssl_ret); 202 return ssl_error(ssl, name, "write", ssl_ret, error);
194} 203}
195 204
196static int 205static int
197do_shutdown(SSL *ssl, const char *name, int *done) 206do_shutdown(SSL *ssl, const char *name, int *done, int *error)
198{ 207{
199 int ssl_ret; 208 int ssl_ret;
200 209
@@ -204,10 +213,10 @@ do_shutdown(SSL *ssl, const char *name, int *done)
204 *done = 1; 213 *done = 1;
205 return 1; 214 return 1;
206 } 215 }
207 return ssl_error(ssl, name, "shutdown", ssl_ret); 216 return ssl_error(ssl, name, "shutdown", ssl_ret, error);
208} 217}
209 218
210typedef int (*ssl_func)(SSL *ssl, const char *name, int *done); 219typedef int (*ssl_func)(SSL *ssl, const char *name, int *done, int *error);
211 220
212static int 221static int
213do_client_server_loop(SSL *client, ssl_func client_func, SSL *server, 222do_client_server_loop(SSL *client, ssl_func client_func, SSL *server,
@@ -220,13 +229,15 @@ do_client_server_loop(SSL *client, ssl_func client_func, SSL *server,
220 if (!client_done) { 229 if (!client_done) {
221 if (debug) 230 if (debug)
222 fprintf(stderr, "DEBUG: client loop\n"); 231 fprintf(stderr, "DEBUG: client loop\n");
223 if (!client_func(client, "client", &client_done)) 232 if (!client_func(client, "client", &client_done,
233 &tls_client_error))
224 return 0; 234 return 0;
225 } 235 }
226 if (!server_done) { 236 if (!server_done) {
227 if (debug) 237 if (debug)
228 fprintf(stderr, "DEBUG: server loop\n"); 238 fprintf(stderr, "DEBUG: server loop\n");
229 if (!server_func(server, "server", &server_done)) 239 if (!server_func(server, "server", &server_done,
240 &tls_server_error))
230 return 0; 241 return 0;
231 } 242 }
232 } while (i++ < 100 && (!client_done || !server_done)); 243 } while (i++ < 100 && (!client_done || !server_done));
@@ -245,8 +256,12 @@ struct tls_reneg_test {
245 int renegotiate_client; 256 int renegotiate_client;
246 int renegotiate_server; 257 int renegotiate_server;
247 int client_ignored; 258 int client_ignored;
259 int client_disable_ri;
260 int server_disable_ri;
248 int want_client_alert; 261 int want_client_alert;
249 int want_server_alert; 262 int want_server_alert;
263 int want_client_connect_error;
264 int want_server_renegotiate_error;
250 int want_failure; 265 int want_failure;
251}; 266};
252 267
@@ -346,6 +361,38 @@ static const struct tls_reneg_test tls_reneg_tests[] = {
346 .want_failure = 1, 361 .want_failure = 1,
347 }, 362 },
348 { 363 {
364 .desc = "TLSv1.2 - Server Renegotiation Indication disabled, "
365 "client legacy connect",
366 .ssl_max_proto_version = TLS1_2_VERSION,
367 .ssl_client_options = SSL_OP_LEGACY_SERVER_CONNECT,
368 .server_disable_ri = 1,
369 },
370 {
371 .desc = "TLSv1.2 - Server Renegotiation Indication disabled, "
372 "no client legacy connect",
373 .ssl_max_proto_version = TLS1_2_VERSION,
374 .server_disable_ri = 1,
375 .want_client_connect_error = SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED,
376 },
377 {
378 .desc = "TLSv1.2 - Server Renegotiation Indication disabled, "
379 "client legacy connect, client renegotiates",
380 .ssl_max_proto_version = TLS1_2_VERSION,
381 .ssl_client_options = SSL_OP_LEGACY_SERVER_CONNECT,
382 .server_disable_ri = 1,
383 .renegotiate_client = 1,
384 .want_client_alert = SSL3_AL_WARNING << 8 | SSL_AD_NO_RENEGOTIATION,
385 },
386 {
387 .desc = "TLSv1.2 - Server Renegotiation Indication disabled, "
388 "client legacy connect, server renegotiates",
389 .ssl_max_proto_version = TLS1_2_VERSION,
390 .ssl_client_options = SSL_OP_LEGACY_SERVER_CONNECT,
391 .server_disable_ri = 1,
392 .renegotiate_server = 1,
393 .want_server_renegotiate_error = SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED,
394 },
395 {
349 .desc = "TLSv1.3 - No renegotiation supported, no renegotiation", 396 .desc = "TLSv1.3 - No renegotiation supported, no renegotiation",
350 .ssl_max_proto_version = TLS1_3_VERSION, 397 .ssl_max_proto_version = TLS1_3_VERSION,
351 }, 398 },
@@ -376,6 +423,11 @@ tls_client_info_callback(const SSL *ssl, int where, int value)
376 SSL_alert_desc_string_long(value)); 423 SSL_alert_desc_string_long(value));
377 tls_client_alert = value; 424 tls_client_alert = value;
378 } 425 }
426
427 if (tls_client_disable_ri) {
428 ssl->s3->renegotiate_seen = 0;
429 ssl->s3->send_connection_binding = 0;
430 }
379} 431}
380 432
381static void 433static void
@@ -387,6 +439,11 @@ tls_server_info_callback(const SSL *ssl, int where, int value)
387 SSL_alert_desc_string_long(value)); 439 SSL_alert_desc_string_long(value));
388 tls_server_alert = value; 440 tls_server_alert = value;
389 } 441 }
442
443 if (tls_server_disable_ri) {
444 ssl->s3->renegotiate_seen = 0;
445 ssl->s3->send_connection_binding = 0;
446 }
390} 447}
391 448
392static int 449static int
@@ -445,6 +502,8 @@ tls_reneg_test(const struct tls_reneg_test *trt)
445 if ((client = tls_client(server_wbio, client_wbio)) == NULL) 502 if ((client = tls_client(server_wbio, client_wbio)) == NULL)
446 goto failure; 503 goto failure;
447 504
505 SSL_clear_options(client, SSL_OP_LEGACY_SERVER_CONNECT);
506
448 SSL_set_options(client, trt->ssl_client_options); 507 SSL_set_options(client, trt->ssl_client_options);
449 SSL_set_info_callback(client, tls_client_info_callback); 508 SSL_set_info_callback(client, tls_client_info_callback);
450 509
@@ -458,13 +517,33 @@ tls_reneg_test(const struct tls_reneg_test *trt)
458 goto failure; 517 goto failure;
459 518
460 tls_client_alert = 0; 519 tls_client_alert = 0;
520 tls_client_error = 0;
521
461 tls_server_alert = 0; 522 tls_server_alert = 0;
523 tls_server_error = 0;
524
525 tls_client_disable_ri = trt->client_disable_ri;
526 tls_server_disable_ri = trt->server_disable_ri;
462 527
463 if (!do_client_server_loop(client, do_connect, server, do_accept)) { 528 if (!do_client_server_loop(client, do_connect, server, do_accept)) {
529 if (trt->want_client_connect_error != 0) {
530 if (ERR_GET_REASON(tls_client_error) != trt->want_client_connect_error) {
531 fprintf(stderr, "FAIL: got client error 0x%x, want "
532 "error 0x%x\n", ERR_GET_REASON(tls_client_error),
533 trt->want_client_connect_error);
534 goto failure;
535 }
536 goto done;
537 }
464 fprintf(stderr, "FAIL: client and server handshake failed\n"); 538 fprintf(stderr, "FAIL: client and server handshake failed\n");
465 goto failure; 539 goto failure;
466 } 540 }
467 541
542 if (trt->want_client_connect_error != 0) {
543 fprintf(stderr, "FAIL: handshake should have failed\n");
544 goto failure;
545 }
546
468 if (!do_client_server_loop(client, do_write, server, do_read)) { 547 if (!do_client_server_loop(client, do_write, server, do_read)) {
469 fprintf(stderr, "FAIL: client write and server read failed\n"); 548 fprintf(stderr, "FAIL: client write and server read failed\n");
470 goto failure; 549 goto failure;
@@ -500,7 +579,16 @@ tls_reneg_test(const struct tls_reneg_test *trt)
500 goto failure; 579 goto failure;
501 580
502 if (!do_client_server_loop(client, do_read, server, do_write)) { 581 if (!do_client_server_loop(client, do_read, server, do_write)) {
503 fprintf(stderr, "FAIL: client read and server write failed\n"); 582 if (trt->want_server_renegotiate_error != 0) {
583 if (ERR_GET_REASON(tls_server_error) != trt->want_server_renegotiate_error) {
584 fprintf(stderr, "FAIL: got server error 0x%x, want "
585 "error 0x%x\n", ERR_GET_REASON(tls_server_error),
586 trt->want_server_renegotiate_error);
587 goto failure;
588 }
589 goto done;
590 }
591 fprintf(stderr, "FAIL: client write and server read failed\n");
504 goto failure; 592 goto failure;
505 } 593 }
506 594
diff --git a/src/regress/lib/libssl/ssl/ssltest.c b/src/regress/lib/libssl/ssl/ssltest.c
index 27adeeaf17..3bc5f99617 100644
--- a/src/regress/lib/libssl/ssl/ssltest.c
+++ b/src/regress/lib/libssl/ssl/ssltest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssltest.c,v 1.45 2024/03/01 03:45:16 tb Exp $ */ 1/* $OpenBSD: ssltest.c,v 1.46 2026/08/30 12:19:37 kenjiro 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 *
@@ -759,11 +759,9 @@ end:
759 SSL_CTX_free(c_ctx); 759 SSL_CTX_free(c_ctx);
760 BIO_free(bio_stdout); 760 BIO_free(bio_stdout);
761 761
762 CRYPTO_cleanup_all_ex_data();
763 ERR_free_strings();
764 ERR_remove_thread_state(NULL);
765 EVP_cleanup();
766 BIO_free(bio_err); 762 BIO_free(bio_err);
763 ERR_remove_thread_state(NULL);
764 OPENSSL_cleanup();
767 765
768 exit(ret); 766 exit(ret);
769 return ret; 767 return ret;
diff --git a/src/regress/lib/libssl/tlsext/tlsexttest.c b/src/regress/lib/libssl/tlsext/tlsexttest.c
index 9c4c0f55a1..29b348154f 100644
--- a/src/regress/lib/libssl/tlsext/tlsexttest.c
+++ b/src/regress/lib/libssl/tlsext/tlsexttest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tlsexttest.c,v 1.97 2026/04/03 07:37:52 jsing Exp $ */ 1/* $OpenBSD: tlsexttest.c,v 1.98 2026/08/29 05:12:47 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2017 Doug Hogan <doug@openbsd.org> 4 * Copyright (c) 2017 Doug Hogan <doug@openbsd.org>
@@ -153,6 +153,14 @@ const uint8_t tlsext_alpn_single_proto[] = {
153 0x68, 0x74, 0x74, 0x70, 0x2f, 0x31, 0x2e, 0x31 153 0x68, 0x74, 0x74, 0x70, 0x2f, 0x31, 0x2e, 0x31
154}; 154};
155 155
156const uint8_t tlsext_alpn_single_proto_unadvertised[] = {
157 /* ProtocolName protocol_name_list<2..2^16-1> -- ALPN names */
158 0x00, 0x09, /* len of all names */
159 /* opaque ProtocolName<1..2^8-1> -- 'http/1.2' */
160 0x08, /* len */
161 0x68, 0x74, 0x74, 0x70, 0x2f, 0x31, 0x2e, 0x32
162};
163
156#define TLSEXT_TYPE_alpn TLSEXT_TYPE_application_layer_protocol_negotiation 164#define TLSEXT_TYPE_alpn TLSEXT_TYPE_application_layer_protocol_negotiation
157 165
158static int 166static int
@@ -334,6 +342,21 @@ test_tlsext_alpn_client(void)
334 goto err; 342 goto err;
335 } 343 }
336 344
345 /* Make sure we don't accept a protocol we did not advertise. */
346
347 CBS_init(&cbs, tlsext_alpn_single_proto_unadvertised,
348 sizeof(tlsext_alpn_single_proto_unadvertised));
349
350 if (client_funcs->process(ssl, SSL_TLSEXT_MSG_SH, &cbs, &alert)) {
351 FAIL("failed to reject unadvertised ALPN protocol\n");
352 goto err;
353 }
354 if (alert != SSL_AD_ILLEGAL_PARAMETER) {
355 FAIL("unadvertised ALPN: want illegal_parameter, got %s\n",
356 SSL_alert_desc_string_long(alert));
357 goto err;
358 }
359
337 /* Make sure we can remove the list and avoid ALPN */ 360 /* Make sure we can remove the list and avoid ALPN */
338 361
339 free(ssl->alpn_client_proto_list); 362 free(ssl->alpn_client_proto_list);
diff --git a/src/regress/lib/libssl/tlsfuzzer/tlsfuzzer.py b/src/regress/lib/libssl/tlsfuzzer/tlsfuzzer.py
index ff678ec9a8..a4d8746556 100644
--- a/src/regress/lib/libssl/tlsfuzzer/tlsfuzzer.py
+++ b/src/regress/lib/libssl/tlsfuzzer/tlsfuzzer.py
@@ -1,4 +1,4 @@
1# $OpenBSD: tlsfuzzer.py,v 1.57 2025/06/15 09:44:57 tb Exp $ 1# $OpenBSD: tlsfuzzer.py,v 1.63 2026/07/28 10:32:37 tb Exp $
2# 2#
3# Copyright (c) 2020 Theo Buehler <tb@openbsd.org> 3# Copyright (c) 2020 Theo Buehler <tb@openbsd.org>
4# 4#
@@ -32,7 +32,15 @@ class Test:
32 32
33 XXX Add client cert support. 33 XXX Add client cert support.
34 """ 34 """
35 def __init__(self, name="", args=[], tls12_args=[], tls13_args=[]): 35
36 def __init__(self, name="", args=None, tls12_args=None, tls13_args=None):
37 if args is None:
38 args = []
39 if tls12_args is None:
40 tls12_args = []
41 if tls13_args is None:
42 tls13_args = []
43
36 self.name = name 44 self.name = name
37 self.tls12_args = args 45 self.tls12_args = args
38 self.tls13_args = args 46 self.tls13_args = args
@@ -48,13 +56,15 @@ class Test:
48 return self.tls12_args 56 return self.tls12_args
49 57
50 def __repr__(self): 58 def __repr__(self):
51 return "<Test: %s tls12_args: %s tls13_args: %s>" % ( 59 return f"<Test: {self.name} tls12_args: {self.tls12_args} tls13_args: {self.tls13_args}>"
52 self.name, self.tls12_args, self.tls13_args
53 )
54 60
55class TestGroup: 61class TestGroup:
56 """ A group of Test objects to be run by TestRunner.""" 62 """A group of Test objects to be run by TestRunner."""
57 def __init__(self, title="Tests", tests=[]): 63
64 def __init__(self, title="Tests", tests=None):
65 if tests is None:
66 tests = []
67
58 self.title = title 68 self.title = title
59 self.tests = tests 69 self.tests = tests
60 70
@@ -77,7 +87,7 @@ def substitute_alert(want, got):
77# Both alerts appear to be reasonable in this context, so work around this 87# Both alerts appear to be reasonable in this context, so work around this
78# in the test instead of the library. 88# in the test instead of the library.
79def generate_test_tls13_finished_args(): 89def generate_test_tls13_finished_args():
80 assertion = substitute_alert("decode_error", "decrypt_error"); 90 assertion = substitute_alert("decode_error", "decrypt_error")
81 paddings = [ 91 paddings = [
82 ("TLS_AES_128_GCM_SHA256", 0, 1), 92 ("TLS_AES_128_GCM_SHA256", 0, 1),
83 ("TLS_AES_128_GCM_SHA256", 0, 2), 93 ("TLS_AES_128_GCM_SHA256", 0, 2),
@@ -649,11 +659,11 @@ failing_groups = [
649] 659]
650 660
651class TestRunner: 661class TestRunner:
652 """ Runs the given tests against a server and displays stats. """ 662 """Runs the given tests against a server and displays stats."""
653 663
654 def __init__( 664 def __init__(
655 self, timing=False, verbose=False, host="localhost", port=4433, 665 self, timing=False, verbose=False, host="localhost", port=4433,
656 use_tls1_3=True, dry_run=False, tests=[], scriptdir=tlsfuzzer_scriptdir, 666 use_tls1_3=True, dry_run=False, scriptdir=tlsfuzzer_scriptdir,
657 ): 667 ):
658 self.tests = [] 668 self.tests = []
659 669
@@ -670,8 +680,9 @@ class TestRunner:
670 self.timing = timing 680 self.timing = timing
671 self.verbose = verbose 681 self.verbose = verbose
672 682
673 def add(self, title="tests", tests=[]): 683 def add(self, title="tests", tests=None):
674 # tests.sort(key=lambda test: test.name) 684 if tests is None:
685 tests = []
675 self.tests.append(TestGroup(title, tests)) 686 self.tests.append(TestGroup(title, tests))
676 687
677 def add_group(self, group): 688 def add_group(self, group):
@@ -743,7 +754,7 @@ class TestRunner:
743 print('\n'.join(self.missing)) 754 print('\n'.join(self.missing))
744 755
745class TlsServer: 756class TlsServer:
746 """ Spawns an s_server listening on localhost:port if necessary. """ 757 """Spawns an s_server listening on localhost:port if necessary."""
747 758
748 def __init__(self, host="localhost", port=4433): 759 def __init__(self, host="localhost", port=4433):
749 self.spawn = True 760 self.spawn = True
@@ -821,11 +832,11 @@ def list_or_missing(missing=True):
821 missing = scripts - set(tests) 832 missing = scripts - set(tests)
822 if missing: 833 if missing:
823 print('\n'.join(sorted(missing))) 834 print('\n'.join(sorted(missing)))
824 exit(0) 835 sys.exit(0)
825 836
826 tests.sort() 837 tests.sort()
827 print('\n'.join(tests)) 838 print('\n'.join(tests))
828 exit(0) 839 sys.exit(0)
829 840
830def usage(): 841def usage():
831 print("Usage: python3 tlsfuzzer.py [-flmnstv] [-p port] [script [test...]]") 842 print("Usage: python3 tlsfuzzer.py [-flmnstv] [-p port] [script [test...]]")
@@ -838,7 +849,7 @@ def usage():
838 print(" -s run slow tests") 849 print(" -s run slow tests")
839 print(" -t show timing stats at end") 850 print(" -t show timing stats at end")
840 print(" -v verbose output") 851 print(" -v verbose output")
841 exit(0) 852 sys.exit(0)
842 853
843def main(): 854def main():
844 failing = False 855 failing = False
@@ -879,13 +890,13 @@ def main():
879 890
880 if not os.path.exists(tlsfuzzer_scriptdir): 891 if not os.path.exists(tlsfuzzer_scriptdir):
881 print("package py3-tlsfuzzer is required for this regress") 892 print("package py3-tlsfuzzer is required for this regress")
882 exit(1) 893 sys.exit(1)
883 894
884 if list and failing: 895 if list and failing:
885 failing = [test.name for group in failing_groups for test in group] 896 failing = [test.name for group in failing_groups for test in group]
886 failing.sort() 897 failing.sort()
887 print('\n'.join(failing)) 898 print('\n'.join(failing))
888 exit(0) 899 sys.exit(0)
889 900
890 if list or missing: 901 if list or missing:
891 list_or_missing(missing) 902 list_or_missing(missing)
@@ -896,7 +907,7 @@ def main():
896 907
897 if args: 908 if args:
898 (dir, script) = os.path.split(args[0]) 909 (dir, script) = os.path.split(args[0])
899 if dir and not dir == '.': 910 if dir and dir != '.':
900 tests.scriptdir = dir 911 tests.scriptdir = dir
901 912
902 testargs = defaultargs(script, tls_server.has_tls1_3) 913 testargs = defaultargs(script, tls_server.has_tls1_3)
@@ -904,7 +915,7 @@ def main():
904 tests.verbose = True 915 tests.verbose = True
905 tests.add("test from command line", [Test(script, testargs + args[1:])]) 916 tests.add("test from command line", [Test(script, testargs + args[1:])])
906 917
907 exit(not tests.run()) 918 sys.exit(not tests.run())
908 919
909 if failing: 920 if failing:
910 if tls_server.has_tls1_3: 921 if tls_server.has_tls1_3:
@@ -929,7 +940,7 @@ def main():
929 940
930 if not success: 941 if not success:
931 print("FAILED") 942 print("FAILED")
932 exit(1) 943 sys.exit(1)
933 944
934if __name__ == "__main__": 945if __name__ == "__main__":
935 main() 946 main()
diff --git a/src/regress/lib/libssl/unit/Makefile b/src/regress/lib/libssl/unit/Makefile
index edc0d910c4..81b234b7ac 100644
--- a/src/regress/lib/libssl/unit/Makefile
+++ b/src/regress/lib/libssl/unit/Makefile
@@ -1,7 +1,8 @@
1# $OpenBSD: Makefile,v 1.17 2025/10/24 11:44:08 tb Exp $ 1# $OpenBSD: Makefile,v 1.19 2026/06/08 11:53:51 tb Exp $
2 2
3PROGS += cipher_list 3PROGS += cipher_list
4PROGS += ssl_get_shared_ciphers 4PROGS += ssl_get_shared_ciphers
5PROGS += ssl_kex
5PROGS += ssl_methods 6PROGS += ssl_methods
6PROGS += ssl_set_alpn_protos 7PROGS += ssl_set_alpn_protos
7PROGS += ssl_verify_param 8PROGS += ssl_verify_param
diff --git a/src/regress/lib/libssl/unit/ssl_kex.c b/src/regress/lib/libssl/unit/ssl_kex.c
new file mode 100644
index 0000000000..4050d04bd5
--- /dev/null
+++ b/src/regress/lib/libssl/unit/ssl_kex.c
@@ -0,0 +1,212 @@
1/* $OpenBSD: ssl_kex.c,v 1.4 2026/06/09 05:20:38 tb Exp $ */
2
3/*
4 * Copyright (c) 2026 Theo Buehler <tb@openbsd.org>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#include <err.h>
20#include <stdio.h>
21
22#include <openssl/ec.h>
23#include <openssl/objects.h>
24
25#include "bytestring.h"
26#include "ssl_local.h"
27
28static const uint8_t point_at_infinity[] = {
29 0x00,
30};
31static const size_t point_at_infinity_len = sizeof(point_at_infinity);
32
33static const uint8_t secp384r1_uncompressed_point[] = {
34 0x04, 0xca, 0x0e, 0xc0, 0x60, 0xce, 0x24, 0x25,
35 0xa7, 0x6e, 0xd1, 0x96, 0x69, 0x33, 0x36, 0x04,
36 0x87, 0x69, 0x36, 0xfd, 0x2a, 0x83, 0x7a, 0x99,
37 0xad, 0xb7, 0x35, 0xe9, 0x4c, 0x2f, 0x56, 0xfc,
38 0xee, 0x7e, 0x68, 0x43, 0x90, 0x41, 0xb7, 0x3c,
39 0x64, 0xd4, 0xec, 0x82, 0xc1, 0xc6, 0xd9, 0x4b,
40 0x7d, 0xfa, 0xaa, 0x43, 0x46, 0x19, 0x94, 0x7f,
41 0xb4, 0xe2, 0xa7, 0xbd, 0x75, 0xaf, 0x4d, 0x8f,
42 0x45, 0xed, 0x3a, 0x8f, 0xef, 0x93, 0x57, 0x50,
43 0x3f, 0x24, 0xf4, 0xa8, 0x68, 0x22, 0xf8, 0xa3,
44 0x8c, 0xa9, 0x8b, 0xe8, 0xb9, 0x28, 0xff, 0x9f,
45 0xcf, 0xcd, 0xac, 0xc1, 0x20, 0x5f, 0x23, 0x07,
46 0x40,
47};
48static const size_t secp384r1_uncompressed_point_len =
49 sizeof(secp384r1_uncompressed_point);
50
51static const uint8_t secp384r1_compressed_point[] = {
52 0x02, 0xca, 0x0e, 0xc0, 0x60, 0xce, 0x24, 0x25,
53 0xa7, 0x6e, 0xd1, 0x96, 0x69, 0x33, 0x36, 0x04,
54 0x87, 0x69, 0x36, 0xfd, 0x2a, 0x83, 0x7a, 0x99,
55 0xad, 0xb7, 0x35, 0xe9, 0x4c, 0x2f, 0x56, 0xfc,
56 0xee, 0x7e, 0x68, 0x43, 0x90, 0x41, 0xb7, 0x3c,
57 0x64, 0xd4, 0xec, 0x82, 0xc1, 0xc6, 0xd9, 0x4b,
58 0x7d,
59};
60static const size_t secp384r1_compressed_point_len =
61 sizeof(secp384r1_compressed_point);
62
63static const uint8_t secp384r1_hybrid_point[] = {
64 0x06, 0xca, 0x0e, 0xc0, 0x60, 0xce, 0x24, 0x25,
65 0xa7, 0x6e, 0xd1, 0x96, 0x69, 0x33, 0x36, 0x04,
66 0x87, 0x69, 0x36, 0xfd, 0x2a, 0x83, 0x7a, 0x99,
67 0xad, 0xb7, 0x35, 0xe9, 0x4c, 0x2f, 0x56, 0xfc,
68 0xee, 0x7e, 0x68, 0x43, 0x90, 0x41, 0xb7, 0x3c,
69 0x64, 0xd4, 0xec, 0x82, 0xc1, 0xc6, 0xd9, 0x4b,
70 0x7d, 0xfa, 0xaa, 0x43, 0x46, 0x19, 0x94, 0x7f,
71 0xb4, 0xe2, 0xa7, 0xbd, 0x75, 0xaf, 0x4d, 0x8f,
72 0x45, 0xed, 0x3a, 0x8f, 0xef, 0x93, 0x57, 0x50,
73 0x3f, 0x24, 0xf4, 0xa8, 0x68, 0x22, 0xf8, 0xa3,
74 0x8c, 0xa9, 0x8b, 0xe8, 0xb9, 0x28, 0xff, 0x9f,
75 0xcf, 0xcd, 0xac, 0xc1, 0x20, 0x5f, 0x23, 0x07,
76 0x40,
77};
78static const size_t secp384r1_hybrid_point_len = sizeof(secp384r1_hybrid_point);
79
80static const uint8_t secp384r1_invalid_point[] = {
81 0x04, 0xca, 0x0e, 0xc0, 0x60, 0xce, 0x24, 0x25,
82 0xa7, 0x6e, 0xd1, 0x96, 0x69, 0x33, 0x36, 0x04,
83 0x87, 0x69, 0x36, 0xfd, 0x2a, 0x83, 0x7a, 0x99,
84 0xad, 0xb7, 0x35, 0xe9, 0x4c, 0x2f, 0x56, 0xfc,
85 0xee, 0x7e, 0x68, 0x43, 0x90, 0x41, 0xb7, 0x3c,
86 0x64, 0xd4, 0xec, 0x82, 0xc1, 0xc6, 0xd9, 0x4b,
87 0x7d, 0xfa, 0xaa, 0x43, 0x46, 0x19, 0x94, 0x7f,
88 0xb4, 0xe2, 0xa7, 0xbd, 0x75, 0xaf, 0x4d, 0x8f,
89 0x45, 0xed, 0x3a, 0x8f, 0xef, 0x93, 0x57, 0x50,
90 0x3f, 0x24, 0xf4, 0xa8, 0x68, 0x22, 0xf8, 0xa3,
91 0x8c, 0xa9, 0x8b, 0xe8, 0xb9, 0x28, 0xff, 0x9f,
92 0xcf, 0xcd, 0xac, 0xc1, 0x20, 0x5f, 0x23, 0x07,
93 0x41,
94};
95static const size_t secp384r1_invalid_point_len = sizeof(secp384r1_invalid_point);
96
97static int
98ssl_key_share_ecdhe_test(void)
99{
100 EC_KEY *ecdh = NULL, *ecdh_peer = NULL;
101 uint8_t *shared_key = NULL;
102 size_t shared_key_len = 0;
103 CBS cbs;
104 int nid = NID_secp384r1;
105 int decode_error = 0;
106 int failed = 0;
107
108 if ((ecdh = EC_KEY_new()) == NULL)
109 err(1, NULL);
110
111 if (!ssl_kex_generate_ecdhe_ecp(ecdh, nid)) {
112 fprintf(stderr, "FAIL: failed to generate P-384 key\n");
113 failed |= 1;
114 }
115
116 decode_error = 0;
117 CBS_init(&cbs, secp384r1_uncompressed_point, secp384r1_uncompressed_point_len);
118 if ((ecdh_peer = EC_KEY_new()) == NULL)
119 err(1, NULL);
120 if (!ssl_kex_peer_public_ecdhe_ecp(ecdh_peer, nid, &cbs, &decode_error)) {
121 fprintf(stderr, "FAIL: failed to parse uncompressed P-384 point\n");
122 failed |= 1;
123 }
124
125 if (!ssl_kex_derive_ecdhe_ecp(ecdh, ecdh_peer, &shared_key, &shared_key_len)) {
126 fprintf(stderr, "FAIL: failed to derive shared P-384 key\n");
127 failed |= 1;
128 }
129
130 EC_KEY_free(ecdh_peer);
131 ecdh_peer = NULL;
132
133 decode_error = 0;
134 CBS_init(&cbs, point_at_infinity, point_at_infinity_len);
135 if ((ecdh_peer = EC_KEY_new()) == NULL)
136 err(1, NULL);
137 if (ssl_kex_peer_public_ecdhe_ecp(ecdh_peer, nid, &cbs, &decode_error)) {
138 fprintf(stderr, "FAIL: parsed point at infinity\n");
139 failed |= 1;
140 }
141 if (!decode_error) {
142 fprintf(stderr, "FAIL: no decode_error for point at infinity\n");
143 failed |= 1;
144 }
145
146 EC_KEY_free(ecdh_peer);
147 ecdh_peer = NULL;
148
149 decode_error = 0;
150 CBS_init(&cbs, secp384r1_compressed_point, secp384r1_compressed_point_len);
151 if ((ecdh_peer = EC_KEY_new()) == NULL)
152 err(1, NULL);
153 if (ssl_kex_peer_public_ecdhe_ecp(ecdh_peer, nid, &cbs, &decode_error)) {
154 fprintf(stderr, "FAIL: parsed compressed P-384 point\n");
155 failed |= 1;
156 }
157 if (!decode_error) {
158 fprintf(stderr, "FAIL: no decode_error for compressed P-384 point\n");
159 failed |= 1;
160 }
161
162 EC_KEY_free(ecdh_peer);
163 ecdh_peer = NULL;
164
165 decode_error = 0;
166 CBS_init(&cbs, secp384r1_hybrid_point, secp384r1_hybrid_point_len);
167 if ((ecdh_peer = EC_KEY_new()) == NULL)
168 err(1, NULL);
169 if (ssl_kex_peer_public_ecdhe_ecp(ecdh_peer, nid, &cbs, &decode_error)) {
170 fprintf(stderr, "FAIL: parsed hybrid P-384 point\n");
171 failed |= 1;
172 }
173 if (!decode_error) {
174 fprintf(stderr, "FAIL: no decode_error for hybrid P-384 point\n");
175 failed |= 1;
176 }
177
178 EC_KEY_free(ecdh_peer);
179 ecdh_peer = NULL;
180
181 decode_error = 0;
182 CBS_init(&cbs, secp384r1_invalid_point, secp384r1_invalid_point_len);
183 if ((ecdh_peer = EC_KEY_new()) == NULL)
184 err(1, NULL);
185 if (ssl_kex_peer_public_ecdhe_ecp(ecdh_peer, nid, &cbs, &decode_error)) {
186 fprintf(stderr, "FAIL: parsed invalid P-384 point\n");
187 failed |= 1;
188 }
189 if (!decode_error) {
190 fprintf(stderr, "FAIL: no decode_error for invalid P-384 point\n");
191 failed |= 1;
192 }
193
194 EC_KEY_free(ecdh_peer);
195 ecdh_peer = NULL;
196
197 EC_KEY_free(ecdh);
198 freezero(shared_key, shared_key_len);
199
200 return failed;
201}
202
203int
204main(void)
205{
206 int failed = 0;
207
208 /* XXX - add DHE and X25519. */
209 failed |= ssl_key_share_ecdhe_test();
210
211 return failed;
212}
diff --git a/src/regress/lib/libtls/verify/verifytest.c b/src/regress/lib/libtls/verify/verifytest.c
index 57aa992149..72b8e4fd83 100644
--- a/src/regress/lib/libtls/verify/verifytest.c
+++ b/src/regress/lib/libtls/verify/verifytest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: verifytest.c,v 1.8 2023/05/28 09:02:01 beck Exp $ */ 1/* $OpenBSD: verifytest.c,v 1.10 2026/05/30 17:04:48 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -125,6 +125,14 @@ struct verify_test verify_tests[] = {
125 .want_match = 0, 125 .want_match = 0,
126 }, 126 },
127 { 127 {
128 /* CN wildcard without SANs - invalid CN wildcard. */
129 .common_name = "*.org.",
130 .common_name_len = -1,
131 .name = "openbsd.org.",
132 .want_return = 0,
133 .want_match = 0,
134 },
135 {
128 /* CN IPv4 without SANs - matching. */ 136 /* CN IPv4 without SANs - matching. */
129 .common_name = "1.2.3.4", 137 .common_name = "1.2.3.4",
130 .common_name_len = -1, 138 .common_name_len = -1,
@@ -497,8 +505,9 @@ do_verify_test(int test_no, struct verify_test *vt)
497 goto done; 505 goto done;
498 } 506 }
499 if (match != vt->want_match) { 507 if (match != vt->want_match) {
500 fprintf(stderr, "FAIL: test %i failed to match name '%s'\n", 508 fprintf(stderr, "FAIL: test %i %s name '%s'\n",
501 test_no, vt->name); 509 test_no, vt->want_match ? "failed to match" : "matched",
510 vt->name);
502 goto done; 511 goto done;
503 } 512 }
504 513
diff --git a/src/usr.bin/openssl/apps.c b/src/usr.bin/openssl/apps.c
index 46197dfd49..49ce7495bc 100644
--- a/src/usr.bin/openssl/apps.c
+++ b/src/usr.bin/openssl/apps.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: apps.c,v 1.72 2025/03/18 13:03:08 tb Exp $ */ 1/* $OpenBSD: apps.c,v 1.73 2026/08/30 23:03:33 jsg Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -490,7 +490,7 @@ load_pkcs12(BIO *err, BIO *in, const char *desc, pem_password_cb *pem_cb,
490 pem_cb = password_callback; 490 pem_cb = password_callback;
491 len = pem_cb(tpass, PEM_BUFSIZE, 0, cb_data); 491 len = pem_cb(tpass, PEM_BUFSIZE, 0, cb_data);
492 if (len < 0) { 492 if (len < 0) {
493 BIO_printf(err, "Passpharse callback error for %s\n", 493 BIO_printf(err, "Passphrase callback error for %s\n",
494 desc); 494 desc);
495 goto die; 495 goto die;
496 } 496 }
diff --git a/src/usr.bin/openssl/ca.c b/src/usr.bin/openssl/ca.c
index a2e8a68368..763b57ced8 100644
--- a/src/usr.bin/openssl/ca.c
+++ b/src/usr.bin/openssl/ca.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ca.c,v 1.64 2025/12/21 07:14:47 tb Exp $ */ 1/* $OpenBSD: ca.c,v 1.65 2026/08/30 23:03:33 jsg 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 *
@@ -114,7 +114,7 @@
114 114
115/* Additional revocation information types */ 115/* Additional revocation information types */
116 116
117#define REV_NONE 0 /* No addditional information */ 117#define REV_NONE 0 /* No additional information */
118#define REV_CRL_REASON 1 /* Value is CRL reason code */ 118#define REV_CRL_REASON 1 /* Value is CRL reason code */
119#define REV_HOLD 2 /* Value is hold instruction */ 119#define REV_HOLD 2 /* Value is hold instruction */
120#define REV_KEY_COMPROMISE 3 /* Value is cert key compromise time */ 120#define REV_KEY_COMPROMISE 3 /* Value is cert key compromise time */
@@ -397,7 +397,7 @@ static const struct option ca_options[] = {
397 { 397 {
398 .name = "extfile", 398 .name = "extfile",
399 .argname = "file", 399 .argname = "file",
400 .desc = "Configuration file with X509v3 extentions to add", 400 .desc = "Configuration file with X509v3 extensions to add",
401 .type = OPTION_ARG, 401 .type = OPTION_ARG,
402 .opt.arg = &cfg.extfile, 402 .opt.arg = &cfg.extfile,
403 }, 403 },
@@ -959,7 +959,7 @@ ca_main(int argc, char **argv)
959 } 959 }
960 } 960 }
961 /*****************************************************************/ 961 /*****************************************************************/
962 /* Read extentions config file */ 962 /* Read extensions config file */
963 if (cfg.extfile != NULL) { 963 if (cfg.extfile != NULL) {
964 extconf = NCONF_new(NULL); 964 extconf = NCONF_new(NULL);
965 if (NCONF_load(extconf, cfg.extfile, &errorline) <= 0) { 965 if (NCONF_load(extconf, cfg.extfile, &errorline) <= 0) {
diff --git a/src/usr.bin/openssl/crl.c b/src/usr.bin/openssl/crl.c
index e64038dfda..54314bee73 100644
--- a/src/usr.bin/openssl/crl.c
+++ b/src/usr.bin/openssl/crl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: crl.c,v 1.17 2023/03/06 14:32:05 tb Exp $ */ 1/* $OpenBSD: crl.c,v 1.18 2026/05/09 14:28:18 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 *
@@ -327,10 +327,11 @@ crl_main(int argc, char **argv)
327 EVP_PKEY_free(pkey); 327 EVP_PKEY_free(pkey);
328 if (i < 0) 328 if (i < 0)
329 goto end; 329 goto end;
330 if (i == 0) 330 if (i == 0) {
331 BIO_printf(bio_err, "verify failure\n"); 331 BIO_printf(bio_err, "verify failure\n");
332 else 332 goto end;
333 BIO_printf(bio_err, "verify OK\n"); 333 }
334 BIO_printf(bio_err, "verify OK\n");
334 } 335 }
335 336
336 /* Print requested information the order that the flags were given. */ 337 /* Print requested information the order that the flags were given. */
diff --git a/src/usr.bin/openssl/ecparam.c b/src/usr.bin/openssl/ecparam.c
index 285f5d563e..a4bb00f290 100644
--- a/src/usr.bin/openssl/ecparam.c
+++ b/src/usr.bin/openssl/ecparam.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ecparam.c,v 1.25 2025/01/19 10:24:17 tb Exp $ */ 1/* $OpenBSD: ecparam.c,v 1.26 2026/05/09 14:24:58 tb Exp $ */
2/* 2/*
3 * Written by Nils Larsch for the OpenSSL project. 3 * Written by Nils Larsch for the OpenSSL project.
4 */ 4 */
@@ -386,8 +386,9 @@ ecparam_main(int argc, char **argv)
386 if (!EC_GROUP_check(group, NULL)) { 386 if (!EC_GROUP_check(group, NULL)) {
387 BIO_printf(bio_err, "failed\n"); 387 BIO_printf(bio_err, "failed\n");
388 ERR_print_errors(bio_err); 388 ERR_print_errors(bio_err);
389 } else 389 goto end;
390 BIO_printf(bio_err, "ok\n"); 390 }
391 BIO_printf(bio_err, "ok\n");
391 392
392 } 393 }
393 if (!cfg.noout) { 394 if (!cfg.noout) {
diff --git a/src/usr.bin/openssl/openssl.1 b/src/usr.bin/openssl/openssl.1
index 20a1d69053..21edd84683 100644
--- a/src/usr.bin/openssl/openssl.1
+++ b/src/usr.bin/openssl/openssl.1
@@ -1,4 +1,4 @@
1.\" $OpenBSD: openssl.1,v 1.170 2026/03/14 06:06:48 tb Exp $ 1.\" $OpenBSD: openssl.1,v 1.171 2026/08/25 00:08:28 jsg Exp $
2.\" ==================================================================== 2.\" ====================================================================
3.\" Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. 3.\" Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
4.\" 4.\"
@@ -110,7 +110,7 @@
110.\" copied and put under another distribution licence 110.\" copied and put under another distribution licence
111.\" [including the GNU Public Licence.] 111.\" [including the GNU Public Licence.]
112.\" 112.\"
113.Dd $Mdocdate: March 14 2026 $ 113.Dd $Mdocdate: August 25 2026 $
114.Dt OPENSSL 1 114.Dt OPENSSL 1
115.Os 115.Os
116.Sh NAME 116.Sh NAME
@@ -1146,7 +1146,7 @@ form where the content is not included.
1146This option will override any content if the input format is S/MIME and 1146This option will override any content if the input format is S/MIME and
1147it uses the multipart/signed MIME content type. 1147it uses the multipart/signed MIME content type.
1148.It Fl crlfeol 1148.It Fl crlfeol
1149Output a S/MIME message with CR/LF end of line. 1149Output an S/MIME message with CR/LF end of line.
1150.It Fl debug_decrypt 1150.It Fl debug_decrypt
1151Set the CMS_DEBUG_DECRYPT flag when decrypting. 1151Set the CMS_DEBUG_DECRYPT flag when decrypting.
1152This option should be used with caution, since this can be used to disable 1152This option should be used with caution, since this can be used to disable
diff --git a/src/usr.bin/openssl/openssl.c b/src/usr.bin/openssl/openssl.c
index 056912a9ed..b9d63fa43a 100644
--- a/src/usr.bin/openssl/openssl.c
+++ b/src/usr.bin/openssl/openssl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: openssl.c,v 1.41 2026/01/02 00:14:24 kenjiro Exp $ */ 1/* $OpenBSD: openssl.c,v 1.42 2026/08/30 12:19:37 kenjiro 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 *
@@ -360,10 +360,6 @@ openssl_shutdown(void)
360 CONF_modules_unload(1); 360 CONF_modules_unload(1);
361 destroy_ui(); 361 destroy_ui();
362 OBJ_cleanup(); 362 OBJ_cleanup();
363 EVP_cleanup();
364 CRYPTO_cleanup_all_ex_data();
365 ERR_remove_thread_state(NULL);
366 ERR_free_strings();
367} 363}
368 364
369int 365int
@@ -461,6 +457,9 @@ main(int argc, char **argv)
461 BIO_free(bio_err); 457 BIO_free(bio_err);
462 bio_err = NULL; 458 bio_err = NULL;
463 } 459 }
460 ERR_remove_thread_state(NULL);
461 OPENSSL_cleanup();
462
464 return (ret); 463 return (ret);
465} 464}
466 465
diff --git a/src/usr.bin/openssl/s_cb.c b/src/usr.bin/openssl/s_cb.c
index fcb2cd3076..b7832ff7db 100644
--- a/src/usr.bin/openssl/s_cb.c
+++ b/src/usr.bin/openssl/s_cb.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s_cb.c,v 1.22 2025/01/02 13:10:03 tb Exp $ */ 1/* $OpenBSD: s_cb.c,v 1.23 2026/08/10 20:27:51 kenjiro 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 *
@@ -847,8 +847,12 @@ generate_cookie_callback(SSL * ssl, unsigned char *cookie,
847 } 847 }
848 848
849 /* Calculate HMAC of buffer using the secret */ 849 /* Calculate HMAC of buffer using the secret */
850 HMAC(EVP_sha1(), cookie_secret, COOKIE_SECRET_LENGTH, 850 if (HMAC(EVP_sha1(), cookie_secret, COOKIE_SECRET_LENGTH,
851 buffer, length, result, &resultlength); 851 buffer, length, result, &resultlength) == NULL) {
852 free(buffer);
853 return 0;
854 }
855
852 free(buffer); 856 free(buffer);
853 857
854 memcpy(cookie, result, resultlength); 858 memcpy(cookie, result, resultlength);
diff --git a/src/usr.bin/openssl/s_client.c b/src/usr.bin/openssl/s_client.c
index 2b05facc17..b053159f41 100644
--- a/src/usr.bin/openssl/s_client.c
+++ b/src/usr.bin/openssl/s_client.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s_client.c,v 1.68 2026/02/01 08:45:31 martijn Exp $ */ 1/* $OpenBSD: s_client.c,v 1.70 2026/08/30 23:03:33 jsg 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 *
@@ -1314,7 +1314,9 @@ s_client_main(int argc, char **argv)
1314 } 1314 }
1315 BIO_printf(sbio, 1315 BIO_printf(sbio,
1316 "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>"); 1316 "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>");
1317 seen = BIO_read(sbio, sbuf, BUFSIZZ); 1317 seen = BIO_read(sbio, sbuf, BUFSIZZ - 1);
1318 if (seen <= 0)
1319 goto shut;
1318 sbuf[seen] = 0; 1320 sbuf[seen] = 0;
1319 if (!strstr(sbuf, "<proceed")) 1321 if (!strstr(sbuf, "<proceed"))
1320 goto shut; 1322 goto shut;
@@ -1413,7 +1415,7 @@ s_client_main(int argc, char **argv)
1413 } 1415 }
1414 if (SSL_is_dtls(con) && 1416 if (SSL_is_dtls(con) &&
1415 DTLSv1_handle_timeout(con) > 0) 1417 DTLSv1_handle_timeout(con) > 0)
1416 BIO_printf(bio_err, "TIMEOUT occured\n"); 1418 BIO_printf(bio_err, "TIMEOUT occurred\n");
1417 if (!ssl_pending && 1419 if (!ssl_pending &&
1418 (pfd[2].revents & (POLLOUT|POLLERR|POLLNVAL))) { 1420 (pfd[2].revents & (POLLOUT|POLLERR|POLLNVAL))) {
1419 if (pfd[2].revents & (POLLERR|POLLNVAL)) { 1421 if (pfd[2].revents & (POLLERR|POLLNVAL)) {
diff --git a/src/usr.bin/openssl/s_server.c b/src/usr.bin/openssl/s_server.c
index f56042a4b4..3c9059c2c5 100644
--- a/src/usr.bin/openssl/s_server.c
+++ b/src/usr.bin/openssl/s_server.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s_server.c,v 1.61 2025/01/02 13:10:03 tb Exp $ */ 1/* $OpenBSD: s_server.c,v 1.62 2026/08/30 23:03:33 jsg 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 *
@@ -1583,7 +1583,7 @@ sv_body(int s, unsigned char *context)
1583 1583
1584 if (SSL_is_dtls(con) && 1584 if (SSL_is_dtls(con) &&
1585 DTLSv1_handle_timeout(con) > 0) 1585 DTLSv1_handle_timeout(con) > 0)
1586 BIO_printf(bio_err, "TIMEOUT occured\n"); 1586 BIO_printf(bio_err, "TIMEOUT occurred\n");
1587 if (i <= 0) 1587 if (i <= 0)
1588 continue; 1588 continue;
1589 if (pfd[0].revents) { 1589 if (pfd[0].revents) {
diff --git a/src/usr.bin/openssl/s_socket.c b/src/usr.bin/openssl/s_socket.c
index 86a23c56d1..a479eac06a 100644
--- a/src/usr.bin/openssl/s_socket.c
+++ b/src/usr.bin/openssl/s_socket.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s_socket.c,v 1.14 2025/01/02 13:10:03 tb Exp $ */ 1/* $OpenBSD: s_socket.c,v 1.15 2026/05/10 03:26:07 kenjiro 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 *
@@ -260,15 +260,8 @@ do_accept(int acc_sock, int *sock)
260 h2 = gethostbyname(host); 260 h2 = gethostbyname(host);
261 if (h2 == NULL) { 261 if (h2 == NULL) {
262 BIO_printf(bio_err, "gethostbyname failure\n"); 262 BIO_printf(bio_err, "gethostbyname failure\n");
263 close(ret); 263 } else if (h2->h_addrtype != AF_INET) {
264 free(host);
265 return (0);
266 }
267 if (h2->h_addrtype != AF_INET) {
268 BIO_printf(bio_err, "gethostbyname addr is not AF_INET\n"); 264 BIO_printf(bio_err, "gethostbyname addr is not AF_INET\n");
269 close(ret);
270 free(host);
271 return (0);
272 } 265 }
273 } 266 }
274 267
diff --git a/src/usr.bin/openssl/speed.c b/src/usr.bin/openssl/speed.c
index 760841d95f..142eb9bab0 100644
--- a/src/usr.bin/openssl/speed.c
+++ b/src/usr.bin/openssl/speed.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: speed.c,v 1.52 2026/03/19 20:28:46 tb Exp $ */ 1/* $OpenBSD: speed.c,v 1.53 2026/05/05 03:32:46 kenjiro 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 *
@@ -156,6 +156,8 @@ static void
156pkey_print_message(const char *str, const char *str2, 156pkey_print_message(const char *str, const char *str2,
157 int bits, int sec); 157 int bits, int sec);
158static void print_result(int alg, int run_no, int count, double time_used); 158static void print_result(int alg, int run_no, int count, double time_used);
159static void speed_timer_start(int s);
160static double speed_timer_stop(int s);
159static int do_multi(int multi); 161static int do_multi(int multi);
160 162
161#define SIZE_NUM 5 163#define SIZE_NUM 5
@@ -983,9 +985,6 @@ sig_done(int sig)
983 run = 0; 985 run = 0;
984} 986}
985 987
986#define START TM_RESET
987#define STOP TM_GET
988
989static double 988static double
990time_f(int s) 989time_f(int s)
991{ 990{
@@ -995,6 +994,20 @@ time_f(int s)
995 return app_timer_real(s); 994 return app_timer_real(s);
996} 995}
997 996
997static void
998speed_timer_start(int s)
999{
1000 run = 1;
1001 alarm(s);
1002 time_f(TM_RESET);
1003}
1004
1005static double
1006speed_timer_stop(int s)
1007{
1008 return time_f(s);
1009}
1010
998static const int KDF1_SHA1_len = 20; 1011static const int KDF1_SHA1_len = 20;
999static void * 1012static void *
1000KDF1_SHA1(const void *in, size_t inlen, void *out, size_t * outlen) 1013KDF1_SHA1(const void *in, size_t inlen, void *out, size_t * outlen)
@@ -1617,10 +1630,10 @@ speed_main(int argc, char **argv)
1617 if (doit[D_MD4]) { 1630 if (doit[D_MD4]) {
1618 for (j = 0; j < SIZE_NUM; j++) { 1631 for (j = 0; j < SIZE_NUM; j++) {
1619 print_message(names[D_MD4], lengths[j]); 1632 print_message(names[D_MD4], lengths[j]);
1620 time_f(START); 1633 speed_timer_start(SECONDS);
1621 for (count = 0, run = 1; COND; count++) 1634 for (count = 0; COND; count++)
1622 EVP_Digest(&(buf[0]), (unsigned long) lengths[j], md, NULL, EVP_md4(), NULL); 1635 EVP_Digest(&(buf[0]), (unsigned long) lengths[j], md, NULL, EVP_md4(), NULL);
1623 d = time_f(STOP); 1636 d = speed_timer_stop(SECONDS);
1624 print_result(D_MD4, j, count, d); 1637 print_result(D_MD4, j, count, d);
1625 } 1638 }
1626 } 1639 }
@@ -1630,10 +1643,10 @@ speed_main(int argc, char **argv)
1630 if (doit[D_MD5]) { 1643 if (doit[D_MD5]) {
1631 for (j = 0; j < SIZE_NUM; j++) { 1644 for (j = 0; j < SIZE_NUM; j++) {
1632 print_message(names[D_MD5], lengths[j]); 1645 print_message(names[D_MD5], lengths[j]);
1633 time_f(START); 1646 speed_timer_start(SECONDS);
1634 for (count = 0, run = 1; COND; count++) 1647 for (count = 0; COND; count++)
1635 EVP_Digest(&(buf[0]), (unsigned long) lengths[j], md, NULL, EVP_get_digestbyname("md5"), NULL); 1648 EVP_Digest(&(buf[0]), (unsigned long) lengths[j], md, NULL, EVP_get_digestbyname("md5"), NULL);
1636 d = time_f(STOP); 1649 d = speed_timer_stop(SECONDS);
1637 print_result(D_MD5, j, count, d); 1650 print_result(D_MD5, j, count, d);
1638 } 1651 }
1639 } 1652 }
@@ -1653,8 +1666,8 @@ speed_main(int argc, char **argv)
1653 1666
1654 for (j = 0; j < SIZE_NUM; j++) { 1667 for (j = 0; j < SIZE_NUM; j++) {
1655 print_message(names[D_HMAC], lengths[j]); 1668 print_message(names[D_HMAC], lengths[j]);
1656 time_f(START); 1669 speed_timer_start(SECONDS);
1657 for (count = 0, run = 1; COND; count++) { 1670 for (count = 0; COND; count++) {
1658 if (!HMAC_Init_ex(hctx, NULL, 0, NULL, NULL)) { 1671 if (!HMAC_Init_ex(hctx, NULL, 0, NULL, NULL)) {
1659 HMAC_CTX_free(hctx); 1672 HMAC_CTX_free(hctx);
1660 goto end; 1673 goto end;
@@ -1668,7 +1681,7 @@ speed_main(int argc, char **argv)
1668 goto end; 1681 goto end;
1669 } 1682 }
1670 } 1683 }
1671 d = time_f(STOP); 1684 d = speed_timer_stop(SECONDS);
1672 print_result(D_HMAC, j, count, d); 1685 print_result(D_HMAC, j, count, d);
1673 } 1686 }
1674 HMAC_CTX_free(hctx); 1687 HMAC_CTX_free(hctx);
@@ -1678,10 +1691,10 @@ speed_main(int argc, char **argv)
1678 if (doit[D_SHA1]) { 1691 if (doit[D_SHA1]) {
1679 for (j = 0; j < SIZE_NUM; j++) { 1692 for (j = 0; j < SIZE_NUM; j++) {
1680 print_message(names[D_SHA1], lengths[j]); 1693 print_message(names[D_SHA1], lengths[j]);
1681 time_f(START); 1694 speed_timer_start(SECONDS);
1682 for (count = 0, run = 1; COND; count++) 1695 for (count = 0; COND; count++)
1683 EVP_Digest(buf, (unsigned long) lengths[j], md, NULL, EVP_sha1(), NULL); 1696 EVP_Digest(buf, (unsigned long) lengths[j], md, NULL, EVP_sha1(), NULL);
1684 d = time_f(STOP); 1697 d = speed_timer_stop(SECONDS);
1685 print_result(D_SHA1, j, count, d); 1698 print_result(D_SHA1, j, count, d);
1686 } 1699 }
1687 } 1700 }
@@ -1689,10 +1702,10 @@ speed_main(int argc, char **argv)
1689 if (doit[D_SHA256]) { 1702 if (doit[D_SHA256]) {
1690 for (j = 0; j < SIZE_NUM; j++) { 1703 for (j = 0; j < SIZE_NUM; j++) {
1691 print_message(names[D_SHA256], lengths[j]); 1704 print_message(names[D_SHA256], lengths[j]);
1692 time_f(START); 1705 speed_timer_start(SECONDS);
1693 for (count = 0, run = 1; COND; count++) 1706 for (count = 0; COND; count++)
1694 SHA256(buf, lengths[j], md); 1707 SHA256(buf, lengths[j], md);
1695 d = time_f(STOP); 1708 d = speed_timer_stop(SECONDS);
1696 print_result(D_SHA256, j, count, d); 1709 print_result(D_SHA256, j, count, d);
1697 } 1710 }
1698 } 1711 }
@@ -1702,10 +1715,10 @@ speed_main(int argc, char **argv)
1702 if (doit[D_SHA512]) { 1715 if (doit[D_SHA512]) {
1703 for (j = 0; j < SIZE_NUM; j++) { 1716 for (j = 0; j < SIZE_NUM; j++) {
1704 print_message(names[D_SHA512], lengths[j]); 1717 print_message(names[D_SHA512], lengths[j]);
1705 time_f(START); 1718 speed_timer_start(SECONDS);
1706 for (count = 0, run = 1; COND; count++) 1719 for (count = 0; COND; count++)
1707 SHA512(buf, lengths[j], md); 1720 SHA512(buf, lengths[j], md);
1708 d = time_f(STOP); 1721 d = speed_timer_stop(SECONDS);
1709 print_result(D_SHA512, j, count, d); 1722 print_result(D_SHA512, j, count, d);
1710 } 1723 }
1711 } 1724 }
@@ -1716,10 +1729,10 @@ speed_main(int argc, char **argv)
1716 if (doit[D_RMD160]) { 1729 if (doit[D_RMD160]) {
1717 for (j = 0; j < SIZE_NUM; j++) { 1730 for (j = 0; j < SIZE_NUM; j++) {
1718 print_message(names[D_RMD160], lengths[j]); 1731 print_message(names[D_RMD160], lengths[j]);
1719 time_f(START); 1732 speed_timer_start(SECONDS);
1720 for (count = 0, run = 1; COND; count++) 1733 for (count = 0; COND; count++)
1721 EVP_Digest(buf, (unsigned long) lengths[j], md, NULL, EVP_ripemd160(), NULL); 1734 EVP_Digest(buf, (unsigned long) lengths[j], md, NULL, EVP_ripemd160(), NULL);
1722 d = time_f(STOP); 1735 d = speed_timer_stop(SECONDS);
1723 print_result(D_RMD160, j, count, d); 1736 print_result(D_RMD160, j, count, d);
1724 } 1737 }
1725 } 1738 }
@@ -1728,11 +1741,11 @@ speed_main(int argc, char **argv)
1728 if (doit[D_RC4]) { 1741 if (doit[D_RC4]) {
1729 for (j = 0; j < SIZE_NUM; j++) { 1742 for (j = 0; j < SIZE_NUM; j++) {
1730 print_message(names[D_RC4], lengths[j]); 1743 print_message(names[D_RC4], lengths[j]);
1731 time_f(START); 1744 speed_timer_start(SECONDS);
1732 for (count = 0, run = 1; COND; count++) 1745 for (count = 0; COND; count++)
1733 RC4(&rc4_ks, (unsigned int) lengths[j], 1746 RC4(&rc4_ks, (unsigned int) lengths[j],
1734 buf, buf); 1747 buf, buf);
1735 d = time_f(STOP); 1748 d = speed_timer_stop(SECONDS);
1736 print_result(D_RC4, j, count, d); 1749 print_result(D_RC4, j, count, d);
1737 } 1750 }
1738 } 1751 }
@@ -1741,23 +1754,23 @@ speed_main(int argc, char **argv)
1741 if (doit[D_CBC_DES]) { 1754 if (doit[D_CBC_DES]) {
1742 for (j = 0; j < SIZE_NUM; j++) { 1755 for (j = 0; j < SIZE_NUM; j++) {
1743 print_message(names[D_CBC_DES], lengths[j]); 1756 print_message(names[D_CBC_DES], lengths[j]);
1744 time_f(START); 1757 speed_timer_start(SECONDS);
1745 for (count = 0, run = 1; COND; count++) 1758 for (count = 0; COND; count++)
1746 DES_ncbc_encrypt(buf, buf, lengths[j], &sch, 1759 DES_ncbc_encrypt(buf, buf, lengths[j], &sch,
1747 &DES_iv, DES_ENCRYPT); 1760 &DES_iv, DES_ENCRYPT);
1748 d = time_f(STOP); 1761 d = speed_timer_stop(SECONDS);
1749 print_result(D_CBC_DES, j, count, d); 1762 print_result(D_CBC_DES, j, count, d);
1750 } 1763 }
1751 } 1764 }
1752 if (doit[D_EDE3_DES]) { 1765 if (doit[D_EDE3_DES]) {
1753 for (j = 0; j < SIZE_NUM; j++) { 1766 for (j = 0; j < SIZE_NUM; j++) {
1754 print_message(names[D_EDE3_DES], lengths[j]); 1767 print_message(names[D_EDE3_DES], lengths[j]);
1755 time_f(START); 1768 speed_timer_start(SECONDS);
1756 for (count = 0, run = 1; COND; count++) 1769 for (count = 0; COND; count++)
1757 DES_ede3_cbc_encrypt(buf, buf, lengths[j], 1770 DES_ede3_cbc_encrypt(buf, buf, lengths[j],
1758 &sch, &sch2, &sch3, 1771 &sch, &sch2, &sch3,
1759 &DES_iv, DES_ENCRYPT); 1772 &DES_iv, DES_ENCRYPT);
1760 d = time_f(STOP); 1773 d = speed_timer_stop(SECONDS);
1761 print_result(D_EDE3_DES, j, count, d); 1774 print_result(D_EDE3_DES, j, count, d);
1762 } 1775 }
1763 } 1776 }
@@ -1766,72 +1779,72 @@ speed_main(int argc, char **argv)
1766 if (doit[D_CBC_128_AES]) { 1779 if (doit[D_CBC_128_AES]) {
1767 for (j = 0; j < SIZE_NUM; j++) { 1780 for (j = 0; j < SIZE_NUM; j++) {
1768 print_message(names[D_CBC_128_AES], lengths[j]); 1781 print_message(names[D_CBC_128_AES], lengths[j]);
1769 time_f(START); 1782 speed_timer_start(SECONDS);
1770 for (count = 0, run = 1; COND; count++) 1783 for (count = 0; COND; count++)
1771 AES_cbc_encrypt(buf, buf, 1784 AES_cbc_encrypt(buf, buf,
1772 (unsigned long) lengths[j], &aes_ks1, 1785 (unsigned long) lengths[j], &aes_ks1,
1773 iv, AES_ENCRYPT); 1786 iv, AES_ENCRYPT);
1774 d = time_f(STOP); 1787 d = speed_timer_stop(SECONDS);
1775 print_result(D_CBC_128_AES, j, count, d); 1788 print_result(D_CBC_128_AES, j, count, d);
1776 } 1789 }
1777 } 1790 }
1778 if (doit[D_CBC_192_AES]) { 1791 if (doit[D_CBC_192_AES]) {
1779 for (j = 0; j < SIZE_NUM; j++) { 1792 for (j = 0; j < SIZE_NUM; j++) {
1780 print_message(names[D_CBC_192_AES], lengths[j]); 1793 print_message(names[D_CBC_192_AES], lengths[j]);
1781 time_f(START); 1794 speed_timer_start(SECONDS);
1782 for (count = 0, run = 1; COND; count++) 1795 for (count = 0; COND; count++)
1783 AES_cbc_encrypt(buf, buf, 1796 AES_cbc_encrypt(buf, buf,
1784 (unsigned long) lengths[j], &aes_ks2, 1797 (unsigned long) lengths[j], &aes_ks2,
1785 iv, AES_ENCRYPT); 1798 iv, AES_ENCRYPT);
1786 d = time_f(STOP); 1799 d = speed_timer_stop(SECONDS);
1787 print_result(D_CBC_192_AES, j, count, d); 1800 print_result(D_CBC_192_AES, j, count, d);
1788 } 1801 }
1789 } 1802 }
1790 if (doit[D_CBC_256_AES]) { 1803 if (doit[D_CBC_256_AES]) {
1791 for (j = 0; j < SIZE_NUM; j++) { 1804 for (j = 0; j < SIZE_NUM; j++) {
1792 print_message(names[D_CBC_256_AES], lengths[j]); 1805 print_message(names[D_CBC_256_AES], lengths[j]);
1793 time_f(START); 1806 speed_timer_start(SECONDS);
1794 for (count = 0, run = 1; COND; count++) 1807 for (count = 0; COND; count++)
1795 AES_cbc_encrypt(buf, buf, 1808 AES_cbc_encrypt(buf, buf,
1796 (unsigned long) lengths[j], &aes_ks3, 1809 (unsigned long) lengths[j], &aes_ks3,
1797 iv, AES_ENCRYPT); 1810 iv, AES_ENCRYPT);
1798 d = time_f(STOP); 1811 d = speed_timer_stop(SECONDS);
1799 print_result(D_CBC_256_AES, j, count, d); 1812 print_result(D_CBC_256_AES, j, count, d);
1800 } 1813 }
1801 } 1814 }
1802 if (doit[D_IGE_128_AES]) { 1815 if (doit[D_IGE_128_AES]) {
1803 for (j = 0; j < SIZE_NUM; j++) { 1816 for (j = 0; j < SIZE_NUM; j++) {
1804 print_message(names[D_IGE_128_AES], lengths[j]); 1817 print_message(names[D_IGE_128_AES], lengths[j]);
1805 time_f(START); 1818 speed_timer_start(SECONDS);
1806 for (count = 0, run = 1; COND; count++) 1819 for (count = 0; COND; count++)
1807 AES_ige_encrypt(buf, buf2, 1820 AES_ige_encrypt(buf, buf2,
1808 (unsigned long) lengths[j], &aes_ks1, 1821 (unsigned long) lengths[j], &aes_ks1,
1809 iv, AES_ENCRYPT); 1822 iv, AES_ENCRYPT);
1810 d = time_f(STOP); 1823 d = speed_timer_stop(SECONDS);
1811 print_result(D_IGE_128_AES, j, count, d); 1824 print_result(D_IGE_128_AES, j, count, d);
1812 } 1825 }
1813 } 1826 }
1814 if (doit[D_IGE_192_AES]) { 1827 if (doit[D_IGE_192_AES]) {
1815 for (j = 0; j < SIZE_NUM; j++) { 1828 for (j = 0; j < SIZE_NUM; j++) {
1816 print_message(names[D_IGE_192_AES], lengths[j]); 1829 print_message(names[D_IGE_192_AES], lengths[j]);
1817 time_f(START); 1830 speed_timer_start(SECONDS);
1818 for (count = 0, run = 1; COND; count++) 1831 for (count = 0; COND; count++)
1819 AES_ige_encrypt(buf, buf2, 1832 AES_ige_encrypt(buf, buf2,
1820 (unsigned long) lengths[j], &aes_ks2, 1833 (unsigned long) lengths[j], &aes_ks2,
1821 iv, AES_ENCRYPT); 1834 iv, AES_ENCRYPT);
1822 d = time_f(STOP); 1835 d = speed_timer_stop(SECONDS);
1823 print_result(D_IGE_192_AES, j, count, d); 1836 print_result(D_IGE_192_AES, j, count, d);
1824 } 1837 }
1825 } 1838 }
1826 if (doit[D_IGE_256_AES]) { 1839 if (doit[D_IGE_256_AES]) {
1827 for (j = 0; j < SIZE_NUM; j++) { 1840 for (j = 0; j < SIZE_NUM; j++) {
1828 print_message(names[D_IGE_256_AES], lengths[j]); 1841 print_message(names[D_IGE_256_AES], lengths[j]);
1829 time_f(START); 1842 speed_timer_start(SECONDS);
1830 for (count = 0, run = 1; COND; count++) 1843 for (count = 0; COND; count++)
1831 AES_ige_encrypt(buf, buf2, 1844 AES_ige_encrypt(buf, buf2,
1832 (unsigned long) lengths[j], &aes_ks3, 1845 (unsigned long) lengths[j], &aes_ks3,
1833 iv, AES_ENCRYPT); 1846 iv, AES_ENCRYPT);
1834 d = time_f(STOP); 1847 d = speed_timer_stop(SECONDS);
1835 print_result(D_IGE_256_AES, j, count, d); 1848 print_result(D_IGE_256_AES, j, count, d);
1836 } 1849 }
1837 } 1850 }
@@ -1841,10 +1854,10 @@ speed_main(int argc, char **argv)
1841 1854
1842 for (j = 0; j < SIZE_NUM; j++) { 1855 for (j = 0; j < SIZE_NUM; j++) {
1843 print_message(names[D_GHASH], lengths[j]); 1856 print_message(names[D_GHASH], lengths[j]);
1844 time_f(START); 1857 speed_timer_start(SECONDS);
1845 for (count = 0, run = 1; COND; count++) 1858 for (count = 0; COND; count++)
1846 CRYPTO_gcm128_aad(ctx, buf, lengths[j]); 1859 CRYPTO_gcm128_aad(ctx, buf, lengths[j]);
1847 d = time_f(STOP); 1860 d = speed_timer_stop(SECONDS);
1848 print_result(D_GHASH, j, count, d); 1861 print_result(D_GHASH, j, count, d);
1849 } 1862 }
1850 CRYPTO_gcm128_release(ctx); 1863 CRYPTO_gcm128_release(ctx);
@@ -1867,11 +1880,11 @@ speed_main(int argc, char **argv)
1867 1880
1868 for (j = 0; j < SIZE_NUM; j++) { 1881 for (j = 0; j < SIZE_NUM; j++) {
1869 print_message(names[D_AES_128_GCM], lengths[j]); 1882 print_message(names[D_AES_128_GCM], lengths[j]);
1870 time_f(START); 1883 speed_timer_start(SECONDS);
1871 for (count = 0, run = 1; COND; count++) 1884 for (count = 0; COND; count++)
1872 EVP_AEAD_CTX_seal(ctx, buf, &buf_len, BUFSIZE, nonce, 1885 EVP_AEAD_CTX_seal(ctx, buf, &buf_len, BUFSIZE, nonce,
1873 nonce_len, buf, lengths[j], NULL, 0); 1886 nonce_len, buf, lengths[j], NULL, 0);
1874 d = time_f(STOP); 1887 d = speed_timer_stop(SECONDS);
1875 print_result(D_AES_128_GCM,j,count,d); 1888 print_result(D_AES_128_GCM,j,count,d);
1876 } 1889 }
1877 EVP_AEAD_CTX_free(ctx); 1890 EVP_AEAD_CTX_free(ctx);
@@ -1895,11 +1908,11 @@ speed_main(int argc, char **argv)
1895 1908
1896 for (j = 0; j < SIZE_NUM; j++) { 1909 for (j = 0; j < SIZE_NUM; j++) {
1897 print_message(names[D_AES_256_GCM], lengths[j]); 1910 print_message(names[D_AES_256_GCM], lengths[j]);
1898 time_f(START); 1911 speed_timer_start(SECONDS);
1899 for (count = 0, run = 1; COND; count++) 1912 for (count = 0; COND; count++)
1900 EVP_AEAD_CTX_seal(ctx, buf, &buf_len, BUFSIZE, nonce, 1913 EVP_AEAD_CTX_seal(ctx, buf, &buf_len, BUFSIZE, nonce,
1901 nonce_len, buf, lengths[j], NULL, 0); 1914 nonce_len, buf, lengths[j], NULL, 0);
1902 d = time_f(STOP); 1915 d = speed_timer_stop(SECONDS);
1903 print_result(D_AES_256_GCM, j, count, d); 1916 print_result(D_AES_256_GCM, j, count, d);
1904 } 1917 }
1905 EVP_AEAD_CTX_free(ctx); 1918 EVP_AEAD_CTX_free(ctx);
@@ -1924,11 +1937,11 @@ speed_main(int argc, char **argv)
1924 1937
1925 for (j = 0; j < SIZE_NUM; j++) { 1938 for (j = 0; j < SIZE_NUM; j++) {
1926 print_message(names[D_CHACHA20_POLY1305], lengths[j]); 1939 print_message(names[D_CHACHA20_POLY1305], lengths[j]);
1927 time_f(START); 1940 speed_timer_start(SECONDS);
1928 for (count = 0, run = 1; COND; count++) 1941 for (count = 0; COND; count++)
1929 EVP_AEAD_CTX_seal(ctx, buf, &buf_len, BUFSIZE, nonce, 1942 EVP_AEAD_CTX_seal(ctx, buf, &buf_len, BUFSIZE, nonce,
1930 nonce_len, buf, lengths[j], NULL, 0); 1943 nonce_len, buf, lengths[j], NULL, 0);
1931 d = time_f(STOP); 1944 d = speed_timer_stop(SECONDS);
1932 print_result(D_CHACHA20_POLY1305, j, count, d); 1945 print_result(D_CHACHA20_POLY1305, j, count, d);
1933 } 1946 }
1934 EVP_AEAD_CTX_free(ctx); 1947 EVP_AEAD_CTX_free(ctx);
@@ -1938,36 +1951,36 @@ speed_main(int argc, char **argv)
1938 if (doit[D_CBC_128_CML]) { 1951 if (doit[D_CBC_128_CML]) {
1939 for (j = 0; j < SIZE_NUM; j++) { 1952 for (j = 0; j < SIZE_NUM; j++) {
1940 print_message(names[D_CBC_128_CML], lengths[j]); 1953 print_message(names[D_CBC_128_CML], lengths[j]);
1941 time_f(START); 1954 speed_timer_start(SECONDS);
1942 for (count = 0, run = 1; COND; count++) 1955 for (count = 0; COND; count++)
1943 Camellia_cbc_encrypt(buf, buf, 1956 Camellia_cbc_encrypt(buf, buf,
1944 (unsigned long) lengths[j], &camellia_ks1, 1957 (unsigned long) lengths[j], &camellia_ks1,
1945 iv, CAMELLIA_ENCRYPT); 1958 iv, CAMELLIA_ENCRYPT);
1946 d = time_f(STOP); 1959 d = speed_timer_stop(SECONDS);
1947 print_result(D_CBC_128_CML, j, count, d); 1960 print_result(D_CBC_128_CML, j, count, d);
1948 } 1961 }
1949 } 1962 }
1950 if (doit[D_CBC_192_CML]) { 1963 if (doit[D_CBC_192_CML]) {
1951 for (j = 0; j < SIZE_NUM; j++) { 1964 for (j = 0; j < SIZE_NUM; j++) {
1952 print_message(names[D_CBC_192_CML], lengths[j]); 1965 print_message(names[D_CBC_192_CML], lengths[j]);
1953 time_f(START); 1966 speed_timer_start(SECONDS);
1954 for (count = 0, run = 1; COND; count++) 1967 for (count = 0; COND; count++)
1955 Camellia_cbc_encrypt(buf, buf, 1968 Camellia_cbc_encrypt(buf, buf,
1956 (unsigned long) lengths[j], &camellia_ks2, 1969 (unsigned long) lengths[j], &camellia_ks2,
1957 iv, CAMELLIA_ENCRYPT); 1970 iv, CAMELLIA_ENCRYPT);
1958 d = time_f(STOP); 1971 d = speed_timer_stop(SECONDS);
1959 print_result(D_CBC_192_CML, j, count, d); 1972 print_result(D_CBC_192_CML, j, count, d);
1960 } 1973 }
1961 } 1974 }
1962 if (doit[D_CBC_256_CML]) { 1975 if (doit[D_CBC_256_CML]) {
1963 for (j = 0; j < SIZE_NUM; j++) { 1976 for (j = 0; j < SIZE_NUM; j++) {
1964 print_message(names[D_CBC_256_CML], lengths[j]); 1977 print_message(names[D_CBC_256_CML], lengths[j]);
1965 time_f(START); 1978 speed_timer_start(SECONDS);
1966 for (count = 0, run = 1; COND; count++) 1979 for (count = 0; COND; count++)
1967 Camellia_cbc_encrypt(buf, buf, 1980 Camellia_cbc_encrypt(buf, buf,
1968 (unsigned long) lengths[j], &camellia_ks3, 1981 (unsigned long) lengths[j], &camellia_ks3,
1969 iv, CAMELLIA_ENCRYPT); 1982 iv, CAMELLIA_ENCRYPT);
1970 d = time_f(STOP); 1983 d = speed_timer_stop(SECONDS);
1971 print_result(D_CBC_256_CML, j, count, d); 1984 print_result(D_CBC_256_CML, j, count, d);
1972 } 1985 }
1973 } 1986 }
@@ -1976,12 +1989,12 @@ speed_main(int argc, char **argv)
1976 if (doit[D_CBC_IDEA]) { 1989 if (doit[D_CBC_IDEA]) {
1977 for (j = 0; j < SIZE_NUM; j++) { 1990 for (j = 0; j < SIZE_NUM; j++) {
1978 print_message(names[D_CBC_IDEA], lengths[j]); 1991 print_message(names[D_CBC_IDEA], lengths[j]);
1979 time_f(START); 1992 speed_timer_start(SECONDS);
1980 for (count = 0, run = 1; COND; count++) 1993 for (count = 0; COND; count++)
1981 idea_cbc_encrypt(buf, buf, 1994 idea_cbc_encrypt(buf, buf,
1982 (unsigned long) lengths[j], &idea_ks, 1995 (unsigned long) lengths[j], &idea_ks,
1983 iv, IDEA_ENCRYPT); 1996 iv, IDEA_ENCRYPT);
1984 d = time_f(STOP); 1997 d = speed_timer_stop(SECONDS);
1985 print_result(D_CBC_IDEA, j, count, d); 1998 print_result(D_CBC_IDEA, j, count, d);
1986 } 1999 }
1987 } 2000 }
@@ -1990,12 +2003,12 @@ speed_main(int argc, char **argv)
1990 if (doit[D_CBC_RC2]) { 2003 if (doit[D_CBC_RC2]) {
1991 for (j = 0; j < SIZE_NUM; j++) { 2004 for (j = 0; j < SIZE_NUM; j++) {
1992 print_message(names[D_CBC_RC2], lengths[j]); 2005 print_message(names[D_CBC_RC2], lengths[j]);
1993 time_f(START); 2006 speed_timer_start(SECONDS);
1994 for (count = 0, run = 1; COND; count++) 2007 for (count = 0; COND; count++)
1995 RC2_cbc_encrypt(buf, buf, 2008 RC2_cbc_encrypt(buf, buf,
1996 (unsigned long) lengths[j], &rc2_ks, 2009 (unsigned long) lengths[j], &rc2_ks,
1997 iv, RC2_ENCRYPT); 2010 iv, RC2_ENCRYPT);
1998 d = time_f(STOP); 2011 d = speed_timer_stop(SECONDS);
1999 print_result(D_CBC_RC2, j, count, d); 2012 print_result(D_CBC_RC2, j, count, d);
2000 } 2013 }
2001 } 2014 }
@@ -2004,12 +2017,12 @@ speed_main(int argc, char **argv)
2004 if (doit[D_CBC_BF]) { 2017 if (doit[D_CBC_BF]) {
2005 for (j = 0; j < SIZE_NUM; j++) { 2018 for (j = 0; j < SIZE_NUM; j++) {
2006 print_message(names[D_CBC_BF], lengths[j]); 2019 print_message(names[D_CBC_BF], lengths[j]);
2007 time_f(START); 2020 speed_timer_start(SECONDS);
2008 for (count = 0, run = 1; COND; count++) 2021 for (count = 0; COND; count++)
2009 BF_cbc_encrypt(buf, buf, 2022 BF_cbc_encrypt(buf, buf,
2010 (unsigned long) lengths[j], &bf_ks, 2023 (unsigned long) lengths[j], &bf_ks,
2011 iv, BF_ENCRYPT); 2024 iv, BF_ENCRYPT);
2012 d = time_f(STOP); 2025 d = speed_timer_stop(SECONDS);
2013 print_result(D_CBC_BF, j, count, d); 2026 print_result(D_CBC_BF, j, count, d);
2014 } 2027 }
2015 } 2028 }
@@ -2018,12 +2031,12 @@ speed_main(int argc, char **argv)
2018 if (doit[D_CBC_CAST]) { 2031 if (doit[D_CBC_CAST]) {
2019 for (j = 0; j < SIZE_NUM; j++) { 2032 for (j = 0; j < SIZE_NUM; j++) {
2020 print_message(names[D_CBC_CAST], lengths[j]); 2033 print_message(names[D_CBC_CAST], lengths[j]);
2021 time_f(START); 2034 speed_timer_start(SECONDS);
2022 for (count = 0, run = 1; COND; count++) 2035 for (count = 0; COND; count++)
2023 CAST_cbc_encrypt(buf, buf, 2036 CAST_cbc_encrypt(buf, buf,
2024 (unsigned long) lengths[j], &cast_ks, 2037 (unsigned long) lengths[j], &cast_ks,
2025 iv, CAST_ENCRYPT); 2038 iv, CAST_ENCRYPT);
2026 d = time_f(STOP); 2039 d = speed_timer_stop(SECONDS);
2027 print_result(D_CBC_CAST, j, count, d); 2040 print_result(D_CBC_CAST, j, count, d);
2028 } 2041 }
2029 } 2042 }
@@ -2055,29 +2068,29 @@ speed_main(int argc, char **argv)
2055 EVP_EncryptInit_ex(ctx, evp_cipher, NULL, key16, iv); 2068 EVP_EncryptInit_ex(ctx, evp_cipher, NULL, key16, iv);
2056 EVP_CIPHER_CTX_set_padding(ctx, 0); 2069 EVP_CIPHER_CTX_set_padding(ctx, 0);
2057 2070
2058 time_f(START); 2071 speed_timer_start(SECONDS);
2059 if (decrypt) 2072 if (decrypt)
2060 for (count = 0, run = 1; COND; count++) 2073 for (count = 0; COND; count++)
2061 EVP_DecryptUpdate(ctx, buf, &outl, buf, lengths[j]); 2074 EVP_DecryptUpdate(ctx, buf, &outl, buf, lengths[j]);
2062 else 2075 else
2063 for (count = 0, run = 1; COND; count++) 2076 for (count = 0; COND; count++)
2064 EVP_EncryptUpdate(ctx, buf, &outl, buf, lengths[j]); 2077 EVP_EncryptUpdate(ctx, buf, &outl, buf, lengths[j]);
2065 if (decrypt) 2078 if (decrypt)
2066 EVP_DecryptFinal_ex(ctx, buf, &outl); 2079 EVP_DecryptFinal_ex(ctx, buf, &outl);
2067 else 2080 else
2068 EVP_EncryptFinal_ex(ctx, buf, &outl); 2081 EVP_EncryptFinal_ex(ctx, buf, &outl);
2069 d = time_f(STOP); 2082 d = speed_timer_stop(SECONDS);
2070 EVP_CIPHER_CTX_free(ctx); 2083 EVP_CIPHER_CTX_free(ctx);
2071 } 2084 }
2072 if (evp_md) { 2085 if (evp_md) {
2073 names[D_EVP] = OBJ_nid2ln(EVP_MD_type(evp_md)); 2086 names[D_EVP] = OBJ_nid2ln(EVP_MD_type(evp_md));
2074 print_message(names[D_EVP], lengths[j]); 2087 print_message(names[D_EVP], lengths[j]);
2075 2088
2076 time_f(START); 2089 speed_timer_start(SECONDS);
2077 for (count = 0, run = 1; COND; count++) 2090 for (count = 0; COND; count++)
2078 EVP_Digest(buf, lengths[j], &(md[0]), NULL, evp_md, NULL); 2091 EVP_Digest(buf, lengths[j], &(md[0]), NULL, evp_md, NULL);
2079 2092
2080 d = time_f(STOP); 2093 d = speed_timer_stop(SECONDS);
2081 } 2094 }
2082 print_result(D_EVP, j, count, d); 2095 print_result(D_EVP, j, count, d);
2083 } 2096 }
@@ -2097,8 +2110,8 @@ speed_main(int argc, char **argv)
2097 rsa_bits[j], 2110 rsa_bits[j],
2098 RSA_SECONDS); 2111 RSA_SECONDS);
2099/* RSA_blinding_on(rsa_key[j],NULL); */ 2112/* RSA_blinding_on(rsa_key[j],NULL); */
2100 time_f(START); 2113 speed_timer_start(RSA_SECONDS);
2101 for (count = 0, run = 1; COND; count++) { 2114 for (count = 0; COND; count++) {
2102 ret = RSA_sign(NID_md5_sha1, buf, 36, buf2, 2115 ret = RSA_sign(NID_md5_sha1, buf, 36, buf2,
2103 &rsa_num, rsa_key[j]); 2116 &rsa_num, rsa_key[j]);
2104 if (ret == 0) { 2117 if (ret == 0) {
@@ -2109,7 +2122,7 @@ speed_main(int argc, char **argv)
2109 break; 2122 break;
2110 } 2123 }
2111 } 2124 }
2112 d = time_f(STOP); 2125 d = speed_timer_stop(RSA_SECONDS);
2113 BIO_printf(bio_err, mr ? "+R1:%ld:%d:%.2f\n" 2126 BIO_printf(bio_err, mr ? "+R1:%ld:%d:%.2f\n"
2114 : "%ld %d bit private RSA in %.2fs\n", 2127 : "%ld %d bit private RSA in %.2fs\n",
2115 count, rsa_bits[j], d); 2128 count, rsa_bits[j], d);
@@ -2126,8 +2139,8 @@ speed_main(int argc, char **argv)
2126 pkey_print_message("public", "rsa", 2139 pkey_print_message("public", "rsa",
2127 rsa_bits[j], 2140 rsa_bits[j],
2128 RSA_SECONDS); 2141 RSA_SECONDS);
2129 time_f(START); 2142 speed_timer_start(RSA_SECONDS);
2130 for (count = 0, run = 1; COND; count++) { 2143 for (count = 0; COND; count++) {
2131 ret = RSA_verify(NID_md5_sha1, buf, 36, buf2, 2144 ret = RSA_verify(NID_md5_sha1, buf, 36, buf2,
2132 rsa_num, rsa_key[j]); 2145 rsa_num, rsa_key[j]);
2133 if (ret <= 0) { 2146 if (ret <= 0) {
@@ -2138,7 +2151,7 @@ speed_main(int argc, char **argv)
2138 break; 2151 break;
2139 } 2152 }
2140 } 2153 }
2141 d = time_f(STOP); 2154 d = speed_timer_stop(RSA_SECONDS);
2142 BIO_printf(bio_err, mr ? "+R2:%ld:%d:%.2f\n" 2155 BIO_printf(bio_err, mr ? "+R2:%ld:%d:%.2f\n"
2143 : "%ld %d bit public RSA in %.2fs\n", 2156 : "%ld %d bit public RSA in %.2fs\n",
2144 count, rsa_bits[j], d); 2157 count, rsa_bits[j], d);
@@ -2171,8 +2184,8 @@ speed_main(int argc, char **argv)
2171 pkey_print_message("sign", "dsa", 2184 pkey_print_message("sign", "dsa",
2172 dsa_bits[j], 2185 dsa_bits[j],
2173 DSA_SECONDS); 2186 DSA_SECONDS);
2174 time_f(START); 2187 speed_timer_start(DSA_SECONDS);
2175 for (count = 0, run = 1; COND; count++) { 2188 for (count = 0; COND; count++) {
2176 ret = DSA_sign(EVP_PKEY_DSA, buf, 20, buf2, 2189 ret = DSA_sign(EVP_PKEY_DSA, buf, 20, buf2,
2177 &kk, dsa_key[j]); 2190 &kk, dsa_key[j]);
2178 if (ret == 0) { 2191 if (ret == 0) {
@@ -2183,7 +2196,7 @@ speed_main(int argc, char **argv)
2183 break; 2196 break;
2184 } 2197 }
2185 } 2198 }
2186 d = time_f(STOP); 2199 d = speed_timer_stop(DSA_SECONDS);
2187 BIO_printf(bio_err, mr ? "+R3:%ld:%d:%.2f\n" 2200 BIO_printf(bio_err, mr ? "+R3:%ld:%d:%.2f\n"
2188 : "%ld %d bit DSA signs in %.2fs\n", 2201 : "%ld %d bit DSA signs in %.2fs\n",
2189 count, dsa_bits[j], d); 2202 count, dsa_bits[j], d);
@@ -2201,8 +2214,8 @@ speed_main(int argc, char **argv)
2201 pkey_print_message("verify", "dsa", 2214 pkey_print_message("verify", "dsa",
2202 dsa_bits[j], 2215 dsa_bits[j],
2203 DSA_SECONDS); 2216 DSA_SECONDS);
2204 time_f(START); 2217 speed_timer_start(DSA_SECONDS);
2205 for (count = 0, run = 1; COND; count++) { 2218 for (count = 0; COND; count++) {
2206 ret = DSA_verify(EVP_PKEY_DSA, buf, 20, buf2, 2219 ret = DSA_verify(EVP_PKEY_DSA, buf, 20, buf2,
2207 kk, dsa_key[j]); 2220 kk, dsa_key[j]);
2208 if (ret <= 0) { 2221 if (ret <= 0) {
@@ -2213,7 +2226,7 @@ speed_main(int argc, char **argv)
2213 break; 2226 break;
2214 } 2227 }
2215 } 2228 }
2216 d = time_f(STOP); 2229 d = speed_timer_stop(DSA_SECONDS);
2217 BIO_printf(bio_err, mr ? "+R4:%ld:%d:%.2f\n" 2230 BIO_printf(bio_err, mr ? "+R4:%ld:%d:%.2f\n"
2218 : "%ld %d bit DSA verify in %.2fs\n", 2231 : "%ld %d bit DSA verify in %.2fs\n",
2219 count, dsa_bits[j], d); 2232 count, dsa_bits[j], d);
@@ -2253,8 +2266,8 @@ speed_main(int argc, char **argv)
2253 test_curves_bits[j], 2266 test_curves_bits[j],
2254 ECDSA_SECONDS); 2267 ECDSA_SECONDS);
2255 2268
2256 time_f(START); 2269 speed_timer_start(ECDSA_SECONDS);
2257 for (count = 0, run = 1; COND; count++) { 2270 for (count = 0; COND; count++) {
2258 ret = ECDSA_sign(0, buf, 20, 2271 ret = ECDSA_sign(0, buf, 20,
2259 ecdsasig, &ecdsasiglen, 2272 ecdsasig, &ecdsasiglen,
2260 ecdsa[j]); 2273 ecdsa[j]);
@@ -2265,7 +2278,7 @@ speed_main(int argc, char **argv)
2265 break; 2278 break;
2266 } 2279 }
2267 } 2280 }
2268 d = time_f(STOP); 2281 d = speed_timer_stop(ECDSA_SECONDS);
2269 2282
2270 BIO_printf(bio_err, mr ? "+R5:%ld:%d:%.2f\n" : 2283 BIO_printf(bio_err, mr ? "+R5:%ld:%d:%.2f\n" :
2271 "%ld %d bit ECDSA signs in %.2fs \n", 2284 "%ld %d bit ECDSA signs in %.2fs \n",
@@ -2285,8 +2298,8 @@ speed_main(int argc, char **argv)
2285 pkey_print_message("verify", "ecdsa", 2298 pkey_print_message("verify", "ecdsa",
2286 test_curves_bits[j], 2299 test_curves_bits[j],
2287 ECDSA_SECONDS); 2300 ECDSA_SECONDS);
2288 time_f(START); 2301 speed_timer_start(ECDSA_SECONDS);
2289 for (count = 0, run = 1; COND; count++) { 2302 for (count = 0; COND; count++) {
2290 ret = ECDSA_verify(0, buf, 20, ecdsasig, ecdsasiglen, ecdsa[j]); 2303 ret = ECDSA_verify(0, buf, 20, ecdsasig, ecdsasiglen, ecdsa[j]);
2291 if (ret != 1) { 2304 if (ret != 1) {
2292 BIO_printf(bio_err, "ECDSA verify failure\n"); 2305 BIO_printf(bio_err, "ECDSA verify failure\n");
@@ -2295,7 +2308,7 @@ speed_main(int argc, char **argv)
2295 break; 2308 break;
2296 } 2309 }
2297 } 2310 }
2298 d = time_f(STOP); 2311 d = speed_timer_stop(ECDSA_SECONDS);
2299 BIO_printf(bio_err, mr ? "+R6:%ld:%d:%.2f\n" 2312 BIO_printf(bio_err, mr ? "+R6:%ld:%d:%.2f\n"
2300 : "%ld %d bit ECDSA verify in %.2fs\n", 2313 : "%ld %d bit ECDSA verify in %.2fs\n",
2301 count, test_curves_bits[j], d); 2314 count, test_curves_bits[j], d);
@@ -2371,14 +2384,14 @@ speed_main(int argc, char **argv)
2371 pkey_print_message("", "ecdh", 2384 pkey_print_message("", "ecdh",
2372 test_curves_bits[j], 2385 test_curves_bits[j],
2373 ECDH_SECONDS); 2386 ECDH_SECONDS);
2374 time_f(START); 2387 speed_timer_start(ECDH_SECONDS);
2375 for (count = 0, run = 1; COND; count++) { 2388 for (count = 0; COND; count++) {
2376 ECDH_compute_key(secret_a, 2389 ECDH_compute_key(secret_a,
2377 outlen, 2390 outlen,
2378 EC_KEY_get0_public_key(ecdh_b[j]), 2391 EC_KEY_get0_public_key(ecdh_b[j]),
2379 ecdh_a[j], kdf); 2392 ecdh_a[j], kdf);
2380 } 2393 }
2381 d = time_f(STOP); 2394 d = speed_timer_stop(ECDH_SECONDS);
2382 BIO_printf(bio_err, mr 2395 BIO_printf(bio_err, mr
2383 ? "+R7:%ld:%d:%.2f\n" 2396 ? "+R7:%ld:%d:%.2f\n"
2384 : "%ld %d-bit ECDH ops in %.2fs\n", 2397 : "%ld %d-bit ECDH ops in %.2fs\n",
@@ -2412,8 +2425,8 @@ speed_main(int argc, char **argv)
2412 continue; 2425 continue;
2413 2426
2414 pkey_print_message("keygen", "mlkem", bits, MLKEM_SECONDS); 2427 pkey_print_message("keygen", "mlkem", bits, MLKEM_SECONDS);
2415 time_f(START); 2428 speed_timer_start(MLKEM_SECONDS);
2416 for (count = 0, run = 1; COND; count++) { 2429 for (count = 0; COND; count++) {
2417 /* 2430 /*
2418 * MLKEM_generate_key requires an uninitialized key 2431 * MLKEM_generate_key requires an uninitialized key
2419 * object, so allocate and free on every iteration. 2432 * object, so allocate and free on every iteration.
@@ -2431,7 +2444,7 @@ speed_main(int argc, char **argv)
2431 free(encoded_pub); 2444 free(encoded_pub);
2432 encoded_pub = NULL; 2445 encoded_pub = NULL;
2433 } 2446 }
2434 d = time_f(STOP); 2447 d = speed_timer_stop(MLKEM_SECONDS);
2435 if (run) 2448 if (run)
2436 goto mlkem_err; 2449 goto mlkem_err;
2437 BIO_printf(bio_err, mr ? "+R8:%ld:%d:%.2f\n" 2450 BIO_printf(bio_err, mr ? "+R8:%ld:%d:%.2f\n"
@@ -2450,8 +2463,8 @@ speed_main(int argc, char **argv)
2450 encoded_pub = NULL; 2463 encoded_pub = NULL;
2451 2464
2452 pkey_print_message("encap", "mlkem", bits, MLKEM_SECONDS); 2465 pkey_print_message("encap", "mlkem", bits, MLKEM_SECONDS);
2453 time_f(START); 2466 speed_timer_start(MLKEM_SECONDS);
2454 for (count = 0, run = 1; COND; count++) { 2467 for (count = 0; COND; count++) {
2455 if (!MLKEM_encap(pub, &ct, &ct_len, &ss, 2468 if (!MLKEM_encap(pub, &ct, &ct_len, &ss,
2456 &ss_len)) 2469 &ss_len))
2457 break; 2470 break;
@@ -2460,7 +2473,7 @@ speed_main(int argc, char **argv)
2460 free(ss); 2473 free(ss);
2461 ss = NULL; 2474 ss = NULL;
2462 } 2475 }
2463 d = time_f(STOP); 2476 d = speed_timer_stop(MLKEM_SECONDS);
2464 if (run) 2477 if (run)
2465 goto mlkem_err; 2478 goto mlkem_err;
2466 BIO_printf(bio_err, mr ? "+R9:%ld:%d:%.2f\n" 2479 BIO_printf(bio_err, mr ? "+R9:%ld:%d:%.2f\n"
@@ -2474,14 +2487,14 @@ speed_main(int argc, char **argv)
2474 ss = NULL; 2487 ss = NULL;
2475 2488
2476 pkey_print_message("decap", "mlkem", bits, MLKEM_SECONDS); 2489 pkey_print_message("decap", "mlkem", bits, MLKEM_SECONDS);
2477 time_f(START); 2490 speed_timer_start(MLKEM_SECONDS);
2478 for (count = 0, run = 1; COND; count++) { 2491 for (count = 0; COND; count++) {
2479 if (!MLKEM_decap(priv, ct, ct_len, &ss, &ss_len)) 2492 if (!MLKEM_decap(priv, ct, ct_len, &ss, &ss_len))
2480 break; 2493 break;
2481 free(ss); 2494 free(ss);
2482 ss = NULL; 2495 ss = NULL;
2483 } 2496 }
2484 d = time_f(STOP); 2497 d = speed_timer_stop(MLKEM_SECONDS);
2485 if (run) 2498 if (run)
2486 goto mlkem_err; 2499 goto mlkem_err;
2487 BIO_printf(bio_err, mr ? "+R10:%ld:%d:%.2f\n" 2500 BIO_printf(bio_err, mr ? "+R10:%ld:%d:%.2f\n"
@@ -2679,7 +2692,6 @@ print_message(const char *s, int length)
2679 BIO_printf(bio_err, mr ? "+DT:%s:%d:%d\n" 2692 BIO_printf(bio_err, mr ? "+DT:%s:%d:%d\n"
2680 : "Doing %s for %ds on %d size blocks: ", s, SECONDS, length); 2693 : "Doing %s for %ds on %d size blocks: ", s, SECONDS, length);
2681 (void) BIO_flush(bio_err); 2694 (void) BIO_flush(bio_err);
2682 alarm(SECONDS);
2683} 2695}
2684 2696
2685static void 2697static void
@@ -2689,7 +2701,6 @@ pkey_print_message(const char *str, const char *str2,
2689 BIO_printf(bio_err, mr ? "+DTP:%d:%s:%s:%d\n" 2701 BIO_printf(bio_err, mr ? "+DTP:%d:%s:%s:%d\n"
2690 : "Doing %d bit %s %s for %ds: ", bits, str, str2, tm); 2702 : "Doing %d bit %s %s for %ds: ", bits, str, str2, tm);
2691 (void) BIO_flush(bio_err); 2703 (void) BIO_flush(bio_err);
2692 alarm(tm);
2693} 2704}
2694 2705
2695static void 2706static void
diff --git a/src/usr.sbin/ocspcheck/ocspcheck.c b/src/usr.sbin/ocspcheck/ocspcheck.c
index ae4b8364f6..8d6d30187b 100644
--- a/src/usr.sbin/ocspcheck/ocspcheck.c
+++ b/src/usr.sbin/ocspcheck/ocspcheck.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ocspcheck.c,v 1.34 2024/12/04 07:58:51 tb Exp $ */ 1/* $OpenBSD: ocspcheck.c,v 1.35 2026/07/29 02:27:31 tb Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2017,2020 Bob Beck <beck@openbsd.org> 4 * Copyright (c) 2017,2020 Bob Beck <beck@openbsd.org>
@@ -399,8 +399,7 @@ ocsp_request_new_from_cert(const char *cadir, char *file, int nonce)
399 return NULL; 399 return NULL;
400} 400}
401 401
402 402static int
403int
404validate_response(char *buf, size_t size, ocsp_request *request, 403validate_response(char *buf, size_t size, ocsp_request *request,
405 X509_STORE *store, char *host, char *file) 404 X509_STORE *store, char *host, char *file)
406{ 405{