~mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
symm/: Allow block cipher and hash functions with strange names.
[catacomb]
/
symm
/
ofb-def.h
diff --git
a/symm/ofb-def.h
b/symm/ofb-def.h
index
358ee54
..
e9eb503
100644
(file)
--- a/
symm/ofb-def.h
+++ b/
symm/ofb-def.h
@@
-65,7
+65,9
@@
* Use: Creates definitions for output feedback mode.
*/
* Use: Creates definitions for output feedback mode.
*/
-#define OFB_DEF(PRE, pre) \
+#define OFB_DEF(PRE, pre) OFB_DEFX(PRE, pre, #pre, #pre)
+
+#define OFB_DEFX(PRE, pre, name, fname) \
\
/* --- @pre_ofbgetiv@ --- * \
* \
\
/* --- @pre_ofbgetiv@ --- * \
* \
@@
-306,7
+308,7
@@
static const gcipher_ops gops = { \
}; \
\
const gccipher pre##_ofb = { \
}; \
\
const gccipher pre##_ofb = { \
-
#pr
e "-ofb", pre##_keysz, PRE##_BLKSZ, \
+
nam
e "-ofb", pre##_keysz, PRE##_BLKSZ, \
ginit \
}; \
\
ginit \
}; \
\
@@
-407,7
+409,7
@@
static void grfill(grand *r, void *p, size_t sz) \
} \
\
static const grand_ops grops = { \
} \
\
static const grand_ops grops = { \
-
#pr
e "-ofb", \
+
nam
e "-ofb", \
GRAND_CRYPTO, 0, \
grmisc, grdestroy, \
grword, grbyte, grword, grand_defaultrange, grfill \
GRAND_CRYPTO, 0, \
grmisc, grdestroy, \
grword, grbyte, grword, grand_defaultrange, grfill \
@@
-432,10
+434,12
@@
grand *pre##_ofbrand(const void *k, size_t sz) \
return (&g->r); \
} \
\
return (&g->r); \
} \
\
-OFB_TEST
(PRE, pr
e)
+OFB_TEST
X(PRE, pre, name, nam
e)
/*----- Test rig ----------------------------------------------------------*/
/*----- Test rig ----------------------------------------------------------*/
+#define OFB_TEST(PRE, pre) OFB_TESTX(PRE, pre, #pre, #pre)
+
#ifdef TEST_RIG
#include <stdio.h>
#ifdef TEST_RIG
#include <stdio.h>
@@
-449,7
+453,7
@@
OFB_TEST(PRE, pre)
* Use: Standard test rig for OFB functions.
*/
* Use: Standard test rig for OFB functions.
*/
-#define OFB_TEST
(PRE, pre)
\
+#define OFB_TEST
X(PRE, pre, name, fname)
\
\
/* --- Initial plaintext for the test --- */ \
\
\
/* --- Initial plaintext for the test --- */ \
\
@@
-486,7
+490,7
@@
int main(void) \
size_t keysz = PRE##_KEYSZ ? \
PRE##_KEYSZ : strlen((const char *)key); \
\
size_t keysz = PRE##_KEYSZ ? \
PRE##_KEYSZ : strlen((const char *)key); \
\
- fputs(
#pr
e "-ofb: ", stdout); \
+ fputs(
nam
e "-ofb: ", stdout); \
\
pre##_init(&k, key, keysz); \
pre##_ofbsetkey(&ctx, &k); \
\
pre##_init(&k, key, keysz); \
pre##_ofbsetkey(&ctx, &k); \
@@
-533,7
+537,7
@@
int main(void) \
}
#else
}
#else
-# define OFB_TEST
(PRE, pr
e)
+# define OFB_TEST
X(PRE, pre, name, fnam
e)
#endif
/*----- That's all, folks -------------------------------------------------*/
#endif
/*----- That's all, folks -------------------------------------------------*/