I thought I tried this, but let me try again.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Christophe Devine
Sent: Saturday, April 21, 2007 2:03 AM
To: openssl-users@openssl.org
Subject: Re: BIGNUM library

Edward Chan <[EMAIL PROTECTED]> wrote:

> But I think this always returned me 128 bytes.  So am I supposed to
> bzero the output buffer first?

Here's how I fixed the bug (not very elegant, it was a quick hack)


    int i, ret = DH_compute_key(secret, pkey, m_dh);
    if( ret > 0 && ret < 128 )
    {
        for(i = ret; i >= 0; i--)
            secret[i+1] = secret[i];

        memset(secret, 0, 128 - ret);
    }
    ReverseBytes(secret, size);


Christophe

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to