summaryrefslogtreecommitdiff
path: root/include/libssh/libgcrypt.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/libssh/libgcrypt.h')
-rw-r--r--include/libssh/libgcrypt.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/libssh/libgcrypt.h b/include/libssh/libgcrypt.h
index 4d98ece3..795d33e1 100644
--- a/include/libssh/libgcrypt.h
+++ b/include/libssh/libgcrypt.h
@@ -92,6 +92,13 @@ int ssh_gcry_rand_range(bignum rnd, bignum max);
#define bignum_sub(dst, a, b) gcry_mpi_sub(dst, a, b)
#define bignum_mod(dst, a, b, ctx) 1,gcry_mpi_mod(dst, a, b)
#define bignum_rand_range(rnd, max) ssh_gcry_rand_range(rnd, max);
+#define bignum_dup(orig, dest) do { \
+ if (*(dest) == NULL) { \
+ *(dest) = gcry_mpi_copy(orig); \
+ } else { \
+ gcry_mpi_set(*(dest), orig); \
+ } \
+ } while(0)
/* Helper functions for data conversions. */
/* Extract an MPI from the given s-expression SEXP named NAME which is