Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The first evp_generic_fetch() always fail in UEFI sys due to wrong return of ossl_config_int() #21299

Closed
liyi77 opened this issue Jun 27, 2023 · 0 comments
Labels
triaged: bug The issue/pr is/fixes a bug

Comments

@liyi77
Copy link
Contributor

liyi77 commented Jun 27, 2023

ossl_config_int() alway return 0 on the first call in UEFI system.

crypto/conf/conf_sap.c L44
int ossl_config_int(const OPENSSL_INIT_SETTINGS *settings)
{
    int ret = 0;
......
#ifndef OPENSSL_SYS_UEFI
    ret = CONF_modules_load_file(filename, appname, flags);
#endif
    openssl_configured = 1;
    return ret;
}

Then the first call of evp_generic_fetch() will fail due to ossl_method_store_fetch() fail:

int ossl_method_store_fetch(OSSL_METHOD_STORE *store,
                            int nid, const char *prop_query,
                            const OSSL_PROVIDER **prov_rw, void **method)
{
......
    if (!OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL))
        return 0; // First call always return 0 here
.....
}

ret only used to check return value of CONF_modules_load_file(), should set it to 1 if in UEFI system.

@liyi77 liyi77 added the issue: bug report The issue was opened to report a bug label Jun 27, 2023
liyi77 added a commit to liyi77/openssl that referenced this issue Jun 27, 2023
FIX: openssl#21299

ret in ossl_config_int() only used to check return value of
CONF_modules_load_file(), should set it to 1 if in UEFI system.

Signed-off-by: Yi Li <yi1.li@intel.com>
@mattcaswell mattcaswell added triaged: bug The issue/pr is/fixes a bug and removed issue: bug report The issue was opened to report a bug labels Jun 27, 2023
openssl-machine pushed a commit that referenced this issue Jun 30, 2023
FIX: #21299

ret in ossl_config_int() only used to check return value of
CONF_modules_load_file(), should set it to 1 if in UEFI system.

Signed-off-by: Yi Li <yi1.li@intel.com>

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #21300)

(cherry picked from commit 500e479)
openssl-machine pushed a commit that referenced this issue Jun 30, 2023
FIX: #21299

ret in ossl_config_int() only used to check return value of
CONF_modules_load_file(), should set it to 1 if in UEFI system.

Signed-off-by: Yi Li <yi1.li@intel.com>

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #21300)

(cherry picked from commit 500e479)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triaged: bug The issue/pr is/fixes a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants