blob: a5216211ddd2b296f60c3aad4c9caa0d48c422c1 [file] [log] [blame]
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001/*
2 * AES encrypt_block
3 *
4 * Copyright (c) 2003-2007, Jouni Malinen <j@w1.fi>
5 *
Dmitry Shmidtc5ec7f52012-03-06 16:33:24 -08006 * This software may be distributed under the terms of the BSD license.
7 * See README for more details.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07008 */
9
10#include "includes.h"
11
12#include "common.h"
13#include "aes.h"
14#include "aes_wrap.h"
15
16/**
17 * aes_128_encrypt_block - Perform one AES 128-bit block operation
18 * @key: Key for AES
19 * @in: Input data (16 bytes)
20 * @out: Output of the AES block operation (16 bytes)
21 * Returns: 0 on success, -1 on failure
22 */
23int aes_128_encrypt_block(const u8 *key, const u8 *in, u8 *out)
24{
25 void *ctx;
26 ctx = aes_encrypt_init(key, 16);
27 if (ctx == NULL)
28 return -1;
29 aes_encrypt(ctx, in, out);
30 aes_encrypt_deinit(ctx);
31 return 0;
32}