PKCS#7: Add OIDs for sha224, sha284 and sha512 hash algos and use them
Subsystems (2)
David Howells
maintainerPATCH 1/1 PKCS#7: Add OIDs for sha224, sha284 and sha512 hash algos and use them
Add OIDs for sha224, sha284 and sha512 hash algos and use them to select the hashing algorithm. Without this, something like the following error might get written to dmesg:
[ 31.829322] PKCS7: Unknown OID: [32] 2.16.840.1.101.3.4.2.3 [ 31.829328] PKCS7: Unknown OID: [180] 2.16.840.1.101.3.4.2.3 [ 31.829330] Unsupported digest algo: 55
Where the 55 on the third line is OID__NR indicating an unknown OID.
---
crypto/asymmetric_keys/mscode_parser.c | 9 +++++++++ crypto/asymmetric_keys/pkcs7_parser.c | 8 ++++++++ include/linux/oid_registry.h | 3 +++ 3 files changed, 20 insertions(+)
crypto/asymmetric_keys/mscode_parser.c +9 -0
@@ -97,6 +97,15 @@ int mscode_note_digest_algo(void *context, size_t hdrlen,case OID_sha256: ctx->digest_algo =HASH_ALGO_SHA256 ;break ; +case OID_sha384: + ctx->digest_algo =HASH_ALGO_SHA384 ; +break ; +case OID_sha512: + ctx->digest_algo =HASH_ALGO_SHA512 ; +break ; +case OID_sha224: + ctx->digest_algo =HASH_ALGO_SHA224 ; +break ;case OID__NR :sprint_oid (value, vlen, buffer,sizeof (buffer));
crypto/asymmetric_keys/pkcs7_parser.c +8 -0
@@ -229,6 +229,14 @@ int pkcs7_sig_note_digest_algo(void *context, size_t hdrlen,case OID_sha256: ctx->sinfo->sig.pkey_hash_algo =HASH_ALGO_SHA256 ;break ; +case OID_sha384: + ctx->sinfo->sig.pkey_hash_algo =HASH_ALGO_SHA384 ; +break ; +case OID_sha512: + ctx->sinfo->sig.pkey_hash_algo =HASH_ALGO_SHA512 ; +break ; +case OID_sha224: + ctx->sinfo->sig.pkey_hash_algo =HASH_ALGO_SHA224 ;default :printk ("Unsupported digest algo: %u\n" , ctx->last_oid);return -ENOPKG ;
include/linux/oid_registry.h +3 -0
@@ -63,6 +63,9 @@ enum OID { OID_certAuthInfoAccess,/* 1.3.6.1.5.5.7.1.1 */ OID_sha1,/* 1.3.14.3.2.26 */ OID_sha256,/* 2.16.840.1.101.3.4.2.1 */ + OID_sha384,/* 2.16.840.1.101.3.4.2.2 */ + OID_sha512,/* 2.16.840.1.101.3.4.2.3 */ + OID_sha224,/* 2.16.840.1.101.3.4.2.4 */ /* Distinguished Name attribute IDs [RFC 2256] */ OID_commonName, /* 2.5.4.3 */
Quoted 8 lines · David Howells
Add OIDs for sha224, sha284 and sha512 hash algos and use them to select the hashing algorithm. Without this, something like the following error might get written to dmesg:
[ 31.829322] PKCS7: Unknown OID: [32] 2.16.840.1.101.3.4.2.3 [ 31.829328] PKCS7: Unknown OID: [180] 2.16.840.1.101.3.4.2.3 [ 31.829330] Unsupported digest algo: 55
Quoted 6 lines
Where the 55 on the third line is
OID__NRindicating an unknown OID.Reported-by Valdis Kletnieks <[email protected]>Signed-off-by David Howells <[email protected]>Tested-by Valdis Kletnieks <[email protected]>---
Please always specify which kernel a patch/pull request is for.
Signature · 2 lines
James Morris <[email protected]>
Quoted 10 lines · James Morris
Quoted 8 lines · David Howells
Add OIDs for sha224, sha284 and sha512 hash algos and use them to select the hashing algorithm. Without this, something like the following error might get written to dmesg:
[ 31.829322] PKCS7: Unknown OID: [32] 2.16.840.1.101.3.4.2.3 [ 31.829328] PKCS7: Unknown OID: [180] 2.16.840.1.101.3.4.2.3 [ 31.829330] Unsupported digest algo: 55
Quoted 8 lines
Quoted 6 lines
Where the 55 on the third line is
OID__NRindicating an unknown OID.Reported-by Valdis Kletnieks <[email protected]>Signed-off-by David Howells <[email protected]>Tested-by Valdis Kletnieks <[email protected]>---
Please always specify which kernel a patch/pull request is for.
The patch was tested against linux-next 20150826....
David Howells
maintainerQuoted 1 line · James Morris
Please always specify which kernel a patch/pull request is for.
security/next in this case.
David