[Cryptech-Commits] [sw/libhal] 07/07: ASN.1 bugfixes.

git at cryptech.is git at cryptech.is
Tue Aug 25 05:03:28 UTC 2015


This is an automated email from the git hooks/post-receive script.

sra at hactrn.net pushed a commit to branch ecdsa
in repository sw/libhal.

commit a4930dbbac93b3637a6f99a443dca55319c35d92
Author: Rob Austein <sra at hactrn.net>
Date:   Tue Aug 25 01:01:30 2015 -0400

    ASN.1 bugfixes.
---
 asn1.c  | 2 ++
 ecdsa.c | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/asn1.c b/asn1.c
index cfbd319..6727128 100644
--- a/asn1.c
+++ b/asn1.c
@@ -85,6 +85,8 @@ hal_error_t hal_asn1_encode_header(const uint8_t tag,
   if (value_len + header_len > der_max)
     return HAL_ERROR_RESULT_TOO_LONG;
 
+  *der++ = tag;
+
   if (value_len < 128) {
     *der = (uint8_t) value_len;
   }
diff --git a/ecdsa.c b/ecdsa.c
index a657aaf..46484dc 100644
--- a/ecdsa.c
+++ b/ecdsa.c
@@ -1153,7 +1153,7 @@ hal_error_t hal_ecdsa_sign(const hal_ecdsa_key_t * const key,
 
   uint8_t * const r_out = signature + *signature_len;
   uint8_t * const s_out = r_out + r_len;
-  signature_len += r_len + s_len;
+  *signature_len += r_len + s_len;
   assert(*signature_len <= signature_max);
 
   if ((err = hal_asn1_encode_integer(r, r_out, NULL, signature_max - (r_out - signature))) != HAL_OK ||



More information about the Commits mailing list