mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 15:02:59 +00:00
sync rsaenh with wine 1.1.33
svn path=/trunk/; revision=44188
This commit is contained in:
parent
25f74e7771
commit
20028cfb2f
1 changed files with 32 additions and 8 deletions
|
@ -361,7 +361,10 @@ 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)
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
@ -396,25 +399,46 @@ BOOL export_private_key_impl(BYTE *pbDest, const KEY_CONTEXT *pKeyContext, DWORD
|
||||||
DWORD *pdwPubExp)
|
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)
|
||||||
|
memset(pbDest + mp_unsigned_bin_size(&pKeyContext->rsa.N), 0,
|
||||||
|
dwKeyLen - mp_unsigned_bin_size(&pKeyContext->rsa.N));
|
||||||
pbDest += dwKeyLen;
|
pbDest += dwKeyLen;
|
||||||
mp_to_unsigned_bin(&pKeyContext->rsa.p, pbDest);
|
mp_to_unsigned_bin(&pKeyContext->rsa.p, pbDest);
|
||||||
reverse_bytes(pbDest, (dwKeyLen+1)>>1);
|
reverse_bytes(pbDest, mp_unsigned_bin_size(&pKeyContext->rsa.p));
|
||||||
|
if (mp_unsigned_bin_size(&pKeyContext->rsa.p) < (dwKeyLen+1)>>1)
|
||||||
|
memset(pbDest + mp_unsigned_bin_size(&pKeyContext->rsa.p), 0,
|
||||||
|
((dwKeyLen+1)>>1) - mp_unsigned_bin_size(&pKeyContext->rsa.p));
|
||||||
pbDest += (dwKeyLen+1)>>1;
|
pbDest += (dwKeyLen+1)>>1;
|
||||||
mp_to_unsigned_bin(&pKeyContext->rsa.q, pbDest);
|
mp_to_unsigned_bin(&pKeyContext->rsa.q, pbDest);
|
||||||
reverse_bytes(pbDest, (dwKeyLen+1)>>1);
|
reverse_bytes(pbDest, mp_unsigned_bin_size(&pKeyContext->rsa.q));
|
||||||
|
if (mp_unsigned_bin_size(&pKeyContext->rsa.q) < (dwKeyLen+1)>>1)
|
||||||
|
memset(pbDest + mp_unsigned_bin_size(&pKeyContext->rsa.q), 0,
|
||||||
|
((dwKeyLen+1)>>1) - mp_unsigned_bin_size(&pKeyContext->rsa.q));
|
||||||
pbDest += (dwKeyLen+1)>>1;
|
pbDest += (dwKeyLen+1)>>1;
|
||||||
mp_to_unsigned_bin(&pKeyContext->rsa.dP, pbDest);
|
mp_to_unsigned_bin(&pKeyContext->rsa.dP, pbDest);
|
||||||
reverse_bytes(pbDest, (dwKeyLen+1)>>1);
|
reverse_bytes(pbDest, mp_unsigned_bin_size(&pKeyContext->rsa.dP));
|
||||||
|
if (mp_unsigned_bin_size(&pKeyContext->rsa.dP) < (dwKeyLen+1)>>1)
|
||||||
|
memset(pbDest + mp_unsigned_bin_size(&pKeyContext->rsa.dP), 0,
|
||||||
|
((dwKeyLen+1)>>1) - mp_unsigned_bin_size(&pKeyContext->rsa.dP));
|
||||||
pbDest += (dwKeyLen+1)>>1;
|
pbDest += (dwKeyLen+1)>>1;
|
||||||
mp_to_unsigned_bin(&pKeyContext->rsa.dQ, pbDest);
|
mp_to_unsigned_bin(&pKeyContext->rsa.dQ, pbDest);
|
||||||
reverse_bytes(pbDest, (dwKeyLen+1)>>1);
|
reverse_bytes(pbDest, mp_unsigned_bin_size(&pKeyContext->rsa.dQ));
|
||||||
|
if (mp_unsigned_bin_size(&pKeyContext->rsa.dQ) < (dwKeyLen+1)>>1)
|
||||||
|
memset(pbDest + mp_unsigned_bin_size(&pKeyContext->rsa.dQ), 0,
|
||||||
|
((dwKeyLen+1)>>1) - mp_unsigned_bin_size(&pKeyContext->rsa.dQ));
|
||||||
pbDest += (dwKeyLen+1)>>1;
|
pbDest += (dwKeyLen+1)>>1;
|
||||||
mp_to_unsigned_bin(&pKeyContext->rsa.qP, pbDest);
|
mp_to_unsigned_bin(&pKeyContext->rsa.qP, pbDest);
|
||||||
reverse_bytes(pbDest, (dwKeyLen+1)>>1);
|
reverse_bytes(pbDest, mp_unsigned_bin_size(&pKeyContext->rsa.qP));
|
||||||
|
if (mp_unsigned_bin_size(&pKeyContext->rsa.qP) < (dwKeyLen+1)>>1)
|
||||||
|
memset(pbDest + mp_unsigned_bin_size(&pKeyContext->rsa.qP), 0,
|
||||||
|
((dwKeyLen+1)>>1) - mp_unsigned_bin_size(&pKeyContext->rsa.qP));
|
||||||
pbDest += (dwKeyLen+1)>>1;
|
pbDest += (dwKeyLen+1)>>1;
|
||||||
mp_to_unsigned_bin(&pKeyContext->rsa.d, pbDest);
|
mp_to_unsigned_bin(&pKeyContext->rsa.d, pbDest);
|
||||||
reverse_bytes(pbDest, dwKeyLen);
|
reverse_bytes(pbDest, mp_unsigned_bin_size(&pKeyContext->rsa.d));
|
||||||
|
if (mp_unsigned_bin_size(&pKeyContext->rsa.d) < dwKeyLen)
|
||||||
|
memset(pbDest + mp_unsigned_bin_size(&pKeyContext->rsa.d), 0,
|
||||||
|
dwKeyLen - mp_unsigned_bin_size(&pKeyContext->rsa.d));
|
||||||
*pdwPubExp = (DWORD)mp_get_int(&pKeyContext->rsa.e);
|
*pdwPubExp = (DWORD)mp_get_int(&pKeyContext->rsa.e);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue