From 59e081f41e40cb981a359fef22bf9d4e91c6d5a7 Mon Sep 17 00:00:00 2001 From: EinMByte Date: Thu, 30 Jul 2015 22:06:42 +0200 Subject: [PATCH] Fix typo "Chipher" -> "Cipher" --- crypto/aes.cpp | 18 +++++++++--------- crypto/aes.h | 20 ++++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/crypto/aes.cpp b/crypto/aes.cpp index a4fee883..ef388976 100644 --- a/crypto/aes.cpp +++ b/crypto/aes.cpp @@ -45,7 +45,7 @@ void ECBCryptoAESNI::ExpandKey (const AESKey& key) ); } -void ECBEncryptionAESNI::Encrypt (const ChipherBlock * in, ChipherBlock * out) +void ECBEncryptionAESNI::Encrypt (const CipherBlock * in, CipherBlock * out) { __asm__ ( @@ -57,7 +57,7 @@ void ECBEncryptionAESNI::Encrypt (const ChipherBlock * in, ChipherBlock * out) } -void ECBDecryptionAESNI::Decrypt (const ChipherBlock * in, ChipherBlock * out) +void ECBDecryptionAESNI::Decrypt (const CipherBlock * in, CipherBlock * out) { __asm__ ( @@ -94,7 +94,7 @@ void ECBDecryptionAESNI::SetKey (const AESKey& key) #endif -void CBCEncryption::Encrypt (int numBlocks, const ChipherBlock * in, ChipherBlock * out) +void CBCEncryption::Encrypt (int numBlocks, const CipherBlock * in, CipherBlock * out) { #ifdef AESNI __asm__ @@ -131,7 +131,7 @@ void CBCEncryption::Encrypt (const uint8_t * in, std::size_t len, uint8_t * out) // len/16 int numBlocks = len >> 4; if (numBlocks > 0) - Encrypt (numBlocks, (const ChipherBlock *)in, (ChipherBlock *)out); + Encrypt (numBlocks, (const CipherBlock *)in, (CipherBlock *)out); } void CBCEncryption::Encrypt (const uint8_t * in, uint8_t * out) @@ -151,11 +151,11 @@ void CBCEncryption::Encrypt (const uint8_t * in, uint8_t * out) : "%xmm0", "%xmm1", "memory" ); #else - Encrypt (1, (const ChipherBlock *)in, (ChipherBlock *)out); + Encrypt (1, (const CipherBlock *)in, (CipherBlock *)out); #endif } -void CBCDecryption::Decrypt (int numBlocks, const ChipherBlock * in, ChipherBlock * out) +void CBCDecryption::Decrypt (int numBlocks, const CipherBlock * in, CipherBlock * out) { #ifdef AESNI __asm__ @@ -181,7 +181,7 @@ void CBCDecryption::Decrypt (int numBlocks, const ChipherBlock * in, ChipherBloc #else for (int i = 0; i < numBlocks; i++) { - ChipherBlock tmp = in[i]; + CipherBlock tmp = in[i]; m_ECBDecryption.Decrypt (in + i, out + i); out[i] ^= m_IV; m_IV = tmp; @@ -193,7 +193,7 @@ void CBCDecryption::Decrypt (const uint8_t * in, std::size_t len, uint8_t * out) { int numBlocks = len >> 4; if (numBlocks > 0) - Decrypt (numBlocks, (const ChipherBlock *)in, (ChipherBlock *)out); + Decrypt (numBlocks, (const CipherBlock *)in, (CipherBlock *)out); } void CBCDecryption::Decrypt (const uint8_t * in, uint8_t * out) @@ -213,7 +213,7 @@ void CBCDecryption::Decrypt (const uint8_t * in, uint8_t * out) : "%xmm0", "%xmm1", "memory" ); #else - Decrypt (1, (const ChipherBlock *)in, (ChipherBlock *)out); + Decrypt (1, (const CipherBlock *)in, (CipherBlock *)out); #endif } diff --git a/crypto/aes.h b/crypto/aes.h index 6e763125..fa46ceaf 100644 --- a/crypto/aes.h +++ b/crypto/aes.h @@ -10,11 +10,11 @@ namespace i2p { namespace crypto { - struct ChipherBlock + struct CipherBlock { uint8_t buf[16]; - void operator^=(const ChipherBlock& other) // XOR + void operator^=(const CipherBlock& other) // XOR { #if defined(__x86_64__) // for Intel x64 __asm__ @@ -81,7 +81,7 @@ namespace crypto public: void SetKey (const AESKey& key) { ExpandKey (key); }; - void Encrypt (const ChipherBlock * in, ChipherBlock * out); + void Encrypt (const CipherBlock * in, CipherBlock * out); }; class ECBDecryptionAESNI: public ECBCryptoAESNI @@ -89,7 +89,7 @@ namespace crypto public: void SetKey (const AESKey& key); - void Decrypt (const ChipherBlock * in, ChipherBlock * out); + void Decrypt (const CipherBlock * in, CipherBlock * out); }; typedef ECBEncryptionAESNI ECBEncryption; @@ -105,7 +105,7 @@ namespace crypto { m_Encryption.SetKey (key, 32); } - void Encrypt (const ChipherBlock * in, ChipherBlock * out) + void Encrypt (const CipherBlock * in, CipherBlock * out) { m_Encryption.ProcessData (out->buf, in->buf, 16); } @@ -123,7 +123,7 @@ namespace crypto { m_Decryption.SetKey (key, 32); } - void Decrypt (const ChipherBlock * in, ChipherBlock * out) + void Decrypt (const CipherBlock * in, CipherBlock * out) { m_Decryption.ProcessData (out->buf, in->buf, 16); } @@ -151,13 +151,13 @@ namespace crypto void SetKey (const AESKey& key) { m_ECBEncryption.SetKey (key); }; // 32 bytes void SetIV (const uint8_t * iv) { memcpy (m_LastBlock.buf, iv, 16); }; // 16 bytes - void Encrypt (int numBlocks, const ChipherBlock * in, ChipherBlock * out); + void Encrypt (int numBlocks, const CipherBlock * in, CipherBlock * out); void Encrypt (const uint8_t * in, std::size_t len, uint8_t * out); void Encrypt (const uint8_t * in, uint8_t * out); // one block private: - ChipherBlock m_LastBlock; + CipherBlock m_LastBlock; ECBEncryption m_ECBEncryption; }; @@ -171,13 +171,13 @@ namespace crypto void SetKey (const AESKey& key) { m_ECBDecryption.SetKey (key); }; // 32 bytes void SetIV (const uint8_t * iv) { memcpy (m_IV.buf, iv, 16); }; // 16 bytes - void Decrypt (int numBlocks, const ChipherBlock * in, ChipherBlock * out); + void Decrypt (int numBlocks, const CipherBlock * in, CipherBlock * out); void Decrypt (const uint8_t * in, std::size_t len, uint8_t * out); void Decrypt (const uint8_t * in, uint8_t * out); // one block private: - ChipherBlock m_IV; + CipherBlock m_IV; ECBDecryption m_ECBDecryption; };