When trying to compile the following code based on the openSSL reference code (https://www.openssl.org/docs/man3.0/man3/RSA_generate_key.html)
#include <openssl/rsa.h>
#include <openssl/evp.h>
int main(){
EVP_PKEY*pkey=EVP_RSA_gen(1024);
}
It throws the following error:
/usr/bin/ld: /tmp/ccLRNWp1.o: in function `main':
rsa2.c:(.text+0x28): undefined reference to `EVP_PKEY_Q_keygen'
collect2: error: ld returned 1 exit status
I'm compiling with the next command.
gcc -I/usr/include/openssl/ rsa2.c -lcrypto -lssl
And my openssl version is
openssl version
OpenSSL 3.0.7 1 Nov 2022 (Library: OpenSSL 3.0.7 1 Nov 2022)
What I might be missing?