Hi,

Are the sample values given in big-endian format?
If so (which is the standard representation way), then even your expected result is false and the correct result as given by many mathematical toolboxs is r = 0x1e1b37d30a287b7e551ca764d190d86f26fa292919fa8665731c766afcd6b3b2, which is the same as the output of BN_mod_exp when all inputs are initialized correctly. I didn't check the results in case you are using a little-endian representation...

Cheers,
--
Mounir IDRASSI
IDRIX
http://www.idrix.fr

Sargeras wrote:
I'm working in a client for authentication of SRP6 and I have a problem with
the function BN_mod_exp.
I'd appreciate some guidance

The values that I use with this function perfectly matches the ones
required.

It's written in C++ and here are the parts of the code that I think are
important.

BigNumber BigNumber::ModExp(const BigNumber &bn1, const BigNumber &bn2)
{
    BigNumber ret;
    BN_CTX *bnctx;

    bnctx = BN_CTX_new();
    BN_mod_exp(ret._bn, _bn, bn1._bn, bn2._bn, bnctx);
    BN_CTX_free(bnctx);

    return ret;
}

BigNumber temp;
temp = g.ModExp(x, N);

Where g, x and N are instances of the class BigNumber.
Here are my output checkings, where I print the calculated value and the
expected.

N (calculated):
B79B3E2A87823CAB8F5EBFBF8EB10108535006298B5BADBD5B53E1895E644B89
N (expected): B79B3E2A87823CAB8F5EBFBF8EB10108535006298B5BADBD5B53E1895E644B89

g (calculated): 07
g (expected):   07

x (calculated): CBFE739D7B671EE5EF8BD304A670459ED445C6CB
x (expected):   CBFE739D7B671EE5EF8BD304A670459ED445C6CB

temp (calculated):
E2D764F327E4C1A9F63E28C48C6F76808108383B3EE14FF3B10BCAFD284E6966
temp (expected): F965C5F89FF0175FA73E2DFCDB28CEAEEFD69999BE88CC015E3356DCE95FC265

Any other piece of code will be given if asked.

Thank you all for your time.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to