Commit a02f3d9f authored by Denis Kasak's avatar Denis Kasak
Browse files

fix: Properly check error conditions for int-returning functions.

OpenSSL functions returning an int like `EVP_PKEY_derive_init` return
non-positive (0 or negative) integers on an error condition, so we need
to check for both.

See e.g.
parent b82dab50
......@@ -34,13 +34,21 @@ static const std::size_t SHA256_BLOCK_LENGTH = 64;
static const std::uint8_t HKDF_DEFAULT_SALT[32] = {};
template <typename T>
static T checked(T val) {
inline T checked(T val) {
if (!val) {
return val;
template <>
inline int checked(int val) {
if (val <= 0) {
return val;
} // namespace
void _olm_crypto_curve25519_generate_key(
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment