From 97829771e9fa1317b2166f9d7a626212b355e5e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Fri, 7 Sep 2001 19:38:29 +0200 Subject: Work-in-progress. Rev: src/nettle/Makefile.am:1.12 Rev: src/nettle/cbc.c:1.2 Rev: src/nettle/cbc.h:1.2 --- cbc.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'cbc.h') diff --git a/cbc.h b/cbc.h index 4335a518..2bf72e7c 100644 --- a/cbc.h +++ b/cbc.h @@ -28,7 +28,7 @@ #include -/* 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 */ -- cgit v1.2.1