Lightweight Cryptography Primitives
 All Data Structures Files Functions Variables Typedefs Macros Pages
knot-masked.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 LWCRYPTO_KNOT_MASKED_H
24 #define LWCRYPTO_KNOT_MASKED_H
25 
26 #include "aead-common.h"
27 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
40 #define KNOT_AEAD_MASKED_128_KEY_SIZE 16
41 
46 #define KNOT_AEAD_MASKED_128_TAG_SIZE 16
47 
51 #define KNOT_AEAD_MASKED_128_NONCE_SIZE 16
52 
56 #define KNOT_AEAD_MASKED_192_KEY_SIZE 24
57 
61 #define KNOT_AEAD_MASKED_192_TAG_SIZE 24
62 
66 #define KNOT_AEAD_MASKED_192_NONCE_SIZE 24
67 
71 #define KNOT_AEAD_MASKED_256_KEY_SIZE 32
72 
76 #define KNOT_AEAD_MASKED_256_TAG_SIZE 32
77 
81 #define KNOT_AEAD_MASKED_256_NONCE_SIZE 32
82 
87 
92 
97 
102 
125  (unsigned char *c, unsigned long long *clen,
126  const unsigned char *m, unsigned long long mlen,
127  const unsigned char *ad, unsigned long long adlen,
128  const unsigned char *nsec,
129  const unsigned char *npub,
130  const unsigned char *k);
131 
155  (unsigned char *m, unsigned long long *mlen,
156  unsigned char *nsec,
157  const unsigned char *c, unsigned long long clen,
158  const unsigned char *ad, unsigned long long adlen,
159  const unsigned char *npub,
160  const unsigned char *k);
161 
184  (unsigned char *c, unsigned long long *clen,
185  const unsigned char *m, unsigned long long mlen,
186  const unsigned char *ad, unsigned long long adlen,
187  const unsigned char *nsec,
188  const unsigned char *npub,
189  const unsigned char *k);
190 
214  (unsigned char *m, unsigned long long *mlen,
215  unsigned char *nsec,
216  const unsigned char *c, unsigned long long clen,
217  const unsigned char *ad, unsigned long long adlen,
218  const unsigned char *npub,
219  const unsigned char *k);
220 
221 
244  (unsigned char *c, unsigned long long *clen,
245  const unsigned char *m, unsigned long long mlen,
246  const unsigned char *ad, unsigned long long adlen,
247  const unsigned char *nsec,
248  const unsigned char *npub,
249  const unsigned char *k);
250 
274  (unsigned char *m, unsigned long long *mlen,
275  unsigned char *nsec,
276  const unsigned char *c, unsigned long long clen,
277  const unsigned char *ad, unsigned long long adlen,
278  const unsigned char *npub,
279  const unsigned char *k);
280 
303  (unsigned char *c, unsigned long long *clen,
304  const unsigned char *m, unsigned long long mlen,
305  const unsigned char *ad, unsigned long long adlen,
306  const unsigned char *nsec,
307  const unsigned char *npub,
308  const unsigned char *k);
309 
333  (unsigned char *m, unsigned long long *mlen,
334  unsigned char *nsec,
335  const unsigned char *c, unsigned long long clen,
336  const unsigned char *ad, unsigned long long adlen,
337  const unsigned char *npub,
338  const unsigned char *k);
339 
340 #ifdef __cplusplus
341 }
342 #endif
343 
344 #endif
aead_cipher_t const knot_aead_128_384_masked_cipher
Meta-information block for the masked KNOT-AEAD-128-384 cipher.
Definition: knot-masked.c:42
Meta-information about an AEAD cipher.
Definition: aead-common.h:185
Definitions that are common across AEAD schemes.
aead_cipher_t const knot_aead_128_256_masked_cipher
Meta-information block for the masked KNOT-AEAD-128-256 cipher.
Definition: knot-masked.c:28
int knot_masked_192_384_aead_encrypt(unsigned char *c, unsigned long long *clen, const unsigned char *m, unsigned long long mlen, const unsigned char *ad, unsigned long long adlen, const unsigned char *nsec, const unsigned char *npub, const unsigned char *k)
Encrypts and authenticates a packet with masked KNOT-AEAD-192-384.
Definition: knot-masked.c:1063
int knot_masked_192_384_aead_decrypt(unsigned char *m, unsigned long long *mlen, unsigned char *nsec, const unsigned char *c, unsigned long long clen, const unsigned char *ad, unsigned long long adlen, const unsigned char *npub, const unsigned char *k)
Decrypts and authenticates a packet with masked KNOT-AEAD-192-384.
Definition: knot-masked.c:1121
aead_cipher_t const knot_aead_192_384_masked_cipher
Meta-information block for the masked KNOT-AEAD-192-384 cipher.
Definition: knot-masked.c:56
int knot_masked_128_384_aead_decrypt(unsigned char *m, unsigned long long *mlen, unsigned char *nsec, const unsigned char *c, unsigned long long clen, const unsigned char *ad, unsigned long long adlen, const unsigned char *npub, const unsigned char *k)
Decrypts and authenticates a packet with masked KNOT-AEAD-128-384.
Definition: knot-masked.c:989
int knot_masked_128_384_aead_encrypt(unsigned char *c, unsigned long long *clen, const unsigned char *m, unsigned long long mlen, const unsigned char *ad, unsigned long long adlen, const unsigned char *nsec, const unsigned char *npub, const unsigned char *k)
Encrypts and authenticates a packet with masked KNOT-AEAD-128-384.
Definition: knot-masked.c:924
int knot_masked_256_512_aead_decrypt(unsigned char *m, unsigned long long *mlen, unsigned char *nsec, const unsigned char *c, unsigned long long clen, const unsigned char *ad, unsigned long long adlen, const unsigned char *npub, const unsigned char *k)
Decrypts and authenticates a packet with masked KNOT-AEAD-256-512.
Definition: knot-masked.c:1244
int knot_masked_256_512_aead_encrypt(unsigned char *c, unsigned long long *clen, const unsigned char *m, unsigned long long mlen, const unsigned char *ad, unsigned long long adlen, const unsigned char *nsec, const unsigned char *npub, const unsigned char *k)
Encrypts and authenticates a packet with masked KNOT-AEAD-256-512.
Definition: knot-masked.c:1186
int knot_masked_128_256_aead_decrypt(unsigned char *m, unsigned long long *mlen, unsigned char *nsec, const unsigned char *c, unsigned long long clen, const unsigned char *ad, unsigned long long adlen, const unsigned char *npub, const unsigned char *k)
Decrypts and authenticates a packet with masked KNOT-AEAD-128-256.
Definition: knot-masked.c:867
int knot_masked_128_256_aead_encrypt(unsigned char *c, unsigned long long *clen, const unsigned char *m, unsigned long long mlen, const unsigned char *ad, unsigned long long adlen, const unsigned char *nsec, const unsigned char *npub, const unsigned char *k)
Encrypts and authenticates a packet with masked KNOT-AEAD-128-256.
Definition: knot-masked.c:815
aead_cipher_t const knot_aead_256_512_masked_cipher
Meta-information block for the masked KNOT-AEAD-256-512 cipher.
Definition: knot-masked.c:70