Skip to content

Commit f0e91d0

Browse files
authored
Merge pull request #86 from sebastian-carpenter/ecc-bad-sig-padding
small ecc signatures have bad padding
2 parents a6779c2 + 9172130 commit f0e91d0

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

scripts/build_ffi.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,7 @@ def build_ffi(local_wolfssl, features):
559559
560560
int mp_init (mp_int * a);
561561
int mp_to_unsigned_bin (mp_int * a, unsigned char *b);
562+
int mp_to_unsigned_bin_len (mp_int * a, unsigned char *b, int c);
562563
int mp_read_unsigned_bin (mp_int * a, const unsigned char *b, int c);
563564
"""
564565

wolfcrypt/ciphers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,11 +1390,11 @@ def sign_raw(self, plaintext, rng=Random()):
13901390
if ret != 0: # pragma: no cover
13911391
raise WolfCryptError("Signature error (%d)" % ret)
13921392

1393-
ret = _lib.mp_to_unsigned_bin(R, R_bin)
1393+
ret = _lib.mp_to_unsigned_bin_len(R, R_bin, self.size)
13941394
if ret != 0: # pragma: no cover
13951395
raise WolfCryptError("wolfCrypt error (%d)" % ret)
13961396

1397-
ret = _lib.mp_to_unsigned_bin(S, S_bin)
1397+
ret = _lib.mp_to_unsigned_bin_len(S, S_bin, self.size)
13981398
if ret != 0: # pragma: no cover
13991399
raise WolfCryptError("wolfCrypt error (%d)" % ret)
14001400

0 commit comments

Comments
 (0)