Home | History | Annotate | Download | only in crypto
      1 /*
      2  * AES encrypt_block
      3  *
      4  * Copyright (c) 2003-2007, Jouni Malinen <j (at) 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 {
     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 }
     33