I am writing Bitcoin-related software in C/C++ and I need to select a cryptography library that supports the usual stuff -- ECDSA, ECC math, SHA2, RIPEMD, PBKDF2, HMAC, and a secure RNG. Any suggestions?
I just assumed that I would be using OpenSSL, but I have discovered that with OpenSSL 3, all of the "low-level" functionality has been deprecated, and that is exactly what I was intending to use. Perhaps, I could use the "high-level" features, but I don't know how or if they even do what I need. Also, I can't find any examples of anyone using these features anywhere, which is weird.
Perhaps sticking with a legacy version of OpenSSL is a good solution.
A friend suggested WolfSSL. It does what I need but it has some drawbacks -- it is a pain to integrate and 75% of the API is undocumented.
What are you using?
Everything you need is in bitcoincore source code & it's the easiest to work with sources you'll find on this topic. It depends on a few things though.
OpenSSL is a great option - the problem is OpenSSL is very difficult & unforgiving to work with. What "low level" functionality isn't in openssl? For all the eliptic curve maths, openssl big number library is going to be faster for high performance than bitcoincore's arith_uint256 classes for example, the same can be said about hashing (hmac, sha256, etc) - but at the cost of being significantly more difficult/cumbersome to work with, accompanied by less documentation. Bitcoincore big number addition for example is 2 or 3 lines of c++, openssl would be closer to 10 with the BN_/BIGNUM* interface.
Bitcoincore isn't "c/c++" though, at least the parts you'd need, it's 100% advanced c++ with many templates/lambdas/multiple inheritance/etc. If your c++ is rock solid - you'll find bitcoincore very pleasant, as a breath of fresh air simplifying the advanced, if your c++ isn't that good - bitcoincore will be a nightmare. OpenSSL is 100% old school C89, you don't need to know what a template or class is to work with it, but openssl won't hold your hand in the way bitcoincore will in terms of memory management & knowledge of advanced maths required (Especially for elliptic curve stuff - signing a TX in openssl is completely diff, IMO more complicated, than using libsecp256k1 in btcore).
I'd say the determining factor is you, and whether you do better in C or C++, but in general the proof of work crypto world is advanced c++, all the daemons, miners, pools, proxies, etc are using advanced c++ so I'd recommend sticking with that.