1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-24 15:17:02 +01:00

gpg: Avoid an unnecessary copy.

* g10/build-packet.c (sig_to_notation): Avoid an unnecessary copy of
the data: the size of the packet is fixed.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
This commit is contained in:
Neal H. Walfield 2016-02-25 14:51:55 +01:00
parent 75861b663b
commit 512bc72e1f

View File

@ -1166,22 +1166,17 @@ do_signature( IOBUF out, int ctb, PKT_signature *sig )
static int static int
do_onepass_sig( IOBUF out, int ctb, PKT_onepass_sig *ops ) do_onepass_sig( IOBUF out, int ctb, PKT_onepass_sig *ops )
{ {
int rc = 0; write_header(out, ctb, 4 + 8 + 1);
IOBUF a = iobuf_temp();
iobuf_put (a, 3); /* Version. */ iobuf_put (out, 3); /* Version. */
iobuf_put(a, ops->sig_class ); iobuf_put(out, ops->sig_class );
iobuf_put(a, ops->digest_algo ); iobuf_put(out, ops->digest_algo );
iobuf_put(a, ops->pubkey_algo ); iobuf_put(out, ops->pubkey_algo );
write_32(a, ops->keyid[0] ); write_32(out, ops->keyid[0] );
write_32(a, ops->keyid[1] ); write_32(out, ops->keyid[1] );
iobuf_put(a, ops->last ); iobuf_put(out, ops->last );
write_header(out, ctb, iobuf_get_temp_length(a) ); return 0;
rc = iobuf_write_temp( out, a );
iobuf_close(a);
return rc;
} }