aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/openssl/crypto/evp/p5_crpt.c
diff options
context:
space:
mode:
authortpashkin <tpashkin@yandex-team.ru>2022-02-10 16:46:42 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:42 +0300
commit656921707c02b816d730f31c1fdc1d615adbfe00 (patch)
tree49e222ea1c5804306084bb3ae065bb702625360f /contrib/libs/openssl/crypto/evp/p5_crpt.c
parent5475379a04e37df30085bd1724f1c57e3f40996f (diff)
downloadydb-656921707c02b816d730f31c1fdc1d615adbfe00.tar.gz
Restoring authorship annotation for <tpashkin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/openssl/crypto/evp/p5_crpt.c')
-rw-r--r--contrib/libs/openssl/crypto/evp/p5_crpt.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/contrib/libs/openssl/crypto/evp/p5_crpt.c b/contrib/libs/openssl/crypto/evp/p5_crpt.c
index d54de47ded..6c5f45f733 100644
--- a/contrib/libs/openssl/crypto/evp/p5_crpt.c
+++ b/contrib/libs/openssl/crypto/evp/p5_crpt.c
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -28,7 +28,7 @@ int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *cctx, const char *pass, int passlen,
EVP_MD_CTX *ctx;
unsigned char md_tmp[EVP_MAX_MD_SIZE];
unsigned char key[EVP_MAX_KEY_LENGTH], iv[EVP_MAX_IV_LENGTH];
- int i, ivl, kl;
+ int i, ivl, kl;
PBEPARAM *pbe;
int saltlen, iter;
unsigned char *salt;
@@ -48,19 +48,19 @@ int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *cctx, const char *pass, int passlen,
return 0;
}
- ivl = EVP_CIPHER_iv_length(cipher);
- if (ivl < 0 || ivl > 16) {
- EVPerr(EVP_F_PKCS5_PBE_KEYIVGEN, EVP_R_INVALID_IV_LENGTH);
- PBEPARAM_free(pbe);
- return 0;
- }
- kl = EVP_CIPHER_key_length(cipher);
- if (kl < 0 || kl > (int)sizeof(md_tmp)) {
- EVPerr(EVP_F_PKCS5_PBE_KEYIVGEN, EVP_R_INVALID_KEY_LENGTH);
- PBEPARAM_free(pbe);
- return 0;
- }
-
+ ivl = EVP_CIPHER_iv_length(cipher);
+ if (ivl < 0 || ivl > 16) {
+ EVPerr(EVP_F_PKCS5_PBE_KEYIVGEN, EVP_R_INVALID_IV_LENGTH);
+ PBEPARAM_free(pbe);
+ return 0;
+ }
+ kl = EVP_CIPHER_key_length(cipher);
+ if (kl < 0 || kl > (int)sizeof(md_tmp)) {
+ EVPerr(EVP_F_PKCS5_PBE_KEYIVGEN, EVP_R_INVALID_KEY_LENGTH);
+ PBEPARAM_free(pbe);
+ return 0;
+ }
+
if (!pbe->iter)
iter = 1;
else
@@ -86,7 +86,7 @@ int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *cctx, const char *pass, int passlen,
if (!EVP_DigestUpdate(ctx, salt, saltlen))
goto err;
PBEPARAM_free(pbe);
- pbe = NULL;
+ pbe = NULL;
if (!EVP_DigestFinal_ex(ctx, md_tmp, NULL))
goto err;
mdsize = EVP_MD_size(md);
@@ -100,8 +100,8 @@ int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *cctx, const char *pass, int passlen,
if (!EVP_DigestFinal_ex(ctx, md_tmp, NULL))
goto err;
}
- memcpy(key, md_tmp, kl);
- memcpy(iv, md_tmp + (16 - ivl), ivl);
+ memcpy(key, md_tmp, kl);
+ memcpy(iv, md_tmp + (16 - ivl), ivl);
if (!EVP_CipherInit_ex(cctx, cipher, NULL, key, iv, en_de))
goto err;
OPENSSL_cleanse(md_tmp, EVP_MAX_MD_SIZE);
@@ -109,7 +109,7 @@ int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *cctx, const char *pass, int passlen,
OPENSSL_cleanse(iv, EVP_MAX_IV_LENGTH);
rv = 1;
err:
- PBEPARAM_free(pbe);
+ PBEPARAM_free(pbe);
EVP_MD_CTX_free(ctx);
return rv;
}