diff options
author | Werner Koch <wk@gnupg.org> | 2017-07-18 10:16:07 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2017-07-18 10:16:16 +0200 |
commit | ecf73dafb7aafed0d0f339d07235b58c2113f94c (patch) | |
tree | 8f3f5322b6943fa2859bf1fa1a1c9fef5486d195 /tests | |
parent | de1e12504dd72bbedd3441be9aab3cad6dbca251 (diff) | |
download | libgcrypt-ecf73dafb7aafed0d0f339d07235b58c2113f94c.tar.gz |
api: New function gcry_mpi_point_copy.
* src/gcrypt.h.in (gcry_mpi_point_copy): New.
(mpi_point_copy): New macro.
* src/visibility.c (gcry_mpi_point_copy): New.
* src/libgcrypt.def, src/libgcrypt.vers: Add function.
* mpi/ec.c (_gcry_mpi_point_copy): New.
* tests/t-mpi-point.c (set_get_point): Add test.
Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/t-mpi-point.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/t-mpi-point.c b/tests/t-mpi-point.c index 9919932c..1eaa08a5 100644 --- a/tests/t-mpi-point.c +++ b/tests/t-mpi-point.c @@ -306,7 +306,7 @@ ec_p_new (gcry_ctx_t *r_ctx, gcry_mpi_t p, gcry_mpi_t a) static void set_get_point (void) { - gcry_mpi_point_t point; + gcry_mpi_point_t point, point2; gcry_mpi_t x, y, z; wherestr = "set_get_point"; @@ -350,7 +350,22 @@ set_get_point (void) || gcry_mpi_cmp_ui (y, 42) || gcry_mpi_cmp_ui (z, 11371)) fail ("point_snatch_set/point_get failed\n"); + point2 = gcry_mpi_point_copy (point); + + gcry_mpi_point_get (x, y, z, point2); + if (gcry_mpi_cmp_ui (x, 17) + || gcry_mpi_cmp_ui (y, 42) || gcry_mpi_cmp_ui (z, 11371)) + fail ("point_copy failed (1)\n"); + gcry_mpi_point_release (point); + + gcry_mpi_point_get (x, y, z, point2); + if (gcry_mpi_cmp_ui (x, 17) + || gcry_mpi_cmp_ui (y, 42) || gcry_mpi_cmp_ui (z, 11371)) + fail ("point_copy failed (2)\n"); + + gcry_mpi_point_release (point2); + gcry_mpi_release (x); gcry_mpi_release (y); gcry_mpi_release (z); |