]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
KEYS: Make the X.509 and PKCS7 parsers supply the sig encoding type [ver #2]
authorDavid Howells <dhowells@redhat.com>
Tue, 9 Oct 2018 16:47:15 +0000 (17:47 +0100)
committerJames Morris <james.morris@microsoft.com>
Fri, 26 Oct 2018 08:30:46 +0000 (09:30 +0100)
Make the X.509 and PKCS7 parsers fill in the signature encoding type field
recently added to the public_key_signature struct.

Signed-off-by: David Howells <dhowells@redhat.com>
Tested-by: Marcel Holtmann <marcel@holtmann.org>
Reviewed-by: Marcel Holtmann <marcel@holtmann.org>
Reviewed-by: Denis Kenzior <denkenz@gmail.com>
Tested-by: Denis Kenzior <denkenz@gmail.com>
Signed-off-by: James Morris <james.morris@microsoft.com>
crypto/asymmetric_keys/pkcs7_parser.c
crypto/asymmetric_keys/x509_cert_parser.c

index 0f134162cef4b5f89c016db315df1b52de18ef16..f0d56e1a8b7e2b4971004959261b0d5c18cf0a6b 100644 (file)
@@ -271,6 +271,7 @@ int pkcs7_sig_note_pkey_algo(void *context, size_t hdrlen,
        switch (ctx->last_oid) {
        case OID_rsaEncryption:
                ctx->sinfo->sig->pkey_algo = "rsa";
+               ctx->sinfo->sig->encoding = "pkcs1";
                break;
        default:
                printk("Unsupported pkey algo: %u\n", ctx->last_oid);
index b6cabac4b62ba6b920cb5947c56db5839711bcc7..991f4d735a4ef1d89083f15cae8efa77f82060d6 100644 (file)
@@ -199,35 +199,32 @@ int x509_note_pkey_algo(void *context, size_t hdrlen,
 
        case OID_md4WithRSAEncryption:
                ctx->cert->sig->hash_algo = "md4";
-               ctx->cert->sig->pkey_algo = "rsa";
-               break;
+               goto rsa_pkcs1;
 
        case OID_sha1WithRSAEncryption:
                ctx->cert->sig->hash_algo = "sha1";
-               ctx->cert->sig->pkey_algo = "rsa";
-               break;
+               goto rsa_pkcs1;
 
        case OID_sha256WithRSAEncryption:
                ctx->cert->sig->hash_algo = "sha256";
-               ctx->cert->sig->pkey_algo = "rsa";
-               break;
+               goto rsa_pkcs1;
 
        case OID_sha384WithRSAEncryption:
                ctx->cert->sig->hash_algo = "sha384";
-               ctx->cert->sig->pkey_algo = "rsa";
-               break;
+               goto rsa_pkcs1;
 
        case OID_sha512WithRSAEncryption:
                ctx->cert->sig->hash_algo = "sha512";
-               ctx->cert->sig->pkey_algo = "rsa";
-               break;
+               goto rsa_pkcs1;
 
        case OID_sha224WithRSAEncryption:
                ctx->cert->sig->hash_algo = "sha224";
-               ctx->cert->sig->pkey_algo = "rsa";
-               break;
+               goto rsa_pkcs1;
        }
 
+rsa_pkcs1:
+       ctx->cert->sig->pkey_algo = "rsa";
+       ctx->cert->sig->encoding = "pkcs1";
        ctx->algo_oid = ctx->last_oid;
        return 0;
 }