~mdw
/
catacomb
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
551a572
)
rand/rand.c: More dynamic assertions converted to use `STATIC_ASSERT'.
author
Mark Wooding
<mdw@distorted.org.uk>
Thu, 12 Dec 2019 19:11:47 +0000
(19:11 +0000)
committer
Mark Wooding
<mdw@distorted.org.uk>
Sat, 9 May 2020 19:56:46 +0000
(20:56 +0100)
rand/rand.c
patch
|
blob
|
blame
|
history
diff --git
a/rand/rand.c
b/rand/rand.c
index
32605ac
..
304c68d
100644
(file)
--- a/
rand/rand.c
+++ b/
rand/rand.c
@@
-304,6
+304,8
@@
void rand_gate(rand_pool *r)
HASH_CTX hc;
CIPHER_CTX cc;
HASH_CTX hc;
CIPHER_CTX cc;
+ STATIC_ASSERT(CIPHER_KEYSZ <= HASH_SZ, "rand cipher keysize too long");
+
RAND_RESOLVE(r);
QUICK(r);
RAND_RESOLVE(r);
QUICK(r);
@@
-319,7
+321,6
@@
void rand_gate(rand_pool *r)
/* --- Now mangle all of the data based on the hash --- */
/* --- Now mangle all of the data based on the hash --- */
- assert(CIPHER_KEYSZ <= HASH_SZ);
CIPHER_INIT(&cc, h, CIPHER_KEYSZ, 0);
CIPHER_ENCRYPT(&cc, r->pool, r->pool, RAND_POOLSZ);
CIPHER_ENCRYPT(&cc, r->buf, r->buf, RAND_BUFSZ);
CIPHER_INIT(&cc, h, CIPHER_KEYSZ, 0);
CIPHER_ENCRYPT(&cc, r->pool, r->pool, RAND_POOLSZ);
CIPHER_ENCRYPT(&cc, r->buf, r->buf, RAND_BUFSZ);
@@
-355,6
+356,8
@@
void rand_stretch(rand_pool *r)
HASH_CTX hc;
CIPHER_CTX cc;
HASH_CTX hc;
CIPHER_CTX cc;
+ STATIC_ASSERT(CIPHER_KEYSZ <= HASH_SZ, "rand cipher keysize too long");
+
RAND_RESOLVE(r);
QUICK(r);
RAND_RESOLVE(r);
QUICK(r);
@@
-370,7
+373,6
@@
void rand_stretch(rand_pool *r)
/* --- Now mangle the buffer based on the hash --- */
/* --- Now mangle the buffer based on the hash --- */
- assert(CIPHER_KEYSZ <= HASH_SZ);
CIPHER_INIT(&cc, h, CIPHER_KEYSZ, 0);
CIPHER_ENCRYPT(&cc, r->buf, r->buf, RAND_BUFSZ);
BURN(cc);
CIPHER_INIT(&cc, h, CIPHER_KEYSZ, 0);
CIPHER_ENCRYPT(&cc, r->buf, r->buf, RAND_BUFSZ);
BURN(cc);