-
Notifications
You must be signed in to change notification settings - Fork 0
/
SimpleFIPS202.h
79 lines (64 loc) · 3.13 KB
/
SimpleFIPS202.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
The eXtended Keccak Code Package (XKCP)
https://github.com/XKCP/XKCP
Keccak, designed by Guido Bertoni, Joan Daemen, Michaël Peeters and Gilles Van Assche.
Implementation by Gilles Van Assche, hereby denoted as "the implementer".
For more information, feedback or questions, please refer to the Keccak Team website:
https://keccak.team/
To the extent possible under law, the implementer has waived all copyright
and related or neighboring rights to the source code in this file.
http://creativecommons.org/publicdomain/zero/1.0/
*/
#ifndef _SimpleFIPS202_h_
#define _SimpleFIPS202_h_
#include "config.h"
#ifdef XKCP_has_KeccakP1600
#include <string.h>
/** Implementation of the SHAKE128 extendable output function (XOF) [FIPS 202].
* @param output Pointer to the output buffer.
* @param outputByteLen The desired number of output bytes.
* @param input Pointer to the input message.
* @param inputByteLen The length of the input message in bytes.
* @return 0 if successful, 1 otherwise.
*/
int SHAKE128(unsigned char *output, size_t outputByteLen, const unsigned char *input, size_t inputByteLen);
/** Implementation of the SHAKE256 extendable output function (XOF) [FIPS 202].
* @param output Pointer to the output buffer.
* @param outputByteLen The desired number of output bytes.
* @param input Pointer to the input message.
* @param inputByteLen The length of the input message in bytes.
* @return 0 if successful, 1 otherwise.
*/
int SHAKE256(unsigned char *output, size_t outputByteLen, const unsigned char *input, size_t inputByteLen);
/** Implementation of SHA3-224 [FIPS 202].
* @param output Pointer to the output buffer (28 bytes).
* @param input Pointer to the input message.
* @param inputByteLen The length of the input message in bytes.
* @return 0 if successful, 1 otherwise.
*/
int SHA3_224(unsigned char *output, const unsigned char *input, size_t inputByteLen);
/** Implementation of SHA3-256 [FIPS 202].
* @param output Pointer to the output buffer (32 bytes).
* @param input Pointer to the input message.
* @param inputByteLen The length of the input message in bytes.
* @return 0 if successful, 1 otherwise.
*/
int SHA3_256(unsigned char *output, const unsigned char *input, size_t inputByteLen);
/** Implementation of SHA3-384 [FIPS 202].
* @param output Pointer to the output buffer (48 bytes).
* @param input Pointer to the input message.
* @param inputByteLen The length of the input message in bytes.
* @return 0 if successful, 1 otherwise.
*/
int SHA3_384(unsigned char *output, const unsigned char *input, size_t inputByteLen);
/** Implementation of SHA3-512 [FIPS 202].
* @param output Pointer to the output buffer (64 bytes).
* @param input Pointer to the input message.
* @param inputByteLen The length of the input message in bytes.
* @return 0 if successful, 1 otherwise.
*/
int SHA3_512(unsigned char *output, const unsigned char *input, size_t inputByteLen);
#else
#error This requires an implementation of Keccak-p[1600]
#endif
#endif