diff options
author | Michael Brown | 2012-03-21 15:18:06 +0100 |
---|---|---|
committer | Michael Brown | 2012-03-22 01:31:22 +0100 |
commit | d56499ab1887f6b9e2ec8635c1f5a93af2bb6ea8 (patch) | |
tree | cf474578ee3990e95439dee0e4cfd2b0de34e88a /src/crypto | |
parent | [crypto] Generalise X.509 OID-identified algorithm to asn1.c (diff) | |
download | ipxe-d56499ab1887f6b9e2ec8635c1f5a93af2bb6ea8.tar.gz ipxe-d56499ab1887f6b9e2ec8635c1f5a93af2bb6ea8.tar.xz ipxe-d56499ab1887f6b9e2ec8635c1f5a93af2bb6ea8.zip |
[crypto] Define ASN.1 OID-identified algorithms for all supported digests
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/crypto')
-rw-r--r-- | src/crypto/md5.c | 11 | ||||
-rw-r--r-- | src/crypto/sha1.c | 11 | ||||
-rw-r--r-- | src/crypto/sha256.c | 11 |
3 files changed, 33 insertions, 0 deletions
diff --git a/src/crypto/md5.c b/src/crypto/md5.c index 2d0d03d1..b8b7b43d 100644 --- a/src/crypto/md5.c +++ b/src/crypto/md5.c @@ -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 ), +}; diff --git a/src/crypto/sha1.c b/src/crypto/sha1.c index fd271a63..7f287d3c 100644 --- a/src/crypto/sha1.c +++ b/src/crypto/sha1.c @@ -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 ), +}; diff --git a/src/crypto/sha256.c b/src/crypto/sha256.c index 6736a577..e85d2006 100644 --- a/src/crypto/sha256.c +++ b/src/crypto/sha256.c @@ -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 ), +}; |