File indexing completed on 2025-01-18 10:02:16
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040 #ifndef NETTLE_TWOFISH_H_INCLUDED
0041 #define NETTLE_TWOFISH_H_INCLUDED
0042
0043 #include "nettle-types.h"
0044
0045 #ifdef __cplusplus
0046 extern "C" {
0047 #endif
0048
0049
0050 #define twofish_set_key nettle_twofish_set_key
0051 #define twofish128_set_key nettle_twofish128_set_key
0052 #define twofish192_set_key nettle_twofish192_set_key
0053 #define twofish256_set_key nettle_twofish256_set_key
0054 #define twofish_encrypt nettle_twofish_encrypt
0055 #define twofish_decrypt nettle_twofish_decrypt
0056
0057 #define TWOFISH_BLOCK_SIZE 16
0058
0059
0060
0061 #define TWOFISH_MIN_KEY_SIZE 16
0062 #define TWOFISH_MAX_KEY_SIZE 32
0063
0064 #define TWOFISH_KEY_SIZE 32
0065 #define TWOFISH128_KEY_SIZE 16
0066 #define TWOFISH192_KEY_SIZE 24
0067 #define TWOFISH256_KEY_SIZE 32
0068
0069 struct twofish_ctx
0070 {
0071 uint32_t keys[40];
0072 uint32_t s_box[4][256];
0073 };
0074
0075 void
0076 twofish_set_key(struct twofish_ctx *ctx,
0077 size_t length, const uint8_t *key);
0078 void
0079 twofish128_set_key(struct twofish_ctx *context, const uint8_t *key);
0080 void
0081 twofish192_set_key(struct twofish_ctx *context, const uint8_t *key);
0082 void
0083 twofish256_set_key(struct twofish_ctx *context, const uint8_t *key);
0084
0085 void
0086 twofish_encrypt(const struct twofish_ctx *ctx,
0087 size_t length, uint8_t *dst,
0088 const uint8_t *src);
0089 void
0090 twofish_decrypt(const struct twofish_ctx *ctx,
0091 size_t length, uint8_t *dst,
0092 const uint8_t *src);
0093
0094 #ifdef __cplusplus
0095 }
0096 #endif
0097
0098 #endif