3 * AEAD schemes based on ChaCha and Poly1305
5 * (c) 2018 Straylight/Edgeware
8 /*----- Licensing notice --------------------------------------------------*
10 * This file is part of Catacomb.
12 * Catacomb is free software: you can redistribute it and/or modify it
13 * under the terms of the GNU Library General Public License as published
14 * by the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * Catacomb is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Library General Public License for more details.
22 * You should have received a copy of the GNU Library General Public
23 * License along with Catacomb. If not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
28 /*----- Header files ------------------------------------------------------*/
31 #include "latinpoly-def.h"
33 /*----- Main code ---------------------------------------------------------*/
35 LATINPOLY_DEF(chacha20, chacha, "chacha20")
36 LATINPOLY_DEF(chacha12, chacha, "chacha12")
37 LATINPOLY_DEF(chacha8, chacha, "chacha8")
39 /*----- Test rig ----------------------------------------------------------*/
43 #include <mLib/quis.h>
44 #include <mLib/testrig.h>
45 #include "latinpoly-test.h"
47 static int check_chacha20_poly1305(dstr *v)
48 { return latinpoly_test(&chacha20_poly1305, v); }
49 static int check_chacha12_poly1305(dstr *v)
50 { return latinpoly_test(&chacha12_poly1305, v); }
51 static int check_chacha8_poly1305(dstr *v)
52 { return latinpoly_test(&chacha8_poly1305, v); }
54 static const test_chunk tests[] = {
55 { "chacha20-poly1305", check_chacha20_poly1305,
56 { &type_hex, &type_hex, &type_hex, &type_hex, &type_hex, &type_hex } },
57 { "chacha12-poly1305", check_chacha12_poly1305,
58 { &type_hex, &type_hex, &type_hex, &type_hex, &type_hex, &type_hex } },
59 { "chacha8-poly1305", check_chacha8_poly1305,
60 { &type_hex, &type_hex, &type_hex, &type_hex, &type_hex, &type_hex } },
65 int main(int argc, char *argv[])
68 test_run(argc, argv, tests, SRCDIR"/t/chacha");
74 /*----- That's all, folks -------------------------------------------------*/