Lightweight Cryptography Primitives
 All Data Structures Files Functions Variables Typedefs Macros Pages
sparkle-aead.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 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_SPARKLE_AEAD_H
24 #define LWCRYPTO_SPARKLE_AEAD_H
25 
26 #include <stddef.h>
27 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
53 #define SCHWAEMM_256_128_KEY_SIZE 16
54 
58 #define SCHWAEMM_256_128_TAG_SIZE 16
59 
63 #define SCHWAEMM_256_128_NONCE_SIZE 32
64 
68 #define SCHWAEMM_192_192_KEY_SIZE 24
69 
73 #define SCHWAEMM_192_192_TAG_SIZE 24
74 
78 #define SCHWAEMM_192_192_NONCE_SIZE 24
79 
83 #define SCHWAEMM_128_128_KEY_SIZE 16
84 
88 #define SCHWAEMM_128_128_TAG_SIZE 16
89 
93 #define SCHWAEMM_128_128_NONCE_SIZE 16
94 
98 #define SCHWAEMM_256_256_KEY_SIZE 32
99 
103 #define SCHWAEMM_256_256_TAG_SIZE 32
104 
108 #define SCHWAEMM_256_256_NONCE_SIZE 32
109 
131  (unsigned char *c, size_t *clen,
132  const unsigned char *m, size_t mlen,
133  const unsigned char *ad, size_t adlen,
134  const unsigned char *npub,
135  const unsigned char *k);
136 
159  (unsigned char *m, size_t *mlen,
160  const unsigned char *c, size_t clen,
161  const unsigned char *ad, size_t adlen,
162  const unsigned char *npub,
163  const unsigned char *k);
164 
186  (unsigned char *c, size_t *clen,
187  const unsigned char *m, size_t mlen,
188  const unsigned char *ad, size_t adlen,
189  const unsigned char *npub,
190  const unsigned char *k);
191 
214  (unsigned char *m, size_t *mlen,
215  const unsigned char *c, size_t clen,
216  const unsigned char *ad, size_t adlen,
217  const unsigned char *npub,
218  const unsigned char *k);
219 
241  (unsigned char *c, size_t *clen,
242  const unsigned char *m, size_t mlen,
243  const unsigned char *ad, size_t adlen,
244  const unsigned char *npub,
245  const unsigned char *k);
246 
269  (unsigned char *m, size_t *mlen,
270  const unsigned char *c, size_t clen,
271  const unsigned char *ad, size_t adlen,
272  const unsigned char *npub,
273  const unsigned char *k);
274 
296  (unsigned char *c, size_t *clen,
297  const unsigned char *m, size_t mlen,
298  const unsigned char *ad, size_t adlen,
299  const unsigned char *npub,
300  const unsigned char *k);
301 
324  (unsigned char *m, size_t *mlen,
325  const unsigned char *c, size_t clen,
326  const unsigned char *ad, size_t adlen,
327  const unsigned char *npub,
328  const unsigned char *k);
329 
330 #ifdef __cplusplus
331 }
332 #endif
333 
334 #endif
int schwaemm_256_128_aead_decrypt(unsigned char *m, size_t *mlen, const unsigned char *c, size_t clen, const unsigned char *ad, size_t adlen, const unsigned char *npub, const unsigned char *k)
Decrypts and authenticates a packet with Schwaemm256-128.
Definition: sparkle-aead.c:171
int schwaemm_128_128_aead_encrypt(unsigned char *c, size_t *clen, const unsigned char *m, size_t mlen, const unsigned char *ad, size_t adlen, const unsigned char *npub, const unsigned char *k)
Encrypts and authenticates a packet with Schwaemm128-128.
Definition: sparkle-aead.c:483
int schwaemm_192_192_aead_encrypt(unsigned char *c, size_t *clen, const unsigned char *m, size_t mlen, const unsigned char *ad, size_t adlen, const unsigned char *npub, const unsigned char *k)
Encrypts and authenticates a packet with Schwaemm192-192.
Definition: sparkle-aead.c:298
int schwaemm_128_128_aead_decrypt(unsigned char *m, size_t *mlen, const unsigned char *c, size_t clen, const unsigned char *ad, size_t adlen, const unsigned char *npub, const unsigned char *k)
Decrypts and authenticates a packet with Schwaemm128-128.
Definition: sparkle-aead.c:544
int schwaemm_192_192_aead_decrypt(unsigned char *m, size_t *mlen, const unsigned char *c, size_t clen, const unsigned char *ad, size_t adlen, const unsigned char *npub, const unsigned char *k)
Decrypts and authenticates a packet with Schwaemm192-192.
Definition: sparkle-aead.c:359
int schwaemm_256_128_aead_encrypt(unsigned char *c, size_t *clen, const unsigned char *m, size_t mlen, const unsigned char *ad, size_t adlen, const unsigned char *npub, const unsigned char *k)
Encrypts and authenticates a packet with Schwaemm256-128.
Definition: sparkle-aead.c:110
int schwaemm_256_256_aead_decrypt(unsigned char *m, size_t *mlen, const unsigned char *c, size_t clen, const unsigned char *ad, size_t adlen, const unsigned char *npub, const unsigned char *k)
Decrypts and authenticates a packet with Schwaemm256-256.
Definition: sparkle-aead.c:735
int schwaemm_256_256_aead_encrypt(unsigned char *c, size_t *clen, const unsigned char *m, size_t mlen, const unsigned char *ad, size_t adlen, const unsigned char *npub, const unsigned char *k)
Encrypts and authenticates a packet with Schwaemm256-256.
Definition: sparkle-aead.c:674