History

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.

David Howells committed 11 years ago

Commit 07f081f1 parent 3f1d44a3 files · +20 −0Browse files

Unified · Split

3 files
  1. crypto/asymmetric_keys/mscode_parser.c +9 −0
  2. crypto/asymmetric_keys/pkcs7_parser.c +8 −0
  3. include/linux/oid_registry.h +3 −0
crypto/asymmetric_keys/mscode_parser.c+9−0
@@ -97,6 +97,15 @@ int mscode_note_digest_algo(void *context, size_t hdrlen, · 96 unmodified lines
9797 case OID_sha256:
9898 ctx->digest_algo = HASH_ALGO_SHA256;
9999 break;
100+ case OID_sha384:
101+ ctx->digest_algo = HASH_ALGO_SHA384;
102+ break;
103+ case OID_sha512:
104+ ctx->digest_algo = HASH_ALGO_SHA512;
105+ break;
106+ case OID_sha224:
107+ ctx->digest_algo = HASH_ALGO_SHA224;
108+ break;
100109
101110 case OID__NR:
102111 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, · 228 unmodified lines
229229 case OID_sha256:
230230 ctx->sinfo->sig.pkey_hash_algo = HASH_ALGO_SHA256;
231231 break;
232+ case OID_sha384:
233+ ctx->sinfo->sig.pkey_hash_algo = HASH_ALGO_SHA384;
234+ break;
235+ case OID_sha512:
236+ ctx->sinfo->sig.pkey_hash_algo = HASH_ALGO_SHA512;
237+ break;
238+ case OID_sha224:
239+ ctx->sinfo->sig.pkey_hash_algo = HASH_ALGO_SHA224;
232240 default:
233241 printk("Unsupported digest algo: %u\n", ctx->last_oid);
234242 return -ENOPKG;
include/linux/oid_registry.h+3−0
@@ -63,6 +63,9 @@ enum OID { · 62 unmodified lines
6363 OID_certAuthInfoAccess, /* 1.3.6.1.5.5.7.1.1 */
6464 OID_sha1, /* 1.3.14.3.2.26 */
6565 OID_sha256, /* 2.16.840.1.101.3.4.2.1 */
66+ OID_sha384, /* 2.16.840.1.101.3.4.2.2 */
67+ OID_sha512, /* 2.16.840.1.101.3.4.2.3 */
68+ OID_sha224, /* 2.16.840.1.101.3.4.2.4 */
6669
6770 /* Distinguished Name attribute IDs [RFC 2256] */
6871 OID_commonName, /* 2.5.4.3 */