summaryrefslogtreecommitdiffstats
path: root/CryptoPP/eax.cpp
diff options
context:
space:
mode:
authorbearbin <bearbin@gmail.com>2013-07-29 14:55:26 +0200
committerbearbin <bearbin@gmail.com>2013-07-29 14:55:26 +0200
commitfb1044c4e55c726753d094b66756a1cb3bc60ee8 (patch)
treec61e56725da7dff0154d566722651e2c39c9d6c6 /CryptoPP/eax.cpp
parentWebAdmin: Removed the duplicate memory usage querying (diff)
parentChanged everyting to Unix line endings. (diff)
downloadcuberite-fb1044c4e55c726753d094b66756a1cb3bc60ee8.tar
cuberite-fb1044c4e55c726753d094b66756a1cb3bc60ee8.tar.gz
cuberite-fb1044c4e55c726753d094b66756a1cb3bc60ee8.tar.bz2
cuberite-fb1044c4e55c726753d094b66756a1cb3bc60ee8.tar.lz
cuberite-fb1044c4e55c726753d094b66756a1cb3bc60ee8.tar.xz
cuberite-fb1044c4e55c726753d094b66756a1cb3bc60ee8.tar.zst
cuberite-fb1044c4e55c726753d094b66756a1cb3bc60ee8.zip
Diffstat (limited to 'CryptoPP/eax.cpp')
-rw-r--r--CryptoPP/eax.cpp118
1 files changed, 59 insertions, 59 deletions
diff --git a/CryptoPP/eax.cpp b/CryptoPP/eax.cpp
index cf836632b..2728c9bcd 100644
--- a/CryptoPP/eax.cpp
+++ b/CryptoPP/eax.cpp
@@ -1,59 +1,59 @@
-// eax.cpp - written and placed in the public domain by Wei Dai
-
-#include "pch.h"
-#include "eax.h"
-
-NAMESPACE_BEGIN(CryptoPP)
-
-void EAX_Base::SetKeyWithoutResync(const byte *userKey, size_t keylength, const NameValuePairs &params)
-{
- AccessMAC().SetKey(userKey, keylength, params);
- m_buffer.New(2*AccessMAC().TagSize());
-}
-
-void EAX_Base::Resync(const byte *iv, size_t len)
-{
- MessageAuthenticationCode &mac = AccessMAC();
- unsigned int blockSize = mac.TagSize();
-
- memset(m_buffer, 0, blockSize);
- mac.Update(m_buffer, blockSize);
- mac.CalculateDigest(m_buffer+blockSize, iv, len);
-
- m_buffer[blockSize-1] = 1;
- mac.Update(m_buffer, blockSize);
-
- m_ctr.SetCipherWithIV(AccessMAC().AccessCipher(), m_buffer+blockSize, blockSize);
-}
-
-size_t EAX_Base::AuthenticateBlocks(const byte *data, size_t len)
-{
- AccessMAC().Update(data, len);
- return 0;
-}
-
-void EAX_Base::AuthenticateLastHeaderBlock()
-{
- assert(m_bufferedDataLength == 0);
- MessageAuthenticationCode &mac = AccessMAC();
- unsigned int blockSize = mac.TagSize();
-
- mac.Final(m_buffer);
- xorbuf(m_buffer+blockSize, m_buffer, blockSize);
-
- memset(m_buffer, 0, blockSize);
- m_buffer[blockSize-1] = 2;
- mac.Update(m_buffer, blockSize);
-}
-
-void EAX_Base::AuthenticateLastFooterBlock(byte *tag, size_t macSize)
-{
- assert(m_bufferedDataLength == 0);
- MessageAuthenticationCode &mac = AccessMAC();
- unsigned int blockSize = mac.TagSize();
-
- mac.TruncatedFinal(m_buffer, macSize);
- xorbuf(tag, m_buffer, m_buffer+blockSize, macSize);
-}
-
-NAMESPACE_END
+// eax.cpp - written and placed in the public domain by Wei Dai
+
+#include "pch.h"
+#include "eax.h"
+
+NAMESPACE_BEGIN(CryptoPP)
+
+void EAX_Base::SetKeyWithoutResync(const byte *userKey, size_t keylength, const NameValuePairs &params)
+{
+ AccessMAC().SetKey(userKey, keylength, params);
+ m_buffer.New(2*AccessMAC().TagSize());
+}
+
+void EAX_Base::Resync(const byte *iv, size_t len)
+{
+ MessageAuthenticationCode &mac = AccessMAC();
+ unsigned int blockSize = mac.TagSize();
+
+ memset(m_buffer, 0, blockSize);
+ mac.Update(m_buffer, blockSize);
+ mac.CalculateDigest(m_buffer+blockSize, iv, len);
+
+ m_buffer[blockSize-1] = 1;
+ mac.Update(m_buffer, blockSize);
+
+ m_ctr.SetCipherWithIV(AccessMAC().AccessCipher(), m_buffer+blockSize, blockSize);
+}
+
+size_t EAX_Base::AuthenticateBlocks(const byte *data, size_t len)
+{
+ AccessMAC().Update(data, len);
+ return 0;
+}
+
+void EAX_Base::AuthenticateLastHeaderBlock()
+{
+ assert(m_bufferedDataLength == 0);
+ MessageAuthenticationCode &mac = AccessMAC();
+ unsigned int blockSize = mac.TagSize();
+
+ mac.Final(m_buffer);
+ xorbuf(m_buffer+blockSize, m_buffer, blockSize);
+
+ memset(m_buffer, 0, blockSize);
+ m_buffer[blockSize-1] = 2;
+ mac.Update(m_buffer, blockSize);
+}
+
+void EAX_Base::AuthenticateLastFooterBlock(byte *tag, size_t macSize)
+{
+ assert(m_bufferedDataLength == 0);
+ MessageAuthenticationCode &mac = AccessMAC();
+ unsigned int blockSize = mac.TagSize();
+
+ mac.TruncatedFinal(m_buffer, macSize);
+ xorbuf(tag, m_buffer, m_buffer+blockSize, macSize);
+}
+
+NAMESPACE_END