Commit 049e2e85e270c6c2a04cc9238058fde233c0298e

Daniel Mendler 2019-10-15T14:02:22

add back missing symbols

diff --git a/bn_deprecated.c b/bn_deprecated.c
index 3c28ee6..a2c4b2e 100644
--- a/bn_deprecated.c
+++ b/bn_deprecated.c
@@ -231,63 +231,55 @@ mp_err mp_n_root(const mp_int *a, mp_digit b, mp_int *c)
    return mp_root_u32(a, (uint32_t)b, c);
 }
 #endif
-
 #ifdef BN_MP_UNSIGNED_BIN_SIZE_C
 int mp_unsigned_bin_size(const mp_int *a)
 {
    return (int)mp_ubin_size(a);
 }
 #endif
-
 #ifdef BN_MP_READ_UNSIGNED_BIN_C
 mp_err mp_read_unsigned_bin(mp_int *a, const unsigned char *b, int c)
 {
    return mp_from_ubin(a, b, (size_t) c);
 }
 #endif
-
 #ifdef BN_MP_TO_UNSIGNED_BIN_C
 mp_err mp_to_unsigned_bin(const mp_int *a, unsigned char *b)
 {
    return mp_to_ubin(a, b, SIZE_MAX, NULL);
 }
 #endif
-
 #ifdef BN_MP_TO_UNSIGNED_BIN_N_C
 mp_err mp_to_unsigned_bin_n(const mp_int *a, unsigned char *b, unsigned long *outlen)
 {
-   if (*outlen < (unsigned long)mp_ubin_size(a)) {
+   size_t n = mp_ubin_size(a);
+   if (*outlen < (unsigned long)n) {
       return MP_VAL;
    }
-   /* TODO: or use "outlen" instead of NULL? */
-   *outlen = (unsigned long)mp_ubin_size(a);
-   return mp_to_ubin(a, b, (size_t)(*outlen), NULL);
+   *outlen = (unsigned long)n;
+   return mp_to_ubin(a, b, n, NULL);
 }
 #endif
-
 #ifdef BN_MP_SIGNED_BIN_SIZE_C
 int mp_signed_bin_size(const mp_int *a)
 {
    return (int)mp_sbin_size(a);
 }
 #endif
-
 #ifdef BN_MP_READ_SIGNED_BIN_C
 mp_err mp_read_signed_bin(mp_int *a, const unsigned char *b, int c)
 {
    return mp_from_sbin(a, b, (size_t) c);
 }
 #endif
-
 #ifdef BN_MP_TO_SIGNED_BIN_C
-mp_err mp_to_unsigned_bin(const mp_int *a, unsigned char *b)
+mp_err mp_to_signed_bin(const mp_int *a, unsigned char *b)
 {
    return mp_to_sbin(a, b, SIZE_MAX, NULL);
 }
 #endif
-
 #ifdef BN_MP_TO_SIGNED_BIN_N_C
-mp_err mp_to_unsigned_bin_n(const mp_int *a, unsigned char *b, unsigned long *outlen)
+mp_err mp_to_signed_bin_n(const mp_int *a, unsigned char *b, unsigned long *outlen)
 {
    if (*outlen < (unsigned long)mp_sbin_size(a)) {
       return MP_VAL;
@@ -296,10 +288,6 @@ mp_err mp_to_unsigned_bin_n(const mp_int *a, unsigned char *b, unsigned long *ou
    return mp_to_sbin(a, b, (size_t)(*outlen), NULL);
 }
 #endif
-
-
-
-
 #ifdef BN_MP_TORADIX_N_C
 mp_err mp_toradix_n(const mp_int *a, char *str, int radix, int maxlen)
 {
diff --git a/tommath_class.h b/tommath_class.h
index 3abb55a..d70fe9f 100644
--- a/tommath_class.h
+++ b/tommath_class.h
@@ -232,6 +232,8 @@
 #   define BN_MP_TORADIX_N_C
 #   define BN_MP_TO_RADIX_C
 #   define BN_MP_TO_SBIN_C
+#   define BN_MP_TO_SIGNED_BIN_C
+#   define BN_MP_TO_SIGNED_BIN_N_C
 #   define BN_MP_TO_UBIN_C
 #   define BN_MP_TO_UNSIGNED_BIN_C
 #   define BN_MP_TO_UNSIGNED_BIN_N_C