Merge pull request #27 from vikramrajkumar/phoenix

Minor cleanup
This commit is contained in:
Nikolai Mushegian 2014-05-23 17:43:16 -04:00
commit adacbf6d6b
4 changed files with 23 additions and 22 deletions

5
.gitignore vendored
View file

@ -15,7 +15,6 @@
*.a
*.lib
#CMake->MSVC artifacts
*.sln
*.vcxproj
@ -41,5 +40,7 @@ libfc.a
libfc_debug.a
fc_automoc.cpp
*.swp
git_revision.cpp
GitSHA3.cpp
*.sw*

View file

@ -193,8 +193,8 @@ ELSE()
IF(APPLE)
SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++11 -stdlib=libc++ -Wall")
ELSE()
target_compile_options(fc PUBLIC -std=c++11 -Wall -fnon-call-exceptions -Wno-unused-local-typedefs -fmax-errors=3)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-local-typedefs -fmax-errors=3 ")
target_compile_options(fc PUBLIC -std=c++11 -Wall -fnon-call-exceptions)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
ENDIF()
ENDIF()

View file

@ -77,7 +77,7 @@ class ripemd160
typedef ripemd160 uint160_t;
typedef ripemd160 uint160;
template<> struct get_typename<uint160> { static const char* name() { return "uint160"; } };
template<> struct get_typename<uint160_t> { static const char* name() { return "uint160_t"; } };
} // namespace fc

View file

