* (c) 2015 Straylight/Edgeware
*/
+/*----- Licensing notice --------------------------------------------------*
+ *
+ * This file is part of Catacomb.
+ *
+ * Catacomb is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * Catacomb is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with Catacomb; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
+
#ifndef CATACOMB_SALSA20_H
#define CATACOMB_SALSA20_H
/*----- Constants ---------------------------------------------------------*/
#define SALSA20_NONCESZ 8u
+#define SALSA20_IETF_NONCESZ 12u
#define SALSA20_KEYSZ 32u
#define SALSA20_OUTSZ 64u
const void */*key*/, size_t /*ksz*/,
const void */*nonce*/);
-/* --- @salsa20_setnonce@ --- *
+/* --- @salsa20_setnonce{,_ietf}@ --- *
*
* Arguments: @salsa20_ctx *ctx@ = pointer to context
- * @const void *nonce@ = the nonce (@SALSA20_NONCESZ@ bytes)
+ * @const void *nonce@ = the nonce (@SALSA20_NONCESZ@ or
+ * @SALSA20_IETF_NONCESZ@ bytes)
*
* Returns: ---
*
*/
extern void salsa20_setnonce(salsa20_ctx */*ctx*/, const void */*nonce*/);
+extern void salsa20_setnonce_ietf(salsa20_ctx */*ctx*/,
+ const void */*nonce*/);
-/* --- @salsa20_seek@, @salsa20_seeku64@ --- *
+/* --- @salsa20_seek{,u64,_ietf}@ --- *
*
* Arguments: @salsa20_ctx *ctx@ = pointer to context
* @unsigned long i@, @kludge64 i@ = new position to set
extern void salsa20_seek(salsa20_ctx */*ctx*/, unsigned long /*i*/);
extern void salsa20_seeku64(salsa20_ctx */*ctx*/, kludge64 /*i*/);
+extern void salsa20_seek_ietf(salsa20_ctx */*ctx*/, uint32 /*i*/);
-/* --- @salsa20_tell@, @salsa20_tellu64@ --- *
+/* --- @salsa20_tell{,u64,_ietf}@ --- *
*
* Arguments: @salsa20_ctx *ctx@ = pointer to context
*
extern unsigned long salsa20_tell(salsa20_ctx */*ctx*/);
extern kludge64 salsa20_tellu64(salsa20_ctx */*ctx*/);
+extern uint32 salsa20_tell_ietf(salsa20_ctx */*ctx*/);
/* --- @salsa20{,12,8}_encrypt@ --- *
*
extern const octet salsa20_keysz[];
#define salsa2012_keysz salsa20_keysz
#define salsa208_keysz salsa20_keysz
+#define salsa20_ietf_keysz salsa20_keysz
+#define salsa2012_ietf_keysz salsa20_keysz
+#define salsa208_ietf_keysz salsa20_keysz
#define xsalsa20_keysz salsa20_keysz
#define xsalsa2012_keysz salsa20_keysz
#define xsalsa208_keysz salsa20_keysz
const gccipher salsa20, salsa2012, salsa208;
+const gccipher salsa20_ietf, salsa2012_ietf, salsa208_ietf;
const gccipher xsalsa20, xsalsa2012, xsalsa208;
/*----- Generic random number generator interface -------------------------*/
-/* --- @salsa20{,12,8}_rand@, @xsalsa20{,12,8}_rand@ --- *
+/* --- @salsa20{,12,8}{,_ietf}_rand@, @xsalsa20{,12,8}{,_ietf}_rand@ --- *
*
* Arguments: @const void *k@ = pointer to key material
* @size_t ksz@ = size of key material
* @const void *n@ = pointer to nonce or null
- * (@SALSA20_NONCESZ@ or @XSALSA20_NONCESZ@)
+ * (@SALSA20_NONCESZ@, @SALSA20_IETF_NONCESZ@,
+ * or @XSALSA20_NONCESZ@)
*
* Returns: Pointer to generic random number generator instance.
*
const void */*n*/);
extern grand *salsa208_rand(const void */*k*/, size_t /*ksz*/,
const void */*n*/);
+extern grand *salsa20_ietf_rand(const void */*k*/, size_t /*ksz*/,
+ const void */*n*/);
+extern grand *salsa2012_ietf_rand(const void */*k*/, size_t /*ksz*/,
+ const void */*n*/);
+extern grand *salsa208_ietf_rand(const void */*k*/, size_t /*ksz*/,
+ const void */*n*/);
extern grand *xsalsa20_rand(const void */*k*/, size_t /*ksz*/,
const void */*n*/);
extern grand *xsalsa2012_rand(const void */*k*/, size_t /*ksz*/,