Lightweight Cryptography Primitives
 All Data Structures Files Functions Variables Typedefs Macros Pages
internal-pyjamask-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_PYJAMASK_M_H
24 #define LW_INTERNAL_PYJAMASK_M_H
25 
26 #include "internal-util.h"
27 #include "internal-masking.h"
28 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
41 #define PYJAMASK_MASKED_ROUNDS 14
42 
46 typedef struct
47 {
50 
52 
56 typedef struct
57 {
60 
62 
70  (pyjamask_masked_128_key_schedule_t *ks, const unsigned char *key);
71 
79  (pyjamask_masked_96_key_schedule_t *ks, const unsigned char *key);
80 
94  (const pyjamask_masked_128_key_schedule_t *ks, unsigned char *output,
95  const unsigned char *input);
96 
110  (const pyjamask_masked_128_key_schedule_t *ks, unsigned char *output,
111  const unsigned char *input);
112 
126  (const pyjamask_masked_96_key_schedule_t *ks, unsigned char *output,
127  const unsigned char *input);
128 
142  (const pyjamask_masked_96_key_schedule_t *ks, unsigned char *output,
143  const unsigned char *input);
144 
145 #ifdef __cplusplus
146 }
147 #endif
148 
149 #endif
void pyjamask_masked_96_encrypt(const pyjamask_masked_96_key_schedule_t *ks, unsigned char *output, const unsigned char *input)
Encrypts a 96-bit block with Pyjamask-96 in masked mode.
Definition: internal-pyjamask-m.c:466
void pyjamask_masked_96_setup_key(pyjamask_masked_96_key_schedule_t *ks, const unsigned char *key)
Sets up the key schedule for the masked Pyjamask-96 block cipher.
Definition: internal-pyjamask-m.c:301
void pyjamask_masked_128_decrypt(const pyjamask_masked_128_key_schedule_t *ks, unsigned char *output, const unsigned char *input)
Decrypts a 128-bit block with Pyjamask-128 in masked mode.
Definition: internal-pyjamask-m.c:411
Structure of the key schedule for masked Pyjamask-128.
Definition: internal-pyjamask-m.h:46
Utilities that help to implement masked ciphers.
#define PYJAMASK_MASKED_ROUNDS
Number of rounds in the masked Pyjamask block cipher.
Definition: internal-pyjamask-m.h:41
Masked 32-bit word with four shares.
Definition: internal-masking.h:152
void pyjamask_masked_96_decrypt(const pyjamask_masked_96_key_schedule_t *ks, unsigned char *output, const unsigned char *input)
Decrypts a 96-bit block with Pyjamask-96 in masked mode.
Definition: internal-pyjamask-m.c:515
Structure of the key schedule for masked Pyjamask-96.
Definition: internal-pyjamask-m.h:56
void pyjamask_masked_128_encrypt(const pyjamask_masked_128_key_schedule_t *ks, unsigned char *output, const unsigned char *input)
Encrypts a 128-bit block with Pyjamask-128 in masked mode.
Definition: internal-pyjamask-m.c:357
void pyjamask_masked_128_setup_key(pyjamask_masked_128_key_schedule_t *ks, const unsigned char *key)
Sets up the key schedule for the masked Pyjamask-128 block cipher.