[31246] in CVS-changelog-for-Kerberos-V5

home help back first fref pref prev next nref lref last post

krb5 commit [krb5-1.20]: Update error checking for OpenSSL CMS_verify

daemon@ATHENA.MIT.EDU (ghudson@mit.edu)
Tue Jul 11 18:56:14 2023

From: ghudson@mit.edu
To: <cvs-krb5@mit.edu>
Message-ID: <20230711225600.ABBE4102BEA@krbdev.mit.edu>
Date: Tue, 11 Jul 2023 18:56:00 -0400 (EDT)
MIME-Version: 1.0
Reply-To: krbdev@mit.edu
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

https://github.com/krb5/krb5/commit/9a2051998c9446f56ba40a29e56c625b83e38467
commit 9a2051998c9446f56ba40a29e56c625b83e38467
Author: Julien Rische <jrische@redhat.com>
Date:   Thu Jul 28 15:20:12 2022 +0200

    Update error checking for OpenSSL CMS_verify
    
    The code for CMS data verification was initially written for OpenSSL's
    PKCS7_verify() function.  It now uses CMS_verify(), but error handling
    is still done using PKCS7_verify() error identifiers.  Update the
    recognized error codes so that the KDC generates
    KDC_ERR_DIGEST_IN_SIGNED_DATA_NOT_ACCEPTED errors when appropriate.
    Use ERR_peek_last_error() to observe the error generated closest to
    the API surface.
    
    [ghudson@mit.edu: edited commit message]
    
    (cherry picked from commit 70f61d417261ca17efe3d60d180033bea2da60b0)
    
    ticket: 9069
    version_fixed: 1.20.2

 src/plugins/preauth/pkinit/pkinit_crypto_openssl.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c b/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
index d500455de..4f295109b 100644
--- a/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
+++ b/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
@@ -2102,12 +2102,15 @@ cms_signeddata_verify(krb5_context context,
             goto cleanup;
         out = BIO_new(BIO_s_mem());
         if (CMS_verify(cms, NULL, store, NULL, out, flags) == 0) {
-            unsigned long err = ERR_peek_error();
+            unsigned long err = ERR_peek_last_error();
             switch(ERR_GET_REASON(err)) {
-            case PKCS7_R_DIGEST_FAILURE:
+            case RSA_R_DIGEST_NOT_ALLOWED:
+            case CMS_R_UNKNOWN_DIGEST_ALGORITHM:
+            case CMS_R_NO_MATCHING_DIGEST:
+            case CMS_R_NO_MATCHING_SIGNATURE:
                 retval = KRB5KDC_ERR_DIGEST_IN_SIGNED_DATA_NOT_ACCEPTED;
                 break;
-            case PKCS7_R_SIGNATURE_FAILURE:
+            case CMS_R_VERIFICATION_FAILURE:
             default:
                 retval = KRB5KDC_ERR_INVALID_SIG;
             }
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5

home help back first fref pref prev next nref lref last post