summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--cipher-chachapoly.c8
2 files changed, 15 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 48f19a385..7db817c09 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
120140704
2 - OpenBSD CVS Sync
3 - jsing@cvs.openbsd.org 2014/07/03 12:42:16
4 [cipher-chachapoly.c]
5 Call chacha_ivsetup() immediately before chacha_encrypt_bytes() - this
6 makes it easier to verify that chacha_encrypt_bytes() is only called once
7 per chacha_ivsetup() call.
8 ok djm@
9
10
120140703 1120140703
2 - (djm) [digest-openssl.c configure.ac] Disable RIPEMD160 if libcrypto 12 - (djm) [digest-openssl.c configure.ac] Disable RIPEMD160 if libcrypto
3 doesn't support it. 13 doesn't support it.
diff --git a/cipher-chachapoly.c b/cipher-chachapoly.c
index 0caccd297..8665b41a3 100644
--- a/cipher-chachapoly.c
+++ b/cipher-chachapoly.c
@@ -14,7 +14,7 @@
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16 16
17/* $OpenBSD: cipher-chachapoly.c,v 1.5 2014/06/24 01:13:21 djm Exp $ */ 17/* $OpenBSD: cipher-chachapoly.c,v 1.6 2014/07/03 12:42:16 jsing Exp $ */
18 18
19#include "includes.h" 19#include "includes.h"
20 20
@@ -65,8 +65,6 @@ chachapoly_crypt(struct chachapoly_ctx *ctx, u_int seqnr, u_char *dest,
65 chacha_ivsetup(&ctx->main_ctx, seqbuf, NULL); 65 chacha_ivsetup(&ctx->main_ctx, seqbuf, NULL);
66 chacha_encrypt_bytes(&ctx->main_ctx, 66 chacha_encrypt_bytes(&ctx->main_ctx,
67 poly_key, poly_key, sizeof(poly_key)); 67 poly_key, poly_key, sizeof(poly_key));
68 /* Set Chacha's block counter to 1 */
69 chacha_ivsetup(&ctx->main_ctx, seqbuf, one);
70 68
71 /* If decrypting, check tag before anything else */ 69 /* If decrypting, check tag before anything else */
72 if (!do_encrypt) { 70 if (!do_encrypt) {
@@ -78,11 +76,15 @@ chachapoly_crypt(struct chachapoly_ctx *ctx, u_int seqnr, u_char *dest,
78 goto out; 76 goto out;
79 } 77 }
80 } 78 }
79
81 /* Crypt additional data */ 80 /* Crypt additional data */
82 if (aadlen) { 81 if (aadlen) {
83 chacha_ivsetup(&ctx->header_ctx, seqbuf, NULL); 82 chacha_ivsetup(&ctx->header_ctx, seqbuf, NULL);
84 chacha_encrypt_bytes(&ctx->header_ctx, src, dest, aadlen); 83 chacha_encrypt_bytes(&ctx->header_ctx, src, dest, aadlen);
85 } 84 }
85
86 /* Set Chacha's block counter to 1 */
87 chacha_ivsetup(&ctx->main_ctx, seqbuf, one);
86 chacha_encrypt_bytes(&ctx->main_ctx, src + aadlen, 88 chacha_encrypt_bytes(&ctx->main_ctx, src + aadlen,
87 dest + aadlen, len); 89 dest + aadlen, len);
88 90