summaryrefslogtreecommitdiffstats
path: root/src/gsm/milenage/aes-encblock.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2011-12-06 22:23:52 +0100
committerHarald Welte <laforge@gnumonks.org>2011-12-06 22:50:31 +0100
commit781bd5daeb98774628ccb7546d449704ea6f7330 (patch)
tree64a910b7b3679b1fbedaf21d6d119b1f7b87ba0e /src/gsm/milenage/aes-encblock.c
parentd82e0eb697abab4eb994800ab649bc36cca99a83 (diff)
Auth: Import milenage implementation from hostap (Jouni Malinen)
... and add integration into the osmo_auth core.
Diffstat (limited to 'src/gsm/milenage/aes-encblock.c')
-rw-r--r--src/gsm/milenage/aes-encblock.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/gsm/milenage/aes-encblock.c b/src/gsm/milenage/aes-encblock.c
new file mode 100644
index 00000000..8f35caa2
--- /dev/null
+++ b/src/gsm/milenage/aes-encblock.c
@@ -0,0 +1,38 @@
+/*
+ * AES encrypt_block
+ *
+ * Copyright (c) 2003-2007, Jouni Malinen <j@w1.fi>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, this software may be distributed under the terms of BSD
+ * license.
+ *
+ * See README and COPYING for more details.
+ */
+
+#include "includes.h"
+
+#include "common.h"
+#include "aes.h"
+#include "aes_wrap.h"
+
+/**
+ * aes_128_encrypt_block - Perform one AES 128-bit block operation
+ * @key: Key for AES
+ * @in: Input data (16 bytes)
+ * @out: Output of the AES block operation (16 bytes)
+ * Returns: 0 on success, -1 on failure
+ */
+int aes_128_encrypt_block(const u8 *key, const u8 *in, u8 *out)
+{
+ void *ctx;
+ ctx = aes_encrypt_init(key, 16);
+ if (ctx == NULL)
+ return -1;
+ aes_encrypt(ctx, in, out);
+ aes_encrypt_deinit(ctx);
+ return 0;
+}