I have some sample code on openssl which I found on the documentation. (https://wiki.openssl.org/index.php/EVP_Symmetric_Encryption_and_Decryption under C++ section)
They suggested to compile with
g++ -Wall -std=c++11 aes_binary.cxx -o aes_binary.exe -lcrypto
I adapted this into bazel as:
cc_binary( name = "aes_binary", srcs = ["aes_binary.cpp"], deps = ["//base"], linkopts = [ "-lcrypto" ] )
It works fine but I want to convert this into a library. The code basically contains a template class, and 3 functions (encrypt, decrypt, genparams). I separated the binary into aes.h and aes.cpp and want to use this library in other modules and binaries.
c_library( name = "aes", hdrs = ["aes.h"], srcs = ["aes.cpp"], )
and imported this in another binary which has:
cc_binary( name = "vulndb_miner", srcs = ["vulndb_miner.cpp"], deps = ["//codelearn/vulndb:aes", ], linkopts = [ "-lcrypto", ] )
However, it does not compile saying that
‘OPENSSL_cleanse’ was not declared in this scope
‘EVP_add_cipher’ was not declared in this scope
What am I doing wrong?
PS: I include the library in vulndb_miner.cpp as #include "codelearn/vulndb/aes.h"
Source: Windows Questions C++