I have three files, rsa.c, prf.c, and rsa-test.c.
I use gcc -c rsa.c
, gcc -c prf.c
, gcc -c rsa-test.c
to get the .o files.
EDIT: I included rsa.c and prf.c in rsa-test.c.
Then I compile the .o files using gcc -o test rsa.o prf.o rsa-test.o
.
I get the following error when I compile the. o files of three files.
Undefined symbols for architecture x86_64:
"_EVP_sha512", referenced from:
randBytes(unsigned char*, unsigned long) in prf.o
"_HMAC", referenced from:
randBytes(unsigned char*, unsigned long) in prf.o
"_SHA512", referenced from:
setSeed(unsigned char*, unsigned long) in prf.o
"___gmpz_add_ui", referenced from:
randBytes(unsigned char*, unsigned long) in prf.o
"___gmpz_clear", referenced from:
rsa_shredKey(_RSA_KEY*) in rsa.o
"___gmpz_export", referenced from:
zToFile(__sFILE*, __mpz_struct*) in rsa.o
"___gmpz_import", referenced from:
zFromFile(__sFILE*, __mpz_struct*) in rsa.o
"___gmpz_init", referenced from:
rsa_initKey(_RSA_KEY*) in rsa.o
setSeed(unsigned char*, unsigned long) in prf.o
"___gmpz_limbs_read", referenced from:
randBytes(unsigned char*, unsigned long) in prf.o
"___gmpz_limbs_write", referenced from:
rsa_shredKey(_RSA_KEY*) in rsa.o
"___gmpz_set_ui", referenced from:
rsa_initKey(_RSA_KEY*) in rsa.o
setSeed(unsigned char*, unsigned long) in prf.o
"___gmpz_size", referenced from:
zToFile(__sFILE*, __mpz_struct*) in rsa.o
rsa_numBytesN(_RSA_KEY*) in rsa.o
rsa_shredKey(_RSA_KEY*) in rsa.o
randBytes(unsigned char*, unsigned long) in prf.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I'm not sure what is causing this error. The linker seems like the problem, because I'm using functions from rsa.c and prf.c in rsa-test.c and that's what's causing this problem.
Please let me know if you would like to test my files, I will post them up.