Merge commit 'c51f1bcffb74aea44ec379710c3d0d3dc252a7e2'

master
Niko PLP 1 year ago
commit abcbc3ab18
  1. 4
      librocksdb-sys/rocksdb/plugin/openssl/openssl_provider.cc
  2. 5
      librocksdb-sys/rocksdb/plugin/openssl/openssl_provider.h

@ -256,13 +256,13 @@ Status OpensslProvider::AddCipher(const std::string& /*descriptor*/,
return Status::InvalidArgument("Multiple encryption keys not supported."); return Status::InvalidArgument("Multiple encryption keys not supported.");
} }
key_ = reinterpret_cast<const unsigned char *>(cipher);
if (len == 16) { aes_cipher_ = EVP_aes_128_ctr(); } if (len == 16) { aes_cipher_ = EVP_aes_128_ctr(); }
else if (len == 24) { aes_cipher_ = EVP_aes_192_ctr(); } else if (len == 24) { aes_cipher_ = EVP_aes_192_ctr(); }
else if (len == 32) { aes_cipher_ = EVP_aes_256_ctr(); } else if (len == 32) { aes_cipher_ = EVP_aes_256_ctr(); }
else return Status::InvalidArgument("Invalid key size in provider."); else return Status::InvalidArgument("Invalid key size in provider.");
memcpy(key_,cipher,len);
//if( 1 != EVP_CIPHER_up_ref(aes_cipher_)) return handleErrors("Failed to create provider."); //if( 1 != EVP_CIPHER_up_ref(aes_cipher_)) return handleErrors("Failed to create provider.");
return Status::OK(); return Status::OK();

@ -48,10 +48,11 @@ class OpensslProvider : public EncryptionProvider {
private: private:
const EVP_CIPHER *aes_cipher_; const EVP_CIPHER *aes_cipher_;
const unsigned char *key_; //const unsigned char *key_;
unsigned char key_[32];
size_t key_len_; size_t key_len_;
OpensslProvider() OpensslProvider()
: aes_cipher_(nullptr), key_(nullptr), key_len_(0) {} : aes_cipher_(nullptr), key_len_(0) {}
OpensslProvider(const OpensslProvider&) = delete; OpensslProvider(const OpensslProvider&) = delete;
OpensslProvider& operator=(const OpensslProvider&) = delete; OpensslProvider& operator=(const OpensslProvider&) = delete;
Status handleErrors (const char * str) const; Status handleErrors (const char * str) const;

Loading…
Cancel
Save