Commit 27027590 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

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

parent 2d05074f
...@@ -361,7 +361,7 @@ BOOL gen_rand_impl(BYTE *pbBuffer, DWORD dwLen) ...@@ -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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment