summaryrefslogtreecommitdiff
path: root/nettle-meta.h
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2002-10-19 12:47:23 +0200
committerNiels Möller <nisse@lysator.liu.se>2002-10-19 12:47:23 +0200
commitbb34f1ed71b7ef43e81fc9490fa9d18968411aa1 (patch)
treea04182a886058bf853db1559bfc1a694e885b29c /nettle-meta.h
parenteb28503d4da145a1c2e32a63ca620c89fc64789c (diff)
downloadnettle-bb34f1ed71b7ef43e81fc9490fa9d18968411aa1.tar.gz
Updated nettle_armor definitions.
Rev: src/nettle/nettle-meta.h:1.8
Diffstat (limited to 'nettle-meta.h')
-rw-r--r--nettle-meta.h52
1 files changed, 34 insertions, 18 deletions
diff --git a/nettle-meta.h b/nettle-meta.h
index 759037c8..7a2498f5 100644
--- a/nettle-meta.h
+++ b/nettle-meta.h
@@ -155,35 +155,51 @@ extern const struct nettle_hash nettle_sha1;
extern const struct nettle_hash nettle_sha256;
-/* ASCII armor codecs */
-typedef unsigned (*nettle_armor_encode_func)(uint8_t *dst,
- unsigned src_length,
- const uint8_t *src);
+/* 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_update_func)(void *ctx,
- uint8_t *dst,
- unsigned src_length,
- const uint8_t *src);
+ 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_status_func)(void *ctx);
struct nettle_armor
{
const char *name;
- unsigned context_size;
- unsigned text_block_size;
- unsigned binary_block_size;
- nettle_armor_encode_func encode;
+ unsigned encode_context_size;
+ unsigned decode_context_size;
+
+ unsigned encode_final_length;
+
+ nettle_armor_init_func encode_init;
+ nettle_armor_length_func encode_length;
+ nettle_armor_update_func encode_update;
+ nettle_armor_encode_final_func encode_final;
+
nettle_armor_init_func decode_init;
+ nettle_armor_length_func decode_length;
nettle_armor_update_func decode_update;
+ nettle_armor_decode_status_func decode_status;
};
-#define _NETTLE_ARMOR(name, NAME) { \
- #name, \
- sizeof(struct name##_ctx), \
- NAME##_TEXT_BLOCK_SIZE, \
- NAME##_BINARY_BLOCK_SIZE, \
- (nettle_armor_encode_func) name##_encode, \
+#define _NETTLE_ARMOR(name, NAME) { \
+ #name, \
+ sizeof(struct name##_encode_ctx), \
+ sizeof(struct name##_decode_ctx), \
+ NAME##_ENCODE_FINAL_LENGTH, \
+ (nettle_armor_init_func) name##_encode_init, \
+ (nettle_armor_length_func) name##_encode_length, \
+ (nettle_armor_update_func) name##_encode_update, \
+ (nettle_armor_encode_final_func) name##_encode_final, \
(nettle_armor_init_func) name##_decode_init, \
- (nettle_armor_update_func) name##_decode_update \
+ (nettle_armor_length_func) name##_decode_length, \
+ (nettle_armor_update_func) name##_decode_update, \
+ (nettle_armor_decode_status_func) name##_decode_status, \
}
extern const struct nettle_armor nettle_base64;