1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-23 10:29:58 +01:00

* build-packet.c (do_plaintext), encode.c (encode_sesskey, encode_simple,

encode_crypt), sign.c (write_plaintext_packet): Use wipememory() instead
of memset() to wipe sensitive memory as the memset() might be optimized
away.
This commit is contained in:
David Shaw 2002-10-31 15:28:19 +00:00
parent 92fb1251d0
commit 456f89ea7a
4 changed files with 12 additions and 5 deletions

View File

@ -1,3 +1,10 @@
2002-10-31 David Shaw <dshaw@jabberwocky.com>
* build-packet.c (do_plaintext), encode.c (encode_sesskey,
encode_simple, encode_crypt), sign.c (write_plaintext_packet): Use
wipememory() instead of memset() to wipe sensitive memory as the
memset() might be optimized away.
2002-10-23 Werner Koch <wk@gnupg.org> 2002-10-23 Werner Koch <wk@gnupg.org>
* pubkey-enc.c (get_it): Fix segv, test for revoked only when PK * pubkey-enc.c (get_it): Fix segv, test for revoked only when PK

View File

@ -555,7 +555,7 @@ do_plaintext( IOBUF out, int ctb, PKT_plaintext *pt )
} }
n += nbytes; n += nbytes;
} }
memset(buf,0,1000); /* at least burn the buffer */ wipememory(buf,1000); /* burn the buffer */
if( !pt->len ) if( !pt->len )
iobuf_set_block_mode(out, 0 ); /* write end marker */ iobuf_set_block_mode(out, 0 ); /* write end marker */
else if( n != pt->len ) else if( n != pt->len )

View File

@ -98,7 +98,7 @@ encode_sesskey( DEK *dek, DEK **ret_dek, byte *enckey )
cipher_close( hd ); cipher_close( hd );
memcpy( enckey, buf, c->keylen + 1 ); memcpy( enckey, buf, c->keylen + 1 );
memset( buf, 0, sizeof buf ); /* burn key */ wipememory( buf, sizeof buf ); /* burn key */
*ret_dek = c; *ret_dek = c;
} }
@ -354,7 +354,7 @@ encode_simple( const char *filename, int mode, int compat )
log_error("copying input to output failed: %s\n", g10_errstr(rc) ); log_error("copying input to output failed: %s\n", g10_errstr(rc) );
break; break;
} }
memset(copy_buffer, 0, 4096); /* burn buffer */ wipememory(copy_buffer, 4096); /* burn buffer */
} }
/* finish the stuff */ /* finish the stuff */
@ -597,7 +597,7 @@ encode_crypt( const char *filename, STRLIST remusr )
g10_errstr(rc) ); g10_errstr(rc) );
break; break;
} }
memset(copy_buffer, 0, 4096); /* burn buffer */ wipememory(copy_buffer, 4096); /* burn buffer */
} }
/* finish the stuff */ /* finish the stuff */

View File

@ -505,7 +505,7 @@ write_plaintext_packet (IOBUF out, IOBUF inp, const char *fname, int ptmode)
g10_errstr(rc)); g10_errstr(rc));
break; break;
} }
memset(copy_buffer, 0, 4096); /* burn buffer */ wipememory(copy_buffer,4096); /* burn buffer */
} }
/* fixme: it seems that we never freed pt/pkt */ /* fixme: it seems that we never freed pt/pkt */