aboutsummaryrefslogtreecommitdiff
path: root/asn1.c
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2015-08-22 17:47:22 -0400
committerRob Austein <sra@hactrn.net>2015-08-22 17:47:22 -0400
commit9e4c5edc6ef46b4c182379eab46abb45e5d2022f (patch)
tree684c35799a6602f0bb9b7563258c0c1525a25b2b /asn1.c
parent511819f0f73c5f37d3f7c033f01d29ef88bfa9cb (diff)
Add hal_ecdsa_verify(). Move hashing out of ECDSA routines. Clean up
a few bits that didn't pass self-review.
Diffstat (limited to 'asn1.c')
-rw-r--r--asn1.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/asn1.c b/asn1.c
index f4b3610..cfbd319 100644
--- a/asn1.c
+++ b/asn1.c
@@ -144,6 +144,11 @@ hal_error_t hal_asn1_encode_integer(fp_int *bn,
return HAL_OK;
}
+/*
+ * Parse tag and length of an ASN.1 object. Tag must match value
+ * specified by the caller. On success, sets hlen and vlen to lengths
+ * of header and value, respectively.
+ */
hal_error_t hal_asn1_decode_header(const uint8_t tag,
const uint8_t * const der, size_t der_max,
@@ -176,6 +181,12 @@ hal_error_t hal_asn1_decode_header(const uint8_t tag,
return HAL_OK;
}
+/*
+ * Decode an ASN.1 INTEGER into a libtfm bignum. Since we only
+ * support (or need to support, or expect to see) unsigned integers,
+ * we return failure if the sign bit is set in the ASN.1 INTEGER.
+ */
+
hal_error_t hal_asn1_decode_integer(fp_int *bn,
const uint8_t * const der, size_t *der_len, const size_t der_max)
{