diff --git a/scripts/build_ffi.py b/scripts/build_ffi.py index 159323e..18caa3a 100644 --- a/scripts/build_ffi.py +++ b/scripts/build_ffi.py @@ -559,6 +559,7 @@ def build_ffi(local_wolfssl, features): int mp_init (mp_int * a); int mp_to_unsigned_bin (mp_int * a, unsigned char *b); + int mp_to_unsigned_bin_len (mp_int * a, unsigned char *b, int c); int mp_read_unsigned_bin (mp_int * a, const unsigned char *b, int c); """ diff --git a/wolfcrypt/ciphers.py b/wolfcrypt/ciphers.py index eb3f27f..d71c847 100644 --- a/wolfcrypt/ciphers.py +++ b/wolfcrypt/ciphers.py @@ -1390,11 +1390,11 @@ def sign_raw(self, plaintext, rng=Random()): if ret != 0: # pragma: no cover raise WolfCryptError("Signature error (%d)" % ret) - ret = _lib.mp_to_unsigned_bin(R, R_bin) + ret = _lib.mp_to_unsigned_bin_len(R, R_bin, self.size) if ret != 0: # pragma: no cover raise WolfCryptError("wolfCrypt error (%d)" % ret) - ret = _lib.mp_to_unsigned_bin(S, S_bin) + ret = _lib.mp_to_unsigned_bin_len(S, S_bin, self.size) if ret != 0: # pragma: no cover raise WolfCryptError("wolfCrypt error (%d)" % ret)