summaryrefslogtreecommitdiff
path: root/cbc.h
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2004-02-26 10:25:29 +0100
committerNiels Möller <nisse@lysator.liu.se>2004-02-26 10:25:29 +0100
commit590c8954cbecadd7b2d2418e3b284a68f0ba5e48 (patch)
tree7c4b08b82955be9b067e40de8c9f1bee0b7404de /cbc.h
parent4af858dfe00fa3962b754d143a86c3c960bd514b (diff)
downloadnettle-590c8954cbecadd7b2d2418e3b284a68f0ba5e48.tar.gz
* cbc.h (nettle_crypt_func): Moved typedef here.
* cbc.c (cbc_encrypt, cbc_decrypt_internal, cbc_decrypt): Use it for typing the f argument. Rev: src/nettle/cbc.c:1.10 Rev: src/nettle/cbc.h:1.7
Diffstat (limited to 'cbc.h')
-rw-r--r--cbc.h17
1 files changed, 10 insertions, 7 deletions
diff --git a/cbc.h b/cbc.h
index 740e9e19..dd19e267 100644
--- a/cbc.h
+++ b/cbc.h
@@ -32,20 +32,23 @@
#define cbc_encrypt nettle_cbc_encrypt
#define cbc_decrypt nettle_cbc_decrypt
-/* Uses a void * for cipher contexts. */
+/* Uses a void * for cipher contexts.
+
+ For block ciphers it would make sense with a const void * for the
+ context, but we use the same typedef for stream ciphers where the
+ internal state changes during the encryption. */
+typedef void (*nettle_crypt_func)(void *ctx,
+ unsigned length, uint8_t *dst,
+ const uint8_t *src);
void
-cbc_encrypt(const void *ctx, void (*f)(const void *ctx,
- unsigned length, uint8_t *dst,
- const uint8_t *src),
+cbc_encrypt(void *ctx, nettle_crypt_func f,
unsigned block_size, uint8_t *iv,
unsigned length, uint8_t *dst,
const uint8_t *src);
void
-cbc_decrypt(const void *ctx, void (*f)(const void *ctx,
- unsigned length, uint8_t *dst,
- const uint8_t *src),
+cbc_decrypt(void *ctx, nettle_crypt_func f,
unsigned block_size, uint8_t *iv,
unsigned length, uint8_t *dst,
const uint8_t *src);