Lightweight Cryptography Primitives
 All Data Structures Files Functions Variables Typedefs Macros Pages
internal-knot-m.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Southern Storm Software, Pty Ltd.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included
12  * in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20  * DEALINGS IN THE SOFTWARE.
21  */
22 
23 #ifndef LW_INTERNAL_KNOT_M_H
24 #define LW_INTERNAL_KNOT_M_H
25 
26 #include "internal-masking.h"
27 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
40 typedef struct
41 {
45 
52 typedef struct
53 {
58 
62 typedef struct
63 {
67 
76 void knot256_masked_permute_6(knot256_masked_state_t *state, uint8_t rounds);
77 
86 void knot256_masked_permute_7(knot256_masked_state_t *state, uint8_t rounds);
87 
94 void knot256_mask(knot256_masked_state_t *output, const uint64_t input[4]);
95 
102 void knot256_unmask(uint64_t output[4], const knot256_masked_state_t *input);
103 
112 void knot384_masked_permute_7(knot384_masked_state_t *state, uint8_t rounds);
113 
120 void knot384_mask(knot384_masked_state_t *output, const uint32_t input[12]);
121 
128 void knot384_unmask(uint32_t output[12], const knot384_masked_state_t *input);
129 
138 void knot512_masked_permute_7(knot512_masked_state_t *state, uint8_t rounds);
139 
148 void knot512_masked_permute_8(knot512_masked_state_t *state, uint8_t rounds);
149 
156 void knot512_mask(knot512_masked_state_t *output, const uint64_t input[8]);
157 
164 void knot512_unmask(uint64_t output[8], const knot512_masked_state_t *input);
165 
166 #ifdef __cplusplus
167 }
168 #endif
169 
170 #endif
void knot256_masked_permute_6(knot256_masked_state_t *state, uint8_t rounds)
Permutes the KNOT-256 state, using 6-bit round constants.
Definition: internal-knot-m.c:179
void knot512_masked_permute_8(knot512_masked_state_t *state, uint8_t rounds)
Permutes the KNOT-512 state, using 8-bit round constants.
Definition: internal-knot-m.c:504
void knot256_masked_permute_7(knot256_masked_state_t *state, uint8_t rounds)
Permutes the KNOT-256 state, using 7-bit round constants.
Definition: internal-knot-m.c:184
Internal state of the masked KNOT-384 permutation.
Definition: internal-knot-m.h:52
Utilities that help to implement masked ciphers.
void knot384_mask(knot384_masked_state_t *output, const uint32_t input[12])
Converts an unmasked KNOT-384 state into a masked state.
Definition: internal-knot-m.c:353
Masked 32-bit word with four shares.
Definition: internal-masking.h:152
void knot256_unmask(uint64_t output[4], const knot256_masked_state_t *input)
Converts a masked KNOT-256 state into an unmasked state.
Definition: internal-knot-m.c:204
Internal state of the masked KNOT-512 permutation.
Definition: internal-knot-m.h:62
void knot384_unmask(uint32_t output[12], const knot384_masked_state_t *input)
Converts a masked KNOT-384 state into an unmasked state.
Definition: internal-knot-m.c:376
Internal state of the masked KNOT-256 permutation.
Definition: internal-knot-m.h:40
Masked 64-bit word with four shares.
Definition: internal-masking.h:212
void knot512_masked_permute_7(knot512_masked_state_t *state, uint8_t rounds)
Permutes the KNOT-512 state, using 7-bit round constants.
Definition: internal-knot-m.c:499
void knot512_mask(knot512_masked_state_t *output, const uint64_t input[8])
Converts an unmasked KNOT-512 state into a masked state.
Definition: internal-knot-m.c:509
void knot256_mask(knot256_masked_state_t *output, const uint64_t input[4])
Converts an unmasked KNOT-256 state into a masked state.
Definition: internal-knot-m.c:189
void knot384_masked_permute_7(knot384_masked_state_t *state, uint8_t rounds)
Permutes the KNOT-384 state, using 7-bit round constants.
Definition: internal-knot-m.c:219
void knot512_unmask(uint64_t output[8], const knot512_masked_state_t *input)
Converts a masked KNOT-512 state into an unmasked state.
Definition: internal-knot-m.c:532