From: Dr. Matthias St. Pierre Date: Mon, 13 Apr 2020 22:12:48 +0000 (+0200) Subject: Fix an assertion (and a comment) of evp_method_id() X-Git-Tag: openssl-3.0.0-alpha1~40 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=64f849f439f5107c972c9dac9454d1284fd0ef48;p=oweals%2Fopenssl.git Fix an assertion (and a comment) of evp_method_id() Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/11542) --- diff --git a/crypto/evp/evp_fetch.c b/crypto/evp/evp_fetch.c index e808bf818f..954ddb685c 100644 --- a/crypto/evp/evp_fetch.c +++ b/crypto/evp/evp_fetch.c @@ -73,8 +73,8 @@ static OSSL_METHOD_STORE *get_evp_method_store(OPENSSL_CTX *libctx) } /* - * To identity the method in the EVP method store, we mix the name identity - * with the operation identity, with the assumption that we don't have more + * To identify the method in the EVP method store, we mix the name identity + * with the operation identity, under the assumption that we don't have more * than 2^24 names or more than 2^8 operation types. * * The resulting identity is a 32-bit integer, composed like this: @@ -85,8 +85,8 @@ static OSSL_METHOD_STORE *get_evp_method_store(OPENSSL_CTX *libctx) */ static uint32_t evp_method_id(unsigned int operation_id, int name_id) { - if (!ossl_assert(name_id < (1 << 24) || operation_id < (1 << 8)) - || !ossl_assert(name_id > 0 && operation_id > 0)) + if (!ossl_assert(name_id > 0 && name_id < (1 << 24)) + || !ossl_assert(operation_id > 0 && operation_id < (1 << 8))) return 0; return ((name_id << 8) & 0xFFFFFF00) | (operation_id & 0x000000FF); }