Lightweight Cryptography Primitives
 All Data Structures Files Functions Variables Typedefs Macros Pages
comet.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_COMET_H
24 #define LWCRYPTO_COMET_H
25 
26 #include "aead-common.h"
27 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
56 #define COMET_KEY_SIZE 16
57 
61 #define COMET_128_TAG_SIZE 16
62 
66 #define COMET_64_TAG_SIZE 8
67 
71 #define COMET_128_NONCE_SIZE 16
72 
76 #define COMET_64_NONCE_SIZE 15
77 
82 
87 
92 
115  (unsigned char *c, unsigned long long *clen,
116  const unsigned char *m, unsigned long long mlen,
117  const unsigned char *ad, unsigned long long adlen,
118  const unsigned char *nsec,
119  const unsigned char *npub,
120  const unsigned char *k);
121 
145  (unsigned char *m, unsigned long long *mlen,
146  unsigned char *nsec,
147  const unsigned char *c, unsigned long long clen,
148  const unsigned char *ad, unsigned long long adlen,
149  const unsigned char *npub,
150  const unsigned char *k);
151 
174  (unsigned char *c, unsigned long long *clen,
175  const unsigned char *m, unsigned long long mlen,
176  const unsigned char *ad, unsigned long long adlen,
177  const unsigned char *nsec,
178  const unsigned char *npub,
179  const unsigned char *k);
180 
204  (unsigned char *m, unsigned long long *mlen,
205  unsigned char *nsec,
206  const unsigned char *c, unsigned long long clen,
207  const unsigned char *ad, unsigned long long adlen,
208  const unsigned char *npub,
209  const unsigned char *k);
210 
233  (unsigned char *c, unsigned long long *clen,
234  const unsigned char *m, unsigned long long mlen,
235  const unsigned char *ad, unsigned long long adlen,
236  const unsigned char *nsec,
237  const unsigned char *npub,
238  const unsigned char *k);
239 
263  (unsigned char *m, unsigned long long *mlen,
264  unsigned char *nsec,
265  const unsigned char *c, unsigned long long clen,
266  const unsigned char *ad, unsigned long long adlen,
267  const unsigned char *npub,
268  const unsigned char *k);
269 
270 #ifdef __cplusplus
271 }
272 #endif
273 
274 #endif
Meta-information about an AEAD cipher.
Definition: aead-common.h:185
Definitions that are common across AEAD schemes.
int comet_64_speck_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 COMET-64_SPECK-64/128.
Definition: comet.c:483
aead_cipher_t const comet_128_cham_cipher
Meta-information block for the COMET-128_CHAM-128/128 cipher.
Definition: comet.c:29
aead_cipher_t const comet_64_speck_cipher
Meta-information block for the COMET-64_SPECK-64/128 cipher.
Definition: comet.c:49
int comet_64_cham_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 COMET-64_CHAM-64/128.
Definition: comet.c:407
aead_cipher_t const comet_64_cham_cipher
Meta-information block for the COMET-64_CHAM-64/128 cipher.
Definition: comet.c:39
int comet_64_cham_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 COMET-64_CHAM-64/128.
Definition: comet.c:444
int comet_128_cham_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 COMET-128_CHAM-128/128.
Definition: comet.c:337
int comet_64_speck_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 COMET-64_SPECK-64/128.
Definition: comet.c:520
int comet_128_cham_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 COMET-128_CHAM-128/128.
Definition: comet.c:371