mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-26 01:08:22 -05:00
1ba787b954
The BLOCK_SIZE define can be made more specific by using AES_ prefix and by moving it to aes.h. After this, most aes-*.c do not really need to include anything from the internal aes_i.h header file. In other words, aes_i.h can now be used only for the code that uses the internal AES block operation implementation and none of the code that can use AES implementation from an external library do not need to include this header file.
38 lines
901 B
C
38 lines
901 B
C
/*
|
|
* AES encrypt_block
|
|
*
|
|
* Copyright (c) 2003-2007, Jouni Malinen <j@w1.fi>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* Alternatively, this software may be distributed under the terms of BSD
|
|
* license.
|
|
*
|
|
* See README and COPYING for more details.
|
|
*/
|
|
|
|
#include "includes.h"
|
|
|
|
#include "common.h"
|
|
#include "aes.h"
|
|
|
|
/**
|
|
* aes_128_encrypt_block - Perform one AES 128-bit block operation
|
|
* @key: Key for AES
|
|
* @in: Input data (16 bytes)
|
|
* @out: Output of the AES block operation (16 bytes)
|
|
* Returns: 0 on success, -1 on failure
|
|
*/
|
|
int aes_128_encrypt_block(const u8 *key, const u8 *in, u8 *out)
|
|
{
|
|
void *ctx;
|
|
ctx = aes_encrypt_init(key, 16);
|
|
if (ctx == NULL)
|
|
return -1;
|
|
aes_encrypt(ctx, in, out);
|
|
aes_encrypt_deinit(ctx);
|
|
return 0;
|
|
}
|