forked from mindspore-Ecosystem/mindspore
!31651 Fix code warnings
Merge pull request !31651 from jxlang910/master
This commit is contained in:
commit
6234ff6700
|
@ -118,7 +118,7 @@ int AESEncrypt::evp_aes_encrypt(const uint8_t *data, const int len, const uint8_
|
|||
EVP_CIPHER_CTX_free(ctx);
|
||||
return -1;
|
||||
}
|
||||
EVP_CIPHER_CTX_set_padding(ctx, EVP_PADDING_PKCS7);
|
||||
(void)EVP_CIPHER_CTX_set_padding(ctx, EVP_PADDING_PKCS7);
|
||||
} else if (aes_mode_ == AES_CTR) {
|
||||
switch (priv_key_len_) {
|
||||
case KEY_LENGTH_16:
|
||||
|
|
|
@ -33,9 +33,9 @@ enum AES_MODE {
|
|||
AES_CBC = 0,
|
||||
AES_CTR = 1,
|
||||
};
|
||||
class SymmetricEncrypt : Encrypt {};
|
||||
class SymmetricEncrypt : public Encrypt {};
|
||||
|
||||
class AESEncrypt : SymmetricEncrypt {
|
||||
class AESEncrypt : public SymmetricEncrypt {
|
||||
public:
|
||||
AESEncrypt(const uint8_t *key, int key_len, const uint8_t *ivec, int ivec_len, AES_MODE mode);
|
||||
~AESEncrypt();
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
|
||||
#include "fl/armour/secure_protocol/key_agreement.h"
|
||||
#include "fl/server/common.h"
|
||||
|
||||
namespace mindspore {
|
||||
namespace armour {
|
||||
|
@ -128,8 +129,8 @@ int PrivateKey::Exchange(PublicKey *peerPublicKey, int key_len, const unsigned c
|
|||
EVP_PKEY_CTX_free(ctx);
|
||||
return -1;
|
||||
}
|
||||
if (!PKCS5_PBKDF2_HMAC(reinterpret_cast<char *>(secret), len, salt, salt_len, ITERATION, EVP_sha256(), key_len,
|
||||
exchangeKey)) {
|
||||
if (!PKCS5_PBKDF2_HMAC(reinterpret_cast<char *>(secret), SizeToInt(len), salt, salt_len, ITERATION, EVP_sha256(),
|
||||
key_len, exchangeKey)) {
|
||||
OPENSSL_free(secret);
|
||||
EVP_PKEY_CTX_free(ctx);
|
||||
return -1;
|
||||
|
|
|
@ -52,7 +52,7 @@ int Masking::GetMasking(std::vector<float> *noise, int noise_len, const uint8_t
|
|||
|
||||
for (int i = 0; i < noise_len; i++) {
|
||||
auto value = *(reinterpret_cast<int32_t *>(encrypt_data.data()) + i);
|
||||
noise->emplace_back(static_cast<float>(value) / INT32_MAX);
|
||||
(void)noise->emplace_back(static_cast<float>(value) / INT32_MAX);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue