Hello everybody Several months ago I developed an OpenSSL PKCS#11 engine for Windows XP and it worked ok (it was compiled with MinGW). Now I'm trying to compile it on Linux (Debian 5 with GCC 4.3.1) but I have the next problem:
In the overwritten function *rsa_keygen* (whose signature is *int rsa_keygen (RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb)*) always when the function ends (after the return instrucction) System reports me *Segmentation Fault*. What I do is: 1. I generate the RSA key with PKCS#11. 2. I get the public part of the key from the device. 3. I store this information in the *rsa* variable (I don't do memory allocation or *RSA_new ()* invoke, I supose rsa variable is initialized). If I do memory allocation or I invoke *RSA_new ()* I get the same error. 4. Finally I return 1 if the process ends ok and -1 in case of error (PKCS#11 error). And when the function ends I get "Segmentation fault" and I don't know why. The OpenSSL version is 1.0.0a (I compiled it from source code). Thanks.