VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Crypto/Whirlpool.h
blob: fe618a9b8c214c9463d4dd40a41fad06322788c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifndef WHIRLPOOL_H
#define WHIRLPOOL_H 1

#include "Common/Tcdefs.h"
#include "config.h"

typedef struct WHIRLPOOL_CTX {
	uint64 countLo;
	uint64 countHi;
	CRYPTOPP_ALIGN_DATA(16) uint64 data[8];
	CRYPTOPP_ALIGN_DATA(16) uint64 state[8];
} WHIRLPOOL_CTX;

// -------------
#if defined(__cplusplus)
extern "C" {
#endif

void WHIRLPOOL_add(const unsigned char * source, unsigned __int32 sourceBytes, WHIRLPOOL_CTX * const ctx);
void WHIRLPOOL_finalize(WHIRLPOOL_CTX* const ctx, unsigned char * result);
void WHIRLPOOL_init(WHIRLPOOL_CTX* const ctx);

#if defined(__cplusplus)
}
#endif

#endif /* WHIRLPOOL_H */
ncryptionMode () { } void EncryptionMode::DecryptSectors (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const { EncryptionThreadPool::DoWork (EncryptionThreadPool::WorkType::DecryptDataUnits, this, data, sectorIndex, sectorCount, sectorSize); } void EncryptionMode::EncryptSectors (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const { EncryptionThreadPool::DoWork (EncryptionThreadPool::WorkType::EncryptDataUnits, this, data, sectorIndex, sectorCount, sectorSize); } EncryptionModeList EncryptionMode::GetAvailableModes () { EncryptionModeList l; l.push_back (shared_ptr <EncryptionMode> (new EncryptionModeXTS ())); return l; } void EncryptionMode::ValidateState () const { if (!KeySet || Ciphers.size() < 1) throw NotInitialized (SRC_POS); } void EncryptionMode::ValidateParameters (byte *data, uint64 length) const { if ((Ciphers.size() > 0 && (length % Ciphers.front()->GetBlockSize()) != 0)) throw ParameterIncorrect (SRC_POS); } void EncryptionMode::ValidateParameters (byte *data, uint64 sectorCount, size_t sectorSize) const { if (sectorCount == 0 || sectorSize == 0 || (sectorSize % EncryptionDataUnitSize) != 0) throw ParameterIncorrect (SRC_POS); } }