11) src/mscrypto/bignum.c, xmlSecMSCryptoDecToHex(), 
xmlSecMSCryptoHexToDec() and friends
Sorry, I don't understand  what you wrote in these functions. IMHO, 
there were too many code and
too many mallocs for such a simple task. I rewrote both functions. 
Please check that I did not break
break your tests.
    

Could you explain the approach you've taken with the newly written code
here? I've taken a look why they are not working, but excexpt for a
wrong assertion at line 198 (should be become xmlSecAssert2(outBase <=
sizeof(xmlSecMSCryptoRevLookupTable), NULL);) I couldn't find a trivial
error, nor could I understand what the code does. 
  
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]);
          }


Aleksey





Reply via email to