From: Tommi Virtanen Date: Tue, 8 Mar 2011 01:01:06 +0000 (-0800) Subject: auth: Use AES IV constant directly, not via local static pointer. X-Git-Tag: v0.26~177 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ff24c82d54953e4c4a6ae92ef45a90b975d0403b;p=ceph.git auth: Use AES IV constant directly, not via local static pointer. Signed-off-by: Tommi Virtanen --- diff --git a/src/auth/Crypto.cc b/src/auth/Crypto.cc index ea9fe6e3ecb5..2aeb1b013844 100644 --- a/src/auth/Crypto.cc +++ b/src/auth/Crypto.cc @@ -95,8 +95,6 @@ public: int decrypt(bufferptr& secret, const bufferlist& in, bufferlist& out); }; -static const unsigned char *aes_iv = (const unsigned char *)CEPH_AES_IV; - int CryptoAES::create(bufferptr& secret) { bufferlist bl; @@ -128,7 +126,7 @@ int CryptoAES::encrypt(bufferptr& secret, const bufferlist& in, bufferlist& out) } string ciphertext; CryptoPP::AES::Encryption aesEncryption(key, CryptoPP::AES::DEFAULT_KEYLENGTH); - CryptoPP::CBC_Mode_ExternalCipher::Encryption cbcEncryption( aesEncryption, aes_iv ); + CryptoPP::CBC_Mode_ExternalCipher::Encryption cbcEncryption( aesEncryption, (const byte*)CEPH_AES_IV ); CryptoPP::StringSink *sink = new CryptoPP::StringSink(ciphertext); if (!sink) return false; @@ -156,7 +154,7 @@ int CryptoAES::decrypt(bufferptr& secret, const bufferlist& in, bufferlist& out) const unsigned char *key = (const unsigned char *)secret.c_str(); CryptoPP::AES::Decryption aesDecryption(key, CryptoPP::AES::DEFAULT_KEYLENGTH); - CryptoPP::CBC_Mode_ExternalCipher::Decryption cbcDecryption( aesDecryption, aes_iv ); + CryptoPP::CBC_Mode_ExternalCipher::Decryption cbcDecryption( aesDecryption, (const byte*)CEPH_AES_IV ); string decryptedtext; CryptoPP::StringSink *sink = new CryptoPP::StringSink(decryptedtext);