diff options
author | Werner Koch <wk@gnupg.org> | 2013-11-04 16:47:13 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2013-11-05 17:26:52 +0100 |
commit | 630aca794ddf057fb7265b7dc346374743036af4 (patch) | |
tree | 3c9d55d4567e3c2c919ebd720c6798df50eeedb4 /src | |
parent | d50a88d1e29124d038196fec6082fd093e922604 (diff) | |
download | libgcrypt-630aca794ddf057fb7265b7dc346374743036af4.tar.gz |
mpi: Add function gcry_mpi_set_opaque_copy.
* src/gcrypt.h.in (gcry_mpi_set_opaque_copy): New.
* src/visibility.c (gcry_mpi_set_opaque_copy): New.
* src/visibility.h (gcry_mpi_set_opaque_copy): Mark visible.
* src/libgcrypt.def, src/libgcrypt.vers: Add new API.
* tests/mpitests.c (test_opaque): Add test.
Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/gcrypt.h.in | 10 | ||||
-rw-r--r-- | src/libgcrypt.def | 2 | ||||
-rw-r--r-- | src/libgcrypt.vers | 3 | ||||
-rw-r--r-- | src/visibility.c | 6 | ||||
-rw-r--r-- | src/visibility.h | 5 |
5 files changed, 22 insertions, 4 deletions
diff --git a/src/gcrypt.h.in b/src/gcrypt.h.in index 2742556e..234e8a4a 100644 --- a/src/gcrypt.h.in +++ b/src/gcrypt.h.in @@ -726,10 +726,18 @@ void gcry_mpi_rshift (gcry_mpi_t x, gcry_mpi_t a, unsigned int n); void gcry_mpi_lshift (gcry_mpi_t x, gcry_mpi_t a, unsigned int n); /* Store NBITS of the value P points to in A and mark A as an opaque - value. WARNING: Never use an opaque MPI for anything thing else than + value. On success A received the the ownership of the value P. + WARNING: Never use an opaque MPI for anything thing else than gcry_mpi_release, gcry_mpi_get_opaque. */ gcry_mpi_t gcry_mpi_set_opaque (gcry_mpi_t a, void *p, unsigned int nbits); +/* Store NBITS of the value P points to in A and mark A as an opaque + value. The function takes a copy of the provided value P. + WARNING: Never use an opaque MPI for anything thing else than + gcry_mpi_release, gcry_mpi_get_opaque. */ +gcry_mpi_t gcry_mpi_set_opaque_copy (gcry_mpi_t a, + const void *p, unsigned int nbits); + /* Return a pointer to an opaque value stored in A and return its size in NBITS. Note that the returned pointer is still owned by A and that the function should never be used for an non-opaque MPI. */ diff --git a/src/libgcrypt.def b/src/libgcrypt.def index 64ba370c..e2aba2bd 100644 --- a/src/libgcrypt.def +++ b/src/libgcrypt.def @@ -259,5 +259,7 @@ EXPORTS gcry_cipher_gettag @227 gcry_cipher_checktag @228 + gcry_mpi_set_opaque_copy @229 + ;; end of file with public symbols for Windows. diff --git a/src/libgcrypt.vers b/src/libgcrypt.vers index 93eaa932..c3a09b86 100644 --- a/src/libgcrypt.vers +++ b/src/libgcrypt.vers @@ -88,7 +88,8 @@ GCRYPT_1.6 { gcry_mpi_mul_2exp; gcry_mpi_mul_ui; gcry_mpi_mulm; gcry_mpi_new; gcry_mpi_powm; gcry_mpi_print; gcry_mpi_randomize; gcry_mpi_release; gcry_mpi_rshift; gcry_mpi_scan; gcry_mpi_set; gcry_mpi_set_bit; - gcry_mpi_set_flag; gcry_mpi_set_highbit; gcry_mpi_set_opaque; + gcry_mpi_set_flag; gcry_mpi_set_highbit; + gcry_mpi_set_opaque; gcry_mpi_set_opaque_copy; gcry_mpi_set_ui; gcry_mpi_snew; gcry_mpi_sub; gcry_mpi_sub_ui; gcry_mpi_subm; gcry_mpi_swap; gcry_mpi_test_bit; gcry_mpi_lshift; gcry_mpi_snatch; diff --git a/src/visibility.c b/src/visibility.c index 1f7bb3ad..852bdf98 100644 --- a/src/visibility.c +++ b/src/visibility.c @@ -629,6 +629,12 @@ gcry_mpi_set_opaque (gcry_mpi_t a, void *p, unsigned int nbits) return _gcry_mpi_set_opaque (a, p, nbits); } +gcry_mpi_t +gcry_mpi_set_opaque_copy (gcry_mpi_t a, const void *p, unsigned int nbits) +{ + return _gcry_mpi_set_opaque_copy (a, p, nbits); +} + void * gcry_mpi_get_opaque (gcry_mpi_t a, unsigned int *nbits) { diff --git a/src/visibility.h b/src/visibility.h index b2fa4c01..438db5bf 100644 --- a/src/visibility.h +++ b/src/visibility.h @@ -603,6 +603,7 @@ MARK_VISIBLE (gcry_mpi_set_bit) MARK_VISIBLE (gcry_mpi_set_flag) MARK_VISIBLE (gcry_mpi_set_highbit) MARK_VISIBLE (gcry_mpi_set_opaque) +MARK_VISIBLEX(gcry_mpi_set_opaque_copy) MARK_VISIBLE (gcry_mpi_set_ui) MARK_VISIBLE (gcry_mpi_snew) MARK_VISIBLE (gcry_mpi_sub) @@ -632,8 +633,8 @@ MARK_VISIBLEX(_gcry_mpi_get_const) between a public and an internal version is that the internal version use gpg_err_code_t and the public version gpg_error_t. */ -#define gcry_sexp_extract_param _gcry_USE_THE_UNDERSCORED_FUNCTION - +#define gcry_sexp_extract_param _gcry_USE_THE_UNDERSCORED_FUNCTION +#define gcry_mpi_set_opaque_copy _gcry_USE_THE_UNDERSCORED_FUNCTION #endif /*!_GCRY_INCLUDED_BY_VISIBILITY_C*/ |