Blame SOURCES/Omit-PA_FOR_USER-if-we-can-t-compute-its-checksum.patch

31ace6
From 4c4c22639eb2794e563370a2ee48a34dbdddc639 Mon Sep 17 00:00:00 2001
31ace6
From: Isaac Boukris <iboukris@gmail.com>
31ace6
Date: Sat, 6 Jun 2020 11:03:37 +0200
31ace6
Subject: [PATCH] Omit PA_FOR_USER if we can't compute its checksum
31ace6
31ace6
OpenSSL in FIPS mode will refuse to perform hmac-md5.  Omit the legacy
31ace6
PA_FOR_USER element in this case rather than failing out.
31ace6
31ace6
[ghudson@mit.edu: minor code and comment edits; wrote commit message]
31ace6
31ace6
ticket: 8912 (new)
31ace6
(cherry picked from commit 03f122bdb22cfa53c7d855ed929c9541e56365e0)
31ace6
(cherry picked from commit 086de78292b8ae89aba8a72926831124da44205d)
31ace6
---
31ace6
 src/lib/krb5/krb/s4u_creds.c | 7 +++++++
31ace6
 1 file changed, 7 insertions(+)
31ace6
31ace6
diff --git a/src/lib/krb5/krb/s4u_creds.c b/src/lib/krb5/krb/s4u_creds.c
31ace6
index fc5c886d6..d8f486dc6 100644
31ace6
--- a/src/lib/krb5/krb/s4u_creds.c
31ace6
+++ b/src/lib/krb5/krb/s4u_creds.c
31ace6
@@ -534,6 +534,13 @@ krb5_get_self_cred_from_kdc(krb5_context context,
31ace6
         if (s4u_user.user_id.user != NULL && s4u_user.user_id.user->length) {
31ace6
             code = build_pa_for_user(context, tgtptr, &s4u_user.user_id,
31ace6
                                      &in_padata[1]);
31ace6
+            /*
31ace6
+             * If we couldn't compute the hmac-md5 checksum, send only the
31ace6
+             * KRB5_PADATA_S4U_X509_USER; this will still work against modern
31ace6
+             * Windows and MIT KDCs.
31ace6
+             */
31ace6
+            if (code == KRB5_CRYPTO_INTERNAL)
31ace6
+                code = 0;
31ace6
             if (code != 0) {
31ace6
                 krb5_free_pa_data(context, in_padata);
31ace6
                 goto cleanup;