[git] GCRYPT - branch, master, updated. libgcrypt-1.7.3-122-gecf73da
by Werner Koch
cvs at cvs.gnupg.org
Tue Jul 18 10:21:09 CEST 2017
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU crypto library".
The branch, master has been updated
via ecf73dafb7aafed0d0f339d07235b58c2113f94c (commit)
from de1e12504dd72bbedd3441be9aab3cad6dbca251 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit ecf73dafb7aafed0d0f339d07235b58c2113f94c
Author: Werner Koch <wk at gnupg.org>
Date: Tue Jul 18 10:16:07 2017 +0200
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 at gnupg.org>
diff --git a/NEWS b/NEWS
index b29bb89..17c9a42 100644
--- a/NEWS
+++ b/NEWS
@@ -72,6 +72,7 @@ Noteworthy changes in version 1.8.0 (unreleased) [C21/A1/R_]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GCRYCTL_REINIT_SYSCALL_CLAMP NEW macro.
gcry_get_config NEW function.
+ gcry_mpi_point_copy NEW function.
gcry_md_info DEPRECATED.
diff --git a/doc/gcrypt.texi b/doc/gcrypt.texi
index cab1318..649332b 100644
--- a/doc/gcrypt.texi
+++ b/doc/gcrypt.texi
@@ -4876,6 +4876,13 @@ Release @var{point} and free all associated resources. Passing
@code{NULL} is allowed and ignored.
@end deftypefun
+ at deftypefun gcry_mpi_point_t gcry_mpi_point_copy (@w{gcry_mpi_point_t @var{point}})
+
+Allocate and return a new point object and initialize it with
+ at var{point}. If @var{point} is NULL the function is identical to
+ at code{gcry_mpi_point_new(0)}.
+ at end deftypefun
+
@deftypefun void gcry_mpi_point_get (@w{gcry_mpi_t @var{x}}, @
@w{gcry_mpi_t @var{y}}, @w{gcry_mpi_t @var{z}}, @
@w{gcry_mpi_point_t @var{point}})
diff --git a/mpi/ec.c b/mpi/ec.c
index 8a6a656..a0f7357 100644
--- a/mpi/ec.c
+++ b/mpi/ec.c
@@ -139,6 +139,20 @@ point_set (mpi_point_t d, mpi_point_t s)
}
+/* Return a copy of POINT. */
+gcry_mpi_point_t
+_gcry_mpi_point_copy (gcry_mpi_point_t point)
+{
+ mpi_point_t newpoint;
+
+ newpoint = _gcry_mpi_point_new (0);
+ if (point)
+ point_set (newpoint, point);
+
+ return newpoint;
+}
+
+
static void
point_resize (mpi_point_t p, mpi_ec_t ctx)
{
diff --git a/src/gcrypt-int.h b/src/gcrypt-int.h
index ef5337b..ddcafa5 100644
--- a/src/gcrypt-int.h
+++ b/src/gcrypt-int.h
@@ -400,6 +400,7 @@ int _gcry_mpi_gcd (gcry_mpi_t g, gcry_mpi_t a, gcry_mpi_t b);
int _gcry_mpi_invm (gcry_mpi_t x, gcry_mpi_t a, gcry_mpi_t m);
gcry_mpi_point_t _gcry_mpi_point_new (unsigned int nbits);
void _gcry_mpi_point_release (gcry_mpi_point_t point);
+gcry_mpi_point_t _gcry_mpi_point_copy (gcry_mpi_point_t point);
void _gcry_mpi_point_get (gcry_mpi_t x, gcry_mpi_t y, gcry_mpi_t z,
gcry_mpi_point_t point);
void _gcry_mpi_point_snatch_get (gcry_mpi_t x, gcry_mpi_t y, gcry_mpi_t z,
@@ -498,6 +499,8 @@ int _gcry_mpi_get_flag (gcry_mpi_t a, enum gcry_mpi_flag flag);
} \
while (0)
+#define mpi_point_copy(p) _gcry_mpi_point_copy((p))
+
#define mpi_point_get(x,y,z,p) _gcry_mpi_point_get((x),(y),(z),(p))
#define mpi_point_snatch_get(x,y,z,p) _gcry_mpi_point_snatch_get((x),(y), \
(z),(p))
diff --git a/src/gcrypt.h.in b/src/gcrypt.h.in
index 9a9acc4..68c1f9e 100644
--- a/src/gcrypt.h.in
+++ b/src/gcrypt.h.in
@@ -698,6 +698,9 @@ gcry_mpi_point_t gcry_mpi_point_new (unsigned int nbits);
/* Release the object POINT. POINT may be NULL. */
void gcry_mpi_point_release (gcry_mpi_point_t point);
+/* Return a copy of POINT. */
+gcry_mpi_point_t gcry_mpi_point_copy (gcry_mpi_point_t point);
+
/* Store the projective coordinates from POINT into X, Y, and Z. */
void gcry_mpi_point_get (gcry_mpi_t x, gcry_mpi_t y, gcry_mpi_t z,
gcry_mpi_point_t point);
@@ -868,6 +871,7 @@ gcry_mpi_t _gcry_mpi_get_const (int no);
(p) = NULL; \
} \
while (0)
+#define mpi_point_copy(p) gcry_mpi_point_copy((p))
#define mpi_point_get(x,y,z,p) gcry_mpi_point_get((x),(y),(z),(p))
#define mpi_point_snatch_get(x,y,z,p) gcry_mpi_point_snatch_get((x),(y),(z),(p))
#define mpi_point_set(p,x,y,z) gcry_mpi_point_set((p),(x),(y),(z))
diff --git a/src/libgcrypt.def b/src/libgcrypt.def
index c4a9eac..a76b377 100644
--- a/src/libgcrypt.def
+++ b/src/libgcrypt.def
@@ -284,4 +284,6 @@ EXPORTS
gcry_get_config @247
+ gcry_mpi_point_copy @248
+
;; end of file with public symbols for Windows.
diff --git a/src/libgcrypt.vers b/src/libgcrypt.vers
index 1d2d150..1aa830f 100644
--- a/src/libgcrypt.vers
+++ b/src/libgcrypt.vers
@@ -107,6 +107,7 @@ GCRYPT_1.6 {
gcry_mpi_ec_get_affine;
gcry_mpi_ec_dup; gcry_mpi_ec_add; gcry_mpi_ec_sub; gcry_mpi_ec_mul;
gcry_mpi_ec_curve_point; gcry_mpi_ec_decode_point;
+ gcry_mpi_point_copy;
gcry_log_debug;
gcry_log_debughex; gcry_log_debugmpi; gcry_log_debugpnt; gcry_log_debugsxp;
diff --git a/src/visibility.c b/src/visibility.c
index fe46c82..104c70d 100644
--- a/src/visibility.c
+++ b/src/visibility.c
@@ -484,6 +484,12 @@ gcry_mpi_point_release (gcry_mpi_point_t point)
_gcry_mpi_point_release (point);
}
+gcry_mpi_point_t
+gcry_mpi_point_copy (gcry_mpi_point_t point)
+{
+ return _gcry_mpi_point_copy (point);
+}
+
void
gcry_mpi_point_get (gcry_mpi_t x, gcry_mpi_t y, gcry_mpi_t z,
gcry_mpi_point_t point)
diff --git a/src/visibility.h b/src/visibility.h
index d28993a..df2caf6 100644
--- a/src/visibility.h
+++ b/src/visibility.h
@@ -246,6 +246,7 @@ MARK_VISIBLEX (gcry_mpi_new)
MARK_VISIBLEX (gcry_mpi_point_get)
MARK_VISIBLEX (gcry_mpi_point_new)
MARK_VISIBLEX (gcry_mpi_point_release)
+MARK_VISIBLEX (gcry_mpi_point_copy)
MARK_VISIBLEX (gcry_mpi_point_set)
MARK_VISIBLEX (gcry_mpi_point_snatch_get)
MARK_VISIBLEX (gcry_mpi_point_snatch_set)
@@ -466,6 +467,7 @@ MARK_VISIBLEX (_gcry_mpi_get_const)
#define gcry_mpi_point_get _gcry_USE_THE_UNDERSCORED_FUNCTION
#define gcry_mpi_point_new _gcry_USE_THE_UNDERSCORED_FUNCTION
#define gcry_mpi_point_release _gcry_USE_THE_UNDERSCORED_FUNCTION
+#define gcry_mpi_point_copy _gcry_USE_THE_UNDERSCORED_FUNCTION
#define gcry_mpi_point_set _gcry_USE_THE_UNDERSCORED_FUNCTION
#define gcry_mpi_point_snatch_get _gcry_USE_THE_UNDERSCORED_FUNCTION
#define gcry_mpi_point_snatch_set _gcry_USE_THE_UNDERSCORED_FUNCTION
diff --git a/tests/t-mpi-point.c b/tests/t-mpi-point.c
index 9919932..1eaa08a 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);
-----------------------------------------------------------------------
Summary of changes:
NEWS | 1 +
doc/gcrypt.texi | 7 +++++++
mpi/ec.c | 14 ++++++++++++++
src/gcrypt-int.h | 3 +++
src/gcrypt.h.in | 4 ++++
src/libgcrypt.def | 2 ++
src/libgcrypt.vers | 1 +
src/visibility.c | 6 ++++++
src/visibility.h | 2 ++
tests/t-mpi-point.c | 17 ++++++++++++++++-
10 files changed, 56 insertions(+), 1 deletion(-)
hooks/post-receive
--
The GNU crypto library
http://git.gnupg.org
_______________________________________________
Gnupg-commits mailing list
Gnupg-commits at gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-commits
More information about the Gcrypt-devel
mailing list