1 #include "crypto/axtls/crypto.h"
3 #include <gpxe/crypto.h>
6 static int aes_setkey ( void *ctx, const void *key, size_t keylen ) {
21 AES_set_key ( aesctx, key, aesctx->iv, mode );
25 static void aes_setiv ( void *ctx, const void *iv ) {
26 AES_CTX *aesctx = ctx;
28 memcpy ( aesctx->iv, iv, sizeof ( aesctx->iv ) );
31 static void aes_encrypt ( void *ctx, const void *data, void *dst,
33 AES_CTX *aesctx = ctx;
35 AES_cbc_encrypt ( aesctx, data, dst, len );
38 static void aes_decrypt ( void *ctx, const void *data, void *dst,
40 AES_CTX *aesctx = ctx;
42 AES_cbc_decrypt ( aesctx, data, dst, len );
45 struct crypto_algorithm aes_algorithm = {
47 .ctxsize = sizeof ( AES_CTX ),
51 .encode = aes_encrypt,
52 .decode = aes_decrypt,