Lightweight Cryptography Primitives
 All Data Structures Files Functions Variables Typedefs Macros Pages
internal-pyjamask.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_H
24 #define LW_INTERNAL_PYJAMASK_H
25 
26 #include "internal-util.h"
27 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
40 #define PYJAMASK_ROUNDS 14
41 
45 typedef struct
46 {
47  uint32_t k[(PYJAMASK_ROUNDS + 1) * 4];
50 
54 typedef struct
55 {
56  uint32_t k[(PYJAMASK_ROUNDS + 1) * 3];
59 
67  (pyjamask_128_key_schedule_t *ks, const unsigned char *key);
68 
76  (pyjamask_96_key_schedule_t *ks, const unsigned char *key);
77 
91  (const pyjamask_128_key_schedule_t *ks, unsigned char *output,
92  const unsigned char *input);
93 
107  (const pyjamask_128_key_schedule_t *ks, unsigned char *output,
108  const unsigned char *input);
109 
123  (const pyjamask_96_key_schedule_t *ks, unsigned char *output,
124  const unsigned char *input);
125 
139  (const pyjamask_96_key_schedule_t *ks, unsigned char *output,
140  const unsigned char *input);
141 
142 #ifdef __cplusplus
143 }
144 #endif
145 
146 #endif
void pyjamask_128_setup_key(pyjamask_128_key_schedule_t *ks, const unsigned char *key)
Sets up the key schedule for the Pyjamask-128 block cipher.
Definition: internal-pyjamask.c:200
Structure of the key schedule for the Pyjamask-128 block cipher.
Definition: internal-pyjamask.h:45
void pyjamask_128_decrypt(const pyjamask_128_key_schedule_t *ks, unsigned char *output, const unsigned char *input)
Decrypts a 128-bit block with Pyjamask-128.
Definition: internal-pyjamask.c:304
#define PYJAMASK_ROUNDS
Number of rounds in the Pyjamask block cipher.
Definition: internal-pyjamask.h:40
void pyjamask_96_setup_key(pyjamask_96_key_schedule_t *ks, const unsigned char *key)
Sets up the key schedule for the Pyjamask-96 block cipher.
Definition: internal-pyjamask.c:364
Structure of the key schedule for the Pyjamask-96 block cipher.
Definition: internal-pyjamask.h:54
void pyjamask_96_encrypt(const pyjamask_96_key_schedule_t *ks, unsigned char *output, const unsigned char *input)
Encrypts a 96-bit block with Pyjamask-96.
Definition: internal-pyjamask.c:411
void pyjamask_128_encrypt(const pyjamask_128_key_schedule_t *ks, unsigned char *output, const unsigned char *input)
Encrypts a 128-bit block with Pyjamask-128.
Definition: internal-pyjamask.c:249
void pyjamask_96_decrypt(const pyjamask_96_key_schedule_t *ks, unsigned char *output, const unsigned char *input)
Decrypts a 96-bit block with Pyjamask-96.
Definition: internal-pyjamask.c:459