rsaenh: Explicitly clear unused memory when exporting a public key.

This commit is contained in:
Juan Lang 2009-11-05 09:47:49 -08:00 committed by Alexandre Julliard
parent 49c11910d8
commit 1004b57c55
1 changed files with 3 additions and 0 deletions

View File

@ -362,6 +362,9 @@ BOOL export_public_key_impl(BYTE *pbDest, const KEY_CONTEXT *pKeyContext, DWORD
{ {
mp_to_unsigned_bin(&pKeyContext->rsa.N, pbDest); mp_to_unsigned_bin(&pKeyContext->rsa.N, pbDest);
reverse_bytes(pbDest, dwKeyLen); reverse_bytes(pbDest, dwKeyLen);
if (mp_unsigned_bin_size(&pKeyContext->rsa.N) < dwKeyLen)
memset(pbDest + mp_unsigned_bin_size(&pKeyContext->rsa.N), 0,
dwKeyLen - mp_unsigned_bin_size(&pKeyContext->rsa.N));
*pdwPubExp = (DWORD)mp_get_int(&pKeyContext->rsa.e); *pdwPubExp = (DWORD)mp_get_int(&pKeyContext->rsa.e);
return TRUE; return TRUE;
} }