summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2003-07-28 10:59:18 +0200
committerWerner Koch <wk@gnupg.org>2003-07-28 10:59:18 +0200
commit860f56b08989ebd51fafc3d3974b8f7856a80c12 (patch)
treeac0cb108d674419305120f0983c269f74ce27bc7
parent* options.h, g10.c (main, add_keyserver_url): Add (diff)
downloadgnupg2-860f56b08989ebd51fafc3d3974b8f7856a80c12.tar.xz
gnupg2-860f56b08989ebd51fafc3d3974b8f7856a80c12.zip
Adjusted for use with current libgcrypt (1.1.42).
-rw-r--r--agent/ChangeLog4
-rw-r--r--agent/minip12.c22
-rw-r--r--agent/pksign.c2
-rw-r--r--scd/ChangeLog4
-rw-r--r--scd/card.c5
-rw-r--r--scd/sc-copykeys.c12
-rw-r--r--sm/ChangeLog4
-rw-r--r--sm/certcheck.c2
-rw-r--r--sm/encrypt.c2
9 files changed, 31 insertions, 26 deletions
diff --git a/agent/ChangeLog b/agent/ChangeLog
index 77d84fc19..f72784ecf 100644
--- a/agent/ChangeLog
+++ b/agent/ChangeLog
@@ -1,3 +1,7 @@
+2003-07-27 Werner Koch <wk@gnupg.org>
+
+ Adjusted for gcry_mpi_print and gcry_mpi_scan API change.
+
2003-07-15 Werner Koch <wk@gnupg.org>
* simple-pwquery.c, simple-pwquery.h: Moved to ../common.
diff --git a/agent/minip12.c b/agent/minip12.c
index d86bcf00c..255fef096 100644
--- a/agent/minip12.c
+++ b/agent/minip12.c
@@ -265,8 +265,7 @@ string_to_key (int id, char *salt, int iter, const char *pw,
/* need more bytes. */
for(i=0; i < 64; i++)
buf_b[i] = hash[i % 20];
- n = 64;
- rc = gcry_mpi_scan (&num_b1, GCRYMPI_FMT_USG, buf_b, &n);
+ rc = gcry_mpi_scan (&num_b1, GCRYMPI_FMT_USG, buf_b, 64, &n);
if (rc)
{
log_error ( "gcry_mpi_scan failed: %s\n", gpg_strerror (rc));
@@ -277,8 +276,7 @@ string_to_key (int id, char *salt, int iter, const char *pw,
{
gcry_mpi_t num_ij;
- n = 64;
- rc = gcry_mpi_scan (&num_ij, GCRYMPI_FMT_USG, buf_i + i, &n);
+ rc = gcry_mpi_scan (&num_ij, GCRYMPI_FMT_USG, buf_i + i, 64, &n);
if (rc)
{
log_error ( "gcry_mpi_scan failed: %s\n",
@@ -287,12 +285,11 @@ string_to_key (int id, char *salt, int iter, const char *pw,
}
gcry_mpi_add (num_ij, num_ij, num_b1);
gcry_mpi_clear_highbit (num_ij, 64*8);
- n = 64;
- rc = gcry_mpi_print (GCRYMPI_FMT_USG, buf_i + i, &n, num_ij);
+ rc = gcry_mpi_print (GCRYMPI_FMT_USG, buf_i + i, 64, &n, num_ij);
if (rc)
{
log_error ( "gcry_mpi_print failed: %s\n",
- gpg_strerror (rc));
+ gpg_strerror (rc));
return -1;
}
gcry_mpi_release (num_ij);
@@ -573,8 +570,6 @@ parse_bag_data (const unsigned char *buffer, size_t length, int startoffset,
where = "reading.key-parameters";
for (result_count=0; len && result_count < 9;)
{
- int dummy_n;
-
if (parse_tag (&p, &n, &ti) || ti.class || ti.tag != TAG_INTEGER)
goto bailout;
if (len < ti.nhdr)
@@ -583,13 +578,12 @@ parse_bag_data (const unsigned char *buffer, size_t length, int startoffset,
if (len < ti.length)
goto bailout;
len -= ti.length;
- dummy_n = ti.length;
if (!result_count && ti.length == 1 && !*p)
; /* ignore the very first one if it is a 0 */
else
{
rc = gcry_mpi_scan (result+result_count, GCRYMPI_FMT_USG, p,
- &dummy_n);
+ ti.length, NULL);
if (rc)
{
log_error ("error parsing key parameter: %s\n",
@@ -874,7 +868,7 @@ p12_build (gcry_mpi_t *kparms, const char *pw, size_t *r_length)
for (i=0; kparms[i]; i++)
{
n = 0;
- rc = gcry_mpi_print (GCRYMPI_FMT_STD, NULL, &n, kparms[i]);
+ rc = gcry_mpi_print (GCRYMPI_FMT_STD, NULL, 0, &n, kparms[i]);
if (rc)
{
log_error ("error formatting parameter: %s\n", gpg_strerror (rc));
@@ -947,7 +941,7 @@ p12_build (gcry_mpi_t *kparms, const char *pw, size_t *r_length)
for (i=0; kparms[i]; i++)
{
n = 0;
- rc = gcry_mpi_print (GCRYMPI_FMT_STD, NULL, &n, kparms[i]);
+ rc = gcry_mpi_print (GCRYMPI_FMT_STD, NULL, 0, &n, kparms[i]);
if (rc)
{
log_error ("oops: error formatting parameter: %s\n",
@@ -958,7 +952,7 @@ p12_build (gcry_mpi_t *kparms, const char *pw, size_t *r_length)
p = store_tag_length (p, TAG_INTEGER, n);
n = plain + needed - p;
- rc = gcry_mpi_print (GCRYMPI_FMT_STD, p, &n, kparms[i]);
+ rc = gcry_mpi_print (GCRYMPI_FMT_STD, p, n, &n, kparms[i]);
if (rc)
{
log_error ("oops: error storing parameter: %s\n",
diff --git a/agent/pksign.c b/agent/pksign.c
index a5f89e3f6..fba2c652c 100644
--- a/agent/pksign.c
+++ b/agent/pksign.c
@@ -77,7 +77,7 @@ do_encode_md (const unsigned char *digest, size_t digestlen, int algo,
if (DBG_CRYPTO)
log_printhex ("encoded hash:", frame, nframe);
- gcry_mpi_scan (r_val, GCRYMPI_FMT_USG, frame, &nframe);
+ gcry_mpi_scan (r_val, GCRYMPI_FMT_USG, frame, n, &nframe);
xfree (frame);
return 0;
}
diff --git a/scd/ChangeLog b/scd/ChangeLog
index fbe8d2fb2..ed6986965 100644
--- a/scd/ChangeLog
+++ b/scd/ChangeLog
@@ -1,3 +1,7 @@
+2003-07-27 Werner Koch <wk@gnupg.org>
+
+ Adjusted for gcry_mpi_print and gcry_mpi_scan API change.
+
2003-07-24 Werner Koch <wk@gnupg.org>
* app-openpgp.c (do_learn_status): Print more status information.
diff --git a/scd/card.c b/scd/card.c
index 00c190fa1..02b7bfdbf 100644
--- a/scd/card.c
+++ b/scd/card.c
@@ -196,6 +196,7 @@ card_close (CARD card)
return a pointer to value as well as its length in NBYTES. Return
NULL if it was not found. Note, that the function does not check
whether the value fits into the provided buffer. */
+#ifdef HAVE_OPENSC
static const char *
find_simple_tlv (const unsigned char *buffer, size_t length,
int tag, size_t *nbytes)
@@ -228,11 +229,13 @@ find_simple_tlv (const unsigned char *buffer, size_t length,
s += len; n -= len;
}
}
+#endif /*HAVE_OPENSC*/
/* Find the ICC Serial Number within the provided BUFFER of LENGTH
(which should contain the GDO file) and return it as a hex encoded
string and allocated string in SERIAL. Return an error code when
the ICCSN was not found. */
+#ifdef HAVE_OPENSC
static int
find_iccsn (const unsigned char *buffer, size_t length, char **serial)
{
@@ -271,7 +274,7 @@ find_iccsn (const unsigned char *buffer, size_t length, char **serial)
*p = 0;
return 0;
}
-
+#endif /*HAVE_OPENSC*/
/* Retrieve the serial number and the time of the last update of the
card. The serial number is returned as a malloced string (hex
diff --git a/scd/sc-copykeys.c b/scd/sc-copykeys.c
index d9a009b33..9caf39a8a 100644
--- a/scd/sc-copykeys.c
+++ b/scd/sc-copykeys.c
@@ -596,8 +596,7 @@ copykeys (APP app, const char *fname)
template = tp = xmalloc (1+2 + 1+1+4 + 1+1+64 + 1+1+64);
*tp++ = 0xC0;
*tp++ = 4;
- n = 4;
- rc = gcry_mpi_print (GCRYMPI_FMT_USG, tp, &n, rsa_e);
+ rc = gcry_mpi_print (GCRYMPI_FMT_USG, tp, 4, &n, rsa_e);
if (rc)
{
log_error ("mpi_print failed: %s\n", gpg_strerror (rc));
@@ -615,8 +614,7 @@ copykeys (APP app, const char *fname)
*tp++ = 0xC1;
*tp++ = 64;
- n = 64;
- rc = gcry_mpi_print (GCRYMPI_FMT_USG, tp, &n, rsa_p);
+ rc = gcry_mpi_print (GCRYMPI_FMT_USG, tp, 64, &n, rsa_p);
if (rc)
{
log_error ("mpi_print failed: %s\n", gpg_strerror (rc));
@@ -627,8 +625,7 @@ copykeys (APP app, const char *fname)
*tp++ = 0xC2;
*tp++ = 64;
- n = 64;
- rc = gcry_mpi_print (GCRYMPI_FMT_USG, tp, &n, rsa_q);
+ rc = gcry_mpi_print (GCRYMPI_FMT_USG, tp, 64, &n, rsa_q);
if (rc)
{
log_error ("mpi_print failed: %s\n", gpg_strerror (rc));
@@ -639,8 +636,7 @@ copykeys (APP app, const char *fname)
assert (tp - template == 138);
/* (we need the modulus to calculate the fingerprint) */
- n = 128;
- rc = gcry_mpi_print (GCRYMPI_FMT_USG, m, &n, rsa_n);
+ rc = gcry_mpi_print (GCRYMPI_FMT_USG, m, 128, &n, rsa_n);
if (rc)
{
log_error ("mpi_print failed: %s\n", gpg_strerror (rc));
diff --git a/sm/ChangeLog b/sm/ChangeLog
index 20b02a194..f4264037d 100644
--- a/sm/ChangeLog
+++ b/sm/ChangeLog
@@ -1,3 +1,7 @@
+2003-07-27 Werner Koch <wk@gnupg.org>
+
+ Adjusted for gcry_mpi_print and gcry_mpi_scan API change.
+
2003-06-24 Werner Koch <wk@gnupg.org>
* server.c (gpgsm_status_with_err_code): New.
diff --git a/sm/certcheck.c b/sm/certcheck.c
index b83783813..35509c67e 100644
--- a/sm/certcheck.c
+++ b/sm/certcheck.c
@@ -90,7 +90,7 @@ do_encode_md (gcry_md_hd_t md, int algo, unsigned int nbits,
log_printf ("\n");
}
- gcry_mpi_scan (r_val, GCRYMPI_FMT_USG, frame, &nframe);
+ gcry_mpi_scan (r_val, GCRYMPI_FMT_USG, frame, n, &nframe);
xfree (frame);
return 0;
}
diff --git a/sm/encrypt.c b/sm/encrypt.c
index dfc905454..725a81b70 100644
--- a/sm/encrypt.c
+++ b/sm/encrypt.c
@@ -192,7 +192,7 @@ encode_session_key (DEK dek, unsigned int nbits)
memcpy (frame+n, dek->key, dek->keylen);
n += dek->keylen;
assert (n == nframe);
- if (gcry_mpi_scan (&a, GCRYMPI_FMT_USG, frame, &nframe) )
+ if (gcry_mpi_scan (&a, GCRYMPI_FMT_USG, frame, n, &nframe) )
BUG ();
gcry_free(frame);