diff options
author | Niels Möller <nisse@lysator.liu.se> | 2008-11-01 14:01:56 +0100 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2008-11-01 14:01:56 +0100 |
commit | e6782e051079c2f5de631fb09dc45747b843552e (patch) | |
tree | d873095e7c121d7fe9665e167942fba3c232a538 /nettle-types.h | |
parent | d2ea4c936bb004372fb91c0da304b40ccbb53fab (diff) | |
download | nettle-e6782e051079c2f5de631fb09dc45747b843552e.tar.gz |
Moved all typedefs for function types to nettle-types.h. Use
non-pointer types, so that the types can be used to declare functions.
Updated all users.
Rev: nettle/arcfour-meta.c:1.2
Rev: nettle/cbc.h:1.2
Rev: nettle/des-compat.c:1.2
Rev: nettle/examples/nettle-benchmark.c:1.3
Rev: nettle/examples/nettle-openssl.c:1.2
Rev: nettle/examples/rsa-encrypt.c:1.2
Rev: nettle/examples/rsa-keygen.c:1.2
Rev: nettle/nettle-internal.c:1.2
Rev: nettle/nettle-meta.h:1.2
Rev: nettle/nettle-types.h:1.2
Rev: nettle/testsuite/dsa-keygen-test.c:1.3
Rev: nettle/testsuite/rsa-encrypt-test.c:1.3
Rev: nettle/testsuite/rsa-keygen-test.c:1.3
Rev: nettle/testsuite/testutils.c:1.3
Diffstat (limited to 'nettle-types.h')
-rw-r--r-- | nettle-types.h | 47 |
1 files changed, 43 insertions, 4 deletions
diff --git a/nettle-types.h b/nettle-types.h index 7b982517..2a977152 100644 --- a/nettle-types.h +++ b/nettle-types.h @@ -29,17 +29,56 @@ extern "C" { #endif +/* Randomness. Used by key generation and dsa signature creation. */ +typedef void (nettle_random_func)(void *ctx, + unsigned length, uint8_t *dst); + +/* Progress report function, mainly for key generation. */ +typedef void (nettle_progress_func)(void *ctx, + int c); + +/* Ciphers */ +typedef void (nettle_set_key_func)(void *ctx, + unsigned length, + const uint8_t *key); + /* 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); +typedef void (nettle_crypt_func)(void *ctx, + unsigned length, uint8_t *dst, + const uint8_t *src); + +/* Hash algorithms */ +typedef void (nettle_hash_init_func)(void *ctx); +typedef void (nettle_hash_update_func)(void *ctx, + unsigned length, + const uint8_t *src); +typedef void (nettle_hash_digest_func)(void *ctx, + unsigned length, uint8_t *dst); + +/* ASCII armor codecs. NOTE: Experimental and subject to change. */ + +typedef unsigned (nettle_armor_length_func)(unsigned length); +typedef void (nettle_armor_init_func)(void *ctx); + +typedef unsigned (nettle_armor_encode_update_func)(void *ctx, + uint8_t *dst, + unsigned src_length, + const uint8_t *src); + +typedef unsigned (nettle_armor_encode_final_func)(void *ctx, uint8_t *dst); + +typedef int (nettle_armor_decode_update_func)(void *ctx, + unsigned *dst_length, + uint8_t *dst, + unsigned src_length, + const uint8_t *src); -/* FIXME: Move more of the typedefs to this file? */ +typedef int (nettle_armor_decode_final_func)(void *ctx); #ifdef __cplusplus } |