Update comments

pull/681/head^2
Jeffrey Walton 2018-07-06 00:35:01 -04:00
parent 97a1e8cae2
commit 30b304b0f1
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
3 changed files with 37 additions and 25 deletions

View File

@ -12,7 +12,7 @@
#include "misc.h" #include "misc.h"
/*h1 function*/ /*h1 function*/
#define h1(x, y) { \ #define h1(x, y) { \
byte a,c; \ byte a,c; \
a = (byte) (x); \ a = (byte) (x); \
c = (byte) ((x) >> 16); \ c = (byte) ((x) >> 16); \
@ -20,7 +20,7 @@
} }
/*h2 function*/ /*h2 function*/
#define h2(x, y) { \ #define h2(x, y) { \
byte a,c; \ byte a,c; \
a = (byte) (x); \ a = (byte) (x); \
c = (byte) ((x) >> 16); \ c = (byte) ((x) >> 16); \
@ -52,25 +52,25 @@
} }
/*update table P*/ /*update table P*/
#define update_P(u,v,a,b,c,d){ \ #define update_P(u,v,a,b,c,d){ \
word32 tem0,tem1,tem2,tem3; \ word32 tem0,tem1,tem2,tem3; \
tem0 = rotrConstant<23>(m_T[(v)]); \ tem0 = rotrConstant<23>(m_T[(v)]); \
tem1 = rotrConstant<10>(m_X[(c)]); \ tem1 = rotrConstant<10>(m_X[(c)]); \
tem2 = rotrConstant<8>(m_X[(b)]); \ tem2 = rotrConstant<8>(m_X[(b)]); \
h1(m_X[(d)],tem3); \ h1(m_X[(d)],tem3); \
(m_T[(u)]) = ((m_T[(u)]) + tem2+(tem0^tem1)) ^ tem3; \ (m_T[(u)]) = ((m_T[(u)]) + tem2+(tem0^tem1)) ^ tem3; \
(m_X[(a)]) = (m_T[(u)]); \ (m_X[(a)]) = (m_T[(u)]); \
} }
/*update table Q*/ /*update table Q*/
#define update_Q(u,v,a,b,c,d){ \ #define update_Q(u,v,a,b,c,d){ \
word32 tem0,tem1,tem2,tem3; \ word32 tem0,tem1,tem2,tem3; \
tem0 = rotrConstant<(32-23)>(m_T[(v)]); \ tem0 = rotrConstant<(32-23)>(m_T[(v)]); \
tem1 = rotrConstant<(32-10)>(m_Y[(c)]); \ tem1 = rotrConstant<(32-10)>(m_Y[(c)]); \
tem2 = rotrConstant<(32-8)>(m_Y[(b)]); \ tem2 = rotrConstant<(32-8)>(m_Y[(b)]); \
h2(m_Y[(d)],tem3); \ h2(m_Y[(d)],tem3); \
(m_T[(u)]) = ((m_T[(u)]) + tem2+(tem0^tem1)) ^ tem3; \ (m_T[(u)]) = ((m_T[(u)]) + tem2+(tem0^tem1)) ^ tem3; \
(m_Y[(a)]) = (m_T[(u)]); \ (m_Y[(a)]) = (m_T[(u)]); \
} }
ANONYMOUS_NAMESPACE_BEGIN ANONYMOUS_NAMESPACE_BEGIN
@ -225,8 +225,11 @@ void HC128Policy::OperateKeystream(KeystreamOperation operation, byte *output, c
PutWord(false, LITTLE_ENDIAN_ORDER, output + 60, keystream[15]); PutWord(false, LITTLE_ENDIAN_ORDER, output + 60, keystream[15]);
// If AdditiveCipherTemplate does not have an accumulated keystream // If AdditiveCipherTemplate does not have an accumulated keystream
// then it will ask OperateKeystream to XOR the plaintext with // then it will ask OperateKeystream to generate one. Optionally it
// the keystream and write it to the ciphertext buffer. // will ask for an XOR of the input with the keystream while
// writing the result to the output buffer. In all cases the
// output buffer is written. The optional part is adding the
// input buffer and keystream.
if ((operation & INPUT_NULL) != INPUT_NULL) if ((operation & INPUT_NULL) != INPUT_NULL)
xorbuf(output, input, 64); xorbuf(output, input, 64);

View File

@ -100,8 +100,11 @@ void HC256Policy::OperateKeystream(KeystreamOperation operation, byte *output, c
PutWord(false, LITTLE_ENDIAN_ORDER, out, Generate()); PutWord(false, LITTLE_ENDIAN_ORDER, out, Generate());
// If AdditiveCipherTemplate does not have an accumulated keystream // If AdditiveCipherTemplate does not have an accumulated keystream
// then it will ask OperateKeystream to XOR the plaintext with // then it will ask OperateKeystream to generate one. Optionally it
// the keystream and write it to the ciphertext buffer. // will ask for an XOR of the input with the keystream while
// writing the result to the output buffer. In all cases the
// output buffer is written. The optional part is adding the
// input buffer and keystream.
if ((operation & INPUT_NULL) != INPUT_NULL) if ((operation & INPUT_NULL) != INPUT_NULL)
xorbuf(output, input, msglen); xorbuf(output, input, msglen);
} }

View File

@ -137,8 +137,11 @@ void RabbitPolicy::OperateKeystream(KeystreamOperation operation, byte *output,
} }
// If AdditiveCipherTemplate does not have an accumulated keystream // If AdditiveCipherTemplate does not have an accumulated keystream
// then it will ask OperateKeystream to XOR the plaintext with // then it will ask OperateKeystream to generate one. Optionally it
// the keystream and write it to the ciphertext buffer. // will ask for an XOR of the input with the keystream while
// writing the result to the output buffer. In all cases the
// output buffer is written. The optional part is adding the
// input buffer and keystream.
if ((operation & INPUT_NULL) != INPUT_NULL) if ((operation & INPUT_NULL) != INPUT_NULL)
xorbuf(output, input, GetBytesPerIteration() * iterationCount); xorbuf(output, input, GetBytesPerIteration() * iterationCount);
} }
@ -235,8 +238,11 @@ void RabbitWithIVPolicy::OperateKeystream(KeystreamOperation operation, byte *ou
} }
// If AdditiveCipherTemplate does not have an accumulated keystream // If AdditiveCipherTemplate does not have an accumulated keystream
// then it will ask OperateKeystream to XOR the plaintext with // then it will ask OperateKeystream to generate one. Optionally it
// the keystream and write it to the ciphertext buffer. // will ask for an XOR of the input with the keystream while
// writing the result to the output buffer. In all cases the
// output buffer is written. The optional part is adding the
// input buffer and keystream.
if ((operation & INPUT_NULL) != INPUT_NULL) if ((operation & INPUT_NULL) != INPUT_NULL)
xorbuf(output, input, GetBytesPerIteration() * iterationCount); xorbuf(output, input, GetBytesPerIteration() * iterationCount);
} }