Merge pull request #373 from libtom/missing-symbols

add back missing symbols
This commit is contained in:
Steffen Jaeckel 2019-10-15 14:46:40 +02:00 committed by GitHub
commit 8365614f59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 21 deletions

View File

@ -231,75 +231,64 @@ 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)) {
size_t n = mp_sbin_size(a);
if (*outlen < (unsigned long)n) {
return MP_VAL;
}
*outlen = (unsigned long)mp_sbin_size(a);
return mp_to_sbin(a, b, (size_t)(*outlen), NULL);
*outlen = (unsigned long)n;
return mp_to_sbin(a, b, n, NULL);
}
#endif
#ifdef BN_MP_TORADIX_N_C
mp_err mp_toradix_n(const mp_int *a, char *str, int radix, int maxlen)
{

View File

@ -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