Line data Source code
1 : /*
2 : * AES encrypt_block
3 : *
4 : * Copyright (c) 2003-2007, Jouni Malinen <j@w1.fi>
5 : *
6 : * This software may be distributed under the terms of the BSD license.
7 : * See README for more details.
8 : */
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 : */
23 2012 : int aes_128_encrypt_block(const u8 *key, const u8 *in, u8 *out)
24 : {
25 : void *ctx;
26 2012 : ctx = aes_encrypt_init(key, 16);
27 2012 : if (ctx == NULL)
28 0 : return -1;
29 2012 : aes_encrypt(ctx, in, out);
30 2012 : aes_encrypt_deinit(ctx);
31 2012 : return 0;
32 : }
|