add back missing symbols
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
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