Attached is the implementation of the scheme outlined bellow. I have
placed code in xmlsec-core
so other xmlsec-crypto libraries can re-use it. Also I am going to
remove src/mscrypto/bignum.c
and include/xmlsec/mscrypto/bignum.h soon because there is nothing left
in these files :)
The patch is checked in and should show up in anonymous CVS tomorrow.
Aleksey
This code is wrong (I sent a message about that last night). I
know how to write a better code
(faster/less mallocs) than one you intialy wrote and I hope to do it
tonight. The basic idea is
to implement following operations:
- add int to bignum
- mul bignum by int
- div bignum by int
where bignum is a binary buffer that MSCrypto returns. After that
converting that buffer (bignum)
to and from dec string is a piece of cake:
bignum-->dec string
dec_str = "";
while(bignum != 0) {
dec _str += convert_to_char(bignum % 10);
bignum = bignum / 10;
}
dec string->bignum
bignum = 0;
for(i = 0; i < strlen(dec_string);i++) {
bignum = bignum * 10;
bignum = bignum + convert_to_int(dec_str[i]);
}
|
mscrypto4.diff.gz
Description: application/gzip