2

Using OpenSSL AES encrypting. Library connected well, rsa commands works well. When i use AES cant reach methods from libcrypto.a.(But when i use RSA methods in code, aes works well. No RSA -> no AES)

Error is: Undefined symbols for architecture x86_64: "_OPENSSL_ia32cap_P", referenced from: _AES_cbc_encrypt in libcrypto.a(aes-x86_64.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

PS. This topic doesn't help

Community
  • 1
  • 1
U. Zorjan
  • 41
  • 3
  • What is your link command? `OPENSSL_ia32cap_P` has public visibility in `libcrypto.a`. However, it is private in `libcrypto.so`. – jww Feb 24 '17 at 20:14
  • Now _OPENSSL_cleanse(NULL, 0);_ put anywhere works stable. Before it was some other mistakes and OPENSSL_cleanse didn't help.After I fix all other errors its became stable. – U. Zorjan Feb 25 '17 at 06:25
  • 1
    I also had this problem on macOS, the solution on my side was to make sure my OTHER_LDFLAGS had `-lssl` and `-lcrypto` before any `-framework` argument. – Alessandro Apr 24 '20 at 07:10

1 Answers1

1

I got the same linker error, and I also tried adding the line extern int OPENSSL_cleanse(void *ptr, size_t len); as mentioned on this post, without success.

What ended up working for me was adding the following line, anywhere in your code files:

uint32_t OPENSSL_ia32cap_P[4] = { 0 };

Also, I used the following link as reference: https://boringssl.googlesource.com/boringssl/+/517073cd4b/crypto/cpu-intel.c#76

Jaime Ivan Cervantes
  • 3,579
  • 1
  • 40
  • 38