29 void UncheckedSetKey(
const byte *userKey,
unsigned int length,
const NameValuePairs ¶ms)
31 this->AssertValidKeyLength(length);
36 key.Assign(userKey, 2*L);
40 CRYPTOPP_CONSTANT(S=T::DIGESTSIZE);
48 class CRYPTOPP_NO_VTABLE Enc :
public Base
53#define KR this->key+this->L
54#define BL this->buffer
55#define BR this->buffer+this->S
57#define IR inBlock+this->S
59#define OR outBlock+this->S
61 void ProcessAndXorBlock(
const byte *inBlock,
const byte *xorBlock,
byte *outBlock)
const
63 this->hm.Update(KL, this->L);
64 this->hm.Update(IL, this->S);
68 this->hm.Update(KR, this->L);
69 this->hm.Update(BR, this->S);
73 this->hm.Update(KL, this->L);
74 this->hm.Update(BL, this->S);
75 this->hm.Final(this->digest);
76 xorbuf(BR, this->digest, this->S);
78 this->hm.Update(KR, this->L);
79 this->hm.Update(OR, this->S);
80 this->hm.Final(this->digest);
81 xorbuf(BL, this->digest, this->S);
84 xorbuf(outBlock, xorBlock, this->buffer, 2*this->S);
86 memcpy_s(outBlock, 2*this->S, this->buffer, 2*this->S);
90 class CRYPTOPP_NO_VTABLE Dec :
public Base
93 void ProcessAndXorBlock(
const byte *inBlock,
const byte *xorBlock,
byte *outBlock)
const
95 this->hm.Update(KR, this->L);
96 this->hm.Update(IR, this->S);
100 this->hm.Update(KL, this->L);
101 this->hm.Update(BL, this->S);
105 this->hm.Update(KR, this->L);
106 this->hm.Update(BR, this->S);
107 this->hm.Final(this->digest);
108 xorbuf(BL, this->digest, this->S);
110 this->hm.Update(KL, this->L);
111 this->hm.Update(OL, this->S);
112 this->hm.Final(this->digest);
113 xorbuf(BR, this->digest, this->S);
116 xorbuf(outBlock, xorBlock, this->buffer, 2*this->S);
118 std::memcpy(outBlock, this->buffer, 2*this->S);
void memcpy_s(void *dest, size_t sizeInBytes, const void *src, size_t count)
Bounds checking replacement for memcpy()
CRYPTOPP_DLL void xorbuf(byte *buf, const byte *mask, size_t count)
Performs an XOR of a buffer with a mask.