Skip to content

Commit b787302

Browse files
authored
Merge pull request #405 from libtom/pr/fix-ecc_import_openssl
fix ecc_import_openssl - bin_seed size
2 parents 6238b63 + 5efbddc commit b787302

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/pk/ecc/ecc_import_openssl.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static int _ecc_import_private_with_oid(const unsigned char *in, unsigned long i
2424

2525
/* ECPrivateKey SEQUENCE */
2626
LTC_SET_ASN1(custom, 0, LTC_ASN1_OBJECT_IDENTIFIER, curveoid, 16UL);
27-
LTC_SET_ASN1(custom, 1, LTC_ASN1_RAW_BIT_STRING, bin_xy, 8u*sizeof(bin_xy));
27+
LTC_SET_ASN1(custom, 1, LTC_ASN1_RAW_BIT_STRING, bin_xy, 8UL*sizeof(bin_xy));
2828
LTC_SET_ASN1(seq_priv, 0, LTC_ASN1_SHORT_INTEGER, &pkver, 1UL);
2929
LTC_SET_ASN1(seq_priv, 1, LTC_ASN1_OCTET_STRING, bin_k, sizeof(bin_k));
3030
LTC_SET_ASN1_CUSTOM_CONSTRUCTED(seq_priv, 2, LTC_ASN1_CL_CONTEXT_SPECIFIC, 0, custom); /* context specific 0 */
@@ -63,7 +63,7 @@ static int _ecc_import_private_with_curve(const unsigned char *in, unsigned long
6363

6464
/* ECPrivateKey SEQUENCE */
6565
LTC_SET_ASN1(custom, 0, LTC_ASN1_SEQUENCE, seq_ecparams, 6UL);
66-
LTC_SET_ASN1(custom, 1, LTC_ASN1_RAW_BIT_STRING, bin_xy, 8u*sizeof(bin_xy));
66+
LTC_SET_ASN1(custom, 1, LTC_ASN1_RAW_BIT_STRING, bin_xy, 8UL*sizeof(bin_xy));
6767
LTC_SET_ASN1(seq_priv, 0, LTC_ASN1_SHORT_INTEGER, &pkver, 1UL);
6868
LTC_SET_ASN1(seq_priv, 1, LTC_ASN1_OCTET_STRING, bin_k, sizeof(bin_k));
6969
LTC_SET_ASN1_CUSTOM_CONSTRUCTED(seq_priv, 2, LTC_ASN1_CL_CONTEXT_SPECIFIC, 0, custom); /* context specific 0 */
@@ -82,7 +82,7 @@ static int _ecc_import_private_with_curve(const unsigned char *in, unsigned long
8282
/* Curve SEQUENCE */
8383
LTC_SET_ASN1(seq_curve, 0, LTC_ASN1_OCTET_STRING, bin_a, sizeof(bin_a));
8484
LTC_SET_ASN1(seq_curve, 1, LTC_ASN1_OCTET_STRING, bin_b, sizeof(bin_b));
85-
LTC_SET_ASN1(seq_curve, 2, LTC_ASN1_RAW_BIT_STRING, bin_seed, sizeof(bin_seed));
85+
LTC_SET_ASN1(seq_curve, 2, LTC_ASN1_RAW_BIT_STRING, bin_seed, 8UL*sizeof(bin_seed));
8686
seq_curve[2].optional = 1;
8787
/* try to load private key */
8888
err = der_decode_sequence(in, inlen, seq_priv, 4);

0 commit comments

Comments
 (0)