48extern const struct lc_sym *
lc_aes;
105#define LC_AES_C_INTERNAL_SIZE (248)
106#define LC_AES_RISCV64_MAX_BLOCK_SIZE (LC_AES_C_INTERNAL_SIZE * 2)
107#define LC_AES_RISCV64_XTS_MAX_BLOCK_SIZE (LC_AES_C_INTERNAL_SIZE * 3 + 48)
108#define LC_AES_RISCV64_CBC_MAX_BLOCK_SIZE (LC_AES_C_INTERNAL_SIZE * 2 + 48)
109#define LC_AES_RISCV64_CTR_MAX_BLOCK_SIZE (LC_AES_C_INTERNAL_SIZE + 48)
111#define LC_AES_C_MAX_BLOCK_SIZE (LC_AES_C_INTERNAL_SIZE)
112#define LC_AES_C_XTS_MAX_BLOCK_SIZE (LC_AES_C_INTERNAL_SIZE * 2 + 48)
113#define LC_AES_C_CBC_MAX_BLOCK_SIZE (LC_AES_C_INTERNAL_SIZE + 48)
114#define LC_AES_C_CTR_MAX_BLOCK_SIZE (LC_AES_C_INTERNAL_SIZE + 48)
116#define LC_AES_ARMCE_MAX_BLOCK_SIZE (LC_AES_C_INTERNAL_SIZE * 2)
117#define LC_AES_ARMCE_XTS_MAX_BLOCK_SIZE (LC_AES_C_INTERNAL_SIZE * 3 + 16 + 1)
118#define LC_AES_ARMCE_CBC_MAX_BLOCK_SIZE (LC_AES_C_INTERNAL_SIZE * 2 + 16)
119#define LC_AES_ARMCE_CTR_MAX_BLOCK_SIZE (LC_AES_C_INTERNAL_SIZE + 16)
121#define LC_AES_AESNI_MAX_BLOCK_SIZE (LC_AES_C_INTERNAL_SIZE * 2)
122#define LC_AES_AESNI_XTS_MAX_BLOCK_SIZE (LC_AES_C_INTERNAL_SIZE * 3 + 16 + 1)
123#define LC_AES_AESNI_CBC_MAX_BLOCK_SIZE (LC_AES_C_INTERNAL_SIZE * 2 + 16)
124#define LC_AES_AESNI_CTR_MAX_BLOCK_SIZE (LC_AES_C_INTERNAL_SIZE + 16)
133#define LC_AES_XTS_CTX_ON_STACK(name) \
134 _Pragma("GCC diagnostic push") _Pragma( \
135 "GCC diagnostic ignored \"-Wdeclaration-after-statement\"") \
136 LC_ALIGNED_BUFFER(name##_ctx_buf, \
137 LC_SYM_CTX_SIZE_LEN( \
138 LC_AES_RISCV64_XTS_MAX_BLOCK_SIZE), \
139 LC_SYM_COMMON_ALIGNMENT); \
140 struct lc_sym_ctx *name = (struct lc_sym_ctx *)name##_ctx_buf; \
141 LC_SYM_SET_CTX(name, lc_aes_xts); \
143 _Pragma("GCC diagnostic pop")
151#define LC_AES_CBC_CTX_ON_STACK(name) \
152 _Pragma("GCC diagnostic push") _Pragma( \
153 "GCC diagnostic ignored \"-Wdeclaration-after-statement\"") \
154 LC_ALIGNED_BUFFER(name##_ctx_buf, \
155 LC_SYM_CTX_SIZE_LEN( \
156 LC_AES_RISCV64_CBC_MAX_BLOCK_SIZE), \
157 LC_SYM_COMMON_ALIGNMENT); \
158 struct lc_sym_ctx *name = (struct lc_sym_ctx *)name##_ctx_buf; \
159 LC_SYM_SET_CTX(name, lc_aes_cbc); \
161 _Pragma("GCC diagnostic pop")
169#define LC_AES_CTR_CTX_ON_STACK(name) \
170 _Pragma("GCC diagnostic push") _Pragma( \
171 "GCC diagnostic ignored \"-Wdeclaration-after-statement\"") \
172 LC_ALIGNED_BUFFER(name##_ctx_buf, \
173 LC_SYM_CTX_SIZE_LEN( \
174 LC_AES_RISCV64_CTR_MAX_BLOCK_SIZE), \
175 LC_SYM_COMMON_ALIGNMENT); \
176 struct lc_sym_ctx *name = (struct lc_sym_ctx *)name##_ctx_buf; \
177 LC_SYM_SET_CTX(name, lc_aes_ctr); \
179 _Pragma("GCC diagnostic pop")
187#define LC_AES_CTX_ON_STACK(name) \
188 _Pragma("GCC diagnostic push") _Pragma( \
189 "GCC diagnostic ignored \"-Wdeclaration-after-statement\"") \
192 LC_SYM_CTX_SIZE_LEN(LC_AES_AESNI_MAX_BLOCK_SIZE), \
193 LC_SYM_COMMON_ALIGNMENT); \
194 struct lc_sym_ctx *name = (struct lc_sym_ctx *)name##_ctx_buf; \
195 LC_SYM_SET_CTX(name, lc_aes); \
197 _Pragma("GCC diagnostic pop")
void lc_aes_kw_encrypt(struct lc_sym_ctx *ctx, const uint8_t *in, uint8_t *out, size_t len)
AES KW encrypt.
int lc_aes_kw_decrypt(struct lc_sym_ctx *ctx, const uint8_t *in, uint8_t *out, size_t len)
AES KW decrypt.
const struct lc_sym * lc_aes_cbc
const struct lc_sym * lc_aes_ecb
const struct lc_sym * lc_aes_kw
const struct lc_sym * lc_aes_ctr
const struct lc_sym * lc_aes
const struct lc_sym * lc_aes_xts