]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[crypto] Define ASN.1 OID-identified algorithms for all supported digests
authorMichael Brown <mcb30@ipxe.org>
Wed, 21 Mar 2012 14:18:06 +0000 (14:18 +0000)
committerMichael Brown <mcb30@ipxe.org>
Thu, 22 Mar 2012 00:31:22 +0000 (00:31 +0000)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/crypto/md5.c
src/crypto/sha1.c
src/crypto/sha256.c

index 2d0d03d130eceb40729d0a95c2f88b41a165fcb7..b8b7b43dd0486ecd9e93ce7e4d19115286a8eb56 100644 (file)
@@ -30,6 +30,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
 #include <assert.h>
 #include <ipxe/rotate.h>
 #include <ipxe/crypto.h>
+#include <ipxe/asn1.h>
 #include <ipxe/md5.h>
 
 /** MD5 variables */
@@ -284,3 +285,13 @@ struct digest_algorithm md5_algorithm = {
        .update         = md5_update,
        .final          = md5_final,
 };
+
+/** "md5" object identifier */
+static uint8_t oid_md5[] = { ASN1_OID_MD5 };
+
+/** "md5" OID-identified algorithm */
+struct asn1_algorithm oid_md5_algorithm __asn1_algorithm = {
+       .name = "md5",
+       .digest = &md5_algorithm,
+       .oid = ASN1_OID_CURSOR ( oid_md5 ),
+};
index fd271a638af90160a27f86f7dd24c2587585a86d..7f287d3c4e2c7cbd9dbdbf8ea4f7feb92c0b4ff8 100644 (file)
@@ -30,6 +30,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
 #include <assert.h>
 #include <ipxe/rotate.h>
 #include <ipxe/crypto.h>
+#include <ipxe/asn1.h>
 #include <ipxe/sha1.h>
 
 /** SHA-1 variables */
@@ -258,3 +259,13 @@ struct digest_algorithm sha1_algorithm = {
        .update         = sha1_update,
        .final          = sha1_final,
 };
+
+/** "sha1" object identifier */
+static uint8_t oid_sha1[] = { ASN1_OID_SHA1 };
+
+/** "sha1" OID-identified algorithm */
+struct asn1_algorithm oid_sha1_algorithm __asn1_algorithm = {
+       .name = "sha1",
+       .digest = &sha1_algorithm,
+       .oid = ASN1_OID_CURSOR ( oid_sha1 ),
+};
index 6736a5773fe2fc36a5f3a9cba8a0e4076481bc14..e85d20067132a1ee58c4f37500045523e7ff1a5e 100644 (file)
@@ -30,6 +30,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
 #include <assert.h>
 #include <ipxe/rotate.h>
 #include <ipxe/crypto.h>
+#include <ipxe/asn1.h>
 #include <ipxe/sha256.h>
 
 /** SHA-256 variables */
@@ -242,3 +243,13 @@ struct digest_algorithm sha256_algorithm = {
        .update         = sha256_update,
        .final          = sha256_final,
 };
+
+/** "sha256" object identifier */
+static uint8_t oid_sha256[] = { ASN1_OID_SHA256 };
+
+/** "sha256" OID-identified algorithm */
+struct asn1_algorithm oid_sha256_algorithm __asn1_algorithm = {
+       .name = "sha256",
+       .digest = &sha256_algorithm,
+       .oid = ASN1_OID_CURSOR ( oid_sha256 ),
+};