aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2009-09-02 17:30:53 +0000
committerWerner Koch <[email protected]>2009-09-02 17:30:53 +0000
commit5f9caad6f1dd891e20840c822e5177e5256debf3 (patch)
treef6abc412c72c977fd9a785815c2b1bbac87983ff
parentPreparing 1.4.10. (diff)
downloadgnupg-5f9caad6f1dd891e20840c822e5177e5256debf3.tar.gz
gnupg-5f9caad6f1dd891e20840c822e5177e5256debf3.zip
Last minute fixes
-rw-r--r--g10/ChangeLog3
-rw-r--r--g10/app-openpgp.c18
-rw-r--r--g10/iso7816.c26
-rw-r--r--g10/iso7816.h2
-rw-r--r--keyserver/ChangeLog5
-rw-r--r--keyserver/Makefile.am6
6 files changed, 41 insertions, 19 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index e28361d4a..e239d9e14 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,5 +1,8 @@
2009-09-02 Werner Koch <[email protected]>
+ * app-openpgp.c (do_decipher): Compute required Le.
+ * iso7816.c (iso7816_decipher): Add new arg LE.
+
* compress-bz2.c (do_uncompress): Detect unexpected EOF. Fixes
bug#1011.
diff --git a/g10/app-openpgp.c b/g10/app-openpgp.c
index 2c10cd9bf..9ab949345 100644
--- a/g10/app-openpgp.c
+++ b/g10/app-openpgp.c
@@ -3316,7 +3316,7 @@ do_decipher (app_t app, const char *keyidstr,
const char *s;
int n;
const char *fpr = NULL;
- int exmode;
+ int exmode, le_value;
if (!keyidstr || !*keyidstr || !indatalen)
return gpg_error (GPG_ERR_INV_VALUE);
@@ -3399,16 +3399,22 @@ do_decipher (app_t app, const char *keyidstr,
indatalen = fixuplen + indatalen;
padind = -1; /* Already padded. */
}
-
+
if (app->app_local->cardcap.ext_lc_le && indatalen > 254 )
- exmode = 1; /* Extended length w/o a limit. */
+ {
+ exmode = 1; /* Extended length w/o a limit. */
+ le_value = app->app_local->extcap.max_rsp_data;
+ }
else if (app->app_local->cardcap.cmd_chaining && indatalen > 254)
- exmode = -254; /* Command chaining with max. 254 bytes. */
+ {
+ exmode = -254; /* Command chaining with max. 254 bytes. */
+ le_value = 0;
+ }
else
- exmode = 0;
+ exmode = le_value = 0;
rc = iso7816_decipher (app->slot, exmode,
- indata, indatalen, padind,
+ indata, indatalen, le_value, padind,
outdata, outdatalen);
xfree (fixbuf);
}
diff --git a/g10/iso7816.c b/g10/iso7816.c
index f1ee0daef..151d56197 100644
--- a/g10/iso7816.c
+++ b/g10/iso7816.c
@@ -545,10 +545,11 @@ iso7816_compute_ds (int slot, int extended_mode,
indicator to be used. It should be 0 if no padding is required, a
value of -1 suppresses the padding byte. On success 0 is returned
and the plaintext is available in a newly allocated buffer stored
- at RESULT with its length stored at RESULTLEN. */
+ at RESULT with its length stored at RESULTLEN. For LE see
+ do_generate_keypair. */
gpg_error_t
iso7816_decipher (int slot, int extended_mode,
- const unsigned char *data, size_t datalen,
+ const unsigned char *data, size_t datalen, int le,
int padind, unsigned char **result, size_t *resultlen)
{
int sw;
@@ -559,6 +560,11 @@ iso7816_decipher (int slot, int extended_mode,
*result = NULL;
*resultlen = 0;
+ if (!extended_mode)
+ le = 256; /* Ignore provided Le and use what apdu_send uses. */
+ else if (le >= 0 && le < 256)
+ le = 256;
+
if (padind >= 0)
{
/* We need to prepend the padding indicator. */
@@ -568,18 +574,18 @@ iso7816_decipher (int slot, int extended_mode,
*buf = padind; /* Padding indicator. */
memcpy (buf+1, data, datalen);
- sw = apdu_send (slot, extended_mode,
- 0x00, CMD_PSO, 0x80, 0x86,
- datalen+1, (char*)buf,
- result, resultlen);
+ sw = apdu_send_le (slot, extended_mode,
+ 0x00, CMD_PSO, 0x80, 0x86,
+ datalen+1, (char*)buf, le,
+ result, resultlen);
xfree (buf);
}
else
{
- sw = apdu_send (slot, extended_mode,
- 0x00, CMD_PSO, 0x80, 0x86,
- datalen, (const char *)data,
- result, resultlen);
+ sw = apdu_send_le (slot, extended_mode,
+ 0x00, CMD_PSO, 0x80, 0x86,
+ datalen, (const char *)data, le,
+ result, resultlen);
}
if (sw != SW_SUCCESS)
{
diff --git a/g10/iso7816.h b/g10/iso7816.h
index 4e7a344ab..3ab6e7694 100644
--- a/g10/iso7816.h
+++ b/g10/iso7816.h
@@ -99,7 +99,7 @@ gpg_error_t iso7816_compute_ds (int slot, int extended_mode,
unsigned char **result, size_t *resultlen);
gpg_error_t iso7816_decipher (int slot, int extended_mode,
const unsigned char *data, size_t datalen,
- int padind,
+ int le, int padind,
unsigned char **result, size_t *resultlen);
gpg_error_t iso7816_internal_authenticate (int slot, int extended_mode,
const unsigned char *data, size_t datalen,
diff --git a/keyserver/ChangeLog b/keyserver/ChangeLog
index d2fd863f1..87fb3b241 100644
--- a/keyserver/ChangeLog
+++ b/keyserver/ChangeLog
@@ -1,3 +1,8 @@
+2009-09-02 Werner Koch <[email protected]>
+
+ * Makefile.am (gpgkeys_curl_SOURCES, gpgkeys_ldap_SOURCES)
+ (gpgkeys_finger_SOURCES): Add ksmalloc.c only with non-faked cURL.
+
2009-08-25 Werner Koch <[email protected]>
* ksmalloc.c: New
diff --git a/keyserver/Makefile.am b/keyserver/Makefile.am
index 4c77a926c..1edf1e6d4 100644
--- a/keyserver/Makefile.am
+++ b/keyserver/Makefile.am
@@ -28,9 +28,9 @@ gpglibexec_SCRIPTS = @GPGKEYS_MAILTO@
noinst_SCRIPTS = gpgkeys_test
gpgkeys_ldap_SOURCES = gpgkeys_ldap.c ksutil.c ksutil.h ksmalloc.c
-gpgkeys_hkp_SOURCES = gpgkeys_hkp.c ksutil.c ksutil.h ksmalloc.c
+gpgkeys_hkp_SOURCES = gpgkeys_hkp.c ksutil.c ksutil.h
gpgkeys_finger_SOURCES = gpgkeys_finger.c ksutil.c ksutil.h
-gpgkeys_curl_SOURCES = gpgkeys_curl.c ksutil.c ksutil.h ksmalloc.c
+gpgkeys_curl_SOURCES = gpgkeys_curl.c ksutil.c ksutil.h
other_libs = $(LIBICONV) $(LIBINTL) $(CAPLIBS)
@@ -45,8 +45,10 @@ gpgkeys_curl_LDADD = ../util/libutil.a @NETLIBS@ @DNSLIBS@ $(other_libs) @GETOPT
gpgkeys_hkp_SOURCES += curl-shim.c curl-shim.h
gpgkeys_hkp_LDADD = ../util/libutil.a @NETLIBS@ @DNSLIBS@ $(other_libs) @GETOPT@ @W32LIBS@
else
+gpgkeys_curl_SOURCES += ksmalloc.c
gpgkeys_curl_CPPFLAGS = @LIBCURL_CPPFLAGS@
gpgkeys_curl_LDADD = ../util/libcompat.a @LIBCURL@ @GETOPT@
+gpgkeys_hkp_SOURCES += ksmalloc.c
gpgkeys_hkp_CPPFLAGS = @LIBCURL_CPPFLAGS@
gpgkeys_hkp_LDADD = ../util/libcompat.a @DNSLIBS@ @LIBCURL@ @GETOPT@
gpgkeys_finger_CPPFLAGS = @LIBCURL_CPPFLAGS@