Warning, file /include/nettle/cfb.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
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 #ifndef NETTLE_CFB_H_INCLUDED
0036 #define NETTLE_CFB_H_INCLUDED
0037
0038 #include "nettle-types.h"
0039
0040 #ifdef __cplusplus
0041 extern "C" {
0042 #endif
0043
0044
0045 #define cfb_encrypt nettle_cfb_encrypt
0046 #define cfb_decrypt nettle_cfb_decrypt
0047
0048 #define cfb8_encrypt nettle_cfb8_encrypt
0049 #define cfb8_decrypt nettle_cfb8_decrypt
0050
0051 void
0052 cfb_encrypt(const void *ctx, nettle_cipher_func *f,
0053 size_t block_size, uint8_t *iv,
0054 size_t length, uint8_t *dst,
0055 const uint8_t *src);
0056
0057 void
0058 cfb_decrypt(const void *ctx, nettle_cipher_func *f,
0059 size_t block_size, uint8_t *iv,
0060 size_t length, uint8_t *dst,
0061 const uint8_t *src);
0062
0063 void
0064 cfb8_encrypt(const void *ctx, nettle_cipher_func *f,
0065 size_t block_size, uint8_t *iv,
0066 size_t length, uint8_t *dst,
0067 const uint8_t *src);
0068
0069 void
0070 cfb8_decrypt(const void *ctx, nettle_cipher_func *f,
0071 size_t block_size, uint8_t *iv,
0072 size_t length, uint8_t *dst,
0073 const uint8_t *src);
0074
0075
0076 #define CFB_CTX(type, size) \
0077 { type ctx; uint8_t iv[size]; }
0078
0079 #define CFB_SET_IV(ctx, data) \
0080 memcpy((ctx)->iv, (data), sizeof((ctx)->iv))
0081
0082 #define CFB8_CTX CFB_CTX
0083 #define CFB8_SET_IV CFB_SET_IV
0084
0085
0086 #define CFB_ENCRYPT(self, f, length, dst, src) \
0087 (0 ? ((f)(&(self)->ctx, ~(size_t) 0, \
0088 (uint8_t *) 0, (const uint8_t *) 0)) \
0089 : cfb_encrypt((void *) &(self)->ctx, \
0090 (nettle_cipher_func *) (f), \
0091 sizeof((self)->iv), (self)->iv, \
0092 (length), (dst), (src)))
0093
0094 #define CFB_DECRYPT(self, f, length, dst, src) \
0095 (0 ? ((f)(&(self)->ctx, ~(size_t) 0, \
0096 (uint8_t *) 0, (const uint8_t *) 0)) \
0097 : cfb_decrypt((void *) &(self)->ctx, \
0098 (nettle_cipher_func *) (f), \
0099 sizeof((self)->iv), (self)->iv, \
0100 (length), (dst), (src)))
0101
0102 #define CFB8_ENCRYPT(self, f, length, dst, src) \
0103 (0 ? ((f)(&(self)->ctx, ~(size_t) 0, \
0104 (uint8_t *) 0, (const uint8_t *) 0)) \
0105 : cfb8_encrypt((void *) &(self)->ctx, \
0106 (nettle_cipher_func *) (f), \
0107 sizeof((self)->iv), (self)->iv, \
0108 (length), (dst), (src)))
0109
0110 #define CFB8_DECRYPT(self, f, length, dst, src) \
0111 (0 ? ((f)(&(self)->ctx, ~(size_t) 0, \
0112 (uint8_t *) 0, (const uint8_t *) 0)) \
0113 : cfb8_decrypt((void *) &(self)->ctx, \
0114 (nettle_cipher_func *) (f), \
0115 sizeof((self)->iv), (self)->iv, \
0116 (length), (dst), (src)))
0117
0118 #ifdef __cplusplus
0119 }
0120 #endif
0121
0122 #endif