Commit 03988490 authored by David Howells's avatar David Howells Committed by James Morris

KEYS: Make the X.509 and PKCS7 parsers supply the sig encoding type [ver #2]

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: default avatarDavid Howells <dhowells@redhat.com>
Tested-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Reviewed-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Reviewed-by: default avatarDenis Kenzior <denkenz@gmail.com>
Tested-by: default avatarDenis Kenzior <denkenz@gmail.com>
Signed-off-by: default avatarJames Morris <james.morris@microsoft.com>
parent 5a307718
...@@ -271,6 +271,7 @@ int pkcs7_sig_note_pkey_algo(void *context, size_t hdrlen, ...@@ -271,6 +271,7 @@ int pkcs7_sig_note_pkey_algo(void *context, size_t hdrlen,
switch (ctx->last_oid) { switch (ctx->last_oid) {
case OID_rsaEncryption: case OID_rsaEncryption:
ctx->sinfo->sig->pkey_algo = "rsa"; ctx->sinfo->sig->pkey_algo = "rsa";
ctx->sinfo->sig->encoding = "pkcs1";
break; break;
default: default:
printk("Unsupported pkey algo: %u\n", ctx->last_oid); printk("Unsupported pkey algo: %u\n", ctx->last_oid);
......
...@@ -199,35 +199,32 @@ int x509_note_pkey_algo(void *context, size_t hdrlen, ...@@ -199,35 +199,32 @@ int x509_note_pkey_algo(void *context, size_t hdrlen,
case OID_md4WithRSAEncryption: case OID_md4WithRSAEncryption:
ctx->cert->sig->hash_algo = "md4"; ctx->cert->sig->hash_algo = "md4";
ctx->cert->sig->pkey_algo = "rsa"; goto rsa_pkcs1;
break;
case OID_sha1WithRSAEncryption: case OID_sha1WithRSAEncryption:
ctx->cert->sig->hash_algo = "sha1"; ctx->cert->sig->hash_algo = "sha1";
ctx->cert->sig->pkey_algo = "rsa"; goto rsa_pkcs1;
break;
case OID_sha256WithRSAEncryption: case OID_sha256WithRSAEncryption:
ctx->cert->sig->hash_algo = "sha256"; ctx->cert->sig->hash_algo = "sha256";
ctx->cert->sig->pkey_algo = "rsa"; goto rsa_pkcs1;
break;
case OID_sha384WithRSAEncryption: case OID_sha384WithRSAEncryption:
ctx->cert->sig->hash_algo = "sha384"; ctx->cert->sig->hash_algo = "sha384";
ctx->cert->sig->pkey_algo = "rsa"; goto rsa_pkcs1;
break;
case OID_sha512WithRSAEncryption: case OID_sha512WithRSAEncryption:
ctx->cert->sig->hash_algo = "sha512"; ctx->cert->sig->hash_algo = "sha512";
ctx->cert->sig->pkey_algo = "rsa"; goto rsa_pkcs1;
break;
case OID_sha224WithRSAEncryption: case OID_sha224WithRSAEncryption:
ctx->cert->sig->hash_algo = "sha224"; ctx->cert->sig->hash_algo = "sha224";
ctx->cert->sig->pkey_algo = "rsa"; goto rsa_pkcs1;
break;
} }
rsa_pkcs1:
ctx->cert->sig->pkey_algo = "rsa";
ctx->cert->sig->encoding = "pkcs1";
ctx->algo_oid = ctx->last_oid; ctx->algo_oid = ctx->last_oid;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment