summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjsing <>2014-06-24 17:48:30 +0000
committerjsing <>2014-06-24 17:48:30 +0000
commit60d3c45c548a5b395746da4eb9dbbf8cb55dc1b5 (patch)
tree6c52198d95904da21e64a1ad2460a9e9464fab98 /src
parent26677f9bb3a482ca44869c898847f16dda2be01e (diff)
downloadopenbsd-60d3c45c548a5b395746da4eb9dbbf8cb55dc1b5.tar.gz
openbsd-60d3c45c548a5b395746da4eb9dbbf8cb55dc1b5.tar.bz2
openbsd-60d3c45c548a5b395746da4eb9dbbf8cb55dc1b5.zip
Some KNF.
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/chacha/chacha-merged.c18
-rw-r--r--src/lib/libssl/src/crypto/chacha/chacha-merged.c18
2 files changed, 24 insertions, 12 deletions
diff --git a/src/lib/libcrypto/chacha/chacha-merged.c b/src/lib/libcrypto/chacha/chacha-merged.c
index 6067ea3b5a..25092b16da 100644
--- a/src/lib/libcrypto/chacha/chacha-merged.c
+++ b/src/lib/libcrypto/chacha/chacha-merged.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: chacha-merged.c,v 1.4 2014/06/12 15:49:28 deraadt Exp $ */ 1/* $OpenBSD: chacha-merged.c,v 1.5 2014/06/24 17:48:30 jsing Exp $ */
2/* 2/*
3chacha-merged.c version 20080118 3chacha-merged.c version 20080118
4D. J. Bernstein 4D. J. Bernstein
@@ -108,8 +108,10 @@ chacha_ivsetup(chacha_ctx *x, const u8 *iv, const u8 *counter)
108static inline void 108static inline void
109chacha_encrypt_bytes(chacha_ctx *x, const u8 *m, u8 *c, u32 bytes) 109chacha_encrypt_bytes(chacha_ctx *x, const u8 *m, u8 *c, u32 bytes)
110{ 110{
111 u32 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15; 111 u32 x0, x1, x2, x3, x4, x5, x6, x7;
112 u32 j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15; 112 u32 x8, x9, x10, x11, x12, x13, x14, x15;
113 u32 j0, j1, j2, j3, j4, j5, j6, j7;
114 u32 j8, j9, j10, j11, j12, j13, j14, j15;
113 u8 *ctarget = NULL; 115 u8 *ctarget = NULL;
114 u8 tmp[64]; 116 u8 tmp[64];
115 u_int i; 117 u_int i;
@@ -136,8 +138,9 @@ chacha_encrypt_bytes(chacha_ctx *x, const u8 *m, u8 *c, u32 bytes)
136 138
137 for (;;) { 139 for (;;) {
138 if (bytes < 64) { 140 if (bytes < 64) {
139 for (i = 0;i < bytes;++i) tmp[i] = m[i]; 141 for (i = 0; i < bytes; ++i)
140 m = tmp; 142 tmp[i] = m[i];
143 m = tmp;
141 ctarget = c; 144 ctarget = c;
142 c = tmp; 145 c = tmp;
143 } 146 }
@@ -204,7 +207,10 @@ chacha_encrypt_bytes(chacha_ctx *x, const u8 *m, u8 *c, u32 bytes)
204 j12 = PLUSONE(j12); 207 j12 = PLUSONE(j12);
205 if (!j12) { 208 if (!j12) {
206 j13 = PLUSONE(j13); 209 j13 = PLUSONE(j13);
207 /* stopping at 2^70 bytes per nonce is user's responsibility */ 210 /*
211 * Stopping at 2^70 bytes per nonce is the user's
212 * responsibility.
213 */
208 } 214 }
209 215
210 U32TO8_LITTLE(c + 0, x0); 216 U32TO8_LITTLE(c + 0, x0);
diff --git a/src/lib/libssl/src/crypto/chacha/chacha-merged.c b/src/lib/libssl/src/crypto/chacha/chacha-merged.c
index 6067ea3b5a..25092b16da 100644
--- a/src/lib/libssl/src/crypto/chacha/chacha-merged.c
+++ b/src/lib/libssl/src/crypto/chacha/chacha-merged.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: chacha-merged.c,v 1.4 2014/06/12 15:49:28 deraadt Exp $ */ 1/* $OpenBSD: chacha-merged.c,v 1.5 2014/06/24 17:48:30 jsing Exp $ */
2/* 2/*
3chacha-merged.c version 20080118 3chacha-merged.c version 20080118
4D. J. Bernstein 4D. J. Bernstein
@@ -108,8 +108,10 @@ chacha_ivsetup(chacha_ctx *x, const u8 *iv, const u8 *counter)
108static inline void 108static inline void
109chacha_encrypt_bytes(chacha_ctx *x, const u8 *m, u8 *c, u32 bytes) 109chacha_encrypt_bytes(chacha_ctx *x, const u8 *m, u8 *c, u32 bytes)
110{ 110{
111 u32 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15; 111 u32 x0, x1, x2, x3, x4, x5, x6, x7;
112 u32 j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15; 112 u32 x8, x9, x10, x11, x12, x13, x14, x15;
113 u32 j0, j1, j2, j3, j4, j5, j6, j7;
114 u32 j8, j9, j10, j11, j12, j13, j14, j15;
113 u8 *ctarget = NULL; 115 u8 *ctarget = NULL;
114 u8 tmp[64]; 116 u8 tmp[64];
115 u_int i; 117 u_int i;
@@ -136,8 +138,9 @@ chacha_encrypt_bytes(chacha_ctx *x, const u8 *m, u8 *c, u32 bytes)
136 138
137 for (;;) { 139 for (;;) {
138 if (bytes < 64) { 140 if (bytes < 64) {
139 for (i = 0;i < bytes;++i) tmp[i] = m[i]; 141 for (i = 0; i < bytes; ++i)
140 m = tmp; 142 tmp[i] = m[i];
143 m = tmp;
141 ctarget = c; 144 ctarget = c;
142 c = tmp; 145 c = tmp;
143 } 146 }
@@ -204,7 +207,10 @@ chacha_encrypt_bytes(chacha_ctx *x, const u8 *m, u8 *c, u32 bytes)
204 j12 = PLUSONE(j12); 207 j12 = PLUSONE(j12);
205 if (!j12) { 208 if (!j12) {
206 j13 = PLUSONE(j13); 209 j13 = PLUSONE(j13);
207 /* stopping at 2^70 bytes per nonce is user's responsibility */ 210 /*
211 * Stopping at 2^70 bytes per nonce is the user's
212 * responsibility.
213 */
208 } 214 }
209 215
210 U32TO8_LITTLE(c + 0, x0); 216 U32TO8_LITTLE(c + 0, x0);