1 /*
2 Copyright (C) 2010-2015 Werner Dittmann
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
19 #include <stdlib.h>
20
21 void macSkein(uint8_t* key, int32_t key_length,
22 const uint8_t* data, uint32_t data_length,
23 uint8_t* mac, int32_t mac_length,
SkeinSize_t skeinSize)
24 {
26
28
32 }
33
34 void macSkein(uint8_t* key, int32_t key_length,
35 const uint8_t* data[], uint32_t data_length[],
36 uint8_t* mac, int32_t mac_length,
SkeinSize_t skeinSize)
37 {
39
41
43 while (*data) {
45 data++;
46 data_length ++;
47 }
49 }
50
53 {
55
58 return ctx;
59 }
60
61 void macSkeinCtx(
void* ctx,
const uint8_t* data, uint32_t data_length,
62 uint8_t* mac)
63 {
65
69 }
70
71 void macSkeinCtx(
void* ctx,
const uint8_t* data[], uint32_t data_length[],
72 uint8_t* mac)
73 {
75
76 while (*data) {
78 data++;
79 data_length++;
80 }
83 }
84
86 {
87 if (ctx)
88 free(ctx);
89 }
void skeinReset(SkeinCtx_t *ctx)
Resets a Skein context for furter use.
void macSkein(uint8_t *key, int32_t key_length, const uint8_t *data, uint32_t data_length, uint8_t *mac, int32_t mac_length, SkeinSize_t skeinSize)
Compute Skein MAC.
int skeinUpdate(SkeinCtx_t *ctx, const uint8_t *msg, size_t msgByteCnt)
Update Skein with the next part of the message.
void macSkeinCtx(void *ctx, const uint8_t *data, uint32_t data_length, uint8_t *mac)
Compute Skein MAC.
int skeinFinal(SkeinCtx_t *ctx, uint8_t *hash)
Finalize Skein and return the hash.
void freeSkeinMacContext(void *ctx)
Free Skein MAC context.
void * createSkeinMacContext(uint8_t *key, int32_t key_length, int32_t mac_length, SkeinSize_t skeinSize)
Create and initialize a Skein MAC context.
int skeinMacInit(SkeinCtx_t *ctx, const uint8_t *key, size_t keyLen, size_t hashBitLen)
Initializes or reuses a Skein context for MAC usage.
Function that provide Skein MAC support.
int skeinCtxPrepare(SkeinCtx_t *ctx, SkeinSize_t size)
Prepare a Skein context.
enum SkeinSize SkeinSize_t
Which Skein size to use.