From 1004b57c55cd51a8ec4b50587a5e0b2d9fffa5ae Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Thu, 5 Nov 2009 09:47:49 -0800 Subject: [PATCH] rsaenh: Explicitly clear unused memory when exporting a public key. --- dlls/rsaenh/implglue.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dlls/rsaenh/implglue.c b/dlls/rsaenh/implglue.c index 3477210c4db..118409ffc0e 100644 --- a/dlls/rsaenh/implglue.c +++ b/dlls/rsaenh/implglue.c @@ -362,6 +362,9 @@ BOOL export_public_key_impl(BYTE *pbDest, const KEY_CONTEXT *pKeyContext, DWORD { mp_to_unsigned_bin(&pKeyContext->rsa.N, pbDest); 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); return TRUE; }