1 #include "crypto/axtls/crypto.h"
4 #include <gpxe/crypto.h>
7 static int aes_setkey ( void *ctx
, const void *key
, size_t keylen
) {
22 AES_set_key ( aesctx
, key
, aesctx
->iv
, mode
);
26 static void aes_setiv ( void *ctx
, const void *iv
) {
27 AES_CTX
*aesctx
= ctx
;
29 memcpy ( aesctx
->iv
, iv
, sizeof ( aesctx
->iv
) );
32 static void aes_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_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_algorithm
= {
48 .ctxsize
= sizeof ( AES_CTX
),
52 .encode
= aes_encrypt
,
53 .decode
= aes_decrypt
,