[git] GCRYPT - branch, master, updated. libgcrypt-1.5.0-116-gbd3afc2

by Werner Koch cvs at cvs.gnupg.org
Mon Apr 15 12:12:32 CEST 2013


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  bd3afc27459a44df8cf501a7e1ae37bb849a8b0e (commit)
      from  71b25a5562f68aad81eae52cc1bab9ca7731a7e9 (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 bd3afc27459a44df8cf501a7e1ae37bb849a8b0e
Author: Werner Koch <wk at gnupg.org>
Date:   Mon Apr 15 11:52:54 2013 +0200

    Add macros to return pre-defined MPIs.
    
    * src/gcrypt.h.in (GCRYMPI_CONST_ONE, GCRYMPI_CONST_TWO)
    (GCRYMPI_CONST_THREE, GCRYMPI_CONST_FOUR, GCRYMPI_CONST_EIGHT): New.
    (_gcry_mpi_get_const): New private function.
    * src/visibility.c (_gcry_mpi_get_const): New.
    * src/visibility.h: Mark it visible.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/NEWS b/NEWS
index c4f89c1..5dea552 100644
--- a/NEWS
+++ b/NEWS
@@ -60,6 +60,11 @@ Noteworthy changes in version 1.6.0 (unreleased)
  gcry_mpi_ec_mul                 NEW.
  GCRYMPI_FLAG_IMMUTABLE          NEW.
  GCRYMPI_FLAG_CONST              NEW.
+ GCRYMPI_CONST_ONE               NEW.
+ GCRYMPI_CONST_TWO               NEW.
+ GCRYMPI_CONST_THREE             NEW.
+ GCRYMPI_CONST_FOUR              NEW.
+ GCRYMPI_CONST_EIGHT             NEW.
  GCRYPT_VERSION_NUMBER           NEW.
  GCRY_KDF_SCRYPT                 NEW.
  gcry_pubkey_get_sexp            NEW.
diff --git a/doc/gcrypt.texi b/doc/gcrypt.texi
index cace087..d4c4194 100644
--- a/doc/gcrypt.texi
+++ b/doc/gcrypt.texi
@@ -4054,6 +4054,11 @@ coordinate is not required, @code{NULL} may be passed to @var{x} or
 @var{y}.  @var{ctx} is the context object which has been created using
 @code{gcry_mpi_ec_new}. Returns 0 on success or not 0 if @var{point}
 is at infinity.
+
+Note that you can use @code{gcry_mpi_ec_set_point} with the value
+ at code{GCRYMPI_CONST_ONE} for @var{z} to convert affine coordinates
+back into projective coordinates.
+
 @end deftypefun
 
 @deftypefun void gcry_mpi_ec_dup ( @
@@ -4127,7 +4132,11 @@ If this flag is set, the MPI is marked as a constant and as immutable
 Setting or changing the value of that MPI is ignored and an error
 message is logged.  Such an MPI will never be deallocated and may thus
 be used without copying.  Note that using gcry_mpi_copy will return a
-copy of that constant with this and the immutable flag cleared.
+copy of that constant with this and the immutable flag cleared.  A few
+commonly used constants are pre-defined and accessible using the
+macros @code{GCRYMPI_CONST_ONE}, @code{GCRYMPI_CONST_TWO},
+ at code{GCRYMPI_CONST_THREE}, @code{GCRYMPI_CONST_FOUR}, and
+ at code{GCRYMPI_CONST_EIGHT}.
 @end table
 
 @deftypefun void gcry_mpi_set_flag (@w{gcry_mpi_t @var{a}}, @
diff --git a/src/gcrypt.h.in b/src/gcrypt.h.in
index 85213ea..f472b02 100644
--- a/src/gcrypt.h.in
+++ b/src/gcrypt.h.in
@@ -467,6 +467,13 @@ enum gcry_mpi_flag
   };
 
 
+/* Macros to return pre-defined MPI constants.  */
+#define GCRYMPI_CONST_ONE   (_gcry_mpi_get_const (1))
+#define GCRYMPI_CONST_TWO   (_gcry_mpi_get_const (2))
+#define GCRYMPI_CONST_THREE (_gcry_mpi_get_const (3))
+#define GCRYMPI_CONST_FOUR  (_gcry_mpi_get_const (4))
+#define GCRYMPI_CONST_EIGHT (_gcry_mpi_get_const (8))
+
 /* Allocate a new big integer object, initialize it with 0 and
    initially allocate memory for a number of at least NBITS. */
 gcry_mpi_t gcry_mpi_new (unsigned int nbits);
@@ -692,6 +699,9 @@ void gcry_mpi_clear_flag (gcry_mpi_t a, enum gcry_mpi_flag flag);
 /* Return true when the FLAG is set for A. */
 int gcry_mpi_get_flag (gcry_mpi_t a, enum gcry_mpi_flag flag);
 
+/* Private function - do not use.  */
+gcry_mpi_t _gcry_mpi_get_const (int no);
+
 /* Unless the GCRYPT_NO_MPI_MACROS is used, provide a couple of
    convenience macros for the big integer functions. */
 #ifndef GCRYPT_NO_MPI_MACROS
diff --git a/src/libgcrypt.def b/src/libgcrypt.def
index 4da4623..9eaf8a7 100644
--- a/src/libgcrypt.def
+++ b/src/libgcrypt.def
@@ -234,3 +234,5 @@ EXPORTS
       gcry_mpi_ec_mul           @211
 
       gcry_pubkey_get_sexp      @212
+
+      _gcry_mpi_get_const       @213
diff --git a/src/libgcrypt.vers b/src/libgcrypt.vers
index 29e46db..6aaf0f1 100644
--- a/src/libgcrypt.vers
+++ b/src/libgcrypt.vers
@@ -98,6 +98,8 @@ GCRYPT_1.6 {
     gcry_mpi_ec_get_affine;
     gcry_mpi_ec_dup; gcry_mpi_ec_add; gcry_mpi_ec_mul;
 
+    _gcry_mpi_get_const;
+
     gcry_ctx_release;
 
   local:
diff --git a/src/visibility.c b/src/visibility.c
index b503be6..c86d31b 100644
--- a/src/visibility.c
+++ b/src/visibility.c
@@ -601,6 +601,20 @@ gcry_mpi_get_flag (gcry_mpi_t a, enum gcry_mpi_flag flag)
   return _gcry_mpi_get_flag (a, flag);
 }
 
+gcry_mpi_t
+_gcry_mpi_get_const (int no)
+{
+  switch (no)
+    {
+    case 1: return _gcry_mpi_const (MPI_C_ONE);
+    case 2: return _gcry_mpi_const (MPI_C_TWO);
+    case 3: return _gcry_mpi_const (MPI_C_THREE);
+    case 4: return _gcry_mpi_const (MPI_C_FOUR);
+    case 8: return _gcry_mpi_const (MPI_C_EIGHT);
+    default: log_bug("unsupported GCRYMPI_CONST_ macro used\n");
+    }
+}
+
 gcry_error_t
 gcry_cipher_open (gcry_cipher_hd_t *handle,
                   int algo, int mode, unsigned int flags)
diff --git a/src/visibility.h b/src/visibility.h
index 1564e86..6887f37 100644
--- a/src/visibility.h
+++ b/src/visibility.h
@@ -594,6 +594,10 @@ MARK_VISIBLE (gcry_mpi_test_bit)
 
 MARK_VISIBLE (gcry_ctx_release)
 
+/* Functions used to implement macros.  */
+MARK_VISIBLEX(_gcry_mpi_get_const)
+
+
 
 #undef MARK_VISIBLE
 #endif /*_GCRY_INCLUDED_BY_VISIBILITY_C*/

-----------------------------------------------------------------------

Summary of changes:
 NEWS               |    5 +++++
 doc/gcrypt.texi    |   11 ++++++++++-
 src/gcrypt.h.in    |   10 ++++++++++
 src/libgcrypt.def  |    2 ++
 src/libgcrypt.vers |    2 ++
 src/visibility.c   |   14 ++++++++++++++
 src/visibility.h   |    4 ++++
 7 files changed, 47 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
The GNU crypto library
http://git.gnupg.org




More information about the Gnupg-commits mailing list