~mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
symm/blkc.h: Add a hook for cipher-specific initialization.
[catacomb]
/
symm
/
blkc.h
diff --git
a/symm/blkc.h
b/symm/blkc.h
index
bbba763
..
444ec8d
100644
(file)
--- a/
symm/blkc.h
+++ b/
symm/blkc.h
@@
-400,9
+400,14
@@
#include <string.h>
#include <string.h>
+#include <mLib/macros.h>
#include <mLib/quis.h>
#include <mLib/testrig.h>
#include <mLib/quis.h>
#include <mLib/testrig.h>
+#ifndef BLKC_TESTHOOK
+# define BLKC_TESTHOOK do ; while (0)
+#endif
+
#define BLKC_VERIFY(PRE, pre) BLKC_VERIFYX(PRE, pre, #pre)
#define BLKC_VERIFYX(PRE, pre, name) \
#define BLKC_VERIFY(PRE, pre) BLKC_VERIFYX(PRE, pre, #pre)
#define BLKC_VERIFYX(PRE, pre, name) \
@@
-429,7
+434,7
@@
static int pre##_verify(dstr *v) \
BLKC_MOVE(PRE, d, p); \
pre##_eblk(&k, d, d); \
BLKC_STORE(PRE, b.buf, d); \
BLKC_MOVE(PRE, d, p); \
pre##_eblk(&k, d, d); \
BLKC_STORE(PRE, b.buf, d); \
- if (
memcmp(b.buf, v[2].buf, PRE##_BLKSZ)) {
\
+ if (
MEMCMP(b.buf, !=, v[2].buf, PRE##_BLKSZ)) {
\
ok = 0; \
printf("\nfail encryption:" \
"\n\tkey = "); \
ok = 0; \
printf("\nfail encryption:" \
"\n\tkey = "); \
@@
-445,7
+450,7
@@
static int pre##_verify(dstr *v) \
BLKC_MOVE(PRE, d, c); \
pre##_dblk(&k, d, d); \
BLKC_STORE(PRE, b.buf, d); \
BLKC_MOVE(PRE, d, c); \
pre##_dblk(&k, d, d); \
BLKC_STORE(PRE, b.buf, d); \
- if (
memcmp(b.buf, v[1].buf, PRE##_BLKSZ)) {
\
+ if (
MEMCMP(b.buf, !=, v[1].buf, PRE##_BLKSZ)) {
\
ok = 0; \
printf("\nfail decryption:" \
"\n\tkey = "); \
ok = 0; \
printf("\nfail decryption:" \
"\n\tkey = "); \
@@
-477,6
+482,7
@@
static const test_chunk defs[] = { \
\
int main(int argc, char *argv[]) \
{ \
\
int main(int argc, char *argv[]) \
{ \
+ BLKC_TESTHOOK; \
test_run(argc, argv, defs, SRCDIR"/t/" fname); \
return (0); \
}
test_run(argc, argv, defs, SRCDIR"/t/" fname); \
return (0); \
}