mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-21 14:47:03 +01:00
* g10.c (main): Alias --charset as --display-charset to help avoid the
continuing confusion and make room for possible changes in devel. * parse-packet.c (parse_plaintext): Show the hex value for the literal packet mode since it may not be printable. * keygen.c (make_backsig): Make sure that the backsig was built successfully before we try and use it. * status.h, status.c (get_status_string), plaintext.c (handle_plaintext): New status tags PLAINTEXT and PLAINTEXT_LENGTH.
This commit is contained in:
parent
d60d73a53b
commit
2cba999f22
@ -1,3 +1,19 @@
|
|||||||
|
2004-07-15 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
|
* g10.c (main): Alias --charset as --display-charset to help avoid
|
||||||
|
the continuing confusion and make room for possible changes in
|
||||||
|
devel.
|
||||||
|
|
||||||
|
* parse-packet.c (parse_plaintext): Show the hex value for the
|
||||||
|
literal packet mode since it may not be printable.
|
||||||
|
|
||||||
|
* keygen.c (make_backsig): Make sure that the backsig was built
|
||||||
|
successfully before we try and use it.
|
||||||
|
|
||||||
|
* status.h, status.c (get_status_string), plaintext.c
|
||||||
|
(handle_plaintext): New status tags PLAINTEXT and
|
||||||
|
PLAINTEXT_LENGTH.
|
||||||
|
|
||||||
2004-06-16 Werner Koch <wk@gnupg.org>
|
2004-06-16 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
* free-packet.c (copy_secret_key): Get last fix right.
|
* free-packet.c (copy_secret_key): Get last fix right.
|
||||||
|
@ -259,7 +259,7 @@ enum cmd_and_opt_values
|
|||||||
oS2KDigest,
|
oS2KDigest,
|
||||||
oS2KCipher,
|
oS2KCipher,
|
||||||
oSimpleSKChecksum,
|
oSimpleSKChecksum,
|
||||||
oCharset,
|
oDisplayCharset,
|
||||||
oNotDashEscaped,
|
oNotDashEscaped,
|
||||||
oEscapeFrom,
|
oEscapeFrom,
|
||||||
oNoEscapeFrom,
|
oNoEscapeFrom,
|
||||||
@ -477,7 +477,8 @@ static ARGPARSE_OPTS opts[] = {
|
|||||||
{ oExportOptions, "export-options",2,"@"},
|
{ oExportOptions, "export-options",2,"@"},
|
||||||
{ oListOptions, "list-options",2,"@"},
|
{ oListOptions, "list-options",2,"@"},
|
||||||
{ oVerifyOptions, "verify-options",2,"@"},
|
{ oVerifyOptions, "verify-options",2,"@"},
|
||||||
{ oCharset, "charset", 2, "@"},
|
{ oDisplayCharset, "display-charset", 2, "@"},
|
||||||
|
{ oDisplayCharset, "charset", 2, "@"},
|
||||||
{ oOptions, "options", 2, "@"},
|
{ oOptions, "options", 2, "@"},
|
||||||
{ oDebug, "debug" ,4|16, "@"},
|
{ oDebug, "debug" ,4|16, "@"},
|
||||||
{ oDebugAll, "debug-all" ,0, "@"},
|
{ oDebugAll, "debug-all" ,0, "@"},
|
||||||
@ -2093,7 +2094,7 @@ main( int argc, char **argv )
|
|||||||
case oNoSecmemWarn: secmem_set_flags( secmem_get_flags() | 1 ); break;
|
case oNoSecmemWarn: secmem_set_flags( secmem_get_flags() | 1 ); break;
|
||||||
case oNoPermissionWarn: opt.no_perm_warn=1; break;
|
case oNoPermissionWarn: opt.no_perm_warn=1; break;
|
||||||
case oNoMDCWarn: opt.no_mdc_warn=1; break;
|
case oNoMDCWarn: opt.no_mdc_warn=1; break;
|
||||||
case oCharset:
|
case oDisplayCharset:
|
||||||
if( set_native_charset( pargs.r.ret_str ) )
|
if( set_native_charset( pargs.r.ret_str ) )
|
||||||
log_error(_("%s is not a valid character set\n"),
|
log_error(_("%s is not a valid character set\n"),
|
||||||
pargs.r.ret_str);
|
pargs.r.ret_str);
|
||||||
|
104
g10/keygen.c
104
g10/keygen.c
@ -651,69 +651,73 @@ make_backsig(PKT_signature *sig, PKT_public_key *pk,
|
|||||||
/* get it into a binary packed form. */
|
/* get it into a binary packed form. */
|
||||||
IOBUF backsig_out=iobuf_temp();
|
IOBUF backsig_out=iobuf_temp();
|
||||||
PACKET backsig_pkt;
|
PACKET backsig_pkt;
|
||||||
byte *buf;
|
|
||||||
size_t pktlen=0;
|
|
||||||
|
|
||||||
init_packet(&backsig_pkt);
|
init_packet(&backsig_pkt);
|
||||||
backsig_pkt.pkttype=PKT_SIGNATURE;
|
backsig_pkt.pkttype=PKT_SIGNATURE;
|
||||||
backsig_pkt.pkt.signature=backsig;
|
backsig_pkt.pkt.signature=backsig;
|
||||||
build_packet(backsig_out,&backsig_pkt);
|
rc=build_packet(backsig_out,&backsig_pkt);
|
||||||
free_packet(&backsig_pkt);
|
free_packet(&backsig_pkt);
|
||||||
buf=iobuf_get_temp_buffer(backsig_out);
|
if(rc)
|
||||||
|
log_error("build_packet failed for backsig: %s\n",g10_errstr(rc));
|
||||||
/* Remove the packet header */
|
|
||||||
if(buf[0]&0x40)
|
|
||||||
{
|
|
||||||
if(buf[1]<192)
|
|
||||||
{
|
|
||||||
pktlen=buf[1];
|
|
||||||
buf+=2;
|
|
||||||
}
|
|
||||||
else if(buf[1]<224)
|
|
||||||
{
|
|
||||||
pktlen=(buf[1]-192)*256;
|
|
||||||
pktlen+=buf[2]+192;
|
|
||||||
buf+=3;
|
|
||||||
}
|
|
||||||
else if(buf[1]==255)
|
|
||||||
{
|
|
||||||
pktlen =buf[2] << 24;
|
|
||||||
pktlen|=buf[3] << 16;
|
|
||||||
pktlen|=buf[4] << 8;
|
|
||||||
pktlen|=buf[5];
|
|
||||||
buf+=6;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
BUG();
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int mark=1;
|
size_t pktlen=0;
|
||||||
|
byte *buf=iobuf_get_temp_buffer(backsig_out);
|
||||||
|
|
||||||
switch(buf[0]&3)
|
/* Remove the packet header */
|
||||||
{
|
if(buf[0]&0x40)
|
||||||
case 3:
|
{
|
||||||
BUG();
|
if(buf[1]<192)
|
||||||
break;
|
{
|
||||||
|
pktlen=buf[1];
|
||||||
|
buf+=2;
|
||||||
|
}
|
||||||
|
else if(buf[1]<224)
|
||||||
|
{
|
||||||
|
pktlen=(buf[1]-192)*256;
|
||||||
|
pktlen+=buf[2]+192;
|
||||||
|
buf+=3;
|
||||||
|
}
|
||||||
|
else if(buf[1]==255)
|
||||||
|
{
|
||||||
|
pktlen =buf[2] << 24;
|
||||||
|
pktlen|=buf[3] << 16;
|
||||||
|
pktlen|=buf[4] << 8;
|
||||||
|
pktlen|=buf[5];
|
||||||
|
buf+=6;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
BUG();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int mark=1;
|
||||||
|
|
||||||
case 2:
|
switch(buf[0]&3)
|
||||||
pktlen =buf[mark++] << 24;
|
{
|
||||||
pktlen|=buf[mark++] << 16;
|
case 3:
|
||||||
|
BUG();
|
||||||
|
break;
|
||||||
|
|
||||||
case 1:
|
case 2:
|
||||||
pktlen|=buf[mark++] << 8;
|
pktlen =buf[mark++] << 24;
|
||||||
|
pktlen|=buf[mark++] << 16;
|
||||||
|
|
||||||
case 0:
|
case 1:
|
||||||
pktlen|=buf[mark++];
|
pktlen|=buf[mark++] << 8;
|
||||||
}
|
|
||||||
|
|
||||||
buf+=mark;
|
case 0:
|
||||||
}
|
pktlen|=buf[mark++];
|
||||||
|
}
|
||||||
|
|
||||||
/* now make the binary blob into a subpacket */
|
buf+=mark;
|
||||||
build_sig_subpkt(sig,SIGSUBPKT_SIGNATURE,buf,pktlen);
|
}
|
||||||
|
|
||||||
|
/* now make the binary blob into a subpacket */
|
||||||
|
build_sig_subpkt(sig,SIGSUBPKT_SIGNATURE,buf,pktlen);
|
||||||
|
|
||||||
iobuf_close(backsig_out);
|
iobuf_close(backsig_out);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -2155,8 +2155,8 @@ parse_plaintext( IOBUF inp, int pkttype, unsigned long pktlen,
|
|||||||
|
|
||||||
if( list_mode ) {
|
if( list_mode ) {
|
||||||
printf(":literal data packet:\n"
|
printf(":literal data packet:\n"
|
||||||
"\tmode %c, created %lu, name=\"",
|
"\tmode %c (%X), created %lu, name=\"",
|
||||||
mode >= ' ' && mode <'z'? mode : '?',
|
mode >= ' ' && mode <'z'? mode : '?', mode,
|
||||||
(ulong)pt->timestamp );
|
(ulong)pt->timestamp );
|
||||||
for(p=pt->name,i=0; i < namelen; p++, i++ ) {
|
for(p=pt->name,i=0; i < namelen; p++, i++ ) {
|
||||||
if( *p >= ' ' && *p <= 'z' )
|
if( *p >= ' ' && *p <= 'z' )
|
||||||
|
@ -61,6 +61,24 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
|
|||||||
int filetype = 0xfff;
|
int filetype = 0xfff;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Let people know what the plaintext info is. This allows the
|
||||||
|
receiving program to try and do something different based on
|
||||||
|
the format code (say, recode UTF-8 to local). */
|
||||||
|
if(!nooutput && is_status_enabled())
|
||||||
|
{
|
||||||
|
char status[20];
|
||||||
|
|
||||||
|
sprintf(status,"%X %lu ",(byte)pt->mode,(ulong)pt->timestamp);
|
||||||
|
write_status_text_and_buffer(STATUS_PLAINTEXT,
|
||||||
|
status,pt->name,pt->namelen,0);
|
||||||
|
|
||||||
|
if(!pt->is_partial)
|
||||||
|
{
|
||||||
|
sprintf(status,"%lu",(ulong)pt->len);
|
||||||
|
write_status_text(STATUS_PLAINTEXT_LENGTH,status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* create the filename as C string */
|
/* create the filename as C string */
|
||||||
if( nooutput )
|
if( nooutput )
|
||||||
;
|
;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* status.c
|
/* status.c
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002,
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003,
|
||||||
* 2004 Free Software Foundation, Inc.
|
* 2004 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
@ -153,6 +153,8 @@ get_status_string ( int no )
|
|||||||
case STATUS_REVKEYSIG : s = "REVKEYSIG"; break;
|
case STATUS_REVKEYSIG : s = "REVKEYSIG"; break;
|
||||||
case STATUS_ATTRIBUTE : s = "ATTRIBUTE"; break;
|
case STATUS_ATTRIBUTE : s = "ATTRIBUTE"; break;
|
||||||
case STATUS_CARDCTRL : s = "CARDCTRL"; break;
|
case STATUS_CARDCTRL : s = "CARDCTRL"; break;
|
||||||
|
case STATUS_PLAINTEXT : s = "PLAINTEXT"; break;
|
||||||
|
case STATUS_PLAINTEXT_LENGTH:s = "PLAINTEXT_LENGTH"; break;
|
||||||
default: s = "?"; break;
|
default: s = "?"; break;
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/* status.h
|
/* status.h
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003,
|
||||||
|
* 2004 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -20,7 +21,6 @@
|
|||||||
#ifndef G10_STATUS_H
|
#ifndef G10_STATUS_H
|
||||||
#define G10_STATUS_H
|
#define G10_STATUS_H
|
||||||
|
|
||||||
|
|
||||||
#define STATUS_ENTER 1
|
#define STATUS_ENTER 1
|
||||||
#define STATUS_LEAVE 2
|
#define STATUS_LEAVE 2
|
||||||
#define STATUS_ABORT 3
|
#define STATUS_ABORT 3
|
||||||
@ -29,7 +29,6 @@
|
|||||||
#define STATUS_BADSIG 5
|
#define STATUS_BADSIG 5
|
||||||
#define STATUS_ERRSIG 6
|
#define STATUS_ERRSIG 6
|
||||||
|
|
||||||
|
|
||||||
#define STATUS_BADARMOR 7
|
#define STATUS_BADARMOR 7
|
||||||
|
|
||||||
#define STATUS_RSA_OR_IDEA 8
|
#define STATUS_RSA_OR_IDEA 8
|
||||||
@ -102,6 +101,8 @@
|
|||||||
#define STATUS_REVKEYSIG 70
|
#define STATUS_REVKEYSIG 70
|
||||||
#define STATUS_CARDCTRL 71
|
#define STATUS_CARDCTRL 71
|
||||||
#define STATUS_NEWSIG 72
|
#define STATUS_NEWSIG 72
|
||||||
|
#define STATUS_PLAINTEXT 73
|
||||||
|
#define STATUS_PLAINTEXT_LENGTH 74
|
||||||
|
|
||||||
/*-- status.c --*/
|
/*-- status.c --*/
|
||||||
void set_status_fd ( int fd );
|
void set_status_fd ( int fd );
|
||||||
@ -129,5 +130,4 @@ int cpr_get_answer_okay_cancel (const char *keyword,
|
|||||||
const char *prompt,
|
const char *prompt,
|
||||||
int def_answer);
|
int def_answer);
|
||||||
|
|
||||||
|
|
||||||
#endif /*G10_STATUS_H*/
|
#endif /*G10_STATUS_H*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user