From 3ee29d7d9f6fd1ef3c01626defa7bf321a174b79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se> Date: Tue, 22 Jan 2002 17:32:08 +0100 Subject: [PATCH] (struct nettle_armor): New struct. Rev: src/nettle/nettle-meta.h:1.3 --- nettle-meta.h | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/nettle-meta.h b/nettle-meta.h index ba500eac..d64f92f7 100644 --- a/nettle-meta.h +++ b/nettle-meta.h @@ -84,7 +84,7 @@ extern const struct nettle_cipher nettle_twofish192; extern const struct nettle_cipher nettle_twofish256; -/* Hash algorithm */ +/* Hash algorithms */ typedef void (*nettle_hash_init_func)(void *ctx); typedef void (*nettle_hash_update_func)(void *ctx, unsigned length, @@ -124,4 +124,32 @@ extern const struct nettle_hash nettle_md5; extern const struct nettle_hash nettle_sha1; extern const struct nettle_hash nettle_sha256; + +/* ASCII armor codecs */ +typedef unsigned (*nettle_armor_func)(uint8_t *dst, + unsigned src_length, + const uint8_t *src); + +struct nettle_armor +{ + const char *name; + + unsigned ascii_block_size; + unsigned raw_block_size; + + nettle_armor_func encode; + nettle_armor_func decode; +}; + +#define _NETTLE_ARMOR(name, NAME) { \ + #name, \ + NAME##_ASCII_BLOCK_SIZE, \ + NAME##_RAW_BLOCK_SIZE, \ + name##_encode, \ + name##_decode \ +} + +extern const struct nettle_armor nettle_base64; +extern const struct nettle_armor nettle_base16; + #endif /* NETTLE_META_H_INCLUDED */ -- GitLab