/src/hostap/src/crypto/aes-encblock.c
Line | Count | Source |
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 | | int aes_128_encrypt_block(const u8 *key, const u8 *in, u8 *out) |
24 | 20.2k | { |
25 | 20.2k | void *ctx; |
26 | 20.2k | ctx = aes_encrypt_init(key, 16); |
27 | 20.2k | if (ctx == NULL) |
28 | 0 | return -1; |
29 | 20.2k | aes_encrypt(ctx, in, out); |
30 | 20.2k | aes_encrypt_deinit(ctx); |
31 | 20.2k | return 0; |
32 | 20.2k | } |