aboutsummaryrefslogtreecommitdiff
path: root/include/libssh/libmbedcrypto.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/libssh/libmbedcrypto.h')
-rw-r--r--include/libssh/libmbedcrypto.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/libssh/libmbedcrypto.h b/include/libssh/libmbedcrypto.h
index c2afddf5..00d5ba8c 100644
--- a/include/libssh/libmbedcrypto.h
+++ b/include/libssh/libmbedcrypto.h
@@ -118,6 +118,14 @@ int ssh_mbedcry_hex2bn(bignum *dest, char *data);
mbedtls_mpi_size(num))
#define bignum_cmp(num1, num2) mbedtls_mpi_cmp_mpi(num1, num2)
#define bignum_rshift1(dest, src) mbedtls_mpi_copy(dest, src), mbedtls_mpi_shift_r(dest, 1)
+#define bignum_dup(orig, dest) do { \
+ if (*(dest) == NULL) { \
+ *(dest) = bignum_new(); \
+ } \
+ if (*(dest) != NULL) { \
+ mbedtls_mpi_copy(orig, *(dest)); \
+ } \
+ } while(0)
mbedtls_ctr_drbg_context *ssh_get_mbedtls_ctr_drbg_context(void);