Lightweight Cryptography Primitives
 All Data Structures Files Functions Variables Typedefs Macros Pages
romulus.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_ROMULUS_H
24 #define LWCRYPTO_ROMULUS_H
25 
26 #include "aead-common.h"
27 
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62 
66 #define ROMULUS_KEY_SIZE 16
67 
71 #define ROMULUS_TAG_SIZE 16
72 
76 #define ROMULUS1_NONCE_SIZE 16
77 
81 #define ROMULUS2_NONCE_SIZE 12
82 
86 #define ROMULUS3_NONCE_SIZE 12
87 
91 extern aead_cipher_t const romulus_n1_cipher;
92 
96 extern aead_cipher_t const romulus_n2_cipher;
97 
101 extern aead_cipher_t const romulus_n3_cipher;
102 
106 extern aead_cipher_t const romulus_m1_cipher;
107 
111 extern aead_cipher_t const romulus_m2_cipher;
112 
116 extern aead_cipher_t const romulus_m3_cipher;
117 
140  (unsigned char *c, unsigned long long *clen,
141  const unsigned char *m, unsigned long long mlen,
142  const unsigned char *ad, unsigned long long adlen,
143  const unsigned char *nsec,
144  const unsigned char *npub,
145  const unsigned char *k);
146 
170  (unsigned char *m, unsigned long long *mlen,
171  unsigned char *nsec,
172  const unsigned char *c, unsigned long long clen,
173  const unsigned char *ad, unsigned long long adlen,
174  const unsigned char *npub,
175  const unsigned char *k);
176 
199  (unsigned char *c, unsigned long long *clen,
200  const unsigned char *m, unsigned long long mlen,
201  const unsigned char *ad, unsigned long long adlen,
202  const unsigned char *nsec,
203  const unsigned char *npub,
204  const unsigned char *k);
205 
229  (unsigned char *m, unsigned long long *mlen,
230  unsigned char *nsec,
231  const unsigned char *c, unsigned long long clen,
232  const unsigned char *ad, unsigned long long adlen,
233  const unsigned char *npub,
234  const unsigned char *k);
235 
258  (unsigned char *c, unsigned long long *clen,
259  const unsigned char *m, unsigned long long mlen,
260  const unsigned char *ad, unsigned long long adlen,
261  const unsigned char *nsec,
262  const unsigned char *npub,
263  const unsigned char *k);
264 
288  (unsigned char *m, unsigned long long *mlen,
289  unsigned char *nsec,
290  const unsigned char *c, unsigned long long clen,
291  const unsigned char *ad, unsigned long long adlen,
292  const unsigned char *npub,
293  const unsigned char *k);
294 
317  (unsigned char *c, unsigned long long *clen,
318  const unsigned char *m, unsigned long long mlen,
319  const unsigned char *ad, unsigned long long adlen,
320  const unsigned char *nsec,
321  const unsigned char *npub,
322  const unsigned char *k);
323 
347  (unsigned char *m, unsigned long long *mlen,
348  unsigned char *nsec,
349  const unsigned char *c, unsigned long long clen,
350  const unsigned char *ad, unsigned long long adlen,
351  const unsigned char *npub,
352  const unsigned char *k);
353 
376  (unsigned char *c, unsigned long long *clen,
377  const unsigned char *m, unsigned long long mlen,
378  const unsigned char *ad, unsigned long long adlen,
379  const unsigned char *nsec,
380  const unsigned char *npub,
381  const unsigned char *k);
382 
406  (unsigned char *m, unsigned long long *mlen,
407  unsigned char *nsec,
408  const unsigned char *c, unsigned long long clen,
409  const unsigned char *ad, unsigned long long adlen,
410  const unsigned char *npub,
411  const unsigned char *k);
412 
435  (unsigned char *c, unsigned long long *clen,
436  const unsigned char *m, unsigned long long mlen,
437  const unsigned char *ad, unsigned long long adlen,
438  const unsigned char *nsec,
439  const unsigned char *npub,
440  const unsigned char *k);
441 
465  (unsigned char *m, unsigned long long *mlen,
466  unsigned char *nsec,
467  const unsigned char *c, unsigned long long clen,
468  const unsigned char *ad, unsigned long long adlen,
469  const unsigned char *npub,
470  const unsigned char *k);
471 
472 #ifdef __cplusplus
473 }
474 #endif
475 
476 #endif
Meta-information about an AEAD cipher.
Definition: aead-common.h:185
Definitions that are common across AEAD schemes.
int romulus_m1_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 Romulus-M1.
Definition: romulus.c:1722
int romulus_n1_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 Romulus-N1.
Definition: romulus.c:1520
int romulus_m2_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 Romulus-M2.
Definition: romulus.c:1806
int romulus_n3_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 Romulus-N3.
Definition: romulus.c:1642
int romulus_n2_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 Romulus-N2.
Definition: romulus.c:1600
int romulus_m1_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 Romulus-M1.
Definition: romulus.c:1762
int romulus_m2_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 Romulus-M2.
Definition: romulus.c:1846
aead_cipher_t const romulus_n3_cipher
Meta-information block for the Romulus-N3 cipher.
Definition: romulus.c:48
int romulus_m3_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 Romulus-M3.
Definition: romulus.c:1890
aead_cipher_t const romulus_m1_cipher
Meta-information block for the Romulus-M1 cipher.
Definition: romulus.c:58
int romulus_m3_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 Romulus-M3.
Definition: romulus.c:1933
aead_cipher_t const romulus_n1_cipher
Meta-information block for the Romulus-N1 cipher.
Definition: romulus.c:28
int romulus_n2_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 Romulus-N2.
Definition: romulus.c:1562
aead_cipher_t const romulus_m2_cipher
Meta-information block for the Romulus-M2 cipher.
Definition: romulus.c:68
aead_cipher_t const romulus_m3_cipher
Meta-information block for the Romulus-M3 cipher.
Definition: romulus.c:78
int romulus_n1_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 Romulus-N1.
Definition: romulus.c:1482
int romulus_n3_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 Romulus-N3.
Definition: romulus.c:1680
aead_cipher_t const romulus_n2_cipher
Meta-information block for the Romulus-N2 cipher.
Definition: romulus.c:38