ccRTP 2.1.2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
skeinApi.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2010-2015 Werner Dittmann
3 
4 Permission is hereby granted, free of charge, to any person
5 obtaining a copy of this software and associated documentation
6 files (the "Software"), to deal in the Software without
7 restriction, including without limitation the rights to use,
8 copy, modify, merge, publish, distribute, sublicense, and/or sell
9 copies of the Software, and to permit persons to whom the
10 Software is furnished to do so, subject to the following
11 conditions:
12 
13 The above copyright notice and this permission notice shall be
14 included in all copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 OTHER DEALINGS IN THE SOFTWARE.
24 
25 */
26 
27 #ifndef SKEINAPI_H
28 #define SKEINAPI_H
29 
81 #include <crypto/skein.h>
82 
83 #ifdef _MSC_VER
84 typedef signed __int8 int8_t;
85 typedef unsigned __int8 uint8_t;
86 typedef signed __int16 int16_t;
87 typedef unsigned __int16 uint16_t;
88 typedef signed __int32 int32_t;
89 typedef unsigned __int32 uint32_t;
90 typedef signed __int64 int64_t;
91 typedef unsigned __int64 uint64_t;
92 #else
93 #include <stdint.h>
94 #endif
95 
96 #ifdef __cplusplus
97 extern "C"
98 {
99 #endif
100 
104  typedef enum SkeinSize {
105  Skein256 = 256,
106  Skein512 = 512,
107  Skein1024 = 1024
108  } SkeinSize_t;
109 
118  typedef struct SkeinCtx {
120  u64b_t XSave[SKEIN_MAX_STATE_WORDS]; /* save area for state variables */
121  union {
126  } m;
127  } SkeinCtx_t;
128 
143  int skeinCtxPrepare(SkeinCtx_t* ctx, SkeinSize_t size);
144 
159  int skeinInit(SkeinCtx_t* ctx, size_t hashBitLen);
160 
171  void skeinReset(SkeinCtx_t* ctx);
172 
193  int skeinMacInit(SkeinCtx_t* ctx, const uint8_t *key, size_t keyLen,
194  size_t hashBitLen);
195 
208  int skeinUpdate(SkeinCtx_t *ctx, const uint8_t *msg,
209  size_t msgByteCnt);
210 
224  int skeinUpdateBits(SkeinCtx_t *ctx, const uint8_t *msg,
225  size_t msgBitCnt);
226 
244  int skeinFinal(SkeinCtx_t* ctx, uint8_t* hash);
245 
246 #ifdef __cplusplus
247 }
248 #endif
249 
253 #endif
uint_64t u64b_t
Definition: skein_port.h:25
void skeinReset(SkeinCtx_t *ctx)
Resets a Skein context for furter use.
Skein1024_Ctxt_t s1024
Definition: skeinApi.h:125
int skeinUpdate(SkeinCtx_t *ctx, const uint8_t *msg, size_t msgByteCnt)
Update Skein with the next part of the message.
int skeinUpdateBits(SkeinCtx_t *ctx, const uint8_t *msg, size_t msgBitCnt)
Update the hash with a message bit string.
int skeinFinal(SkeinCtx_t *ctx, uint8_t *hash)
Finalize Skein and return the hash.
Skein_512_Ctxt_t s512
Definition: skeinApi.h:124
int skeinMacInit(SkeinCtx_t *ctx, const uint8_t *key, size_t keyLen, size_t hashBitLen)
Initializes or reuses a Skein context for MAC usage.
SkeinSize
Which Skein size to use.
Definition: skeinApi.h:104
Skein_Ctxt_Hdr_t h
Definition: skeinApi.h:122
u64b_t skeinSize
Definition: skeinApi.h:119
Context for Skein.
Definition: skeinApi.h:118
#define SKEIN_MAX_STATE_WORDS
Definition: skein.h:50
union SkeinCtx::@3 m
int skeinCtxPrepare(SkeinCtx_t *ctx, SkeinSize_t size)
Prepare a Skein context.
u64b_t XSave[SKEIN_MAX_STATE_WORDS]
Definition: skeinApi.h:120
struct SkeinCtx SkeinCtx_t
Context for Skein.
enum SkeinSize SkeinSize_t
Which Skein size to use.
Skein_256_Ctxt_t s256
Definition: skeinApi.h:123
int skeinInit(SkeinCtx_t *ctx, size_t hashBitLen)
Initialize a Skein context.