~ubuntu-branches/ubuntu/utopic/moonshot-gss-eap/utopic-backports

« back to all changes in this revision

Viewing changes to libeap/src/crypto/aes-encblock.c

  • Committer: Package Import Robot
  • Author(s): Sam Hartman
  • Date: 2014-09-16 08:38:39 UTC
  • Revision ID: package-import@ubuntu.com-20140916083839-ipqco3thb1wcwvs0
Tags: upstream-0.9.2
ImportĀ upstreamĀ versionĀ 0.9.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * AES encrypt_block
 
3
 *
 
4
 * Copyright (c) 2003-2007, Jouni Malinen <j@w1.fi>
 
5
 *
 
6
 * This program is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License version 2 as
 
8
 * published by the Free Software Foundation.
 
9
 *
 
10
 * Alternatively, this software may be distributed under the terms of BSD
 
11
 * license.
 
12
 *
 
13
 * See README and COPYING for more details.
 
14
 */
 
15
 
 
16
#include "includes.h"
 
17
 
 
18
#include "common.h"
 
19
#include "aes.h"
 
20
#include "aes_wrap.h"
 
21
 
 
22
/**
 
23
 * aes_128_encrypt_block - Perform one AES 128-bit block operation
 
24
 * @key: Key for AES
 
25
 * @in: Input data (16 bytes)
 
26
 * @out: Output of the AES block operation (16 bytes)
 
27
 * Returns: 0 on success, -1 on failure
 
28
 */
 
29
int aes_128_encrypt_block(const u8 *key, const u8 *in, u8 *out)
 
30
{
 
31
        void *ctx;
 
32
        ctx = aes_encrypt_init(key, 16);
 
33
        if (ctx == NULL)
 
34
                return -1;
 
35
        aes_encrypt(ctx, in, out);
 
36
        aes_encrypt_deinit(ctx);
 
37
        return 0;
 
38
}