RE: Question about OffloadModExpo() Function
From: john (phenerse_at_hotmail.com)
Date: 10/26/05
- Next message: viveque.kumar_at_gmail.com: "Re: CALG_SSL3_SHAMD5 support for ClientAuthentication"
- Previous message: Rhett Gong [MSFT]: "RE: Update CSP"
- Maybe in reply to: JohnShen: "Question about OffloadModExpo() Function"
- Next in thread: John Banes: "Re: Question about OffloadModExpo() Function"
- Reply: John Banes: "Re: Question about OffloadModExpo() Function"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Wed, 26 Oct 2005 03:03:03 -0700
Hi Laszlo,
I'm sorry to disturb you again.Because I really have no idea about it.
So much time on this, but still little effect.
I'm sure my implementation is right. The problem is in the INTERFACE.
But I cannot know when and how MS CAPI calls OffloadModExpo.Maybe the
description of OffloadModExpo in MSDN is not right, at least not clear.
Would you please help me to have a look of my function?
It's quite short.
///////////////////////
_declspec (dllexport)
BOOL OffloadModExpo(
BYTE *pbBase, // in
BYTE *pbExpo, // in
DWORD cbExpo, // in
BYTE *pbMod, // in
DWORD cbMod, // in
BYTE *pbResult, // out
void *pReserved, // reserved
DWORD dwFlags // in
)
{
DWORD dwModLen;
DWORD dwExpoLen;
DWORD *result;
DWORD *base;
DWORD *expo;
DWORD *mod;
dwModLen = ((cbMod - 1) >> 2) + 1;
dwExpoLen = ((cbExpo - 1) >> 2) + 1;
result = (DWORD *) malloc(dwModLen * sizeof(DWORD));
base = (DWORD *) malloc(dwModLen * sizeof(DWORD));
expo = (DWORD *) malloc(dwExpoLen * sizeof(DWORD));
mod = (DWORD *) malloc(dwModLen * sizeof(DWORD));
memset(result, 0, dwModLen * sizeof(DWORD));
memset(base, 0, dwModLen * sizeof(DWORD));
memset(expo, 0, dwExpoLen * sizeof(DWORD));
memset(mod, 0, dwModLen * sizeof(DWORD));
memcpy(base, pbBase, cbMod);
memcpy(expo, pbExpo, cbExpo);
memcpy(mod, pbMod, cbMod);
NN_ModExp(result, base, expo, dwExpoLen, mod, dwModLen);
memcpy(pbResult, result, cbMod);
return TRUE;
}
///////////////
NN_ModExp() is from RSAREF
lib(http://www.mirrors.wiretapped.net/security/cryptography/libraries/math/rsaref/rsaref-2.0-1996.tar.gz)
It's 'big number' params are DWORD array, while MS is BYTE array.
So I do a convert here. NN_ModExp computes: result = base ^ expo % mod.
Thanks you very much.
-- John "lelteto" wrote:
- Next message: viveque.kumar_at_gmail.com: "Re: CALG_SSL3_SHAMD5 support for ClientAuthentication"
- Previous message: Rhett Gong [MSFT]: "RE: Update CSP"
- Maybe in reply to: JohnShen: "Question about OffloadModExpo() Function"
- Next in thread: John Banes: "Re: Question about OffloadModExpo() Function"
- Reply: John Banes: "Re: Question about OffloadModExpo() Function"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|