[svn] GnuPG - r4185 - in branches/GNUPG-1-9-BRANCH: . g10 scd
svn author wk
cvs at cvs.gnupg.org
Fri Jun 30 11:42:10 CEST 2006
Author: wk
Date: 2006-06-30 11:42:08 +0200 (Fri, 30 Jun 2006)
New Revision: 4185
Modified:
branches/GNUPG-1-9-BRANCH/TODO
branches/GNUPG-1-9-BRANCH/g10/ChangeLog
branches/GNUPG-1-9-BRANCH/g10/card-util.c
branches/GNUPG-1-9-BRANCH/g10/keygen.c
branches/GNUPG-1-9-BRANCH/g10/mainproc.c
branches/GNUPG-1-9-BRANCH/g10/misc.c
branches/GNUPG-1-9-BRANCH/g10/parse-packet.c
branches/GNUPG-1-9-BRANCH/g10/pkclist.c
branches/GNUPG-1-9-BRANCH/g10/pubkey-enc.c
branches/GNUPG-1-9-BRANCH/g10/seskey.c
branches/GNUPG-1-9-BRANCH/scd/ChangeLog
branches/GNUPG-1-9-BRANCH/scd/app-openpgp.c
Log:
A couple of fixes. gpg2's key generation does now work.
Modified: branches/GNUPG-1-9-BRANCH/TODO
===================================================================
--- branches/GNUPG-1-9-BRANCH/TODO 2006-06-28 22:29:25 UTC (rev 4184)
+++ branches/GNUPG-1-9-BRANCH/TODO 2006-06-30 09:42:08 UTC (rev 4185)
@@ -103,6 +103,9 @@
* sm/
** check that we issue NO_SECKEY xxx if a -u key was not found
+* jnlib/
+** provide jnlib_malloc and try to remove all jnlib_xmalloc.
+
* gpg/
** issue a NO_SECKEY xxxx if a -u key was not found.
** Replace DIGEST_ALGO_SHA224
Modified: branches/GNUPG-1-9-BRANCH/g10/ChangeLog
===================================================================
--- branches/GNUPG-1-9-BRANCH/g10/ChangeLog 2006-06-28 22:29:25 UTC (rev 4184)
+++ branches/GNUPG-1-9-BRANCH/g10/ChangeLog 2006-06-30 09:42:08 UTC (rev 4185)
@@ -1,3 +1,24 @@
+2006-06-30 Werner Koch <wk at g10code.com>
+
+ * misc.c (checksum_mpi): No need for nbits as they are alredy
+ included in the buffer.
+
+2006-06-29 Werner Koch <wk at g10code.com>
+
+ * parse-packet.c (parse_signature, parse_key): Need store the
+ length of opaque data as number of bits.
+ * card-util.c (card_store_subkey): Ditto.
+
+ * mainproc.c (print_pkenc_list, check_sig_and_print): Replaced
+ log_get_stream by calls to log_printf. This avoids the extra LFs
+ inserted by the logging function. They are a bit too smart
+ sometimes.
+ * pkclist.c (do_show_revocation_reason): Print final LF through
+ log_printf to avoid extra LFs.
+ * pubkey-enc.c (get_it): Ditto.
+
+ * seskey.c (encode_md_value): Fix call to gcry.
+
2006-06-27 Werner Koch <wk at g10code.com>
Applied patches from 1.4.x (2006-05-22 to 2006-06-23) from David:
Modified: branches/GNUPG-1-9-BRANCH/g10/card-util.c
===================================================================
--- branches/GNUPG-1-9-BRANCH/g10/card-util.c 2006-06-28 22:29:25 UTC (rev 4184)
+++ branches/GNUPG-1-9-BRANCH/g10/card-util.c 2006-06-30 09:42:08 UTC (rev 4185)
@@ -1271,7 +1271,7 @@
sk->skey[i] = NULL;
}
i = pubkey_get_npkey (sk->pubkey_algo);
- sk->skey[i] = mpi_set_opaque (NULL, xstrdup ("dummydata"), 10);
+ sk->skey[i] = gcry_mpi_set_opaque (NULL, xstrdup ("dummydata"), 10*8);
sk->is_protected = 1;
sk->protect.s2k.mode = 1002;
s = info.serialno;
Modified: branches/GNUPG-1-9-BRANCH/g10/keygen.c
===================================================================
--- branches/GNUPG-1-9-BRANCH/g10/keygen.c 2006-06-28 22:29:25 UTC (rev 4184)
+++ branches/GNUPG-1-9-BRANCH/g10/keygen.c 2006-06-30 09:42:08 UTC (rev 4185)
@@ -3701,7 +3701,7 @@
sk->skey[i] = NULL;
}
i = pubkey_get_npkey (sk->pubkey_algo);
- sk->skey[i] = mpi_set_opaque (NULL, xstrdup ("dummydata"), 10);
+ sk->skey[i] = gcry_mpi_set_opaque (NULL, xstrdup ("dummydata"), 10*8);
sk->is_protected = 1;
sk->protect.s2k.mode = 1002;
s = get_parameter_value (para, pSERIALNO);
Modified: branches/GNUPG-1-9-BRANCH/g10/mainproc.c
===================================================================
--- branches/GNUPG-1-9-BRANCH/g10/mainproc.c 2006-06-28 22:29:25 UTC (rev 4184)
+++ branches/GNUPG-1-9-BRANCH/g10/mainproc.c 2006-06-30 09:42:08 UTC (rev 4185)
@@ -445,7 +445,7 @@
nbits_from_pk( pk ), algstr, keystr_from_pk(pk),
strtimestamp(pk->timestamp) );
p=get_user_id_native(list->kid);
- fprintf(log_get_stream(),_(" \"%s\"\n"),p);
+ log_printf (_(" \"%s\"\n"),p);
xfree(p);
}
else
@@ -1527,7 +1527,7 @@
not going to even try to make two strings here :) */
log_info(_("Key available at: ") );
print_utf8_string( log_get_stream(), p, n );
- putc( '\n', log_get_stream() );
+ log_printf ("\n");
if(opt.keyserver_options.options&KEYSERVER_AUTO_KEY_RETRIEVE
&& opt.keyserver_options.options&KEYSERVER_HONOR_KEYSERVER_URL)
@@ -1667,9 +1667,9 @@
xfree(p);
if(opt.verify_options&VERIFY_SHOW_UID_VALIDITY)
- fprintf(log_get_stream()," [%s]\n",trust_value_to_string(valid));
+ log_printf (" [%s]\n",trust_value_to_string(valid));
else
- fputs("\n", log_get_stream() );
+ log_printf ("\n");
count++;
}
if( !count ) { /* just in case that we have no valid textual
@@ -1712,11 +1712,8 @@
else
log_info(_("Good signature from \"%s\""),p);
if (opt.trust_model!=TM_ALWAYS && un)
- {
- putc(' ', log_get_stream() );
- fputs(_("[uncertain]"), log_get_stream() );
- }
- fputs("\n", log_get_stream() );
+ log_printf (" %s",_("[uncertain]") );
+ log_printf ("\n");
}
/* If we have a good signature and already printed
@@ -1760,10 +1757,10 @@
valid=trust_value_to_string(get_validity(pk,
un->pkt->
pkt.user_id));
- fprintf(log_get_stream()," [%s]\n",valid);
+ log_printf (" [%s]\n",valid);
}
else
- fputs("\n", log_get_stream() );
+ log_printf ("\n");
}
}
release_kbnode( keyblock );
Modified: branches/GNUPG-1-9-BRANCH/g10/misc.c
===================================================================
--- branches/GNUPG-1-9-BRANCH/g10/misc.c 2006-06-28 22:29:25 UTC (rev 4184)
+++ branches/GNUPG-1-9-BRANCH/g10/misc.c 2006-06-30 09:42:08 UTC (rev 4185)
@@ -297,7 +297,6 @@
u16 csum;
byte *buffer;
unsigned int nbytes;
- unsigned int nbits;
if ( gcry_mpi_print (GCRYMPI_FMT_PGP, NULL, 0, &nbytes, a) )
BUG ();
@@ -308,9 +307,7 @@
gcry_xmalloc_secure (nbytes) : gcry_xmalloc (nbytes));
if ( gcry_mpi_print (GCRYMPI_FMT_PGP, buffer, nbytes, NULL, a) )
BUG ();
- nbits = gcry_mpi_get_nbits (a);
- csum = checksum_u16 (nbits);
- csum += checksum (buffer, nbytes);
+ csum = checksum (buffer, nbytes);
xfree (buffer);
return csum;
}
Modified: branches/GNUPG-1-9-BRANCH/g10/parse-packet.c
===================================================================
--- branches/GNUPG-1-9-BRANCH/g10/parse-packet.c 2006-06-28 22:29:25 UTC (rev 4184)
+++ branches/GNUPG-1-9-BRANCH/g10/parse-packet.c 2006-06-30 09:42:08 UTC (rev 4185)
@@ -1490,9 +1490,10 @@
if( list_mode )
fprintf (listfp, "\tunknown algorithm %d\n", sig->pubkey_algo );
unknown_pubkey_warning( sig->pubkey_algo );
- /* we store the plain material in data[0], so that we are able
+ /* We store the plain material in data[0], so that we are able
* to write it back with build_packet() */
- sig->data[0]= mpi_set_opaque(NULL, read_rest(inp, pktlen, 0), pktlen );
+ sig->data[0]= gcry_mpi_set_opaque (NULL, read_rest(inp, pktlen, 0),
+ pktlen*8 );
pktlen = 0;
}
else {
@@ -1715,8 +1716,8 @@
size_t snlen = 0;
if( !npkey ) {
- sk->skey[0] = mpi_set_opaque( NULL,
- read_rest(inp, pktlen, 0), pktlen );
+ sk->skey[0] = gcry_mpi_set_opaque (NULL, read_rest(inp, pktlen, 0),
+ pktlen*8 );
pktlen = 0;
goto leave;
}
@@ -1894,15 +1895,17 @@
if( sk->protect.s2k.mode == 1001
|| sk->protect.s2k.mode == 1002 ) {
/* better set some dummy stuff here */
- sk->skey[npkey] = mpi_set_opaque(NULL, xstrdup("dummydata"), 10);
+ sk->skey[npkey] = gcry_mpi_set_opaque(NULL,
+ xstrdup("dummydata"), 10*8);
pktlen = 0;
}
else if( is_v4 && sk->is_protected ) {
/* ugly; the length is encrypted too, so we read all
* stuff up to the end of the packet into the first
* skey element */
- sk->skey[npkey] = mpi_set_opaque(NULL,
- read_rest(inp, pktlen, 0),pktlen);
+ sk->skey[npkey] = gcry_mpi_set_opaque (NULL,
+ read_rest(inp, pktlen, 0),
+ pktlen*8);
pktlen = 0;
if( list_mode ) {
fprintf (listfp, "\tencrypted stuff follows\n");
@@ -1942,8 +1945,9 @@
PKT_public_key *pk = pkt->pkt.public_key;
if( !npkey ) {
- pk->pkey[0] = mpi_set_opaque( NULL,
- read_rest(inp, pktlen, 0), pktlen );
+ pk->pkey[0] = gcry_mpi_set_opaque ( NULL,
+ read_rest(inp, pktlen, 0),
+ pktlen*8 );
pktlen = 0;
goto leave;
}
Modified: branches/GNUPG-1-9-BRANCH/g10/pkclist.c
===================================================================
--- branches/GNUPG-1-9-BRANCH/g10/pkclist.c 2006-06-28 22:29:25 UTC (rev 4184)
+++ branches/GNUPG-1-9-BRANCH/g10/pkclist.c 2006-06-30 09:42:08 UTC (rev 4185)
@@ -76,7 +76,7 @@
fputs( text, log_get_stream() );
else
fprintf( log_get_stream(), "code=%02x", *p );
- putc( '\n', log_get_stream() );
+ log_printf ("\n");
n--; p++;
pp = NULL;
do {
@@ -88,9 +88,9 @@
if( n ) {
pp = memchr( p, '\n', n );
nn = pp? pp - p : n;
- log_info( _("revocation comment: ") );
- print_string( log_get_stream(), p, nn, 0 );
- putc( '\n', log_get_stream() );
+ log_info ( _("revocation comment: ") );
+ print_string ( log_get_stream(), p, nn, 0 );
+ log_printf ("\n");
p += nn; n -= nn;
}
} while( pp );
Modified: branches/GNUPG-1-9-BRANCH/g10/pubkey-enc.c
===================================================================
--- branches/GNUPG-1-9-BRANCH/g10/pubkey-enc.c 2006-06-28 22:29:25 UTC (rev 4184)
+++ branches/GNUPG-1-9-BRANCH/g10/pubkey-enc.c 2006-06-30 09:42:08 UTC (rev 4185)
@@ -308,7 +308,7 @@
if ( pk && pk->is_revoked ) {
log_info( _("NOTE: key has been revoked") );
- putc( '\n', log_get_stream() );
+ log_printf ("\n");
show_revocation_reason( pk, 1 );
}
Modified: branches/GNUPG-1-9-BRANCH/g10/seskey.c
===================================================================
--- branches/GNUPG-1-9-BRANCH/g10/seskey.c 2006-06-28 22:29:25 UTC (rev 4184)
+++ branches/GNUPG-1-9-BRANCH/g10/seskey.c 2006-06-30 09:42:08 UTC (rev 4185)
@@ -220,8 +220,7 @@
{
/* It's a DSA signature, so find out the size of q. */
- unsigned int qbytes = gcry_mpi_get_nbits (pk?pk->pkey[1]:sk->skey[1]);
- size_t n;
+ size_t qbytes = gcry_mpi_get_nbits (pk?pk->pkey[1]:sk->skey[1]);
/* Make sure it is a multiple of 8 bits. */
@@ -259,7 +258,7 @@
}
if (gcry_mpi_scan (&frame, GCRYMPI_FMT_USG,
- gcry_md_read (md, hash_algo), n, &n))
+ gcry_md_read (md, hash_algo), qbytes, &qbytes))
BUG();
}
else
Modified: branches/GNUPG-1-9-BRANCH/scd/ChangeLog
===================================================================
--- branches/GNUPG-1-9-BRANCH/scd/ChangeLog 2006-06-28 22:29:25 UTC (rev 4184)
+++ branches/GNUPG-1-9-BRANCH/scd/ChangeLog 2006-06-30 09:42:08 UTC (rev 4185)
@@ -1,3 +1,9 @@
+2006-06-28 Werner Koch <wk at g10code.com>
+
+ * app-openpgp.c (do_writekey): Fixed computation of memmove
+ length. This led to garbled keys if E was larger than one byte.
+ Thanks to Achim Pietig for hinting at the garbled E.
+
2006-06-09 Marcus Brinkmann <marcus at g10code.de>
* Makefile.am (scdaemon_LDADD): Add $(NETLIBS).
Modified: branches/GNUPG-1-9-BRANCH/scd/app-openpgp.c
===================================================================
--- branches/GNUPG-1-9-BRANCH/scd/app-openpgp.c 2006-06-28 22:29:25 UTC (rev 4184)
+++ branches/GNUPG-1-9-BRANCH/scd/app-openpgp.c 2006-06-30 09:42:08 UTC (rev 4185)
@@ -1828,7 +1828,7 @@
if (rsa_e_len < 4)
{
/* Right justify E. */
- memmove (tp+4-rsa_e_len, tp, 4-rsa_e_len);
+ memmove (tp+4-rsa_e_len, tp, rsa_e_len);
memset (tp, 0, 4-rsa_e_len);
}
tp += 4;
More information about the Gnupg-commits
mailing list