diff options
author | Rob Austein <sra@hactrn.net> | 2015-08-22 17:47:22 -0400 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2015-08-22 17:47:22 -0400 |
commit | 9e4c5edc6ef46b4c182379eab46abb45e5d2022f (patch) | |
tree | 684c35799a6602f0bb9b7563258c0c1525a25b2b /asn1.c | |
parent | 511819f0f73c5f37d3f7c033f01d29ef88bfa9cb (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.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -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) { |