shake128.h
Go to the documentation of this file.
1 /**
2  * @file shake128.h
3  * @brief SHAKE128 extendable-output function (XOF)
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2020 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneCRYPTO Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 1.9.8
29  **/
30 
31 #ifndef _SHAKE128_H
32 #define _SHAKE128_H
33 
34 //Dependencies
35 #include "core/crypto.h"
36 #include "xof/keccak.h"
37 
38 //C++ guard
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 
44 /**
45  * @brief SHAKE128 algorithm context
46  **/
47 
49 
50 
51 //SHAKE128 related constants
52 extern const uint8_t shake128Oid[9];
53 
54 //SHAKE128 related functions
55 error_t shake128Compute(const void *input, size_t inputLen,
56  uint8_t *output, size_t outputLen);
57 
58 void shake128Init(Shake128Context *context);
59 void shake128Absorb(Shake128Context *context, const void *input, size_t length);
60 void shake128Final(Shake128Context *context);
61 void shake128Squeeze(Shake128Context *context, uint8_t *output, size_t length);
62 
63 //C++ guard
64 #ifdef __cplusplus
65 }
66 #endif
67 
68 #endif
uint8_t length
Definition: coap_common.h:190
Keccak context.
Definition: keccak.h:107
void shake128Final(Shake128Context *context)
Finish absorbing phase.
Definition: shake128.c:118
error_t
Error codes.
Definition: error.h:42
General definitions for cryptographic algorithms.
error_t shake128Compute(const void *input, size_t inputLen, uint8_t *output, size_t outputLen)
Digest a message using SHAKE128.
Definition: shake128.c:60
KeccakContext Shake128Context
SHAKE128 algorithm context.
Definition: shake128.h:48
void shake128Squeeze(Shake128Context *context, uint8_t *output, size_t length)
Extract data from the squeezing phase.
Definition: shake128.c:132
Keccak sponge function.
void shake128Init(Shake128Context *context)
Initialize SHAKE128 context.
Definition: shake128.c:92
const uint8_t shake128Oid[9]
Definition: shake128.c:48
void shake128Absorb(Shake128Context *context, const void *input, size_t length)
Absorb data.
Definition: shake128.c:106