Commit 16796809d8 for openssl.org

commit 16796809d8f2fc92ce0bded75e6b60a9e1bba3bb
Author: Richard Levitte <levitte@openssl.foundation>
Date:   Tue Nov 17 12:41:17 2026 +0100

    test_external_krb5: update krb5 submodule to 1.22.3

    Update the krb5 submodule to krb5-1.22.3-final (f5bee90a).  The four
    locally carried patches are present in 1.22.3 in equivalent form,
    so they are dropped;  the release also carries the C23 strchr() fixes
    that the gcc 15 default -std=gnu23 requires (the ubuntu-26.04 runners
    fail the build with -Werror=discarded-qualifiers).

    One small patch is carried instead:  the k5tls plugin lacks two
    const qualifiers for OpenSSL 4.x APIs.

    Resolves: https://github.com/openssl/openssl/issues/33794
    Assisted-by: Pi:moonshotai/kimi-k3
    Signed-off-by: Richard Levitte <levitte@openssl.foundation>
    Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
    Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
    Merge-date: Tue Nov 17 15:08:26 2026
    Merged-from: https://github.com/openssl/openssl/pull/33795

diff --git a/krb5 b/krb5
index 784c38f50e..f5bee90a50 160000
--- a/krb5
+++ b/krb5
@@ -1 +1 @@
-Subproject commit 784c38f50e70a739400cdd3f2620bac2e2788e6c
+Subproject commit f5bee90a501da6c351b3db46c1ae837b033a714c
diff --git a/test/recipes/95-test_external_krb5_data/patches/0001-Cons-return-value-from-X509_STORE_CTX_get_current_ce.patch b/test/recipes/95-test_external_krb5_data/patches/0001-Cons-return-value-from-X509_STORE_CTX_get_current_ce.patch
deleted file mode 100644
index 8ea4257405..0000000000
--- a/test/recipes/95-test_external_krb5_data/patches/0001-Cons-return-value-from-X509_STORE_CTX_get_current_ce.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-From db9d5b69c2987c4aaf0db612d76fb0931b990019 Mon Sep 17 00:00:00 2001
-From: Bob Beck <beck@openssl.org>
-Date: Fri, 20 Feb 2026 17:38:19 -0700
-Subject: [PATCH] Cons return value from X509_STORE_CTX_get_current_cert
-
----
- src/plugins/preauth/pkinit/pkinit_crypto_openssl.c | 4 ++--
- src/plugins/tls/k5tls/openssl.c                    | 4 ++--
- 2 files changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c b/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
-index d1fe18e5a..d5e3f0094 100644
---- a/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
-+++ b/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
-@@ -2156,7 +2156,7 @@ cms_signeddata_verify(krb5_context context,
-         i = X509_verify_cert(cert_ctx);
-         if (i <= 0) {
-             int j = X509_STORE_CTX_get_error(cert_ctx);
--            X509 *cert;
-+            const X509 *cert;
-
-             cert = X509_STORE_CTX_get_current_cert(cert_ctx);
-             reqctx->received_cert = X509_dup(cert);
-@@ -3355,7 +3355,7 @@ openssl_callback(int ok, X509_STORE_CTX * ctx)
- {
- #ifdef DEBUG
-     if (!ok) {
--        X509 *cert = X509_STORE_CTX_get_current_cert(ctx);
-+        const X509 *cert = X509_STORE_CTX_get_current_cert(ctx);
-         int err = X509_STORE_CTX_get_error(ctx);
-         const char *errmsg = X509_verify_cert_error_string(err);
-         char buf[DN_BUF_LEN];
-diff --git a/src/plugins/tls/k5tls/openssl.c b/src/plugins/tls/k5tls/openssl.c
-index aab67c01c..2c7ce0317 100644
---- a/src/plugins/tls/k5tls/openssl.c
-+++ b/src/plugins/tls/k5tls/openssl.c
-@@ -288,7 +288,7 @@ check_cert_name_or_ip(X509 *x, const char *expected_name)
- static int
- verify_callback(int preverify_ok, X509_STORE_CTX *store_ctx)
- {
--    X509 *x;
-+    const X509 *x;
-     SSL *ssl;
-     BIO *bio;
-     krb5_context context;
-@@ -330,7 +330,7 @@ verify_callback(int preverify_ok, X509_STORE_CTX *store_ctx)
-         return 1;
-     /* Check if the name we expect to find is in the certificate. */
-     expected_name = handle->servername;
--    if (check_cert_name_or_ip(x, expected_name)) {
-+    if (check_cert_name_or_ip((X509 *)x, expected_name)) {
-         TRACE_TLS_SERVER_NAME_MATCH(context, expected_name);
-         return 1;
-     } else {
---
-2.52.0
-
diff --git a/test/recipes/95-test_external_krb5_data/patches/0001-Fix-X509_NAME-const-issues-in-krb.patch b/test/recipes/95-test_external_krb5_data/patches/0001-Fix-X509_NAME-const-issues-in-krb.patch
deleted file mode 100644
index 91dd2016fe..0000000000
--- a/test/recipes/95-test_external_krb5_data/patches/0001-Fix-X509_NAME-const-issues-in-krb.patch
+++ /dev/null
@@ -1,146 +0,0 @@
-From 8ab536cf04d9a87a2e87b7bb775563ffb8cc14b2 Mon Sep 17 00:00:00 2001
-From: Bob Beck <beck@openssl.org>
-Date: Fri, 20 Feb 2026 18:38:42 -0700
-Subject: [PATCH] Fix X509_NAME const issues in krb
-
----
- .../preauth/pkinit/pkinit_crypto_openssl.c    |  4 +--
- src/plugins/tls/k5tls/openssl.c               | 27 +++++++++----------
- 2 files changed, 14 insertions(+), 17 deletions(-)
-
-diff --git a/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c b/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
-index 2f26197b1..0a4c510f4 100644
---- a/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
-+++ b/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
-@@ -4768,7 +4768,7 @@ out:
- }
-
- static krb5_error_code
--rfc2253_name(X509_NAME *name, char **str_out)
-+rfc2253_name(const X509_NAME *name, char **str_out)
- {
-     BIO *b = NULL;
-     char *str;
-@@ -5237,7 +5237,7 @@ create_identifiers_from_stack(STACK_OF(X509) *sk,
-     int i = 0, sk_size = sk_X509_num(sk);
-     krb5_external_principal_identifier **krb5_cas = NULL;
-     X509 *x = NULL;
--    X509_NAME *xn = NULL;
-+    const X509_NAME *xn = NULL;
-     unsigned char *p = NULL;
-     int len = 0;
-     PKCS7_ISSUER_AND_SERIAL *is = NULL;
-diff --git a/src/plugins/tls/k5tls/openssl.c b/src/plugins/tls/k5tls/openssl.c
-index aab67c01c..f7db3a11b 100644
---- a/src/plugins/tls/k5tls/openssl.c
-+++ b/src/plugins/tls/k5tls/openssl.c
-@@ -48,8 +48,7 @@ static int ex_handle_id = -1;
-
- MAKE_INIT_FUNCTION(init_openssl);
-
--int
--init_openssl(void)
-+int init_openssl(void)
- {
-     SSL_library_init();
-     SSL_load_error_strings();
-@@ -89,7 +88,7 @@ ascii_tolower(char p)
-  */
- static krb5_boolean
- label_match(const char *presented, size_t plen, const char *expected,
--            size_t elen, krb5_boolean allow_wildcard, krb5_boolean *wildcard)
-+    size_t elen, krb5_boolean allow_wildcard, krb5_boolean *wildcard)
- {
-     unsigned int i;
-
-@@ -158,7 +157,7 @@ get_cert_sans(X509 *x)
- static int
- get_cert_cn(X509 *x, char *buf, size_t bufsize)
- {
--    X509_NAME *name;
-+    const X509_NAME *name;
-
-     name = X509_get_subject_name(x);
-     if (name == NULL)
-@@ -217,8 +216,7 @@ check_cert_address(X509 *x, const char *text)
-     name_length = get_cert_cn(x, buf, sizeof(buf));
-     if (name_length >= 0) {
-         /* Do a string compare to check if it's an acceptable value. */
--        return strlen(text) == (size_t)name_length &&
--               strncmp(text, buf, name_length) == 0;
-+        return strlen(text) == (size_t)name_length && strncmp(text, buf, name_length) == 0;
-     }
-
-     /* We didn't find a match. */
-@@ -277,8 +275,7 @@ check_cert_name_or_ip(X509 *x, const char *expected_name)
-     struct in_addr in;
-     struct in6_addr in6;
-
--    if (inet_pton(AF_INET, expected_name, &in) != 0 ||
--        inet_pton(AF_INET6, expected_name, &in6) != 0) {
-+    if (inet_pton(AF_INET, expected_name, &in) != 0 || inet_pton(AF_INET6, expected_name, &in6) != 0) {
-         return check_cert_address(x, expected_name);
-     } else {
-         return check_cert_servername(x, expected_name);
-@@ -298,7 +295,7 @@ verify_callback(int preverify_ok, X509_STORE_CTX *store_ctx)
-     size_t count;
-
-     ssl = X509_STORE_CTX_get_ex_data(store_ctx,
--                                     SSL_get_ex_data_X509_STORE_CTX_idx());
-+        SSL_get_ex_data_X509_STORE_CTX_idx());
-     context = SSL_get_ex_data(ssl, ex_context_id);
-     handle = SSL_get_ex_data(ssl, ex_handle_id);
-     assert(context != NULL && handle != NULL);
-@@ -378,7 +375,7 @@ load_anchor_dir(X509_STORE *store, const char *path)
-     while ((dentry = readdir(d)) != NULL) {
-         if (dentry->d_name[0] != '.') {
-             snprintf(filename, sizeof(filename), "%s/%s",
--                     path, dentry->d_name);
-+                path, dentry->d_name);
-             if (load_anchor_file(store, filename) == 0)
-                 found_any = TRUE;
-         }
-@@ -430,7 +427,7 @@ load_anchors(krb5_context context, char **anchors, SSL_CTX *sctx)
-
- static krb5_error_code
- setup(krb5_context context, SOCKET fd, const char *servername,
--      char **anchors, k5_tls_handle *handle_out)
-+    char **anchors, k5_tls_handle *handle_out)
- {
-     int e;
-     long options = SSL_OP_NO_SSLv2;
-@@ -503,7 +500,7 @@ error:
-
- static k5_tls_status
- write_tls(krb5_context context, k5_tls_handle handle, const void *data,
--          size_t len)
-+    size_t len)
- {
-     int nwritten, e;
-
-@@ -526,7 +523,7 @@ write_tls(krb5_context context, k5_tls_handle handle, const void *data,
-
- static k5_tls_status
- read_tls(krb5_context context, k5_tls_handle handle, void *data,
--         size_t data_size, size_t *len_out)
-+    size_t data_size, size_t *len_out)
- {
-     ssize_t nread;
-     int e;
-@@ -566,11 +563,11 @@ free_handle(krb5_context context, k5_tls_handle handle)
-
- krb5_error_code
- tls_k5tls_initvt(krb5_context context, int maj_ver, int min_ver,
--                 krb5_plugin_vtable vtable);
-+    krb5_plugin_vtable vtable);
-
- krb5_error_code
- tls_k5tls_initvt(krb5_context context, int maj_ver, int min_ver,
--                 krb5_plugin_vtable vtable)
-+    krb5_plugin_vtable vtable)
- {
-     k5_tls_vtable vt;
-
---
-2.52.0
-
diff --git a/test/recipes/95-test_external_krb5_data/patches/0001-Use-Accessors-for-ASN1_STRING-values-from-OpenSSL.patch b/test/recipes/95-test_external_krb5_data/patches/0001-Use-Accessors-for-ASN1_STRING-values-from-OpenSSL.patch
deleted file mode 100644
index 7ce8b8689a..0000000000
--- a/test/recipes/95-test_external_krb5_data/patches/0001-Use-Accessors-for-ASN1_STRING-values-from-OpenSSL.patch
+++ /dev/null
@@ -1,74 +0,0 @@
-From 77e11f75423e971e1af9e5f8cc971a606adcb01e Mon Sep 17 00:00:00 2001
-From: Bob Beck <beck@openssl.org>
-Date: Mon, 2 Feb 2026 09:50:36 -0700
-Subject: [PATCH] Use Accessors for ASN1_STRING values from OpenSSL.
-
-OpenSSL is making ASN1_STRING opaque, These accessors
-have been around for a very long time. and should be
-used instead of directly manipulating the fields int the
-structure.
-
-https://github.com/openssl/openssl/issues/29117
----
- .../preauth/pkinit/pkinit_crypto_openssl.c       | 18 +++++++++++-------
- 1 file changed, 11 insertions(+), 7 deletions(-)
-
-diff --git a/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c b/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
-index d1fe18e5a..14e060de8 100644
---- a/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
-+++ b/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
-@@ -2002,7 +2002,7 @@ cms_signeddata_verify(krb5_context context,
-         unsigned char *d;
-         *is_signed = 0;
-         octets = CMS_get0_content(cms);
--        if (!octets || ((*octets)->type != V_ASN1_OCTET_STRING)) {
-+        if (!octets || (ASN1_STRING_type(*octets) != V_ASN1_OCTET_STRING)) {
-             retval = KRB5KDC_ERR_PREAUTH_FAILED;
-             krb5_set_error_message(context, retval,
-                                    _("Invalid pkinit packet: octet string "
-@@ -2058,7 +2058,8 @@ cms_signeddata_verify(krb5_context context,
-         /* We cannot use CMS_dataInit because there may be no digest */
-         octets = CMS_get0_content(cms);
-         if (octets)
--            out = BIO_new_mem_buf((*octets)->data, (*octets)->length);
-+            out = BIO_new_mem_buf(ASN1_STRING_get0_data(*octets),
-+                                  ASN1_STRING_length(*octets));
-         if (out == NULL)
-             goto cleanup;
-     } else {
-@@ -2379,8 +2380,8 @@ crypto_retrieve_X509_sans(krb5_context context,
-         gen = sk_GENERAL_NAME_value(ialt, i);
-         switch (gen->type) {
-         case GEN_OTHERNAME:
--            name.length = gen->d.otherName->value->value.sequence->length;
--            name.data = (char *)gen->d.otherName->value->value.sequence->data;
-+            name.length = ASN1_STRING_length(gen->d.otherName->value->value.sequence);
-+            name.data = (char *)ASN1_STRING_get0_data(gen->d.otherName->value->value.sequence);
-             if (princs != NULL &&
-                 OBJ_cmp(plgctx->id_pkinit_san,
-                         gen->d.otherName->type_id) == 0) {
-@@ -2414,12 +2415,17 @@ crypto_retrieve_X509_sans(krb5_context context,
-         case GEN_DNS:
-             if (dnss != NULL) {
-+                if (ASN1_STRING_length(gen->d.dNSName) == 0)
-+                    break;
-                 /* Prevent abuse of embedded null characters. */
--                if (memchr(gen->d.dNSName->data, '\0', gen->d.dNSName->length))
-+                if (memchr(ASN1_STRING_get0_data(gen->d.dNSName), '\0',
-+                           ASN1_STRING_length(gen->d.dNSName)))
-                     break;
--                pkiDebug("%s: found dns name = %s\n", __FUNCTION__,
--                         gen->d.dNSName->data);
-+                pkiDebug("%s: found dns name = %.*s\n", __FUNCTION__,
-+                         (int)ASN1_STRING_length(gen->d.dNSName),
-+                         ASN1_STRING_get0_data(gen->d.dNSName));
-                 dnss[d] = (unsigned char *)
--                    strdup((char *)gen->d.dNSName->data);
-+                    strndup((char *)ASN1_STRING_get0_data(gen->d.dNSName),
-+                            ASN1_STRING_length(gen->d.dNSName));
-                 if (dnss[d] == NULL) {
-                     pkiDebug("%s: failed to duplicate dns name\n",
-                              __FUNCTION__);
---
-2.52.0
-
diff --git a/test/recipes/95-test_external_krb5_data/patches/0001-constify-X509_EXTENSION-return-values.patch b/test/recipes/95-test_external_krb5_data/patches/0001-constify-X509_EXTENSION-return-values.patch
deleted file mode 100644
index 46cc217191..0000000000
--- a/test/recipes/95-test_external_krb5_data/patches/0001-constify-X509_EXTENSION-return-values.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From d7699a98e33376bccf3221bfd46c9e3519e1fdd2 Mon Sep 17 00:00:00 2001
-From: Bob Beck <beck@openssl.org>
-Date: Mon, 22 Dec 2025 15:34:19 -0700
-Subject: [PATCH] constify X509_EXTENSION return values
-
----
- src/plugins/preauth/pkinit/pkinit_crypto_openssl.c | 2 +-
- src/plugins/tls/k5tls/openssl.c                    | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c b/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
-index d1fe18e5a..27dfca6e1 100644
---- a/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
-+++ b/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
-@@ -2316,7 +2316,7 @@ crypto_retrieve_X509_sans(krb5_context context,
-     char **upns = NULL;
-     unsigned char **dnss = NULL;
-     unsigned int i, num_sans = 0;
--    X509_EXTENSION *ext = NULL;
-+    const X509_EXTENSION *ext = NULL;
-     GENERAL_NAMES *ialt = NULL;
-     GENERAL_NAME *gen = NULL;
-
-diff --git a/src/plugins/tls/k5tls/openssl.c b/src/plugins/tls/k5tls/openssl.c
-index aab67c01c..c3a253009 100644
---- a/src/plugins/tls/k5tls/openssl.c
-+++ b/src/plugins/tls/k5tls/openssl.c
-@@ -142,7 +142,7 @@ static GENERAL_NAMES *
- get_cert_sans(X509 *x)
- {
-     int ext;
--    X509_EXTENSION *san_ext;
-+    const X509_EXTENSION *san_ext;
-
-     ext = X509_get_ext_by_NID(x, NID_subject_alt_name, -1);
-     if (ext < 0)
---
-2.52.0
-
diff --git a/test/recipes/95-test_external_krb5_data/patches/0001-constify-k5tls-openssl-plugin.patch b/test/recipes/95-test_external_krb5_data/patches/0001-constify-k5tls-openssl-plugin.patch
new file mode 100644
index 0000000000..e79c076f98
--- /dev/null
+++ b/test/recipes/95-test_external_krb5_data/patches/0001-constify-k5tls-openssl-plugin.patch
@@ -0,0 +1,36 @@
+From e8e15b31dc01963f3c4995f63f699e68d8724c22 Mon Sep 17 00:00:00 2001
+From: Richard Levitte <levitte@openssl.foundation>
+Date: Tue, 17 Nov 2026 12:54:04 +0100
+Subject: [PATCH] constify k5tls OpenSSL plugin
+
+X509_get_ext() and X509_get_subject_name() return const pointers in
+OpenSSL 4.x.
+---
+ src/plugins/tls/k5tls/openssl.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/plugins/tls/k5tls/openssl.c b/src/plugins/tls/k5tls/openssl.c
+index 3b0b29a5f..6bc2c3d4b 100644
+--- a/src/plugins/tls/k5tls/openssl.c
++++ b/src/plugins/tls/k5tls/openssl.c
+@@ -162,7 +162,7 @@ static GENERAL_NAMES *
+ get_cert_sans(const X509 *x)
+ {
+     int ext;
+-    X509_EXTENSION *san_ext;
++    const X509_EXTENSION *san_ext;
+
+     ext = X509_get_ext_by_NID(x, NID_subject_alt_name, -1);
+     if (ext < 0)
+@@ -178,7 +178,7 @@ get_cert_sans(const X509 *x)
+ static int
+ get_cert_cn(const X509 *x, char *buf, size_t bufsize)
+ {
+-    X509_NAME *name;
++    const X509_NAME *name;
+
+     name = X509_get_subject_name(x);
+     if (name == NULL)
+--
+2.55.0
+