summaryrefslogtreecommitdiff
path: root/cbc.h
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2001-09-07 19:38:29 +0200
committerNiels Möller <nisse@lysator.liu.se>2001-09-07 19:38:29 +0200
commit97829771e9fa1317b2166f9d7a626212b355e5e0 (patch)
tree380760696c366b11b70c6f495fd8c6f3ca9da926 /cbc.h
parent4fc4077870fe97ce762e7d4bcb370d47c6eb7259 (diff)
downloadnettle-97829771e9fa1317b2166f9d7a626212b355e5e0.tar.gz
Work-in-progress.
Rev: src/nettle/Makefile.am:1.12 Rev: src/nettle/cbc.c:1.2 Rev: src/nettle/cbc.h:1.2
Diffstat (limited to 'cbc.h')
-rw-r--r--cbc.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/cbc.h b/cbc.h
index 4335a518..2bf72e7c 100644
--- a/cbc.h
+++ b/cbc.h
@@ -28,7 +28,7 @@
#include <inttypes.h>
-/* Uses a void * for cipher contexts. It's hard to be type safe. */
+/* Uses a void * for cipher contexts. */
void
cbc_encrypt(void *ctx, void (*f)(void *ctx,
@@ -46,4 +46,11 @@ cbc_decrypt(void *ctx, void (*f)(void *ctx,
unsigned length, uint8_t *dst,
const uint8_t *src);
+/* Type safer variants */
+#define CBC_ENCRYPT(ctx, f, b, iv, l, dst, src) \
+(0 ? ((f)((ctx),0,NULL,NULL)) \
+ : cbc_encrypt((void *)(ctx), \
+ ((*)(void *, unsigned, uint8_t *, const uint8_t *)) (f), \
+ (b), (iv), (l), (dst), (src)))
+
#endif /* NETTLE_CBC_H_INCLUDED */