mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-10 13:04:23 +01:00
more bug fixesand some warning cleanups
This commit is contained in:
parent
2874670be9
commit
d4cd7a3d4b
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
2001-09-09 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
|
* configure.ac: autoconf changed the name of the maintainer mode
|
||||||
|
flag, so that not all warnings where enabled. Fixed that.
|
||||||
|
Reported by Dirk Meyer.
|
||||||
|
|
||||||
|
2001-09-07 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
|
* configure.ac: Test for strsep().
|
||||||
|
|
||||||
2001-09-03 Werner Koch <wk@gnupg.org>
|
2001-09-03 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
* configure.ac: Removed GDBM tests.
|
* configure.ac: Removed GDBM tests.
|
||||||
|
1
THANKS
1
THANKS
@ -41,6 +41,7 @@ David R. Bergstein dbergstein@home.com
|
|||||||
Detlef Lannert lannert@lannert.rz.uni-duesseldorf.de
|
Detlef Lannert lannert@lannert.rz.uni-duesseldorf.de
|
||||||
Dimitri dmitri@advantrix.com
|
Dimitri dmitri@advantrix.com
|
||||||
Dirk Lattermann dlatt@t-online.de
|
Dirk Lattermann dlatt@t-online.de
|
||||||
|
Dirk Meyer dirk.meyer@dinoex.sub.org
|
||||||
Ed Boraas ecxjo@esperanto.org
|
Ed Boraas ecxjo@esperanto.org
|
||||||
Edmund GRIMLEY EVANS edmundo@rano.org
|
Edmund GRIMLEY EVANS edmundo@rano.org
|
||||||
Edwin Woudt edwin@woudt.nl
|
Edwin Woudt edwin@woudt.nl
|
||||||
|
4
TODO
4
TODO
@ -1,4 +1,8 @@
|
|||||||
|
|
||||||
|
* 12345678! does not work anymore
|
||||||
|
|
||||||
|
* Always use the primary key to sign other keys.
|
||||||
|
|
||||||
* add listing of notation data
|
* add listing of notation data
|
||||||
|
|
||||||
* Check the changes to the gpg random gatherer on all W32 platforms.
|
* Check the changes to the gpg random gatherer on all W32 platforms.
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2001-09-09 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
|
* rsa.c (rsa_get_info): s/usage/r_usage/ to avoid shadow warnings.
|
||||||
|
|
||||||
2001-08-24 Werner Koch <wk@gnupg.org>
|
2001-08-24 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
* md.c (md_write): Made buf arg const.
|
* md.c (md_write): Made buf arg const.
|
||||||
|
@ -296,7 +296,7 @@ set_random_seed_file( const char *name )
|
|||||||
* and return true if this was successful
|
* and return true if this was successful
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
read_seed_file()
|
read_seed_file(void)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
12
cipher/rsa.c
12
cipher/rsa.c
@ -446,7 +446,7 @@ rsa_get_nbits( int algo, MPI *pkey )
|
|||||||
*/
|
*/
|
||||||
const char *
|
const char *
|
||||||
rsa_get_info( int algo,
|
rsa_get_info( int algo,
|
||||||
int *npkey, int *nskey, int *nenc, int *nsig, int *usage )
|
int *npkey, int *nskey, int *nenc, int *nsig, int *r_usage )
|
||||||
{
|
{
|
||||||
*npkey = 2;
|
*npkey = 2;
|
||||||
*nskey = 6;
|
*nskey = 6;
|
||||||
@ -454,10 +454,12 @@ rsa_get_info( int algo,
|
|||||||
*nsig = 1;
|
*nsig = 1;
|
||||||
|
|
||||||
switch( algo ) {
|
switch( algo ) {
|
||||||
case 1: *usage = PUBKEY_USAGE_SIG | PUBKEY_USAGE_ENC; return "RSA";
|
case 1: *r_usage = PUBKEY_USAGE_SIG | PUBKEY_USAGE_ENC; return "RSA";
|
||||||
case 2: *usage = PUBKEY_USAGE_ENC; return "RSA-E";
|
case 2: *r_usage = PUBKEY_USAGE_ENC; return "RSA-E";
|
||||||
case 3: *usage = PUBKEY_USAGE_SIG; return "RSA-S";
|
case 3: *r_usage = PUBKEY_USAGE_SIG; return "RSA-S";
|
||||||
default:*usage = 0; return NULL;
|
default:*r_usage = 0; return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ dnl (Process this file with autoconf to produce a configure script.)
|
|||||||
AC_REVISION($Revision$)dnl
|
AC_REVISION($Revision$)dnl
|
||||||
|
|
||||||
AC_PREREQ(2.52)
|
AC_PREREQ(2.52)
|
||||||
AC_INIT(gnupg,1.0.6a)
|
AC_INIT(gnupg,1.0.6b)
|
||||||
AC_CONFIG_SRCDIR(g10/g10.c)
|
AC_CONFIG_SRCDIR(g10/g10.c)
|
||||||
AC_CONFIG_AUX_DIR(scripts)
|
AC_CONFIG_AUX_DIR(scripts)
|
||||||
AC_CONFIG_HEADERS(config.h)
|
AC_CONFIG_HEADERS(config.h)
|
||||||
@ -449,10 +449,10 @@ fi
|
|||||||
dnl Checks for library functions.
|
dnl Checks for library functions.
|
||||||
AC_FUNC_FSEEKO
|
AC_FUNC_FSEEKO
|
||||||
AC_FUNC_VPRINTF
|
AC_FUNC_VPRINTF
|
||||||
AC_CHECK_FUNCS(strerror stpcpy strlwr stricmp tcgetattr rand strtoul mmap)
|
AC_CHECK_FUNCS(strerror stpcpy strsep strlwr stricmp tcgetattr strtoul mmap)
|
||||||
AC_CHECK_FUNCS(memmove gettimeofday getrusage setrlimit clock_gettime)
|
AC_CHECK_FUNCS(memmove gettimeofday getrusage setrlimit clock_gettime)
|
||||||
AC_CHECK_FUNCS(memicmp atexit raise getpagesize strftime nl_langinfo)
|
AC_CHECK_FUNCS(memicmp atexit raise getpagesize strftime nl_langinfo)
|
||||||
AC_CHECK_FUNCS(waitpid wait4 sigaction sigprocmask)
|
AC_CHECK_FUNCS(waitpid wait4 sigaction sigprocmask rand)
|
||||||
|
|
||||||
#
|
#
|
||||||
# check for gethrtime and run a testprogram to see whether
|
# check for gethrtime and run a testprogram to see whether
|
||||||
@ -794,7 +794,7 @@ esac
|
|||||||
|
|
||||||
|
|
||||||
if test "$GCC" = yes; then
|
if test "$GCC" = yes; then
|
||||||
if test "$MAINTAINER_MODE" = "yes"; then
|
if test "$USE_MAINTAINER_MODE" = "yes"; then
|
||||||
CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
|
CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
|
||||||
else
|
else
|
||||||
CFLAGS="$CFLAGS -Wall"
|
CFLAGS="$CFLAGS -Wall"
|
||||||
|
@ -1,3 +1,23 @@
|
|||||||
|
2001-09-09 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
|
* keyedit.c (keyedit_menu): No need to define another p.
|
||||||
|
|
||||||
|
* keylist.c (print_capabilities): s/used/use/ so that it
|
||||||
|
does not shadow a global.
|
||||||
|
* sign.c (sign_file): Renamed arg encrypt to encryptflag
|
||||||
|
* keygen.c: Replaced all "usage" by "use".
|
||||||
|
* misc.c (openpgp_pk_algo_usage): Ditto.
|
||||||
|
|
||||||
|
* pubkey-enc.c (get_it): Renamed arg k to enc so that the later
|
||||||
|
defined k does not shadow it.
|
||||||
|
|
||||||
|
* parse-packet.c (parse_gpg_control): No need to define another i.
|
||||||
|
|
||||||
|
* getkey.c (get_pubkey_byfprint): Must use the enum values and not
|
||||||
|
the fprint_len.
|
||||||
|
* keyring.c (keyring_search): Removed a non-sense break. Both
|
||||||
|
bugs pointed out by Stefan.
|
||||||
|
|
||||||
2001-09-07 Werner Koch <wk@gnupg.org>
|
2001-09-07 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
* status.c, status.h: Added NO_RECP and ALREADY_SIGNED.
|
* status.c, status.h: Added NO_RECP and ALREADY_SIGNED.
|
||||||
|
@ -911,7 +911,8 @@ get_pubkey_byfprint( PKT_public_key *pk,
|
|||||||
ctx.not_allocated = 1;
|
ctx.not_allocated = 1;
|
||||||
ctx.kr_handle = keydb_new (0);
|
ctx.kr_handle = keydb_new (0);
|
||||||
ctx.nitems = 1;
|
ctx.nitems = 1;
|
||||||
ctx.items[0].mode = fprint_len;
|
ctx.items[0].mode = fprint_len==16? KEYDB_SEARCH_MODE_FPR16
|
||||||
|
: KEYDB_SEARCH_MODE_FPR20;
|
||||||
memcpy( ctx.items[0].u.fpr, fprint, fprint_len );
|
memcpy( ctx.items[0].u.fpr, fprint, fprint_len );
|
||||||
rc = lookup( &ctx, &kb, 0 );
|
rc = lookup( &ctx, &kb, 0 );
|
||||||
if (!rc && pk )
|
if (!rc && pk )
|
||||||
|
@ -955,7 +955,7 @@ keyedit_menu( const char *username, STRLIST locusr, STRLIST commands,
|
|||||||
|
|
||||||
case cmdUPDPREF:
|
case cmdUPDPREF:
|
||||||
{
|
{
|
||||||
char *p = keygen_get_std_prefs ();
|
p = keygen_get_std_prefs ();
|
||||||
tty_printf (("Current preference list: %s\n"), p);
|
tty_printf (("Current preference list: %s\n"), p);
|
||||||
m_free (p);
|
m_free (p);
|
||||||
}
|
}
|
||||||
|
46
g10/keygen.c
46
g10/keygen.c
@ -124,17 +124,17 @@ write_uid( KBNODE root, const char *s )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
do_add_key_flags (PKT_signature *sig, unsigned int usage)
|
do_add_key_flags (PKT_signature *sig, unsigned int use)
|
||||||
{
|
{
|
||||||
byte buf[1];
|
byte buf[1];
|
||||||
|
|
||||||
if (!usage)
|
if (!use)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
buf[0] = 0;
|
buf[0] = 0;
|
||||||
if (usage & PUBKEY_USAGE_SIG)
|
if (use & PUBKEY_USAGE_SIG)
|
||||||
buf[0] |= 0x01 | 0x02;
|
buf[0] |= 0x01 | 0x02;
|
||||||
if (usage & PUBKEY_USAGE_ENC)
|
if (use & PUBKEY_USAGE_ENC)
|
||||||
buf[0] |= 0x04 | 0x08;
|
buf[0] |= 0x04 | 0x08;
|
||||||
build_sig_subpkt (sig, SIGSUBPKT_KEY_FLAGS, buf, 1);
|
build_sig_subpkt (sig, SIGSUBPKT_KEY_FLAGS, buf, 1);
|
||||||
}
|
}
|
||||||
@ -292,7 +292,7 @@ add_feature_mdc (PKT_signature *sig)
|
|||||||
return; /* already set */
|
return; /* already set */
|
||||||
if (!s || !n) { /* create a new one */
|
if (!s || !n) { /* create a new one */
|
||||||
n = 1;
|
n = 1;
|
||||||
buf = m_alloc (n);
|
buf = m_alloc_clear (n);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
buf = m_alloc (n);
|
buf = m_alloc (n);
|
||||||
@ -358,7 +358,7 @@ keygen_add_std_prefs( PKT_signature *sig, void *opaque )
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
write_selfsig( KBNODE root, KBNODE pub_root, PKT_secret_key *sk,
|
write_selfsig( KBNODE root, KBNODE pub_root, PKT_secret_key *sk,
|
||||||
unsigned int usage )
|
unsigned int use )
|
||||||
{
|
{
|
||||||
PACKET *pkt;
|
PACKET *pkt;
|
||||||
PKT_signature *sig;
|
PKT_signature *sig;
|
||||||
@ -380,7 +380,7 @@ write_selfsig( KBNODE root, KBNODE pub_root, PKT_secret_key *sk,
|
|||||||
if( !node )
|
if( !node )
|
||||||
BUG();
|
BUG();
|
||||||
pk = node->pkt->pkt.public_key;
|
pk = node->pkt->pkt.public_key;
|
||||||
pk->pubkey_usage = usage;
|
pk->pubkey_usage = use;
|
||||||
/* we have to cache the key, so that the verification of the signature
|
/* we have to cache the key, so that the verification of the signature
|
||||||
* creation is able to retrieve the public key */
|
* creation is able to retrieve the public key */
|
||||||
cache_public_key (pk);
|
cache_public_key (pk);
|
||||||
@ -402,7 +402,7 @@ write_selfsig( KBNODE root, KBNODE pub_root, PKT_secret_key *sk,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
write_keybinding( KBNODE root, KBNODE pub_root, PKT_secret_key *sk,
|
write_keybinding( KBNODE root, KBNODE pub_root, PKT_secret_key *sk,
|
||||||
unsigned int usage )
|
unsigned int use )
|
||||||
{
|
{
|
||||||
PACKET *pkt;
|
PACKET *pkt;
|
||||||
PKT_signature *sig;
|
PKT_signature *sig;
|
||||||
@ -433,7 +433,7 @@ write_keybinding( KBNODE root, KBNODE pub_root, PKT_secret_key *sk,
|
|||||||
BUG();
|
BUG();
|
||||||
|
|
||||||
/* and make the signature */
|
/* and make the signature */
|
||||||
oduap.usage = usage;
|
oduap.usage = use;
|
||||||
oduap.pk = subpk;
|
oduap.pk = subpk;
|
||||||
rc = make_keysig_packet( &sig, pk, NULL, subpk, sk, 0x18, 0, 0,
|
rc = make_keysig_packet( &sig, pk, NULL, subpk, sk, 0x18, 0, 0,
|
||||||
keygen_add_key_flags_and_expire, &oduap );
|
keygen_add_key_flags_and_expire, &oduap );
|
||||||
@ -1296,26 +1296,26 @@ parse_parameter_usage (const char *fname,
|
|||||||
{
|
{
|
||||||
struct para_data_s *r = get_parameter( para, key );
|
struct para_data_s *r = get_parameter( para, key );
|
||||||
char *p, *pn;
|
char *p, *pn;
|
||||||
unsigned int usage;
|
unsigned int use;
|
||||||
|
|
||||||
if( !r )
|
if( !r )
|
||||||
return 0; /* none (this is an optional parameter)*/
|
return 0; /* none (this is an optional parameter)*/
|
||||||
|
|
||||||
usage = 0;
|
use = 0;
|
||||||
pn = r->u.value;
|
pn = r->u.value;
|
||||||
while ( (p = strsep (&pn, " \t,")) ) {
|
while ( (p = strsep (&pn, " \t,")) ) {
|
||||||
if ( !*p)
|
if ( !*p)
|
||||||
;
|
;
|
||||||
else if ( !ascii_strcasecmp (p, "sign") )
|
else if ( !ascii_strcasecmp (p, "sign") )
|
||||||
usage |= PUBKEY_USAGE_SIG;
|
use |= PUBKEY_USAGE_SIG;
|
||||||
else if ( !ascii_strcasecmp (p, "encrypt") )
|
else if ( !ascii_strcasecmp (p, "encrypt") )
|
||||||
usage |= PUBKEY_USAGE_ENC;
|
use |= PUBKEY_USAGE_ENC;
|
||||||
else {
|
else {
|
||||||
log_error("%s:%d: invalid usage list\n", fname, r->lnr );
|
log_error("%s:%d: invalid usage list\n", fname, r->lnr );
|
||||||
return -1; /* error */
|
return -1; /* error */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
r->u.usage = usage;
|
r->u.usage = use;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1662,7 +1662,7 @@ generate_keypair( const char *fname )
|
|||||||
DEK *dek;
|
DEK *dek;
|
||||||
STRING2KEY *s2k;
|
STRING2KEY *s2k;
|
||||||
int algo;
|
int algo;
|
||||||
unsigned int usage;
|
unsigned int use;
|
||||||
int both = 0;
|
int both = 0;
|
||||||
u32 expire;
|
u32 expire;
|
||||||
struct para_data_s *para = NULL;
|
struct para_data_s *para = NULL;
|
||||||
@ -1676,7 +1676,7 @@ generate_keypair( const char *fname )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
algo = ask_algo( 0, &usage );
|
algo = ask_algo( 0, &use );
|
||||||
if( !algo ) { /* default: DSA with ElG subkey of the specified size */
|
if( !algo ) { /* default: DSA with ElG subkey of the specified size */
|
||||||
both = 1;
|
both = 1;
|
||||||
r = m_alloc_clear( sizeof *r + 20 );
|
r = m_alloc_clear( sizeof *r + 20 );
|
||||||
@ -1705,12 +1705,12 @@ generate_keypair( const char *fname )
|
|||||||
r->next = para;
|
r->next = para;
|
||||||
para = r;
|
para = r;
|
||||||
|
|
||||||
if (usage) {
|
if (use) {
|
||||||
r = m_alloc_clear( sizeof *r + 20 );
|
r = m_alloc_clear( sizeof *r + 20 );
|
||||||
r->key = pKEYUSAGE;
|
r->key = pKEYUSAGE;
|
||||||
sprintf( r->u.value, "%s%s",
|
sprintf( r->u.value, "%s%s",
|
||||||
(usage & PUBKEY_USAGE_SIG)? "sign ":"",
|
(use & PUBKEY_USAGE_SIG)? "sign ":"",
|
||||||
(usage & PUBKEY_USAGE_ENC)? "encrypt ":"" );
|
(use & PUBKEY_USAGE_ENC)? "encrypt ":"" );
|
||||||
r->next = para;
|
r->next = para;
|
||||||
para = r;
|
para = r;
|
||||||
}
|
}
|
||||||
@ -1977,7 +1977,7 @@ generate_subkeypair( KBNODE pub_keyblock, KBNODE sec_keyblock )
|
|||||||
KBNODE node;
|
KBNODE node;
|
||||||
PKT_secret_key *sk = NULL; /* this is the primary sk */
|
PKT_secret_key *sk = NULL; /* this is the primary sk */
|
||||||
int algo;
|
int algo;
|
||||||
unsigned int usage;
|
unsigned int use;
|
||||||
u32 expire;
|
u32 expire;
|
||||||
unsigned nbits;
|
unsigned nbits;
|
||||||
char *passphrase = NULL;
|
char *passphrase = NULL;
|
||||||
@ -2031,7 +2031,7 @@ generate_subkeypair( KBNODE pub_keyblock, KBNODE sec_keyblock )
|
|||||||
goto leave;
|
goto leave;
|
||||||
|
|
||||||
|
|
||||||
algo = ask_algo( 1, &usage );
|
algo = ask_algo( 1, &use );
|
||||||
assert(algo);
|
assert(algo);
|
||||||
nbits = ask_keysize( algo );
|
nbits = ask_keysize( algo );
|
||||||
expire = ask_expire_interval();
|
expire = ask_expire_interval();
|
||||||
@ -2050,9 +2050,9 @@ generate_subkeypair( KBNODE pub_keyblock, KBNODE sec_keyblock )
|
|||||||
rc = do_create( algo, nbits, pub_keyblock, sec_keyblock,
|
rc = do_create( algo, nbits, pub_keyblock, sec_keyblock,
|
||||||
dek, s2k, NULL, expire );
|
dek, s2k, NULL, expire );
|
||||||
if( !rc )
|
if( !rc )
|
||||||
rc = write_keybinding(pub_keyblock, pub_keyblock, sk, usage);
|
rc = write_keybinding(pub_keyblock, pub_keyblock, sk, use);
|
||||||
if( !rc )
|
if( !rc )
|
||||||
rc = write_keybinding(sec_keyblock, pub_keyblock, sk, usage);
|
rc = write_keybinding(sec_keyblock, pub_keyblock, sk, use);
|
||||||
if( !rc ) {
|
if( !rc ) {
|
||||||
okay = 1;
|
okay = 1;
|
||||||
write_status_text (STATUS_KEY_CREATED, "S");
|
write_status_text (STATUS_KEY_CREATED, "S");
|
||||||
|
@ -166,12 +166,12 @@ print_key_data( PKT_public_key *pk, u32 *keyid )
|
|||||||
static void
|
static void
|
||||||
print_capabilities (PKT_public_key *pk, PKT_secret_key *sk, KBNODE keyblock)
|
print_capabilities (PKT_public_key *pk, PKT_secret_key *sk, KBNODE keyblock)
|
||||||
{
|
{
|
||||||
unsigned int usage = pk? pk->pubkey_usage : sk->pubkey_usage;
|
unsigned int use = pk? pk->pubkey_usage : sk->pubkey_usage;
|
||||||
|
|
||||||
if ( usage & PUBKEY_USAGE_ENC ) {
|
if ( use & PUBKEY_USAGE_ENC ) {
|
||||||
putchar ('e');
|
putchar ('e');
|
||||||
}
|
}
|
||||||
if ( usage & PUBKEY_USAGE_SIG ) {
|
if ( use & PUBKEY_USAGE_SIG ) {
|
||||||
putchar ('s');
|
putchar ('s');
|
||||||
putchar ('c');
|
putchar ('c');
|
||||||
}
|
}
|
||||||
|
@ -795,7 +795,7 @@ keyring_search (KEYRING_HANDLE hd, KEYDB_SEARCH_DESC *desc, size_t ndesc)
|
|||||||
&& desc[n].u.kid[1] == aki[1])
|
&& desc[n].u.kid[1] == aki[1])
|
||||||
goto found;
|
goto found;
|
||||||
break;
|
break;
|
||||||
case KEYDB_SEARCH_MODE_FPR16: break;
|
case KEYDB_SEARCH_MODE_FPR16:
|
||||||
if ((pk||sk) && !memcmp (desc[n].u.fpr, afp, 16))
|
if ((pk||sk) && !memcmp (desc[n].u.fpr, afp, 16))
|
||||||
goto found;
|
goto found;
|
||||||
break;
|
break;
|
||||||
|
BIN
g10/keyring.o
BIN
g10/keyring.o
Binary file not shown.
17
g10/misc.c
17
g10/misc.c
@ -299,33 +299,32 @@ openpgp_pk_test_algo( int algo, unsigned int usage_flags )
|
|||||||
int
|
int
|
||||||
openpgp_pk_algo_usage ( int algo )
|
openpgp_pk_algo_usage ( int algo )
|
||||||
{
|
{
|
||||||
int usage = 0;
|
int use = 0;
|
||||||
|
|
||||||
/* they are hardwired in gpg 1.0 */
|
/* they are hardwired in gpg 1.0 */
|
||||||
switch ( algo ) {
|
switch ( algo ) {
|
||||||
case PUBKEY_ALGO_RSA:
|
case PUBKEY_ALGO_RSA:
|
||||||
usage = PUBKEY_USAGE_SIG | PUBKEY_USAGE_ENC;
|
use = PUBKEY_USAGE_SIG | PUBKEY_USAGE_ENC;
|
||||||
break;
|
break;
|
||||||
case PUBKEY_ALGO_RSA_E:
|
case PUBKEY_ALGO_RSA_E:
|
||||||
usage = PUBKEY_USAGE_ENC;
|
use = PUBKEY_USAGE_ENC;
|
||||||
break;
|
break;
|
||||||
case PUBKEY_ALGO_RSA_S:
|
case PUBKEY_ALGO_RSA_S:
|
||||||
usage = PUBKEY_USAGE_SIG;
|
use = PUBKEY_USAGE_SIG;
|
||||||
break;
|
break;
|
||||||
case PUBKEY_ALGO_ELGAMAL_E:
|
case PUBKEY_ALGO_ELGAMAL_E:
|
||||||
usage = PUBKEY_USAGE_ENC;
|
use = PUBKEY_USAGE_ENC;
|
||||||
break;
|
break;
|
||||||
case PUBKEY_ALGO_DSA:
|
case PUBKEY_ALGO_DSA:
|
||||||
usage = PUBKEY_USAGE_SIG;
|
use = PUBKEY_USAGE_SIG;
|
||||||
break;
|
break;
|
||||||
case PUBKEY_ALGO_ELGAMAL:
|
case PUBKEY_ALGO_ELGAMAL:
|
||||||
usage = PUBKEY_USAGE_SIG | PUBKEY_USAGE_ENC;
|
use = PUBKEY_USAGE_SIG | PUBKEY_USAGE_ENC;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return usage;
|
return use;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1931,7 +1931,9 @@ parse_gpg_control( IOBUF inp,
|
|||||||
|
|
||||||
skipit:
|
skipit:
|
||||||
if ( list_mode ) {
|
if ( list_mode ) {
|
||||||
int c, i=0 ;
|
int c;
|
||||||
|
|
||||||
|
i=0;
|
||||||
printf("- private (rest length %lu)\n", pktlen);
|
printf("- private (rest length %lu)\n", pktlen);
|
||||||
if( iobuf_in_block_mode(inp) ) {
|
if( iobuf_in_block_mode(inp) ) {
|
||||||
while( (c=iobuf_get(inp)) != -1 )
|
while( (c=iobuf_get(inp)) != -1 )
|
||||||
|
@ -211,7 +211,7 @@ readn ( int fd, void *buf, size_t buflen, size_t *ret_nread )
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
agent_open ()
|
agent_open (void)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
char *infostr, *p;
|
char *infostr, *p;
|
||||||
|
@ -117,7 +117,7 @@ get_session_key( PKT_pubkey_enc *k, DEK *dek )
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
get_it( PKT_pubkey_enc *k, DEK *dek, PKT_secret_key *sk, u32 *keyid )
|
get_it( PKT_pubkey_enc *enc, DEK *dek, PKT_secret_key *sk, u32 *keyid )
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
MPI plain_dek = NULL;
|
MPI plain_dek = NULL;
|
||||||
@ -125,7 +125,7 @@ get_it( PKT_pubkey_enc *k, DEK *dek, PKT_secret_key *sk, u32 *keyid )
|
|||||||
unsigned n, nframe;
|
unsigned n, nframe;
|
||||||
u16 csum, csum2;
|
u16 csum, csum2;
|
||||||
|
|
||||||
rc = pubkey_decrypt(sk->pubkey_algo, &plain_dek, k->data, sk->skey );
|
rc = pubkey_decrypt(sk->pubkey_algo, &plain_dek, enc->data, sk->skey );
|
||||||
if( rc )
|
if( rc )
|
||||||
goto leave;
|
goto leave;
|
||||||
frame = mpi_get_buffer( plain_dek, &nframe, NULL );
|
frame = mpi_get_buffer( plain_dek, &nframe, NULL );
|
||||||
|
16
g10/sign.c
16
g10/sign.c
@ -495,7 +495,7 @@ write_signature_packets (SK_LIST sk_list, IOBUF out, MD_HANDLE hash,
|
|||||||
* make a detached signature. If FILENAMES->d is NULL read from stdin
|
* make a detached signature. If FILENAMES->d is NULL read from stdin
|
||||||
* and ignore the detached mode. Sign the file with all secret keys
|
* and ignore the detached mode. Sign the file with all secret keys
|
||||||
* which can be taken from LOCUSR, if this is NULL, use the default one
|
* which can be taken from LOCUSR, if this is NULL, use the default one
|
||||||
* If ENCRYPT is true, use REMUSER (or ask if it is NULL) to encrypt the
|
* If ENCRYPTFLAG is true, use REMUSER (or ask if it is NULL) to encrypt the
|
||||||
* signed data for these users.
|
* signed data for these users.
|
||||||
* If OUTFILE is not NULL; this file is used for output and the function
|
* If OUTFILE is not NULL; this file is used for output and the function
|
||||||
* does not ask for overwrite permission; output is then always
|
* does not ask for overwrite permission; output is then always
|
||||||
@ -503,7 +503,7 @@ write_signature_packets (SK_LIST sk_list, IOBUF out, MD_HANDLE hash,
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
sign_file( STRLIST filenames, int detached, STRLIST locusr,
|
sign_file( STRLIST filenames, int detached, STRLIST locusr,
|
||||||
int encrypt, STRLIST remusr, const char *outfile )
|
int encryptflag, STRLIST remusr, const char *outfile )
|
||||||
{
|
{
|
||||||
const char *fname;
|
const char *fname;
|
||||||
armor_filter_context_t afx;
|
armor_filter_context_t afx;
|
||||||
@ -536,7 +536,7 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr,
|
|||||||
else
|
else
|
||||||
fname = NULL;
|
fname = NULL;
|
||||||
|
|
||||||
if( fname && filenames->next && (!detached || encrypt) )
|
if( fname && filenames->next && (!detached || encryptflag) )
|
||||||
log_bug("multiple files can only be detached signed");
|
log_bug("multiple files can only be detached signed");
|
||||||
|
|
||||||
if( (rc=build_sk_list( locusr, &sk_list, 1, PUBKEY_USAGE_SIG )) )
|
if( (rc=build_sk_list( locusr, &sk_list, 1, PUBKEY_USAGE_SIG )) )
|
||||||
@ -544,7 +544,7 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr,
|
|||||||
if( !old_style )
|
if( !old_style )
|
||||||
old_style = only_old_style( sk_list );
|
old_style = only_old_style( sk_list );
|
||||||
|
|
||||||
if( encrypt ) {
|
if( encryptflag ) {
|
||||||
if( (rc=build_pk_list( remusr, &pk_list, PUBKEY_USAGE_ENC )) )
|
if( (rc=build_pk_list( remusr, &pk_list, PUBKEY_USAGE_ENC )) )
|
||||||
goto leave;
|
goto leave;
|
||||||
if( !old_style )
|
if( !old_style )
|
||||||
@ -586,13 +586,13 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr,
|
|||||||
if( !multifile )
|
if( !multifile )
|
||||||
iobuf_push_filter( inp, md_filter, &mfx );
|
iobuf_push_filter( inp, md_filter, &mfx );
|
||||||
|
|
||||||
if( detached && !encrypt && !opt.rfc1991 )
|
if( detached && !encryptflag && !opt.rfc1991 )
|
||||||
afx.what = 2;
|
afx.what = 2;
|
||||||
|
|
||||||
if( opt.armor && !outfile )
|
if( opt.armor && !outfile )
|
||||||
iobuf_push_filter( out, armor_filter, &afx );
|
iobuf_push_filter( out, armor_filter, &afx );
|
||||||
|
|
||||||
if( encrypt ) {
|
if( encryptflag ) {
|
||||||
efx.pk_list = pk_list;
|
efx.pk_list = pk_list;
|
||||||
/* fixme: set efx.cfx.datalen if known */
|
/* fixme: set efx.cfx.datalen if known */
|
||||||
iobuf_push_filter( out, encrypt_filter, &efx );
|
iobuf_push_filter( out, encrypt_filter, &efx );
|
||||||
@ -604,7 +604,7 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr,
|
|||||||
else {
|
else {
|
||||||
if( old_style
|
if( old_style
|
||||||
|| compr_algo == 1
|
|| compr_algo == 1
|
||||||
|| (compr_algo == -1 && !encrypt) )
|
|| (compr_algo == -1 && !encryptflag) )
|
||||||
zfx.algo = 1; /* use the non optional algorithm */
|
zfx.algo = 1; /* use the non optional algorithm */
|
||||||
iobuf_push_filter( out, compress_filter, &zfx );
|
iobuf_push_filter( out, compress_filter, &zfx );
|
||||||
}
|
}
|
||||||
@ -672,7 +672,7 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr,
|
|||||||
iobuf_cancel(out);
|
iobuf_cancel(out);
|
||||||
else {
|
else {
|
||||||
iobuf_close(out);
|
iobuf_close(out);
|
||||||
if (encrypt)
|
if (encryptflag)
|
||||||
write_status( STATUS_END_ENCRYPTION );
|
write_status( STATUS_END_ENCRYPTION );
|
||||||
}
|
}
|
||||||
iobuf_close(inp);
|
iobuf_close(inp);
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2001-09-07 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
|
* util.h: Add strsep().
|
||||||
|
|
||||||
2001-08-30 Werner Koch <wk@gnupg.org>
|
2001-08-30 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
* cipher.h (DEK): Added use_mdc.
|
* cipher.h (DEK): Added use_mdc.
|
||||||
|
@ -203,6 +203,9 @@ char *stpcpy(char *a,const char *b);
|
|||||||
#ifndef HAVE_STRLWR
|
#ifndef HAVE_STRLWR
|
||||||
char *strlwr(char *a);
|
char *strlwr(char *a);
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef HAVE_STRSEP
|
||||||
|
char *strsep (char **stringp, const char *delim);
|
||||||
|
#endif
|
||||||
#ifndef HAVE_STRCASECMP
|
#ifndef HAVE_STRCASECMP
|
||||||
int strcasecmp( const char *, const char *b);
|
int strcasecmp( const char *, const char *b);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2001-09-07 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
|
* strgutil.c (strsep): New, taken from glibc 2.2.1.
|
||||||
|
|
||||||
2001-09-03 Werner Koch <wk@gnupg.org>
|
2001-09-03 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
* miscutil.c (strtimestamp,asctimestamp): Avoid trigraphs.
|
* miscutil.c (strtimestamp,asctimestamp): Avoid trigraphs.
|
||||||
|
@ -689,6 +689,56 @@ stpcpy(char *a,const char *b)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef HAVE_STRSEP
|
||||||
|
/* code taken from glibc-2.2.1/sysdeps/generic/strsep.c */
|
||||||
|
char *
|
||||||
|
strsep (char **stringp, const char *delim)
|
||||||
|
{
|
||||||
|
char *begin, *end;
|
||||||
|
|
||||||
|
begin = *stringp;
|
||||||
|
if (begin == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
/* A frequent case is when the delimiter string contains only one
|
||||||
|
character. Here we don't need to call the expensive `strpbrk'
|
||||||
|
function and instead work using `strchr'. */
|
||||||
|
if (delim[0] == '\0' || delim[1] == '\0')
|
||||||
|
{
|
||||||
|
char ch = delim[0];
|
||||||
|
|
||||||
|
if (ch == '\0')
|
||||||
|
end = NULL;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (*begin == ch)
|
||||||
|
end = begin;
|
||||||
|
else if (*begin == '\0')
|
||||||
|
end = NULL;
|
||||||
|
else
|
||||||
|
end = strchr (begin + 1, ch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
/* Find the end of the token. */
|
||||||
|
end = strpbrk (begin, delim);
|
||||||
|
|
||||||
|
if (end)
|
||||||
|
{
|
||||||
|
/* Terminate the token and set *STRINGP past NUL character. */
|
||||||
|
*end++ = '\0';
|
||||||
|
*stringp = end;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
/* No more delimiters; this is the last token. */
|
||||||
|
*stringp = NULL;
|
||||||
|
|
||||||
|
return begin;
|
||||||
|
}
|
||||||
|
#endif /*HAVE_STRSEP*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef HAVE_STRLWR
|
#ifndef HAVE_STRLWR
|
||||||
char *
|
char *
|
||||||
strlwr(char *s)
|
strlwr(char *s)
|
||||||
@ -823,4 +873,3 @@ vasprintf ( char **result, const char *format, va_list args)
|
|||||||
|
|
||||||
#endif /*__MINGW32__*/
|
#endif /*__MINGW32__*/
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user