Commit 67f7d60b3a08a3e3ec51c29c25767a9d9d0bd2b1
1 parent
206ce59a10
Exists in
smarc-imx_3.14.28_1.0.0_ga
and in
1 other branch
KEYS: Store public key algo ID in public_key struct
Store public key algo ID in public_key struct for reference purposes. This allows it to be removed from the x509_certificate struct and used to find a default in public_key_verify_signature(). Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Kees Cook <keescook@chromium.org> Reviewed-by: Josh Boyer <jwboyer@redhat.com>
Showing 4 changed files with 6 additions and 5 deletions Side-by-side Diff
crypto/asymmetric_keys/x509_cert_parser.c
... | ... | @@ -343,8 +343,9 @@ |
343 | 343 | if (ctx->last_oid != OID_rsaEncryption) |
344 | 344 | return -ENOPKG; |
345 | 345 | |
346 | - /* There seems to be an extraneous 0 byte on the front of the data */ | |
347 | - ctx->cert->pkey_algo = PKEY_ALGO_RSA; | |
346 | + ctx->cert->pub->pkey_algo = PKEY_ALGO_RSA; | |
347 | + | |
348 | + /* Discard the BIT STRING metadata */ | |
348 | 349 | ctx->key = value + 1; |
349 | 350 | ctx->key_size = vlen - 1; |
350 | 351 | return 0; |
crypto/asymmetric_keys/x509_parser.h
... | ... | @@ -20,7 +20,6 @@ |
20 | 20 | char *authority; /* Authority key fingerprint as hex */ |
21 | 21 | struct tm valid_from; |
22 | 22 | struct tm valid_to; |
23 | - enum pkey_algo pkey_algo : 8; /* Public key algorithm */ | |
24 | 23 | enum pkey_algo sig_pkey_algo : 8; /* Signature public key algorithm */ |
25 | 24 | enum pkey_hash_algo sig_hash_algo : 8; /* Signature hash algorithm */ |
26 | 25 | const void *tbs; /* Signed data */ |
crypto/asymmetric_keys/x509_public_key.c
... | ... | @@ -108,7 +108,7 @@ |
108 | 108 | |
109 | 109 | pr_devel("Cert Issuer: %s\n", cert->issuer); |
110 | 110 | pr_devel("Cert Subject: %s\n", cert->subject); |
111 | - pr_devel("Cert Key Algo: %s\n", pkey_algo_name[cert->pkey_algo]); | |
111 | + pr_devel("Cert Key Algo: %s\n", pkey_algo_name[cert->pub->pkey_algo]); | |
112 | 112 | pr_devel("Cert Valid From: %04ld-%02d-%02d %02d:%02d:%02d\n", |
113 | 113 | cert->valid_from.tm_year + 1900, cert->valid_from.tm_mon + 1, |
114 | 114 | cert->valid_from.tm_mday, cert->valid_from.tm_hour, |
... | ... | @@ -165,7 +165,7 @@ |
165 | 165 | goto error_free_cert; |
166 | 166 | } |
167 | 167 | |
168 | - cert->pub->algo = pkey_algo[cert->pkey_algo]; | |
168 | + cert->pub->algo = pkey_algo[cert->pub->pkey_algo]; | |
169 | 169 | cert->pub->id_type = PKEY_ID_X509; |
170 | 170 | |
171 | 171 | /* Check the signature on the key */ |