mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
Last minute fixes
This commit is contained in:
parent
d890215d18
commit
5f9caad6f1
@ -1,5 +1,8 @@
|
|||||||
2009-09-02 Werner Koch <wk@g10code.com>
|
2009-09-02 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* 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
|
* compress-bz2.c (do_uncompress): Detect unexpected EOF. Fixes
|
||||||
bug#1011.
|
bug#1011.
|
||||||
|
|
||||||
|
@ -3316,7 +3316,7 @@ do_decipher (app_t app, const char *keyidstr,
|
|||||||
const char *s;
|
const char *s;
|
||||||
int n;
|
int n;
|
||||||
const char *fpr = NULL;
|
const char *fpr = NULL;
|
||||||
int exmode;
|
int exmode, le_value;
|
||||||
|
|
||||||
if (!keyidstr || !*keyidstr || !indatalen)
|
if (!keyidstr || !*keyidstr || !indatalen)
|
||||||
return gpg_error (GPG_ERR_INV_VALUE);
|
return gpg_error (GPG_ERR_INV_VALUE);
|
||||||
@ -3401,14 +3401,20 @@ do_decipher (app_t app, const char *keyidstr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (app->app_local->cardcap.ext_lc_le && indatalen > 254 )
|
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)
|
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
|
else
|
||||||
exmode = 0;
|
exmode = le_value = 0;
|
||||||
|
|
||||||
rc = iso7816_decipher (app->slot, exmode,
|
rc = iso7816_decipher (app->slot, exmode,
|
||||||
indata, indatalen, padind,
|
indata, indatalen, le_value, padind,
|
||||||
outdata, outdatalen);
|
outdata, outdatalen);
|
||||||
xfree (fixbuf);
|
xfree (fixbuf);
|
||||||
}
|
}
|
||||||
|
@ -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
|
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
|
value of -1 suppresses the padding byte. On success 0 is returned
|
||||||
and the plaintext is available in a newly allocated buffer stored
|
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
|
gpg_error_t
|
||||||
iso7816_decipher (int slot, int extended_mode,
|
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 padind, unsigned char **result, size_t *resultlen)
|
||||||
{
|
{
|
||||||
int sw;
|
int sw;
|
||||||
@ -559,6 +560,11 @@ iso7816_decipher (int slot, int extended_mode,
|
|||||||
*result = NULL;
|
*result = NULL;
|
||||||
*resultlen = 0;
|
*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)
|
if (padind >= 0)
|
||||||
{
|
{
|
||||||
/* We need to prepend the padding indicator. */
|
/* We need to prepend the padding indicator. */
|
||||||
@ -568,18 +574,18 @@ iso7816_decipher (int slot, int extended_mode,
|
|||||||
|
|
||||||
*buf = padind; /* Padding indicator. */
|
*buf = padind; /* Padding indicator. */
|
||||||
memcpy (buf+1, data, datalen);
|
memcpy (buf+1, data, datalen);
|
||||||
sw = apdu_send (slot, extended_mode,
|
sw = apdu_send_le (slot, extended_mode,
|
||||||
0x00, CMD_PSO, 0x80, 0x86,
|
0x00, CMD_PSO, 0x80, 0x86,
|
||||||
datalen+1, (char*)buf,
|
datalen+1, (char*)buf, le,
|
||||||
result, resultlen);
|
result, resultlen);
|
||||||
xfree (buf);
|
xfree (buf);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sw = apdu_send (slot, extended_mode,
|
sw = apdu_send_le (slot, extended_mode,
|
||||||
0x00, CMD_PSO, 0x80, 0x86,
|
0x00, CMD_PSO, 0x80, 0x86,
|
||||||
datalen, (const char *)data,
|
datalen, (const char *)data, le,
|
||||||
result, resultlen);
|
result, resultlen);
|
||||||
}
|
}
|
||||||
if (sw != SW_SUCCESS)
|
if (sw != SW_SUCCESS)
|
||||||
{
|
{
|
||||||
|
@ -99,7 +99,7 @@ gpg_error_t iso7816_compute_ds (int slot, int extended_mode,
|
|||||||
unsigned char **result, size_t *resultlen);
|
unsigned char **result, size_t *resultlen);
|
||||||
gpg_error_t iso7816_decipher (int slot, int extended_mode,
|
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 padind,
|
int le, int padind,
|
||||||
unsigned char **result, size_t *resultlen);
|
unsigned char **result, size_t *resultlen);
|
||||||
gpg_error_t iso7816_internal_authenticate (int slot, int extended_mode,
|
gpg_error_t iso7816_internal_authenticate (int slot, int extended_mode,
|
||||||
const unsigned char *data, size_t datalen,
|
const unsigned char *data, size_t datalen,
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2009-09-02 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* Makefile.am (gpgkeys_curl_SOURCES, gpgkeys_ldap_SOURCES)
|
||||||
|
(gpgkeys_finger_SOURCES): Add ksmalloc.c only with non-faked cURL.
|
||||||
|
|
||||||
2009-08-25 Werner Koch <wk@g10code.com>
|
2009-08-25 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* ksmalloc.c: New
|
* ksmalloc.c: New
|
||||||
|
@ -28,9 +28,9 @@ gpglibexec_SCRIPTS = @GPGKEYS_MAILTO@
|
|||||||
noinst_SCRIPTS = gpgkeys_test
|
noinst_SCRIPTS = gpgkeys_test
|
||||||
|
|
||||||
gpgkeys_ldap_SOURCES = gpgkeys_ldap.c ksutil.c ksutil.h ksmalloc.c
|
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_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)
|
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_SOURCES += curl-shim.c curl-shim.h
|
||||||
gpgkeys_hkp_LDADD = ../util/libutil.a @NETLIBS@ @DNSLIBS@ $(other_libs) @GETOPT@ @W32LIBS@
|
gpgkeys_hkp_LDADD = ../util/libutil.a @NETLIBS@ @DNSLIBS@ $(other_libs) @GETOPT@ @W32LIBS@
|
||||||
else
|
else
|
||||||
|
gpgkeys_curl_SOURCES += ksmalloc.c
|
||||||
gpgkeys_curl_CPPFLAGS = @LIBCURL_CPPFLAGS@
|
gpgkeys_curl_CPPFLAGS = @LIBCURL_CPPFLAGS@
|
||||||
gpgkeys_curl_LDADD = ../util/libcompat.a @LIBCURL@ @GETOPT@
|
gpgkeys_curl_LDADD = ../util/libcompat.a @LIBCURL@ @GETOPT@
|
||||||
|
gpgkeys_hkp_SOURCES += ksmalloc.c
|
||||||
gpgkeys_hkp_CPPFLAGS = @LIBCURL_CPPFLAGS@
|
gpgkeys_hkp_CPPFLAGS = @LIBCURL_CPPFLAGS@
|
||||||
gpgkeys_hkp_LDADD = ../util/libcompat.a @DNSLIBS@ @LIBCURL@ @GETOPT@
|
gpgkeys_hkp_LDADD = ../util/libcompat.a @DNSLIBS@ @LIBCURL@ @GETOPT@
|
||||||
gpgkeys_finger_CPPFLAGS = @LIBCURL_CPPFLAGS@
|
gpgkeys_finger_CPPFLAGS = @LIBCURL_CPPFLAGS@
|
||||||
|
Loading…
x
Reference in New Issue
Block a user