rsaenh: Only reverse the significant bytes of an exported public key.

This commit is contained in:
Juan Lang 2009-11-05 10:02:57 -08:00 committed by Alexandre Julliard
parent 2d05074fba
commit 27027590f8
1 changed files with 1 additions and 1 deletions

View File

@ -361,7 +361,7 @@ BOOL gen_rand_impl(BYTE *pbBuffer, DWORD dwLen)
BOOL export_public_key_impl(BYTE *pbDest, const KEY_CONTEXT *pKeyContext, DWORD dwKeyLen,DWORD *pdwPubExp) BOOL export_public_key_impl(BYTE *pbDest, const KEY_CONTEXT *pKeyContext, DWORD dwKeyLen,DWORD *pdwPubExp)
{ {
mp_to_unsigned_bin(&pKeyContext->rsa.N, pbDest); mp_to_unsigned_bin(&pKeyContext->rsa.N, pbDest);
reverse_bytes(pbDest, dwKeyLen); reverse_bytes(pbDest, mp_unsigned_bin_size(&pKeyContext->rsa.N));
if (mp_unsigned_bin_size(&pKeyContext->rsa.N) < dwKeyLen) if (mp_unsigned_bin_size(&pKeyContext->rsa.N) < dwKeyLen)
memset(pbDest + mp_unsigned_bin_size(&pKeyContext->rsa.N), 0, memset(pbDest + mp_unsigned_bin_size(&pKeyContext->rsa.N), 0,
dwKeyLen - mp_unsigned_bin_size(&pKeyContext->rsa.N)); dwKeyLen - mp_unsigned_bin_size(&pKeyContext->rsa.N));