On Fri, Dec 03, 2010 at 09:10:41AM -0800, Marcus Carey wrote:

> I am still have issues with the default ECDH parameters in 1.0.0c.

kEECDH handshakes appear to work.

> The key generation with NIST Prime-Curve P-192 crashes.  

How do you reproduce this?

> static void nist_cp_bn(BN_ULONG *buf, BN_ULONG *a, int top)
> {
>    int i;
>    BN_ULONG *_tmp1 = (buf), *_tmp2 = (a);
>    for (i = (top); i != 0; i--)
>    *_tmp1++ = *_tmp2++;  //There is a problem here
> }

The above looks fine, in what context is this called?

The code in crypto/bn/bn_nist.c has not changed since 0.9.8j, it is
different in 0.9.8i.

    http://cvs.openssl.org/chngview?cn=17756

I don't understand the code in BN_nist_mod_192(), which calls
nist_cp_bn(), it has rather obscure pointer manipulation:

        /*
         * we need 'if (carry==0 || result>=modulus) result-=modulus;'
         * as comparison implies subtraction, we can write
         * 'tmp=result-modulus; if (!carry || !borrow) result=tmp;'
         * this is what happens below, but without explicit if:-) a.
         */
        mask  = 0-(size_t)bn_sub_words(c_d,r_d,_nist_p_192[0],BN_NIST_192_TOP);
        mask &= 0-(size_t)carry;
--->    res   = (BN_ULONG *)(((size_t)c_d&~mask) | ((size_t)r_d&mask));
        nist_cp_bn(r_d, res, BN_NIST_192_TOP);

-- 
        Viktor.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to