Topic: RsaPublicKeyDecode and --enable-opensslextra

Hi,

I'm using RsaPublicKeyDecode to load a public key, DER format, and it appears to me that the key decoding only works when --enable-opensslextra is used (wolfSSL 2.8.0).

Hopefully I missed something in the doc.

I did all tests on several Ubuntu (13.10 and 12.04) with two basic builds : raw ./configure  and ./configure --enable-opensslextra both on a C file limited to  a single :

int res = RsaPublicKeyDecode(buffer, &idx, &key, ksize);

In the first case I got a -143 error code, while second case is OK.

Are these the expected results ?

Thanks a lot,

Stéphane.

Share

Re: RsaPublicKeyDecode and --enable-opensslextra

Hi Stéphane,

Are you initializing your RsaKey structure with InitRsaKey() before your call to RsaPublicKeyDecode?

Regards,
Chris

Re: RsaPublicKeyDecode and --enable-opensslextra

Hi Chris,

I tested both alternatives, compiling wolfSSL embedded SSL with either a raw ./configure or ./configure --enable-opensslextra

Here is the code (der data was removed in here).

#include <cyassl/ctaocrypt/rsa.h>
#include <stdio.h>
unsigned char der[] = { 0xAA ... };
size_t ksize = sizeof(der);
int main() {
    word32 idx =0;
    RsaKey *key = calloc(1,sizeof(RsaKey)); 
    CyaSSL_Init(); 
    InitRsaKey(key,0); 
    int res = RsaPublicKeyDecode(der, &idx, key, ksize);
    printf("res=%d\n",res);
    return res;
}

compiled using :

gcc -DUSE_FAST_MATH -ggdb -I./cyassl-2.8.0 foo.c -L ./cyassl-2.8.0/src/.libs/ -lcyassl

got either 0 or -143 depending on the configure/build option.

Regards,

Stéphane.

PS : host is ubuntu 13.10 x86_64 Kernel : 3.11.0-15-generic #25-Ubuntu SMP

Share