mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02: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
7 changed files with 101 additions and 60 deletions
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. */
|
||||
IOBUF backsig_out=iobuf_temp();
|
||||
PACKET backsig_pkt;
|
||||
byte *buf;
|
||||
size_t pktlen=0;
|
||||
|
||||
init_packet(&backsig_pkt);
|
||||
backsig_pkt.pkttype=PKT_SIGNATURE;
|
||||
backsig_pkt.pkt.signature=backsig;
|
||||
build_packet(backsig_out,&backsig_pkt);
|
||||
rc=build_packet(backsig_out,&backsig_pkt);
|
||||
free_packet(&backsig_pkt);
|
||||
buf=iobuf_get_temp_buffer(backsig_out);
|
||||
|
||||
/* 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();
|
||||
}
|
||||
if(rc)
|
||||
log_error("build_packet failed for backsig: %s\n",g10_errstr(rc));
|
||||
else
|
||||
{
|
||||
int mark=1;
|
||||
{
|
||||
size_t pktlen=0;
|
||||
byte *buf=iobuf_get_temp_buffer(backsig_out);
|
||||
|
||||
switch(buf[0]&3)
|
||||
{
|
||||
case 3:
|
||||
BUG();
|
||||
break;
|
||||
/* 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
|
||||
{
|
||||
int mark=1;
|
||||
|
||||
case 2:
|
||||
pktlen =buf[mark++] << 24;
|
||||
pktlen|=buf[mark++] << 16;
|
||||
switch(buf[0]&3)
|
||||
{
|
||||
case 3:
|
||||
BUG();
|
||||
break;
|
||||
|
||||
case 1:
|
||||
pktlen|=buf[mark++] << 8;
|
||||
case 2:
|
||||
pktlen =buf[mark++] << 24;
|
||||
pktlen|=buf[mark++] << 16;
|
||||
|
||||
case 0:
|
||||
pktlen|=buf[mark++];
|
||||
}
|
||||
case 1:
|
||||
pktlen|=buf[mark++] << 8;
|
||||
|
||||
buf+=mark;
|
||||
}
|
||||
case 0:
|
||||
pktlen|=buf[mark++];
|
||||
}
|
||||
|
||||
/* now make the binary blob into a subpacket */
|
||||
build_sig_subpkt(sig,SIGSUBPKT_SIGNATURE,buf,pktlen);
|
||||
buf+=mark;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue