[git] GCRYPT - branch, master, updated. libgcrypt-1.6.0-339-g4051fe7

by Justus Winter cvs at cvs.gnupg.org
Wed Mar 16 13:59:09 CET 2016


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  4051fe7fec6ffdc7a2f5c3856665478866991ee7 (commit)
       via  fcf4358a7a7ba8d32bf385ea99ced5f47cbd3ae2 (commit)
      from  5d601dd57fcb41aa2015ab655fd6fc51537da667 (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 4051fe7fec6ffdc7a2f5c3856665478866991ee7
Author: Justus Winter <justus at g10code.com>
Date:   Wed Mar 16 13:35:37 2016 +0100

    Update documentation for 'gcry_sexp_extract_param'.
    
    * doc/gcrypt.texi (gcry_sexp_extract_param): Mention that all MIPs
    must be set to NULL first, and document how the function behaves in
    case of errors.
    * src/sexp.c (_gcry_sexp_extract_param): Likewise.
    * src/gcrypt.h.in (gcry_sexp_extract_param): Copy the comment from
    '_gcry_sexp_extract_param'.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/doc/gcrypt.texi b/doc/gcrypt.texi
index 23b1f79..3265a70 100644
--- a/doc/gcrypt.texi
+++ b/doc/gcrypt.texi
@@ -4336,8 +4336,10 @@ In general parameter names are single letters.  To use a string for a
 parameter name, enclose the name in single quotes.
 
 Unless in buffer descriptor mode for each parameter name a pointer to
-an @code{gcry_mpi_t} variable is expected finally followed by a @code{NULL}.
-For example
+an @code{gcry_mpi_t} variable is expected that must be set to
+ at code{NULL} prior to invoking this function, and finally a @code{NULL}
+is expected.  For example
+
 @example
   _gcry_sexp_extract_param (key, NULL, "n/x+e d-'foo'",
                             &mpi_n, &mpi_x, &mpi_e, &mpi_foo, NULL)
@@ -4366,8 +4368,11 @@ number of bytes copied to that buffer; in case the buffer is too
 small, the function immediately returns with an error code (and
 @var{len} is set to 0).
 
-The function returns NULL on success.  On error an error code is
-returned and the passed MPIs are either unchanged or set to NULL.
+The function returns 0 on success.  On error an error code is
+returned, all passed MPIs that might have been allocated up to this
+point are deallocated and set to @code{NULL}, and all passed buffers
+are either truncated if the caller supplied the buffer, or deallocated
+if the function allocated the buffer.
 @end deftypefun
 
 
diff --git a/src/gcrypt.h.in b/src/gcrypt.h.in
index f48f04f..797da2e 100644
--- a/src/gcrypt.h.in
+++ b/src/gcrypt.h.in
@@ -473,8 +473,51 @@ char *gcry_sexp_nth_string (gcry_sexp_t list, int number);
    value can't be converted to an MPI, `NULL' is returned.  */
 gcry_mpi_t gcry_sexp_nth_mpi (gcry_sexp_t list, int number, int mpifmt);
 
-/* Convenience function to extract parameters from an S-expression
- * using a list of single letter parameters.  */
+/* Extract MPIs from an s-expression using a list of parameters.  The
+ * names of these parameters are given by the string LIST.  Some
+ * special characters may be given to control the conversion:
+ *
+ *    + :: Switch to unsigned integer format (default).
+ *    - :: Switch to standard signed format.
+ *    / :: Switch to opaque format.
+ *    & :: Switch to buffer descriptor mode - see below.
+ *    ? :: The previous parameter is optional.
+ *
+ * In general parameter names are single letters.  To use a string for
+ * a parameter name, enclose the name in single quotes.
+ *
+ * Unless in gcry_buffer_t mode for each parameter name a pointer to
+ * an MPI variable is expected that must be set to NULL prior to
+ * invoking this function, and finally a NULL is expected.  Example:
+ *
+ *   _gcry_sexp_extract_param (key, NULL, "n/x+ed",
+ *                             &mpi_n, &mpi_x, &mpi_e, NULL)
+ *
+ * This stores the parameter "N" from KEY as an unsigned MPI into
+ * MPI_N, the parameter "X" as an opaque MPI into MPI_X, and the
+ * parameter "E" again as an unsigned MPI into MPI_E.
+ *
+ * If in buffer descriptor mode a pointer to gcry_buffer_t descriptor
+ * is expected instead of a pointer to an MPI.  The caller may use two
+ * different operation modes: If the DATA field of the provided buffer
+ * descriptor is NULL, the function allocates a new buffer and stores
+ * it at DATA; the other fields are set accordingly with OFF being 0.
+ * If DATA is not NULL, the function assumes that DATA, SIZE, and OFF
+ * describe a buffer where to but the data; on return the LEN field
+ * receives the number of bytes copied to that buffer; if the buffer
+ * is too small, the function immediately returns with an error code
+ * (and LEN set to 0).
+ *
+ * PATH is an optional string used to locate a token.  The exclamation
+ * mark separated tokens are used to via gcry_sexp_find_token to find
+ * a start point inside SEXP.
+ *
+ * The function returns 0 on success.  On error an error code is
+ * returned, all passed MPIs that might have been allocated up to this
+ * point are deallocated and set to NULL, and all passed buffers are
+ * either truncated if the caller supplied the buffer, or deallocated
+ * if the function allocated the buffer.
+ */
 gpg_error_t gcry_sexp_extract_param (gcry_sexp_t sexp,
                                      const char *path,
                                      const char *list,
diff --git a/src/sexp.c b/src/sexp.c
index d063962..636f922 100644
--- a/src/sexp.c
+++ b/src/sexp.c
@@ -2183,8 +2183,8 @@ _gcry_sexp_canon_len (const unsigned char *buffer, size_t length,
  * a parameter name, enclose the name in single quotes.
  *
  * Unless in gcry_buffer_t mode for each parameter name a pointer to
- * an MPI variable is expected and finally a NULL is expected.
- * Example:
+ * an MPI variable is expected that must be set to NULL prior to
+ * invoking this function, and finally a NULL is expected.  Example:
  *
  *   _gcry_sexp_extract_param (key, NULL, "n/x+ed",
  *                             &mpi_n, &mpi_x, &mpi_e, NULL)
@@ -2208,8 +2208,11 @@ _gcry_sexp_canon_len (const unsigned char *buffer, size_t length,
  * mark separated tokens are used to via gcry_sexp_find_token to find
  * a start point inside SEXP.
  *
- * The function returns NULL on success.  On error an error code is
- * returned and the passed MPIs are either unchanged or set to NULL.
+ * The function returns 0 on success.  On error an error code is
+ * returned, all passed MPIs that might have been allocated up to this
+ * point are deallocated and set to NULL, and all passed buffers are
+ * either truncated if the caller supplied the buffer, or deallocated
+ * if the function allocated the buffer.
  */
 gpg_err_code_t
 _gcry_sexp_vextract_param (gcry_sexp_t sexp, const char *path,

commit fcf4358a7a7ba8d32bf385ea99ced5f47cbd3ae2
Author: Justus Winter <justus at g10code.com>
Date:   Wed Mar 16 12:49:26 2016 +0100

    cipher: Update comment.
    
    * cipher/ecc.c (ecc_get_nbits): Update comment to reflect the fact
    that a curve parameter can be given.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/cipher/ecc.c b/cipher/ecc.c
index 4cdbb14..f65203f 100644
--- a/cipher/ecc.c
+++ b/cipher/ecc.c
@@ -1657,6 +1657,7 @@ ecc_decrypt_raw (gcry_sexp_t *r_plain, gcry_sexp_t s_data, gcry_sexp_t keyparms)
  * for example:
  *
  *   (ecc
+ *     (curve <name>)
  *     (p <mpi>)
  *     (a <mpi>)
  *     (b <mpi>)
@@ -1664,8 +1665,7 @@ ecc_decrypt_raw (gcry_sexp_t *r_plain, gcry_sexp_t s_data, gcry_sexp_t keyparms)
  *     (n <mpi>)
  *     (q <mpi>))
  *
- * More parameters may be given currently P is needed.  FIXME: We
- * need allow for a "curve" parameter.
+ * More parameters may be given. Either P or CURVE is needed.
  */
 static unsigned int
 ecc_get_nbits (gcry_sexp_t parms)

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

Summary of changes:
 cipher/ecc.c    |  4 ++--
 doc/gcrypt.texi | 13 +++++++++----
 src/gcrypt.h.in | 47 +++++++++++++++++++++++++++++++++++++++++++++--
 src/sexp.c      | 11 +++++++----
 4 files changed, 63 insertions(+), 12 deletions(-)


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