Hi, I keep getting segfaults within cryptopp on freebsd for at least PBKDF DeriveKey(). I used the sample code from the wiki: https://www.cryptopp.com/wiki/PKCS12_PBKDF
I used the cryptopp-lib that is available through the binary ports collection (pkg). The reported version is 8.5.0 Any ideas on how I can fix this or at least where to look? Below all the technical info about versions and traces for a first triage. - Rogier $ ./crypto_test [1] 995 segmentation fault (core dumped) ./crypto_test lldb ./crypto_test -c crypto_test.core (lldb) target create "./crypto_test" --core "crypto_test.core" Core file '/home/bloem/source/c++/etude/crypto_test.core' (x86_64) was loaded. (lldb) bt * thread #1, name = 'crypto_test', stop reason = signal SIGSEGV * frame #0: 0x00000008008d64b1 libcryptopp.so.8`___lldb_unnamed_symbol84$$libcryptopp.so.8 + 17 frame #1: 0x00000008008d72af libcryptopp.so.8`CryptoPP::SHA256::HashMultipleBlocks(unsigned int const*, unsigned long) + 79 frame #2: 0x0000000800843682 libcryptopp.so.8`CryptoPP::IteratedHashBase<unsigned int, CryptoPP::HashTransformation>::Update(unsigned char const*, unsigned long) + 338 frame #3: 0x0000000000210771 crypto_test`CryptoPP::HashTransformation::CalculateDigest(unsigned char*, unsigned char const*, unsigned long) + 49 frame #4: 0x000000000020cf6c crypto_test`CryptoPP::PKCS12_PBKDF<CryptoPP::SHA256>::DeriveKey(unsigned char*, unsigned long, unsigned char, unsigned char const*, unsigned long, unsigned char const*, unsigned long, unsigned int, double) const + 844 frame #5: 0x000000000020c9be crypto_test`main + 190 frame #6: 0x000000000020c710 crypto_test`_start(ap=<unavailable>, cleanup=<unavailable>) at crt1.c:76:7 $ c++ -o crypto_test \ -I/usr/local/include/cryptopp \ -L/usr/local/lib/ -lcryptopp \ crypto_test1.cc $cat crypto_test1.cc #include <iostream> #include <string> #include "cryptlib.h" #include "pwdbased.h" #include "sha.h" #include "hex.h" int main(int argc, char* argv[]) { using namespace CryptoPP; byte password[] ="password"; size_t plen = strlen((const char*)password); byte salt[] = "salt"; size_t slen = strlen((const char*)salt); byte derived[SHA256::DIGESTSIZE]; PKCS12_PBKDF<SHA256> pbkdf; byte purpose = 0; pbkdf.DeriveKey(derived, sizeof(derived), purpose, password, plen, salt, slen, 1024, 0.0f); std::string result; HexEncoder encoder(new StringSink(result)); encoder.Put(derived, sizeof(derived)); encoder.MessageEnd(); std::cout << "Derived: " << result << std::endl; return 0; } $ uname -v FreeBSD 12.2-RELEASE-p6 GENERIC $ c++ --version FreeBSD clang version 10.0.1 (g...@github.com:llvm/llvm-project.git llvmorg-10.0.1-0-gef32c611aa2) Target: x86_64-unknown-freebsd12.2 Thread model: posix InstalledDir: /usr/bin $ pkg info cryptopp cryptopp-8.5.0 Name : cryptopp Version : 8.5.0 Installed on : Mon May 3 20:11:11 2021 CEST Origin : security/cryptopp Architecture : FreeBSD:12:amd64 Prefix : /usr/local Categories : security Licenses : BSL Maintainer : jhale < a t > FreeBSD.org WWW : https://www.cryptopp.com/ Comment : Free C++ class library of Cryptographic Primitives Options : DEBUG : off DOCS : on FULL_DEBUG : off SIMD : off TOOLS : on Shared Libs provided: libcryptopp.so.8 Annotations : FreeBSD_version: 1202000 cpe : cpe:2.3:a:cryptopp:crypto++:8.5.0:::::freebsd12:x64 repo_type : binary repository : FreeBSD Flat size : 28.0MiB Description : Crypto++ Library is a free C++ class library of cryptographic schemes. One purpose of Crypto++ is to act as a repository of public domain (not copyrighted) source code. Although the library is copyrighted as a compilation, the individual files in it (except for a few exceptions listed in the license) are in the public domain. WWW: https://www.cryptopp.com/ -- You received this message because you are subscribed to the Google Groups "Crypto++ Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to cryptopp-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/cryptopp-users/62215a2d-3011-489c-ade4-75b6dece16d7n%40googlegroups.com.