From d1c3637a9fa8d20fa399aff98405cc9e201de463 Mon Sep 17 00:00:00 2001 From: dnotestein Date: Tue, 27 May 2014 09:40:23 -0400 Subject: [PATCH] Fix variable name (input parameter to function is length of cipher text, not decoded plain text) and function comments (looks like it was some copy/paste error). --- src/crypto/aes.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/crypto/aes.cpp b/src/crypto/aes.cpp index 3f0933f..19518f1 100644 --- a/src/crypto/aes.cpp +++ b/src/crypto/aes.cpp @@ -107,19 +107,19 @@ aes_decoder::~aes_decoder() { } -uint32_t aes_decoder::decode( const char* ciphertxt, uint32_t plaintext_len, char* plaintext ) +uint32_t aes_decoder::decode( const char* ciphertxt, uint32_t ciphertxt_len, char* plaintext ) { - int ciphertext_len = 0; - /* Provide the message to be encrypted, and obtain the encrypted output. + int plaintext_len = 0; + /* Provide the message to be decrypted, and obtain the decrypted output. * * EVP_DecryptUpdate can be called multiple times if necessary * */ - if(1 != EVP_DecryptUpdate(my->ctx, (unsigned char*)plaintext, &ciphertext_len, (const unsigned char*)ciphertxt, plaintext_len)) + if (1 != EVP_DecryptUpdate(my->ctx, (unsigned char*)plaintext, &plaintext_len, (const unsigned char*)ciphertxt, ciphertxt_len)) { - FC_THROW_EXCEPTION( exception, "error durring aes 256 cbc encryption update", + FC_THROW_EXCEPTION( exception, "error durring aes 256 cbc decryption update", ("s", ERR_error_string( ERR_get_error(), nullptr) ) ); } - FC_ASSERT( ciphertext_len == plaintext_len, "", ("ciphertext_len",ciphertext_len)("plaintext_len",plaintext_len) ); - return ciphertext_len; + FC_ASSERT( ciphertxt_len == plaintext_len, "", ("ciphertxt_len",ciphertxt_len)("plaintext_len",plaintext_len) ); + return plaintext_len; } #if 0 uint32_t aes_decoder::final_decode( char* plaintext )