[svn] gcry - r1235 - in trunk: cipher tests
svn author marcus
cvs at cvs.gnupg.org
Sat Apr 28 20:51:44 CEST 2007
Author: marcus
Date: 2007-04-28 20:51:15 +0200 (Sat, 28 Apr 2007)
New Revision: 1235
Modified:
trunk/cipher/ChangeLog
trunk/cipher/ac.c
trunk/tests/ChangeLog
trunk/tests/ac-data.c
Log:
cipher/
2007-04-28 Marcus Brinkmann <marcus at g10code.de>
* ac.c (gcry_ac_mpi): Remove member NAME_PROVIDED.
(ac_data_mpi_copy, _gcry_ac_data_set, _gcry_ac_data_get_name)
(_gcry_ac_data_get_index, ac_data_construct): Adjust handling of
NAME accordingly.
tests/
2007-04-28 Marcus Brinkmann <marcus at g10code.de>
* ac-data.c (check_run): Don't give redundant
GCRY_AC_FLAG_DEALLOC
in addition to GCRY_AC_FLAG_COPY. Don't release LABEL1 or MPI0,
as those are donated to libgcrypt, but do release MPI0 and MPI2.
Modified: trunk/cipher/ChangeLog
===================================================================
--- trunk/cipher/ChangeLog 2007-04-20 10:52:30 UTC (rev 1234)
+++ trunk/cipher/ChangeLog 2007-04-28 18:51:15 UTC (rev 1235)
@@ -1,3 +1,10 @@
+2007-04-28 Marcus Brinkmann <marcus at g10code.de>
+
+ * ac.c (gcry_ac_mpi): Remove member NAME_PROVIDED.
+ (ac_data_mpi_copy, _gcry_ac_data_set, _gcry_ac_data_get_name)
+ (_gcry_ac_data_get_index, ac_data_construct): Adjust handling of
+ NAME accordingly.
+
2007-04-20 Werner Koch <wk at g10code.com>
* ecc.c (domain_parms): Add standard brainpool curves.
Modified: trunk/cipher/ac.c
===================================================================
--- trunk/cipher/ac.c 2007-04-20 10:52:30 UTC (rev 1234)
+++ trunk/cipher/ac.c 2007-04-28 18:51:15 UTC (rev 1235)
@@ -88,7 +88,6 @@
/* A named MPI value. */
typedef struct gcry_ac_mpi
{
- const char *name_provided; /* Provided name of MPI value. */
char *name; /* Self-maintained copy of name. */
gcry_mpi_t mpi; /* MPI value. */
unsigned int flags; /* Flags. */
@@ -213,10 +212,7 @@
{
/* Copy values. */
- if (data_mpis[i].name)
- label = gcry_strdup (data_mpis[i].name);
- else
- label = gcry_strdup (data_mpis[i].name_provided);
+ label = gcry_strdup (data_mpis[i].name);
mpi = gcry_mpi_copy (data_mpis[i].mpi);
if (! (label && mpi))
{
@@ -331,6 +327,7 @@
{
/* Create copies. */
+ flags |= GCRY_AC_FLAG_DEALLOC;
name_cp = gcry_strdup (name);
mpi_cp = gcry_mpi_copy (mpi);
if (! (name_cp && mpi_cp))
@@ -342,9 +339,7 @@
/* Search for existing entry. */
for (i = 0; i < data->data_n; i++)
- if (! strcmp (name,
- data->data[i].name
- ? data->data[i].name : data->data[i].name_provided))
+ if (! strcmp (name, data->data[i].name))
break;
if (i < data->data_n)
{
@@ -374,8 +369,7 @@
data->data_n++;
}
- data->data[i].name_provided = name_cp ? NULL : name;
- data->data[i].name = name_cp;
+ data->data[i].name = name_cp ? name_cp : ((char *) name);
data->data[i].mpi = mpi_cp ? mpi_cp : mpi;
data->data[i].flags = flags;
err = 0;
@@ -417,9 +411,7 @@
}
for (i = 0; i < data->data_n; i++)
- if (! strcmp (name,
- data->data[i].name ?
- data->data[i].name : data->data[i].name_provided))
+ if (! strcmp (name, data->data[i].name))
break;
if (i == data->data_n)
{
@@ -487,10 +479,7 @@
/* Return copies to the user. */
if (name)
{
- if (data->data[idx].name_provided)
- name_cp = gcry_strdup (data->data[idx].name_provided);
- else
- name_cp = gcry_strdup (data->data[idx].name);
+ name_cp = gcry_strdup (data->data[idx].name);
if (! name_cp)
{
err = gcry_error_from_errno (errno);
@@ -509,9 +498,7 @@
}
if (name)
- *name = name_cp ? name_cp : (data->data[idx].name
- ? data->data[idx].name
- : data->data[idx].name_provided);
+ *name = name_cp ? name_cp : data->data[idx].name;
if (mpi)
*mpi = mpi_cp ? mpi_cp : data->data[idx].mpi;
err = 0;
@@ -1373,9 +1360,7 @@
/* Fill list with MPIs. */
for (i = 0; i < data_length; i++)
{
- char **nameaddr = (data->data[i].name
- ? &data->data[i].name
- : ((char **) &data->data[i].name_provided));
+ char **nameaddr = &data->data[i].name;
arg_list[(i * 2) + 0] = nameaddr;
arg_list[(i * 2) + 1] = &data->data[i].mpi;
Modified: trunk/tests/ChangeLog
===================================================================
--- trunk/tests/ChangeLog 2007-04-20 10:52:30 UTC (rev 1234)
+++ trunk/tests/ChangeLog 2007-04-28 18:51:15 UTC (rev 1235)
@@ -1,3 +1,9 @@
+2007-04-28 Marcus Brinkmann <marcus at g10code.de>
+
+ * ac-data.c (check_run): Don't give redundant GCRY_AC_FLAG_DEALLOC
+ in addition to GCRY_AC_FLAG_COPY. Don't release LABEL1 or MPI0,
+ as those are donated to libgcrypt, but do release MPI0 and MPI2.
+
2007-04-12 Marcus Brinkmann <marcus at g10code.de>
* ac-schemes.c (scheme_spec): Revert last change.
Modified: trunk/tests/ac-data.c
===================================================================
--- trunk/tests/ac-data.c 2007-04-20 10:52:30 UTC (rev 1234)
+++ trunk/tests/ac-data.c 2007-04-28 18:51:15 UTC (rev 1235)
@@ -141,17 +141,14 @@
err = gcry_ac_data_set (data, GCRY_AC_FLAG_COPY, label0, mpi0);
assert_err (err);
- err = gcry_ac_data_set (data, GCRY_AC_FLAG_COPY | GCRY_AC_FLAG_DEALLOC,
- "foo", mpi0);
+
+ err = gcry_ac_data_set (data, GCRY_AC_FLAG_COPY, "foo", mpi0);
assert_err (err);
- err = gcry_ac_data_set (data, GCRY_AC_FLAG_COPY | GCRY_AC_FLAG_DEALLOC,
- "foo", mpi0);
+ err = gcry_ac_data_set (data, GCRY_AC_FLAG_COPY, "foo", mpi0);
assert_err (err);
- err = gcry_ac_data_set (data, GCRY_AC_FLAG_COPY | GCRY_AC_FLAG_DEALLOC,
- "bar", mpi0);
+ err = gcry_ac_data_set (data, GCRY_AC_FLAG_COPY, "bar", mpi0);
assert_err (err);
- err = gcry_ac_data_set (data, GCRY_AC_FLAG_COPY | GCRY_AC_FLAG_DEALLOC,
- "blah1", mpi0);
+ err = gcry_ac_data_set (data, GCRY_AC_FLAG_COPY, "blah1", mpi0);
assert_err (err);
check_sexp_conversion (data, identifiers);
check_sexp_conversion (data, identifiers_null);
@@ -166,8 +163,8 @@
assert (mpi1 != mpi2);
err = gcry_ac_data_get_index (data, 0, 0, &label1, &mpi1);
assert_err (err);
- gcry_free ((void *) label1); /* FIXME!! */
- gcry_mpi_release (mpi1);
+ gcry_mpi_release (mpi0);
+ gcry_mpi_release (mpi2);
if (verbose)
printf ("data-set-test-1 succeeded\n");
More information about the Gnupg-commits
mailing list