1 #include "crypto/axtls/crypto.h"
4 #include <gpxe/crypto.h>
7 static int aes_cbc_setkey ( void *ctx, const void *key, size_t keylen ) {
22 AES_set_key ( aesctx, key, aesctx->iv, mode );
26 static void aes_cbc_setiv ( void *ctx, const void *iv ) {
27 AES_CTX *aesctx = ctx;
29 memcpy ( aesctx->iv, iv, sizeof ( aesctx->iv ) );
32 static void aes_cbc_encrypt ( void *ctx, const void *data, void *dst,
34 AES_CTX *aesctx = ctx;
36 AES_cbc_encrypt ( aesctx, data, dst, len );
39 static void aes_cbc_decrypt ( void *ctx, const void *data, void *dst,
41 AES_CTX *aesctx = ctx;
43 AES_cbc_decrypt ( aesctx, data, dst, len );
46 struct crypto_algorithm aes_cbc_algorithm = {
48 .ctxsize = sizeof ( AES_CTX ),
50 .setkey = aes_cbc_setkey,
51 .setiv = aes_cbc_setiv,
52 .encode = aes_cbc_encrypt,
53 .decode = aes_cbc_decrypt,