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 #ifndef NETTLE_XTS_H_INCLUDED
0037 #define NETTLE_XTS_H_INCLUDED
0038
0039 #include "nettle-types.h"
0040 #include "aes.h"
0041
0042 #ifdef __cplusplus
0043 extern "C" {
0044 #endif
0045
0046
0047 #define xts_encrypt_message nettle_xts_encrypt_message
0048 #define xts_decrypt_message nettle_xts_decrypt_message
0049 #define xts_aes128_set_encrypt_key nettle_xts_aes128_set_encrypt_key
0050 #define xts_aes128_set_decrypt_key nettle_xts_aes128_set_decrypt_key
0051 #define xts_aes128_encrypt_message nettle_xts_aes128_encrypt_message
0052 #define xts_aes128_decrypt_message nettle_xts_aes128_decrypt_message
0053 #define xts_aes256_set_encrypt_key nettle_xts_aes256_set_encrypt_key
0054 #define xts_aes256_set_decrypt_key nettle_xts_aes256_set_decrypt_key
0055 #define xts_aes256_encrypt_message nettle_xts_aes256_encrypt_message
0056 #define xts_aes256_decrypt_message nettle_xts_aes256_decrypt_message
0057
0058 #define XTS_BLOCK_SIZE 16
0059
0060 void
0061 xts_encrypt_message(const void *enc_ctx, const void *twk_ctx,
0062 nettle_cipher_func *encf,
0063 const uint8_t *tweak, size_t length,
0064 uint8_t *dst, const uint8_t *src);
0065 void
0066 xts_decrypt_message(const void *dec_ctx, const void *twk_ctx,
0067 nettle_cipher_func *decf, nettle_cipher_func *encf,
0068 const uint8_t *tweak, size_t length,
0069 uint8_t *dst, const uint8_t *src);
0070
0071
0072 struct xts_aes128_key {
0073 struct aes128_ctx cipher;
0074 struct aes128_ctx tweak_cipher;
0075 };
0076
0077 void
0078 xts_aes128_set_encrypt_key(struct xts_aes128_key *xts_key,
0079 const uint8_t *key);
0080
0081 void
0082 xts_aes128_set_decrypt_key(struct xts_aes128_key *xts_key,
0083 const uint8_t *key);
0084
0085 void
0086 xts_aes128_encrypt_message(const struct xts_aes128_key *xtskey,
0087 const uint8_t *tweak, size_t length,
0088 uint8_t *dst, const uint8_t *src);
0089
0090 void
0091 xts_aes128_decrypt_message(const struct xts_aes128_key *xts_key,
0092 const uint8_t *tweak, size_t length,
0093 uint8_t *dst, const uint8_t *src);
0094
0095
0096 struct xts_aes256_key {
0097 struct aes256_ctx cipher;
0098 struct aes256_ctx tweak_cipher;
0099 };
0100
0101 void
0102 xts_aes256_set_encrypt_key(struct xts_aes256_key *xts_key,
0103 const uint8_t *key);
0104
0105 void
0106 xts_aes256_set_decrypt_key(struct xts_aes256_key *xts_key,
0107 const uint8_t *key);
0108
0109 void
0110 xts_aes256_encrypt_message(const struct xts_aes256_key *xts_key,
0111 const uint8_t *tweak, size_t length,
0112 uint8_t *dst, const uint8_t *src);
0113
0114 void
0115 xts_aes256_decrypt_message(const struct xts_aes256_key *xts_key,
0116 const uint8_t *tweak, size_t length,
0117 uint8_t *dst, const uint8_t *src);
0118
0119 #ifdef __cplusplus
0120 }
0121 #endif
0122
0123 #endif