I have openssl-0.9.5a and openssh-2.1.0. I configured ssl with rsaref and it passes the tests. When I configure ssh I get: ---- checking for OpenSSL directory... configure: error: Could not find working SSLeay / OpenSSL libraries, please install ---- it is failing RSA_private_decrypt function call. The RSA_generate_key seems to work (does not return null) but then goes on to fail at RSA_private_decrypt. Like I said, the openssl tests passed.... AnyHELP? conftest.c generated by configure: --------- gcc -o conftest -g -O2 -Wall -I/opt/openssl/include -L/opt/openssl/lib -L/opt/openssl conftest.c -ldl -lnsl -lz -lutil -lpam -lcrypto -lRSAglue -lrsaref 1>&5 configure: failed program was: #line 2032 "configure" #include "confdefs.h" #include <string.h> #include <openssl/rand.h> #include <openssl/rsa.h> #include <openssl/bn.h> #include <openssl/sha.h> int main(void) { RSA *key; char a[2048],b[2048];; memset(a, 0, sizeof(a));memset(b, 0, sizeof(b)); RAND_add(a, sizeof(a), sizeof(a)); key=RSA_generate_key(32,3,NULL,NULL); if (key==NULL) return(1); return(-1==RSA_private_decrypt(RSA_size(key),a,b,key,RSA_NO_PADDING)); }
is it me or should there be an encrypt function before the decrypt?
I'm seeing this too. -- Mark H. Wood, radical centrist OpenPGP ID 876A8B75 mhwood at ameritech.net 01/01/00 00:00:00 -- Apocralypse Now
I kind of merged rsa_test and came up with the following that seems to work with rsaref. The problem areas on the original was 32 for the key gen, rsaref likes 1024 at least. And rsaref likes RSA_PKCS1_PADDING but not RSA_NO_PADDING for some reason. I am not versed in ssl but just tried different things with debugging until it worked. I assume it will work with the non-rsaref also. #line 2032 "configure" #include "confdefs.h" #include <string.h> #include <openssl/rand.h> #include <openssl/rsa.h> #include <openssl/bn.h> #include <openssl/sha.h> int main(void) { int num; RSA *key; char a[2048],b[2048]; static unsigned char ptext_ex[] = "This is the text to encrypt"; unsigned char ctext[256]; unsigned char ptext[256]; memset(a, 0, sizeof(a));memset(b, 0, sizeof(b)); RAND_add(a, sizeof(a), sizeof(a)); key=RSA_generate_key(512,3,NULL,NULL); if (key==NULL) return(1); num=RSA_public_encrypt(sizeof(ptext_ex)-1,ptext_ex,ctext, key,RSA_PKCS1_PADDING); return(-1==RSA_private_decrypt(num,ctext,ptext,key,RSA_PKCS1_PADDING)); }