diff options
author | madmaxoft <github@xoft.cz> | 2014-01-22 22:26:40 +0100 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2014-01-22 22:26:40 +0100 |
commit | 34f13d589a2ebbcae9230732c7a763b3cdd88b41 (patch) | |
tree | 4f7bad4f90ca8f7a896d83951804f0207082cafb /lib/cryptopp/eax.cpp | |
parent | Replacing CryptoPP with PolarSSL. (diff) | |
download | cuberite-34f13d589a2ebbcae9230732c7a763b3cdd88b41.tar cuberite-34f13d589a2ebbcae9230732c7a763b3cdd88b41.tar.gz cuberite-34f13d589a2ebbcae9230732c7a763b3cdd88b41.tar.bz2 cuberite-34f13d589a2ebbcae9230732c7a763b3cdd88b41.tar.lz cuberite-34f13d589a2ebbcae9230732c7a763b3cdd88b41.tar.xz cuberite-34f13d589a2ebbcae9230732c7a763b3cdd88b41.tar.zst cuberite-34f13d589a2ebbcae9230732c7a763b3cdd88b41.zip |
Diffstat (limited to '')
-rw-r--r-- | lib/cryptopp/eax.cpp | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/lib/cryptopp/eax.cpp b/lib/cryptopp/eax.cpp deleted file mode 100644 index 2728c9bcd..000000000 --- a/lib/cryptopp/eax.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// 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 ¶ms) -{ - 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 |