diff --git a/include/libssh/libmbedcrypto.h b/include/libssh/libmbedcrypto.h index e6fc393cd31823288f61f56dc5929183ce27e9cf..6cf186261d1be88b70d98309fb4d6496a6ad0a59 100644 --- a/include/libssh/libmbedcrypto.h +++ b/include/libssh/libmbedcrypto.h @@ -79,7 +79,7 @@ extern "C" { bignum ssh_mbedcry_bn_new(void); void ssh_mbedcry_bn_free(bignum num); -unsigned char *ssh_mbedcry_bn2num(const_bignum num, int radix); +char *ssh_mbedcry_bn2num(const_bignum num, int radix); int ssh_mbedcry_rand(bignum rnd, int bits, int top, int bottom); int ssh_mbedcry_is_bit_set(bignum num, size_t pos); int ssh_mbedcry_rand_range(bignum dest, bignum max); @@ -105,7 +105,7 @@ int ssh_mbedcry_hex2bn(bignum *dest, char *data); } while(0) #define bignum_bn2dec(num) ssh_mbedcry_bn2num(num, 10) #define bignum_dec2bn(data, bn) mbedtls_mpi_read_string(bn, 10, data) -#define bignum_bn2hex(num, dest) (*dest)=ssh_mbedcry_bn2num(num, 16) +#define bignum_bn2hex(num, dest) (*dest)=(unsigned char *)ssh_mbedcry_bn2num(num, 16) #define bignum_hex2bn(data, dest) ssh_mbedcry_hex2bn(dest, data) #define bignum_rand(rnd, bits) ssh_mbedcry_rand((rnd), (bits), 0, 1) #define bignum_rand_range(rnd, max) ssh_mbedcry_rand_range(rnd, max) diff --git a/src/mbedcrypto_missing.c b/src/mbedcrypto_missing.c index ac0d688c9bd206f4e1a798ea43a4c8884b28010a..fb35ca473ecd70a6e174917ac90a147c695da782 100644 --- a/src/mbedcrypto_missing.c +++ b/src/mbedcrypto_missing.c @@ -45,7 +45,7 @@ void ssh_mbedcry_bn_free(bignum bn) SAFE_FREE(bn); } -unsigned char *ssh_mbedcry_bn2num(const_bignum num, int radix) +char *ssh_mbedcry_bn2num(const_bignum num, int radix) { char *buf = NULL; size_t olen; @@ -67,7 +67,7 @@ unsigned char *ssh_mbedcry_bn2num(const_bignum num, int radix) return NULL; } - return (unsigned char *) buf; + return buf; } int ssh_mbedcry_rand(bignum rnd, int bits, int top, int bottom)