New Makefile structure; added compatibility with Windows + Visual C + nmake.
[BearSSL] / inc / bearssl_block.h
index 547f3b2..6641e6c 100644 (file)
@@ -1000,10 +1000,10 @@ uint32_t br_aes_ct64_ctr_run(const br_aes_ct64_ctr_keys *ctx,
  */
 typedef union {
        const br_block_cbcenc_class *vtable;
  */
 typedef union {
        const br_block_cbcenc_class *vtable;
-       br_aes_big_cbcenc_keys big;
-       br_aes_small_cbcenc_keys small;
-       br_aes_ct_cbcenc_keys ct;
-       br_aes_ct64_cbcenc_keys ct64;
+       br_aes_big_cbcenc_keys c_big;
+       br_aes_small_cbcenc_keys c_small;
+       br_aes_ct_cbcenc_keys c_ct;
+       br_aes_ct64_cbcenc_keys c_ct64;
 } br_aes_gen_cbcenc_keys;
 
 /**
 } br_aes_gen_cbcenc_keys;
 
 /**
@@ -1012,10 +1012,10 @@ typedef union {
  */
 typedef union {
        const br_block_cbcdec_class *vtable;
  */
 typedef union {
        const br_block_cbcdec_class *vtable;
-       br_aes_big_cbcdec_keys big;
-       br_aes_small_cbcdec_keys small;
-       br_aes_ct_cbcdec_keys ct;
-       br_aes_ct64_cbcdec_keys ct64;
+       br_aes_big_cbcdec_keys c_big;
+       br_aes_small_cbcdec_keys c_small;
+       br_aes_ct_cbcdec_keys c_ct;
+       br_aes_ct64_cbcdec_keys c_ct64;
 } br_aes_gen_cbcdec_keys;
 
 /**
 } br_aes_gen_cbcdec_keys;
 
 /**
@@ -1024,10 +1024,10 @@ typedef union {
  */
 typedef union {
        const br_block_ctr_class *vtable;
  */
 typedef union {
        const br_block_ctr_class *vtable;
-       br_aes_big_ctr_keys big;
-       br_aes_small_ctr_keys small;
-       br_aes_ct_ctr_keys ct;
-       br_aes_ct64_ctr_keys ct64;
+       br_aes_big_ctr_keys c_big;
+       br_aes_small_ctr_keys c_small;
+       br_aes_ct_ctr_keys c_ct;
+       br_aes_ct64_ctr_keys c_ct64;
 } br_aes_gen_ctr_keys;
 
 /*
 } br_aes_gen_ctr_keys;
 
 /*
@@ -1235,8 +1235,8 @@ typedef union {
  */
 typedef union {
        const br_block_cbcdec_class *vtable;
  */
 typedef union {
        const br_block_cbcdec_class *vtable;
-       br_des_tab_cbcdec_keys tab;
-       br_des_ct_cbcdec_keys ct;
+       br_des_tab_cbcdec_keys c_tab;
+       br_des_ct_cbcdec_keys c_ct;
 } br_des_gen_cbcdec_keys;
 
 /**
 } br_des_gen_cbcdec_keys;
 
 /**
@@ -1248,7 +1248,7 @@ typedef union {
  *
  *   - IV is 96 bits (`iv` points to exactly 12 bytes).
  *
  *
  *   - IV is 96 bits (`iv` points to exactly 12 bytes).
  *
- *   - Block counter is oveer 32 bits and starts at value `cc`; the
+ *   - Block counter is over 32 bits and starts at value `cc`; the
  *     resulting value is returned.
  *
  * Data (pointed to by `data`, of length `len`) is encrypted/decrypted
  *     resulting value is returned.
  *
  * Data (pointed to by `data`, of length `len`) is encrypted/decrypted
@@ -1323,4 +1323,48 @@ void br_poly1305_ctmul_run(const void *key, const void *iv,
        void *data, size_t len, const void *aad, size_t aad_len,
        void *tag, br_chacha20_run ichacha, int encrypt);
 
        void *data, size_t len, const void *aad, size_t aad_len,
        void *tag, br_chacha20_run ichacha, int encrypt);
 
+/**
+ * \brief ChaCha20+Poly1305 AEAD implementation (pure 32-bit multiplications).
+ *
+ * \see br_poly1305_run
+ *
+ * \param key       secret key (32 bytes).
+ * \param iv        nonce (12 bytes).
+ * \param data      data to encrypt or decrypt.
+ * \param len       data length (in bytes).
+ * \param aad       additional authenticated data.
+ * \param aad_len   length of additional authenticated data (in bytes).
+ * \param tag       output buffer for the authentication tag.
+ * \param ichacha   implementation of ChaCha20.
+ * \param encrypt   non-zero for encryption, zero for decryption.
+ */
+void br_poly1305_ctmul32_run(const void *key, const void *iv,
+       void *data, size_t len, const void *aad, size_t aad_len,
+       void *tag, br_chacha20_run ichacha, int encrypt);
+
+/**
+ * \brief ChaCha20+Poly1305 AEAD implementation (i15).
+ *
+ * This implementation relies on the generic big integer code "i15"
+ * (which uses pure 32-bit multiplications). As such, it may save a
+ * little code footprint in a context where "i15" is already included
+ * (e.g. for elliptic curves or for RSA); however, it is also
+ * substantially slower than the ctmul and ctmul32 implementations.
+ *
+ * \see br_poly1305_run
+ *
+ * \param key       secret key (32 bytes).
+ * \param iv        nonce (12 bytes).
+ * \param data      data to encrypt or decrypt.
+ * \param len       data length (in bytes).
+ * \param aad       additional authenticated data.
+ * \param aad_len   length of additional authenticated data (in bytes).
+ * \param tag       output buffer for the authentication tag.
+ * \param ichacha   implementation of ChaCha20.
+ * \param encrypt   non-zero for encryption, zero for decryption.
+ */
+void br_poly1305_i15_run(const void *key, const void *iv,
+       void *data, size_t len, const void *aad, size_t aad_len,
+       void *tag, br_chacha20_run ichacha, int encrypt);
+
 #endif
 #endif