@ -38,7 +38,7 @@ void aes_encoder::init( const fc::sha256& key, const fc::uint128& init_value )
* is 128 bits */
if(1 != EVP_EncryptInit_ex(my->ctx, EVP_aes_256_cbc(), NULL, (unsigned char*)&key, (unsigned char*)&init_value))
{
FC_THROW_EXCEPTION( exception, "error durring aes 256 cbc encryption init",
FC_THROW_EXCEPTION( exception, "error during aes 256 cbc encryption init",
("s", ERR_error_string( ERR_get_error(), nullptr) ) );
}
EVP_CIPHER_CTX_set_padding( my->ctx, 0 );
@ -52,7 +52,7 @@ uint32_t aes_encoder::encode( const char* plaintxt, uint32_t plaintext_len, char
* */
if(1 != EVP_EncryptUpdate(my->ctx, (unsigned char*)ciphertxt, &ciphertext_len, (const unsigned char*)plaintxt, plaintext_len))
{
FC_THROW_EXCEPTION( exception, "error durring aes 256 cbc encryption update",
FC_THROW_EXCEPTION( exception, "error during aes 256 cbc encryption update",
("s", ERR_error_string( ERR_get_error(), nullptr) ) );
}
FC_ASSERT( ciphertext_len == plaintext_len, "", ("ciphertext_len",ciphertext_len)("plaintext_len",plaintext_len) );
@ -67,7 +67,7 @@ uint32_t aes_encoder::final_encode( char* ciphertxt )
* */
if(1 != EVP_EncryptFinal_ex(my->ctx, (unsigned char*)ciphertxt, &ciphertext_len))
{
FC_THROW_EXCEPTION( exception, "error durring aes 256 cbc encryption final",
FC_THROW_EXCEPTION( exception, "error during aes 256 cbc encryption final",
("s", ERR_error_string( ERR_get_error(), nullptr) ) );
}
return ciphertext_len;
@ -98,7 +98,7 @@ void aes_decoder::init( const fc::sha256& key, const fc::uint128& init_value )
* is 128 bits */
if(1 != EVP_DecryptInit_ex(my->ctx, EVP_aes_256_cbc(), NULL, (unsigned char*)&key, (unsigned char*)&init_value))
{
FC_THROW_EXCEPTION( exception, "error durring aes 256 cbc encryption init",
FC_THROW_EXCEPTION( exception, "error during aes 256 cbc encryption init",
("s", ERR_error_string( ERR_get_error(), nullptr) ) );
}
EVP_CIPHER_CTX_set_padding( my->ctx, 0 );
@ -115,7 +115,7 @@ uint32_t aes_decoder::decode( const char* ciphertxt, uint32_t plaintext_len, cha
* */
if(1 != EVP_DecryptUpdate(my->ctx, (unsigned char*)plaintext, &ciphertext_len, (const unsigned char*)ciphertxt, plaintext_len))
{
FC_THROW_EXCEPTION( exception, "error durring aes 256 cbc encryption update",
FC_THROW_EXCEPTION( exception, "error during aes 256 cbc encryption update",
("s", ERR_error_string( ERR_get_error(), nullptr) ) );
}
FC_ASSERT( ciphertext_len == plaintext_len, "", ("ciphertext_len",ciphertext_len)("plaintext_len",plaintext_len) );
@ -131,7 +131,7 @@ uint32_t aes_decoder::final_decode( char* plaintext )
* */
if(1 != EVP_DecryptFinal_ex(my->ctx, (unsigned char*)plaintext, &ciphertext_len))
{
FC_THROW_EXCEPTION( exception, "error durring aes 256 cbc encryption final",
FC_THROW_EXCEPTION( exception, "error during aes 256 cbc encryption final",
("s", ERR_error_string( ERR_get_error(), nullptr) ) );
}
return ciphertext_len;
@ -172,7 +172,7 @@ int aes_encrypt(unsigned char *plaintext, int plaintext_len, unsigned char *key,
* is 128 bits */
if(1 != EVP_EncryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, key, iv))
{
FC_THROW_EXCEPTION( exception, "error durring aes 256 cbc encryption init",
FC_THROW_EXCEPTION( exception, "error during aes 256 cbc encryption init",
("s", ERR_error_string( ERR_get_error(), nullptr) ) );
}
@ -181,7 +181,7 @@ int aes_encrypt(unsigned char *plaintext, int plaintext_len, unsigned char *key,
* */
if(1 != EVP_EncryptUpdate(ctx, ciphertext, &len, plaintext, plaintext_len))
{
FC_THROW_EXCEPTION( exception, "error durring aes 256 cbc encryption update",
FC_THROW_EXCEPTION( exception, "error during aes 256 cbc encryption update",
("s", ERR_error_string( ERR_get_error(), nullptr) ) );
}
ciphertext_len = len;
@ -191,7 +191,7 @@ int aes_encrypt(unsigned char *plaintext, int plaintext_len, unsigned char *key,
* */
if(1 != EVP_EncryptFinal_ex(ctx, ciphertext + len, &len))
{
FC_THROW_EXCEPTION( exception, "error durring aes 256 cbc encryption final",
FC_THROW_EXCEPTION( exception, "error during aes 256 cbc encryption final",
("s", ERR_error_string( ERR_get_error(), nullptr) ) );
}
ciphertext_len += len;
@ -220,7 +220,7 @@ int aes_decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned char *ke
* * is 128 bits */
if(1 != EVP_DecryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, key, iv))
{
FC_THROW_EXCEPTION( exception, "error durring aes 256 cbc decrypt init",
FC_THROW_EXCEPTION( exception, "error during aes 256 cbc decrypt init",
("s", ERR_error_string( ERR_get_error(), nullptr) ) );
}
@ -229,7 +229,7 @@ int aes_decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned char *ke
* */
if(1 != EVP_DecryptUpdate(ctx, plaintext, &len, ciphertext, ciphertext_len))
{
FC_THROW_EXCEPTION( exception, "error durring aes 256 cbc decrypt update",
FC_THROW_EXCEPTION( exception, "error during aes 256 cbc decrypt update",
("s", ERR_error_string( ERR_get_error(), nullptr) ) );
}
@ -240,7 +240,7 @@ int aes_decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned char *ke
* */
if(1 != EVP_DecryptFinal_ex(ctx, plaintext + len, &len))
{
FC_THROW_EXCEPTION( exception, "error durring aes 256 cbc decrypt final",
FC_THROW_EXCEPTION( exception, "error during aes 256 cbc decrypt final",
("s", ERR_error_string( ERR_get_error(), nullptr) ) );
}
plaintext_len += len;
@ -269,7 +269,7 @@ int aes_cfb_decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned char
* * is 128 bits */
if(1 != EVP_DecryptInit_ex(ctx, EVP_aes_256_cfb128(), NULL, key, iv))
{
FC_THROW_EXCEPTION( exception, "error durring aes 256 cbc decrypt init",
FC_THROW_EXCEPTION( exception, "error during aes 256 cbc decrypt init",
("s", ERR_error_string( ERR_get_error(), nullptr) ) );
}
@ -278,7 +278,7 @@ int aes_cfb_decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned char
* */
if(1 != EVP_DecryptUpdate(ctx, plaintext, &len, ciphertext, ciphertext_len))
{
FC_THROW_EXCEPTION( exception, "error durring aes 256 cbc decrypt update",
FC_THROW_EXCEPTION( exception, "error during aes 256 cbc decrypt update",
("s", ERR_error_string( ERR_get_error(), nullptr) ) );
}
@ -289,7 +289,7 @@ int aes_cfb_decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned char
* */
if(1 != EVP_DecryptFinal_ex(ctx, plaintext + len, &len))
{
FC_THROW_EXCEPTION( exception, "error durring aes 256 cbc decrypt final",
FC_THROW_EXCEPTION( exception, "error during aes 256 cbc decrypt final",
("s", ERR_error_string( ERR_get_error(), nullptr) ) );
}
plaintext_len += len;