mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-28 15:41:40 +00:00
lib: rsa: use actual OpenSSL 1.1.0 EVP MD API
Since OpenSSL 1.1.0, EVP_MD_CTX_create() is EVP_MD_CTX_new() EVP_MD_CTX_destroy() is EVP_MD_CTX_free() EVP_MD_CTX_init() is EVP_MD_CTX_reset() As there's no need to reset a newly created EVP_MD_CTX, moreover EVP_DigestSignInit() does the reset, thus call to EVP_MD_CTX_init() can be dropped. As there's no need to reset an EVP_MD_CTX before it's destroyed, as it will be reset by EVP_MD_CTX_free(), call to EVP_MD_CTX_reset() is not needed and can be dropped. Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
This commit is contained in:
parent
4fa4227cdd
commit
9b5ad4f5da
1 changed files with 3 additions and 5 deletions
|
@ -383,12 +383,11 @@ static int rsa_sign_with_key(EVP_PKEY *pkey, struct padding_algo *padding_algo,
|
|||
goto err_alloc;
|
||||
}
|
||||
|
||||
context = EVP_MD_CTX_create();
|
||||
context = EVP_MD_CTX_new();
|
||||
if (!context) {
|
||||
ret = rsa_err("EVP context creation failed");
|
||||
goto err_create;
|
||||
}
|
||||
EVP_MD_CTX_init(context);
|
||||
|
||||
ckey = EVP_PKEY_CTX_new(pkey, NULL);
|
||||
if (!ckey) {
|
||||
|
@ -425,8 +424,7 @@ static int rsa_sign_with_key(EVP_PKEY *pkey, struct padding_algo *padding_algo,
|
|||
goto err_sign;
|
||||
}
|
||||
|
||||
EVP_MD_CTX_reset(context);
|
||||
EVP_MD_CTX_destroy(context);
|
||||
EVP_MD_CTX_free(context);
|
||||
|
||||
debug("Got signature: %zu bytes, expected %d\n", size, EVP_PKEY_size(pkey));
|
||||
*sigp = sig;
|
||||
|
@ -435,7 +433,7 @@ static int rsa_sign_with_key(EVP_PKEY *pkey, struct padding_algo *padding_algo,
|
|||
return 0;
|
||||
|
||||
err_sign:
|
||||
EVP_MD_CTX_destroy(context);
|
||||
EVP_MD_CTX_free(context);
|
||||
err_create:
|
||||
free(sig);
|
||||
err_alloc:
|
||||
|
|
Loading…
Reference in a new issue