• R
    EVP: Reverse the fetch logic in all pkey using functionality · 5246183e
    Richard Levitte 提交于
    In all initializing functions for functionality that use an EVP_PKEY, the
    coded logic was to find an KEYMGMT implementation first, and then try to
    find the operation method (for example, SIGNATURE implementation) in the
    same provider.
    
    This implies that in providers where there is a KEYMGMT implementation,
    there must also be a SIGNATURE implementation, along with a KEYEXCH,
    ASYM_CIPHER, etc implementation.
    
    The intended design was, however, the opposite implication, i.e. that
    where there is a SIGNATURE implementation, there must also be KEYMGMT.
    
    This change reverses the logic of the code to be closer to the intended
    design.
    
    There is a consequence; we now use the query_operation_name function from
    the KEYMGMT of the EVP_PKEY given by the EVP_PKEY_CTX (ultimately given by
    the application).  Previously, we used the query_operation_name function
    from the KEYMGMT found alongside the SIGNATURE implementation.
    
    Another minor consequence is that the |keymgmt| field in EVP_PKEY_CTX
    is now always a reference to the KEYMGMT of the |pkey| field if that
    one is given (|pkey| isn't NULL) and is provided (|pkey->keymgmt|
    isn't NULL).
    
    Fixes #16614
    Reviewed-by: NTomas Mraz <tomas@openssl.org>
    Reviewed-by: NMatt Caswell <matt@openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/16725)
    5246183e
keymgmt_lib.c 18.3 KB