* @return
* SKEIN_SUCESS of SKEIN_FAIL
*/
- int skeinMacInit(struct skein_ctx* ctx, const uint8_t *key, size_t keyLen,
+ int skeinMacInit(struct skein_ctx* ctx, const u8 *key, size_t keyLen,
size_t hashBitLen);
/**
* @return
* Success or error code.
*/
- int skeinUpdate(struct skein_ctx *ctx, const uint8_t *msg,
+ int skeinUpdate(struct skein_ctx *ctx, const u8 *msg,
size_t msgByteCnt);
/**
* @param msgBitCnt
* Length of the message in @b bits.
*/
- int skeinUpdateBits(struct skein_ctx *ctx, const uint8_t *msg,
+ int skeinUpdateBits(struct skein_ctx *ctx, const u8 *msg,
size_t msgBitCnt);
/**
* Success or error code.
* @see skeinReset
*/
- int skeinFinal(struct skein_ctx* ctx, uint8_t* hash);
+ int skeinFinal(struct skein_ctx* ctx, u8* hash);
/**
* @}
* @param tweak
* Pointer to the two tweak words (word has 64 bits).
*/
- void threefishSetKey(struct threefish_key* keyCtx, enum threefish_size stateSize, uint64_t* keyData, uint64_t* tweak);
+ void threefishSetKey(struct threefish_key* keyCtx, enum threefish_size stateSize, u64* keyData, u64* tweak);
/**
* Encrypt Threefisch block (bytes).
* @param out
* Pointer to cipher buffer.
*/
- void threefishEncryptBlockBytes(struct threefish_key* keyCtx, uint8_t* in, uint8_t* out);
+ void threefishEncryptBlockBytes(struct threefish_key* keyCtx, u8* in, u8* out);
/**
* Encrypt Threefisch block (words).
* @param out
* Pointer to cipher buffer.
*/
- void threefishEncryptBlockWords(struct threefish_key* keyCtx, uint64_t* in, uint64_t* out);
+ void threefishEncryptBlockWords(struct threefish_key* keyCtx, u64* in, u64* out);
/**
* Decrypt Threefisch block (bytes).
* @param out
* Pointer to plaintext buffer.
*/
- void threefishDecryptBlockBytes(struct threefish_key* keyCtx, uint8_t* in, uint8_t* out);
+ void threefishDecryptBlockBytes(struct threefish_key* keyCtx, u8* in, u8* out);
/**
* Decrypt Threefisch block (words).
* @param out
* Pointer to plaintext buffer.
*/
- void threefishDecryptBlockWords(struct threefish_key* keyCtx, uint64_t* in, uint64_t* out);
+ void threefishDecryptBlockWords(struct threefish_key* keyCtx, u64* in, u64* out);
- void threefishEncrypt256(struct threefish_key* keyCtx, uint64_t* input, uint64_t* output);
- void threefishEncrypt512(struct threefish_key* keyCtx, uint64_t* input, uint64_t* output);
- void threefishEncrypt1024(struct threefish_key* keyCtx, uint64_t* input, uint64_t* output);
- void threefishDecrypt256(struct threefish_key* keyCtx, uint64_t* input, uint64_t* output);
- void threefishDecrypt512(struct threefish_key* keyCtx, uint64_t* input, uint64_t* output);
- void threefishDecrypt1024(struct threefish_key* keyCtx, uint64_t* input, uint64_t* output);
+ void threefishEncrypt256(struct threefish_key* keyCtx, u64* input, u64* output);
+ void threefishEncrypt512(struct threefish_key* keyCtx, u64* input, u64* output);
+ void threefishEncrypt1024(struct threefish_key* keyCtx, u64* input, u64* output);
+ void threefishDecrypt256(struct threefish_key* keyCtx, u64* input, u64* output);
+ void threefishDecrypt512(struct threefish_key* keyCtx, u64* input, u64* output);
+ void threefishDecrypt1024(struct threefish_key* keyCtx, u64* input, u64* output);
/**
* @}
*/
int ret = SKEIN_FAIL;
size_t Xlen = 0;
u64* X = NULL;
- uint64_t treeInfo = SKEIN_CFG_TREE_INFO_SEQUENTIAL;
+ u64 treeInfo = SKEIN_CFG_TREE_INFO_SEQUENTIAL;
Skein_Assert(ctx, SKEIN_FAIL);
/*
return ret;
}
-int skeinMacInit(struct skein_ctx* ctx, const uint8_t *key, size_t keyLen,
+int skeinMacInit(struct skein_ctx* ctx, const u8 *key, size_t keyLen,
size_t hashBitLen)
{
int ret = SKEIN_FAIL;
u64* X = NULL;
size_t Xlen = 0;
- uint64_t treeInfo = SKEIN_CFG_TREE_INFO_SEQUENTIAL;
+ u64 treeInfo = SKEIN_CFG_TREE_INFO_SEQUENTIAL;
Skein_Assert(ctx, SKEIN_FAIL);
Skein_Start_New_Type(&ctx->m, MSG);
}
-int skeinUpdate(struct skein_ctx *ctx, const uint8_t *msg,
+int skeinUpdate(struct skein_ctx *ctx, const u8 *msg,
size_t msgByteCnt)
{
int ret = SKEIN_FAIL;
}
-int skeinUpdateBits(struct skein_ctx *ctx, const uint8_t *msg,
+int skeinUpdateBits(struct skein_ctx *ctx, const u8 *msg,
size_t msgBitCnt)
{
/*
* arithmetic.
*/
size_t length;
- uint8_t mask;
- uint8_t* up;
+ u8 mask;
+ u8* up;
/* only the final Update() call is allowed do partial bytes, else assert an error */
Skein_Assert((ctx->m.h.T[1] & SKEIN_T1_FLAG_BIT_PAD) == 0 || msgBitCnt == 0, SKEIN_FAIL);
* Skein's real partial block buffer.
* If this layout ever changes we have to adapt this as well.
*/
- up = (uint8_t*)ctx->m.s256.X + ctx->skeinSize / 8;
+ up = (u8*)ctx->m.s256.X + ctx->skeinSize / 8;
Skein_Set_Bit_Pad_Flag(ctx->m.h); /* set tweak flag for the skeinFinal call */
/* now "pad" the final partial byte the way NIST likes */
length = ctx->m.h.bCnt; /* get the bCnt value (same location for all block sizes) */
Skein_assert(length != 0); /* internal sanity check: there IS a partial byte in the buffer! */
- mask = (uint8_t) (1u << (7 - (msgBitCnt & 7))); /* partial byte bit mask */
- up[length-1] = (uint8_t)((up[length-1] & (0-mask))|mask); /* apply bit padding on final byte (in the buffer) */
+ mask = (u8) (1u << (7 - (msgBitCnt & 7))); /* partial byte bit mask */
+ up[length-1] = (u8)((up[length-1] & (0-mask))|mask); /* apply bit padding on final byte (in the buffer) */
return SKEIN_SUCCESS;
}
-int skeinFinal(struct skein_ctx* ctx, uint8_t* hash)
+int skeinFinal(struct skein_ctx* ctx, u8* hash)
{
int ret = SKEIN_FAIL;
Skein_Assert(ctx, SKEIN_FAIL);
#include <threefishApi.h>
-void threefishEncrypt1024(struct threefish_key* keyCtx, uint64_t* input, uint64_t* output)
+void threefishEncrypt1024(struct threefish_key* keyCtx, u64* input, u64* output)
{
- uint64_t b0 = input[0], b1 = input[1],
+ u64 b0 = input[0], b1 = input[1],
b2 = input[2], b3 = input[3],
b4 = input[4], b5 = input[5],
b6 = input[6], b7 = input[7],
b10 = input[10], b11 = input[11],
b12 = input[12], b13 = input[13],
b14 = input[14], b15 = input[15];
- uint64_t k0 = keyCtx->key[0], k1 = keyCtx->key[1],
+ u64 k0 = keyCtx->key[0], k1 = keyCtx->key[1],
k2 = keyCtx->key[2], k3 = keyCtx->key[3],
k4 = keyCtx->key[4], k5 = keyCtx->key[5],
k6 = keyCtx->key[6], k7 = keyCtx->key[7],
k12 = keyCtx->key[12], k13 = keyCtx->key[13],
k14 = keyCtx->key[14], k15 = keyCtx->key[15],
k16 = keyCtx->key[16];
- uint64_t t0 = keyCtx->tweak[0], t1 = keyCtx->tweak[1],
+ u64 t0 = keyCtx->tweak[0], t1 = keyCtx->tweak[1],
t2 = keyCtx->tweak[2];
b1 += k1; b0 += b1 + k0; b1 = ((b1 << 24) | (b1 >> (64 - 24))) ^ b0;
output[15] = b15 + k1 + 20;
}
-void threefishDecrypt1024(struct threefish_key* keyCtx, uint64_t* input, uint64_t* output)
+void threefishDecrypt1024(struct threefish_key* keyCtx, u64* input, u64* output)
{
- uint64_t b0 = input[0], b1 = input[1],
+ u64 b0 = input[0], b1 = input[1],
b2 = input[2], b3 = input[3],
b4 = input[4], b5 = input[5],
b6 = input[6], b7 = input[7],
b10 = input[10], b11 = input[11],
b12 = input[12], b13 = input[13],
b14 = input[14], b15 = input[15];
- uint64_t k0 = keyCtx->key[0], k1 = keyCtx->key[1],
+ u64 k0 = keyCtx->key[0], k1 = keyCtx->key[1],
k2 = keyCtx->key[2], k3 = keyCtx->key[3],
k4 = keyCtx->key[4], k5 = keyCtx->key[5],
k6 = keyCtx->key[6], k7 = keyCtx->key[7],
k12 = keyCtx->key[12], k13 = keyCtx->key[13],
k14 = keyCtx->key[14], k15 = keyCtx->key[15],
k16 = keyCtx->key[16];
- uint64_t t0 = keyCtx->tweak[0], t1 = keyCtx->tweak[1],
+ u64 t0 = keyCtx->tweak[0], t1 = keyCtx->tweak[1],
t2 = keyCtx->tweak[2];
- uint64_t tmp;
+ u64 tmp;
b0 -= k3;
b1 -= k4;
#include <threefishApi.h>
-void threefishEncrypt256(struct threefish_key* keyCtx, uint64_t* input, uint64_t* output)
+void threefishEncrypt256(struct threefish_key* keyCtx, u64* input, u64* output)
{
- uint64_t b0 = input[0], b1 = input[1],
+ u64 b0 = input[0], b1 = input[1],
b2 = input[2], b3 = input[3];
- uint64_t k0 = keyCtx->key[0], k1 = keyCtx->key[1],
+ u64 k0 = keyCtx->key[0], k1 = keyCtx->key[1],
k2 = keyCtx->key[2], k3 = keyCtx->key[3],
k4 = keyCtx->key[4];
- uint64_t t0 = keyCtx->tweak[0], t1 = keyCtx->tweak[1],
+ u64 t0 = keyCtx->tweak[0], t1 = keyCtx->tweak[1],
t2 = keyCtx->tweak[2];
b1 += k1 + t0; b0 += b1 + k0; b1 = ((b1 << 14) | (b1 >> (64 - 14))) ^ b0;
output[3] = b3 + k1 + 18;
}
-void threefishDecrypt256(struct threefish_key* keyCtx, uint64_t* input, uint64_t* output)
+void threefishDecrypt256(struct threefish_key* keyCtx, u64* input, u64* output)
{
- uint64_t b0 = input[0], b1 = input[1],
+ u64 b0 = input[0], b1 = input[1],
b2 = input[2], b3 = input[3];
- uint64_t k0 = keyCtx->key[0], k1 = keyCtx->key[1],
+ u64 k0 = keyCtx->key[0], k1 = keyCtx->key[1],
k2 = keyCtx->key[2], k3 = keyCtx->key[3],
k4 = keyCtx->key[4];
- uint64_t t0 = keyCtx->tweak[0], t1 = keyCtx->tweak[1],
+ u64 t0 = keyCtx->tweak[0], t1 = keyCtx->tweak[1],
t2 = keyCtx->tweak[2];
- uint64_t tmp;
+ u64 tmp;
b0 -= k3;
b1 -= k4 + t0;
#include <threefishApi.h>
-void threefishEncrypt512(struct threefish_key* keyCtx, uint64_t* input, uint64_t* output)
+void threefishEncrypt512(struct threefish_key* keyCtx, u64* input, u64* output)
{
- uint64_t b0 = input[0], b1 = input[1],
+ u64 b0 = input[0], b1 = input[1],
b2 = input[2], b3 = input[3],
b4 = input[4], b5 = input[5],
b6 = input[6], b7 = input[7];
- uint64_t k0 = keyCtx->key[0], k1 = keyCtx->key[1],
+ u64 k0 = keyCtx->key[0], k1 = keyCtx->key[1],
k2 = keyCtx->key[2], k3 = keyCtx->key[3],
k4 = keyCtx->key[4], k5 = keyCtx->key[5],
k6 = keyCtx->key[6], k7 = keyCtx->key[7],
k8 = keyCtx->key[8];
- uint64_t t0 = keyCtx->tweak[0], t1 = keyCtx->tweak[1],
+ u64 t0 = keyCtx->tweak[0], t1 = keyCtx->tweak[1],
t2 = keyCtx->tweak[2];
b1 += k1; b0 += b1 + k0; b1 = ((b1 << 46) | (b1 >> (64 - 46))) ^ b0;
output[7] = b7 + k7 + 18;
}
-void threefishDecrypt512(struct threefish_key* keyCtx, uint64_t* input, uint64_t* output)
+void threefishDecrypt512(struct threefish_key* keyCtx, u64* input, u64* output)
{
- uint64_t b0 = input[0], b1 = input[1],
+ u64 b0 = input[0], b1 = input[1],
b2 = input[2], b3 = input[3],
b4 = input[4], b5 = input[5],
b6 = input[6], b7 = input[7];
- uint64_t k0 = keyCtx->key[0], k1 = keyCtx->key[1],
+ u64 k0 = keyCtx->key[0], k1 = keyCtx->key[1],
k2 = keyCtx->key[2], k3 = keyCtx->key[3],
k4 = keyCtx->key[4], k5 = keyCtx->key[5],
k6 = keyCtx->key[6], k7 = keyCtx->key[7],
k8 = keyCtx->key[8];
- uint64_t t0 = keyCtx->tweak[0], t1 = keyCtx->tweak[1],
+ u64 t0 = keyCtx->tweak[0], t1 = keyCtx->tweak[1],
t2 = keyCtx->tweak[2];
- uint64_t tmp;
+ u64 tmp;
b0 -= k0;
b1 -= k1;
#include <threefishApi.h>
void threefishSetKey(struct threefish_key* keyCtx, enum threefish_size stateSize,
- uint64_t* keyData, uint64_t* tweak)
+ u64* keyData, u64* tweak)
{
int keyWords = stateSize / 64;
int i;
- uint64_t parity = KeyScheduleConst;
+ u64 parity = KeyScheduleConst;
keyCtx->tweak[0] = tweak[0];
keyCtx->tweak[1] = tweak[1];
keyCtx->stateSize = stateSize;
}
-void threefishEncryptBlockBytes(struct threefish_key* keyCtx, uint8_t* in,
- uint8_t* out)
+void threefishEncryptBlockBytes(struct threefish_key* keyCtx, u8* in,
+ u8* out)
{
u64 plain[SKEIN_MAX_STATE_WORDS]; /* max number of words*/
u64 cipher[SKEIN_MAX_STATE_WORDS];
Skein_Put64_LSB_First(out, cipher, keyCtx->stateSize / 8); /* words to bytes */
}
-void threefishEncryptBlockWords(struct threefish_key* keyCtx, uint64_t* in,
- uint64_t* out)
+void threefishEncryptBlockWords(struct threefish_key* keyCtx, u64* in,
+ u64* out)
{
switch (keyCtx->stateSize) {
case Threefish256:
}
}
-void threefishDecryptBlockBytes(struct threefish_key* keyCtx, uint8_t* in,
- uint8_t* out)
+void threefishDecryptBlockBytes(struct threefish_key* keyCtx, u8* in,
+ u8* out)
{
u64 plain[SKEIN_MAX_STATE_WORDS]; /* max number of words*/
u64 cipher[SKEIN_MAX_STATE_WORDS];
Skein_Put64_LSB_First(out, plain, keyCtx->stateSize / 8); /* words to bytes */
}
-void threefishDecryptBlockWords(struct threefish_key* keyCtx, uint64_t* in,
- uint64_t* out)
+void threefishDecryptBlockWords(struct threefish_key* keyCtx, u64* in,
+ u64* out)
{
switch (keyCtx->stateSize) {
case Threefish256: