2009-08-13 10:40:28 +02:00
|
|
|
/*
|
|
|
|
* AES encrypt_block
|
|
|
|
*
|
|
|
|
* Copyright (c) 2003-2007, Jouni Malinen <j@w1.fi>
|
|
|
|
*
|
2012-02-11 15:46:35 +01:00
|
|
|
* This software may be distributed under the terms of the BSD license.
|
|
|
|
* See README for more details.
|
2009-08-13 10:40:28 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "includes.h"
|
|
|
|
|
|
|
|
#include "common.h"
|
2009-08-17 19:27:25 +02:00
|
|
|
#include "aes.h"
|
2009-11-24 23:57:00 +01:00
|
|
|
#include "aes_wrap.h"
|
2009-08-13 10:40:28 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
}
|