Skip to content
Snippets Groups Projects
Commit 590c8954 authored by Niels Möller's avatar Niels Möller
Browse files

* 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
parent 4af858df
No related branches found
No related tags found
No related merge requests found
...@@ -37,9 +37,7 @@ ...@@ -37,9 +37,7 @@
#include "nettle-internal.h" #include "nettle-internal.h"
void void
cbc_encrypt(const void *ctx, void (*f)(const void *ctx, cbc_encrypt(void *ctx, nettle_crypt_func f,
unsigned length, uint8_t *dst,
const uint8_t *src),
unsigned block_size, uint8_t *iv, unsigned block_size, uint8_t *iv,
unsigned length, uint8_t *dst, unsigned length, uint8_t *dst,
const uint8_t *src) const uint8_t *src)
...@@ -56,9 +54,7 @@ cbc_encrypt(const void *ctx, void (*f)(const void *ctx, ...@@ -56,9 +54,7 @@ cbc_encrypt(const void *ctx, void (*f)(const void *ctx,
/* Reqires that dst != src */ /* Reqires that dst != src */
static void static void
cbc_decrypt_internal(const void *ctx, void (*f)(const void *ctx, cbc_decrypt_internal(void *ctx, nettle_crypt_func f,
unsigned length, uint8_t *dst,
const uint8_t *src),
unsigned block_size, uint8_t *iv, unsigned block_size, uint8_t *iv,
unsigned length, uint8_t *dst, unsigned length, uint8_t *dst,
const uint8_t *src) const uint8_t *src)
...@@ -80,9 +76,7 @@ cbc_decrypt_internal(const void *ctx, void (*f)(const void *ctx, ...@@ -80,9 +76,7 @@ cbc_decrypt_internal(const void *ctx, void (*f)(const void *ctx,
#define CBC_BUFFER_LIMIT 4096 #define CBC_BUFFER_LIMIT 4096
void void
cbc_decrypt(const void *ctx, void (*f)(const void *ctx, cbc_decrypt(void *ctx, nettle_crypt_func f,
unsigned length, uint8_t *dst,
const uint8_t *src),
unsigned block_size, uint8_t *iv, unsigned block_size, uint8_t *iv,
unsigned length, uint8_t *dst, unsigned length, uint8_t *dst,
const uint8_t *src) const uint8_t *src)
......
...@@ -32,20 +32,23 @@ ...@@ -32,20 +32,23 @@
#define cbc_encrypt nettle_cbc_encrypt #define cbc_encrypt nettle_cbc_encrypt
#define cbc_decrypt nettle_cbc_decrypt #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 void
cbc_encrypt(const void *ctx, void (*f)(const void *ctx, cbc_encrypt(void *ctx, nettle_crypt_func f,
unsigned length, uint8_t *dst,
const uint8_t *src),
unsigned block_size, uint8_t *iv, unsigned block_size, uint8_t *iv,
unsigned length, uint8_t *dst, unsigned length, uint8_t *dst,
const uint8_t *src); const uint8_t *src);
void void
cbc_decrypt(const void *ctx, void (*f)(const void *ctx, cbc_decrypt(void *ctx, nettle_crypt_func f,
unsigned length, uint8_t *dst,
const uint8_t *src),
unsigned block_size, uint8_t *iv, unsigned block_size, uint8_t *iv,
unsigned length, uint8_t *dst, unsigned length, uint8_t *dst,
const uint8_t *src); const uint8_t *src);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment