Lightweight Cryptography Primitives
 All Data Structures Files Functions Variables Typedefs Macros Pages
internal-saturnin.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_SATURNIN_H
24 #define LW_INTERNAL_SATURNIN_H
25 
33 #include "internal-util.h"
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
42 #define SATURNIN_BLOCK_SIZE 32
43 
47 #define SATURNIN_DOMAIN_10_1 0
48 
52 #define SATURNIN_DOMAIN_10_2 10
53 
57 #define SATURNIN_DOMAIN_10_3 20
58 
62 #define SATURNIN_DOMAIN_10_4 30
63 
67 #define SATURNIN_DOMAIN_10_5 40
68 
72 #define SATURNIN_DOMAIN_10_6 50
73 
77 #define SATURNIN_DOMAIN_16_7 60
78 
82 #define SATURNIN_DOMAIN_16_8 76
83 
87 typedef struct
88 {
90  uint32_t k[16];
91 
93 
101  (saturnin_key_schedule_t *ks, const unsigned char *key);
102 
115  (const saturnin_key_schedule_t *ks, unsigned char *output,
116  const unsigned char *input, unsigned domain);
117 
130  (const saturnin_key_schedule_t *ks, unsigned char *output,
131  const unsigned char *input, unsigned domain);
132 
133 #ifdef __cplusplus
134 }
135 #endif
136 
137 #endif
void saturnin_setup_key(saturnin_key_schedule_t *ks, const unsigned char *key)
Sets up a key schedule for Saturnin.
Definition: internal-saturnin.c:353
void saturnin_decrypt_block(const saturnin_key_schedule_t *ks, unsigned char *output, const unsigned char *input, unsigned domain)
Decrypts a 256-bit block with Saturnin.
Definition: internal-saturnin.c:425
void saturnin_encrypt_block(const saturnin_key_schedule_t *ks, unsigned char *output, const unsigned char *input, unsigned domain)
Encrypts a 256-bit block with Saturnin.
Definition: internal-saturnin.c:366
Structure of the key schedule for Saturnin.
Definition: internal-saturnin.h:87