Skinny-C
 All Data Structures Files Functions Variables Groups Pages
mantis-parallel.h
1 /*
2  * Copyright (C) 2017 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 MANTIS_PARALLEL_h
24 #define MANTIS_PARALLEL_h
25 
26 #include "mantis-cipher.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
40 typedef struct
41 {
43  const void *vtable;
44 
46  void *ctx;
47 
51  size_t parallel_size;
52 
54 
66 
73 
91  (MantisParallelECB_t *ecb, const void *key, unsigned size,
92  unsigned rounds, int mode);
93 
101 
125  (void *output, const void *input, const void *tweak, size_t size,
126  const MantisParallelECB_t *ecb);
127 
130 #ifdef __cplusplus
131 }
132 #endif
133 
134 #endif
State information for Mantis in parallel ECB mode.
void mantis_parallel_ecb_cleanup(MantisParallelECB_t *ecb)
Cleans up a parallel ECB control block for Mantis.
int mantis_parallel_ecb_init(MantisParallelECB_t *ecb)
Initializes Mantis in parallel ECB mode.
void mantis_parallel_ecb_swap_modes(MantisParallelECB_t *ecb)
Swaps the encryption and decryption modes on a parallel Mantis key schedule.
int mantis_parallel_ecb_crypt(void *output, const void *input, const void *tweak, size_t size, const MantisParallelECB_t *ecb)
Encrypts or decrypts a block of data using Mantis in parallel ECB mode.
int mantis_parallel_ecb_set_key(MantisParallelECB_t *ecb, const void *key, unsigned size, unsigned rounds, int mode)
Sets the key schedule for a Mantis block cipher in parallel ECB mode.