aboutsummaryrefslogtreecommitdiff
path: root/asn1.c
diff options
context:
space:
mode:
authorPaul Selkirk <paul@psgd.org>2018-02-27 18:04:39 +0100
committerPaul Selkirk <paul@psgd.org>2018-04-19 18:59:01 -0400
commita478fe1230efae768c72b8cdb29e2887e4226312 (patch)
tree4803bc024458a0e4904ee1546e4f9b454f92c27f /asn1.c
parentefc47f47581bb164440b86e9e57382972a32dbe8 (diff)
Implement hash-based signatures, per draft-mcgrew-hash-sigs-08.txt
Diffstat (limited to 'asn1.c')
-rw-r--r--asn1.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/asn1.c b/asn1.c
index 1f4a14a..37318a9 100644
--- a/asn1.c
+++ b/asn1.c
@@ -77,6 +77,10 @@ const uint8_t hal_asn1_oid_aesKeyWrap[] = { 0x60, 0x86, 0x48, 0x01, 0x65, 0x03,
const size_t hal_asn1_oid_aesKeyWrap_len = sizeof(hal_asn1_oid_aesKeyWrap);
#endif
+/* from draft-housley-cms-mts-hash-sig-07.txt */
+const uint8_t hal_asn1_oid_mts_hashsig[] = { 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x10, 0x03, 0x11 };
+const size_t hal_asn1_oid_mts_hashsig_len = sizeof(hal_asn1_oid_mts_hashsig);
+
/*
* Encode tag and length fields of an ASN.1 object.
*
@@ -932,6 +936,12 @@ hal_error_t hal_asn1_guess_key_type(hal_key_type_t *type,
return err;
}
+ if (alg_oid_len == hal_asn1_oid_mts_hashsig_len && memcmp(alg_oid, hal_asn1_oid_mts_hashsig, alg_oid_len) == 0) {
+ *type = public ? HAL_KEY_TYPE_HASHSIG_PUBLIC : HAL_KEY_TYPE_HASHSIG_PRIVATE;
+ *curve = HAL_CURVE_NONE;
+ return HAL_OK;
+ }
+
*type = HAL_KEY_TYPE_NONE;
*curve = HAL_CURVE_NONE;
return HAL_ERROR_UNSUPPORTED_KEY;