Skip to content

Commit

Permalink
Zero the buffer in pgp_rsa_public_decrypt so we're not using uninitia…
Browse files Browse the repository at this point in the history
…lized memory.
  • Loading branch information
Daniel Wyatt authored and Daniel Wyatt committed May 17, 2017
1 parent a574de2 commit c8de8ce
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lib/rsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@
#include "readerwriter.h"
#include "rnpdefs.h"

#include <string.h>

/**
\ingroup Core_Crypto
\brief Recovers message digest from the signature
Expand Down Expand Up @@ -112,6 +114,7 @@ pgp_rsa_public_decrypt(uint8_t *out,
if(n_bytes < out_bytes)
return 0;

memset(out, 0, n_bytes);
botan_mp_to_bin(output, out + (n_bytes - out_bytes));

return n_bytes;
Expand Down

0 comments on commit c8de8ce

Please sign in to comment.