summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pjlib-util/build/Makefile2
-rw-r--r--pjlib-util/build/pjlib_util.dsp10
-rw-r--r--pjlib-util/include/pjlib-util/base64.h91
-rw-r--r--pjlib-util/src/pjlib-util-test/encryption.c103
-rw-r--r--pjlib-util/src/pjlib-util/base64.c181
-rw-r--r--pjproject-vs8.sln13
-rw-r--r--pjproject.dsw15
-rw-r--r--pjsip-apps/build/wince-evc4/wince_demos.vcw15
-rw-r--r--pjsip/build/pjsip_core.dsp8
-rw-r--r--pjsip/include/pjsip.h1
-rw-r--r--pjsip/include/pjsip/sip_auth.h103
-rw-r--r--pjsip/include/pjsip/sip_auth_aka.h91
-rw-r--r--pjsip/include/pjsip/sip_errno.h10
-rw-r--r--pjsip/include/pjsua-lib/pjsua.h16
-rw-r--r--pjsip/src/pjsip/sip_auth_aka.c121
-rw-r--r--pjsip/src/pjsip/sip_auth_client.c103
-rw-r--r--pjsip/src/pjsip/sip_errno.c2
-rw-r--r--pjsip/src/pjsua-lib/pjsua_core.c10
-rw-r--r--third_party/README.txt1
-rw-r--r--third_party/build/Makefile2
-rw-r--r--third_party/build/milenage/Makefile59
-rw-r--r--third_party/build/milenage/libmilenage.dsp108
-rw-r--r--third_party/build/milenage/libmilenage.vcp962
-rw-r--r--third_party/build/milenage/libmilenage.vcproj229
-rw-r--r--third_party/build/os-darwinos.mak1
-rw-r--r--third_party/build/os-linux.mak1
-rw-r--r--third_party/build/os-win32.mak1
-rw-r--r--third_party/milenage/milenage.c284
-rw-r--r--third_party/milenage/milenage.h35
-rw-r--r--third_party/milenage/rijndael.c440
-rw-r--r--third_party/milenage/rijndael.h26
31 files changed, 2979 insertions, 65 deletions
diff --git a/pjlib-util/build/Makefile b/pjlib-util/build/Makefile
index cf22b0f5..dd8a5646 100644
--- a/pjlib-util/build/Makefile
+++ b/pjlib-util/build/Makefile
@@ -27,7 +27,7 @@ export _LDFLAGS := $(subst /,$(HOST_PSEP),$(PJLIB_UTIL_LIB)) \
#
export PJLIB_UTIL_SRCDIR = ../src/pjlib-util
export PJLIB_UTIL_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
- crc32.o errno.o dns.o dns_dump.o getopt.o \
+ base64.o crc32.o errno.o dns.o dns_dump.o getopt.o \
hmac_md5.o hmac_sha1.o md5.o resolver.o \
scanner.o sha1.o srv_resolver.o string.o stun_simple.o \
stun_simple_client.o xml.o
diff --git a/pjlib-util/build/pjlib_util.dsp b/pjlib-util/build/pjlib_util.dsp
index 414d7f6f..825ede8e 100644
--- a/pjlib-util/build/pjlib_util.dsp
+++ b/pjlib-util/build/pjlib_util.dsp
@@ -40,6 +40,7 @@ RSC=rc.exe
# PROP Output_Dir "./output/pjlib-util-i386-win32-vc6-release"
# PROP Intermediate_Dir "./output/pjlib-util-i386-win32-vc6-release"
# PROP Target_Dir ""
+F90=df.exe
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MD /W4 /GX /Zi /O2 /Ob2 /I "../include" /I "../../pjlib/include" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D PJ_WIN32=1 /D PJ_M_I386=1 /FR /FD /c
# SUBTRACT CPP /YX
@@ -64,6 +65,7 @@ LIB32=link.exe -lib
# PROP Output_Dir "./output/pjlib-util-i386-win32-vc6-debug"
# PROP Intermediate_Dir "./output/pjlib-util-i386-win32-vc6-debug"
# PROP Target_Dir ""
+F90=df.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "../include" /I "../../pjlib/include" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D PJ_WIN32=1 /D PJ_M_I386=1 /FR /FD /GZ /c
# SUBTRACT CPP /YX
@@ -87,6 +89,10 @@ LIB32=link.exe -lib
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
+SOURCE="..\src\pjlib-util\base64.c"
+# End Source File
+# Begin Source File
+
SOURCE="..\src\pjlib-util\crc32.c"
# End Source File
# Begin Source File
@@ -169,6 +175,10 @@ SOURCE="..\src\pjlib-util\xml.c"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
+SOURCE="..\include\pjlib-util\base64.h"
+# End Source File
+# Begin Source File
+
SOURCE="..\include\pjlib-util\config.h"
# End Source File
# Begin Source File
diff --git a/pjlib-util/include/pjlib-util/base64.h b/pjlib-util/include/pjlib-util/base64.h
new file mode 100644
index 00000000..b01f918b
--- /dev/null
+++ b/pjlib-util/include/pjlib-util/base64.h
@@ -0,0 +1,91 @@
+/* $Id$ */
+/*
+ * Copyright (C) 2003-2007 Benny Prijono <benny@prijono.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#ifndef __PJLIB_UTIL_BASE64_H__
+#define __PJLIB_UTIL_BASE64_H__
+
+/**
+ * @file base64.h
+ * @brief Base64 encoding and decoding
+ */
+
+#include <pjlib-util/types.h>
+
+PJ_BEGIN_DECL
+
+/**
+ * @defgroup PJLIB_UTIL_BASE64 Base64 Encoding/Decoding
+ * @ingroup PJLIB_UTIL_ENCRYPTION
+ * @{
+ * This module implements base64 encoding and decoding.
+ */
+
+/**
+ * Helper macro to calculate the approximate length required for base256 to
+ * base64 conversion.
+ */
+#define PJ_BASE256_TO_BASE64_LEN(len) (len * 4 / 3 + 3)
+
+/**
+ * Helper macro to calculate the approximage length required for base64 to
+ * base256 conversion.
+ */
+#define PJ_BASE64_TO_BASE256_LEN(len) (len * 3 / 4)
+
+
+/**
+ * Encode a buffer into base64 encoding.
+ *
+ * @param input The input buffer.
+ * @param in_len Size of the input buffer.
+ * @param output Output buffer. Caller must allocate this buffer with
+ * the appropriate size.
+ * @param out_len On entry, it specifies the length of the output buffer.
+ * Upon return, this will be filled with the actual
+ * length of the output buffer.
+ *
+ * @return PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pj_base64_encode(const pj_uint8_t *input, int in_len,
+ char *output, int *out_len);
+
+
+/**
+ * Decode base64 string.
+ *
+ * @param input Input string.
+ * @param out Buffer to store the output. Caller must allocate
+ * this buffer with the appropriate size.
+ * @param out_len On entry, it specifies the length of the output buffer.
+ * Upon return, this will be filled with the actual
+ * length of the output.
+ */
+PJ_DECL(pj_status_t) pj_base64_decode(const pj_str_t *input,
+ pj_uint8_t *out, long *out_len);
+
+
+
+/**
+ * @}
+ */
+
+PJ_END_DECL
+
+
+#endif /* __PJLIB_UTIL_BASE64_H__ */
+
diff --git a/pjlib-util/src/pjlib-util-test/encryption.c b/pjlib-util/src/pjlib-util-test/encryption.c
index 7d91e463..8fc2f828 100644
--- a/pjlib-util/src/pjlib-util-test/encryption.c
+++ b/pjlib-util/src/pjlib-util-test/encryption.c
@@ -465,10 +465,113 @@ static int crc32_test(void)
}
+/*
+ * Base64 test vectors (RFC 4648)
+ */
+static struct base64_test_vec
+{
+ const char *base256;
+ const char *base64;
+} base64_test_vec[] =
+{
+ {
+ "",
+ ""
+ },
+ {
+ "f",
+ "Zg=="
+ },
+ {
+ "fo",
+ "Zm8="
+ },
+ {
+ "foo",
+ "Zm9v"
+ },
+ {
+ "foob",
+ "Zm9vYg=="
+ },
+ {
+ "fooba",
+ "Zm9vYmE=",
+ },
+ {
+ "foobar",
+ "Zm9vYmFy"
+ },
+ {
+ "\x14\xfb\x9c\x03\xd9\x7e",
+ "FPucA9l+"
+ },
+ {
+ "\x14\xfb\x9c\x03\xd9",
+ "FPucA9k="
+ },
+ {
+ "\x14\xfb\x9c\x03",
+ "FPucAw=="
+ }
+};
+
+
+static int base64_test(void)
+{
+ unsigned i;
+ char output[80];
+ pj_status_t rc;
+
+ PJ_LOG(3, (THIS_FILE, " base64 test.."));
+
+ for (i=0; i<PJ_ARRAY_SIZE(base64_test_vec); ++i) {
+ /* Encode test */
+ pj_str_t input;
+ int out_len = sizeof(output);
+
+ rc = pj_base64_encode(base64_test_vec[i].base256,
+ strlen(base64_test_vec[i].base256),
+ output, &out_len);
+ if (rc != PJ_SUCCESS)
+ return -90;
+
+ if (out_len != strlen(base64_test_vec[i].base64))
+ return -91;
+
+ output[out_len] = '\0';
+ if (strcmp(output, base64_test_vec[i].base64) != 0)
+ return -92;
+
+ /* Decode test */
+ out_len = sizeof(output);
+ input.ptr = base64_test_vec[i].base64;
+ input.slen = strlen(base64_test_vec[i].base64);
+ rc = pj_base64_decode(&input, (pj_uint8_t*)output, &out_len);
+ if (rc != PJ_SUCCESS)
+ return -95;
+
+ if (out_len != strlen(base64_test_vec[i].base256))
+ return -96;
+
+ output[out_len] = '\0';
+
+ if (strcmp(output, base64_test_vec[i].base256) != 0)
+ return -97;
+ }
+
+ return 0;
+}
+
+
int encryption_test()
{
int rc;
+ rc = base64_test();
+ if (rc != 0)
+ return rc;
+
rc = sha1_test1();
if (rc != 0)
return rc;
diff --git a/pjlib-util/src/pjlib-util/base64.c b/pjlib-util/src/pjlib-util/base64.c
new file mode 100644
index 00000000..7bad4b4a
--- /dev/null
+++ b/pjlib-util/src/pjlib-util/base64.c
@@ -0,0 +1,181 @@
+/* $Id$ */
+/*
+ * Copyright (C) 2003-2007 Benny Prijono <benny@prijono.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include <pjlib-util/base64.h>
+#include <pj/assert.h>
+#include <pj/errno.h>
+
+#define INV -1
+#define PADDING '='
+
+const char base64_char[] = {
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
+ 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
+ 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd',
+ 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
+ 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
+ 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', '+', '/'
+};
+
+static int base256_char(char c)
+{
+ if (c >= 'A' && c <= 'Z')
+ return (c - 'A');
+ else if (c >= 'a' && c <= 'z')
+ return (c - 'a' + 26);
+ else if (c >= '0' && c <= '9')
+ return (c - '0' + 52);
+ else if (c == '+')
+ return (62);
+ else if (c == '/')
+ return (63);
+ else {
+ pj_assert(!"Should not happen as '=' should have been filtered");
+ return INV;
+ }
+}
+
+
+static void base256to64(pj_uint8_t c1, pj_uint8_t c2, pj_uint8_t c3,
+ int padding, char *output)
+{
+ *output++ = base64_char[c1>>2];
+ *output++ = base64_char[((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4)];
+ switch (padding) {
+ case 0:
+ *output++ = base64_char[((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6)];
+ *output = base64_char[c3 & 0x3F];
+ break;
+ case 1:
+ *output++ = base64_char[((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6)];
+ *output = PADDING;
+ break;
+ case 2:
+ default:
+ *output++ = PADDING;
+ *output = PADDING;
+ break;
+ }
+}
+
+
+PJ_DEF(pj_status_t) pj_base64_encode(const pj_uint8_t *input, int in_len,
+ char *output, int *out_len)
+{
+ const pj_uint8_t *pi = input;
+ pj_uint8_t c1, c2, c3;
+ int i = 0;
+ char *po = output;
+
+ PJ_ASSERT_RETURN(input && output && out_len, PJ_EINVAL);
+ PJ_ASSERT_RETURN(*out_len >= PJ_BASE256_TO_BASE64_LEN(in_len),
+ PJ_ETOOSMALL);
+
+ while (i < in_len) {
+ c1 = *pi++;
+ ++i;
+
+ if (i == in_len) {
+ base256to64(c1, 0, 0, 2, po);
+ po += 4;
+ break;
+ } else {
+ c2 = *pi++;
+ ++i;
+
+ if (i == in_len) {
+ base256to64(c1, c2, 0, 1, po);
+ po += 4;
+ break;
+ } else {
+ c3 = *pi++;
+ ++i;
+ base256to64(c1, c2, c3, 0, po);
+ }
+ }
+
+ po += 4;
+ }
+
+ *out_len = po - output;
+ return PJ_SUCCESS;
+}
+
+
+PJ_DEF(pj_status_t) pj_base64_decode(const pj_str_t *input,
+ pj_uint8_t *out, long *out_len)
+{
+ const char *buf = input->ptr;
+ int len = input->slen;
+ int i, j;
+ int c1, c2, c3, c4;
+
+ PJ_ASSERT_RETURN(input && out && out_len, PJ_EINVAL);
+
+ while (buf[len-1] == '=' && len)
+ --len;
+
+ PJ_ASSERT_RETURN(*out_len >= PJ_BASE64_TO_BASE256_LEN(len),
+ PJ_ETOOSMALL);
+
+ for (i=0, j=0; i+3 < len; i+=4) {
+ c1 = base256_char(buf[i]);
+ c2 = base256_char(buf[i+1]);
+ c3 = base256_char(buf[i+2]);
+ c4 = base256_char(buf[i+3]);
+
+ out[j++] = (pj_uint8_t)((c1<<2) | ((c2 & 0x30)>>4));
+ out[j++] = (pj_uint8_t)(((c2 & 0x0F)<<4) | ((c3 & 0x3C)>>2));
+ out[j++] = (pj_uint8_t)(((c3 & 0x03)<<6) | (c4 & 0x3F));
+ }
+
+ if (i < len) {
+ c1 = base256_char(buf[i]);
+
+ if (i+1 < len)
+ c2 = base256_char(buf[i+1]);
+ else
+ c2 = (INV);
+
+ if (i+2 < len)
+ c3 = base256_char(buf[i+2]);
+ else
+ c3 = (INV);
+
+ c4 = (INV);
+
+ if (c2 != INV) {
+ out[j++] = (pj_uint8_t)((c1<<2) | ((c2 & 0x30)>>4));
+ if (c3 != INV) {
+ out[j++] = (pj_uint8_t)(((c2 & 0x0F)<<4) | ((c3 & 0x3C)>>2));
+ if (c4 != INV) {
+ out[j++] = (pj_uint8_t)(((c3 & 0x03)<<6) | (c4 & 0x3F));
+ }
+ }
+ }
+
+ }
+
+ pj_assert(j < *out_len);
+ *out_len = j;
+
+ return PJ_SUCCESS;
+}
+
+
diff --git a/pjproject-vs8.sln b/pjproject-vs8.sln
index c4d2b4c6..50820bd1 100644
--- a/pjproject-vs8.sln
+++ b/pjproject-vs8.sln
@@ -28,6 +28,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjsip_ua", "pjsip\build\pjs
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjsua", "pjsip-apps\build\pjsua.vcproj", "{8310649E-A25E-4AF0-91E8-9E3CC659BB89}"
ProjectSection(ProjectDependencies) = postProject
+ {2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031}
+ {4BF51C21-5A30-423B-82FE-1ED410E5769D} = {4BF51C21-5A30-423B-82FE-1ED410E5769D}
{E53AA5FF-B737-40AA-BD13-387EFA99023D} = {E53AA5FF-B737-40AA-BD13-387EFA99023D}
{9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37}
{B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} = {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D}
@@ -41,15 +43,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjsua", "pjsip-apps\build\p
{6794B975-4E84-4F49-B2DC-C31F2224E03E} = {6794B975-4E84-4F49-B2DC-C31F2224E03E}
{FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693}
{A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} = {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4}
- {2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjsua_lib", "pjsip\build\pjsua_lib.vcproj", "{9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample_debug", "pjsip-apps\build\sample_debug.vcproj", "{A0F1AA62-0F6F-420D-B09A-AC04B6862821}"
ProjectSection(ProjectDependencies) = postProject
- {2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031}
- {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} = {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4}
{E53AA5FF-B737-40AA-BD13-387EFA99023D} = {E53AA5FF-B737-40AA-BD13-387EFA99023D}
{9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37}
{B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} = {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D}
@@ -62,6 +61,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample_debug", "pjsip-apps\
{7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65}
{6794B975-4E84-4F49-B2DC-C31F2224E03E} = {6794B975-4E84-4F49-B2DC-C31F2224E03E}
{FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693}
+ {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} = {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4}
+ {2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "samples", "pjsip-apps\build\samples.vcproj", "{E378A1FC-0C9C-4462-860F-7E60BC1BF84E}"
@@ -102,6 +103,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspeex", "third_party\bui
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libresample_dll", "third_party\build\resample\libresample_dll.vcproj", "{C48EAAF5-F69E-410B-9CE4-23AB41B00E2A}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmilenage", "third_party\build\milenage\libmilenage.vcproj", "{4BF51C21-5A30-423B-82FE-1ED410E5769D}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -192,6 +195,10 @@ Global
{C48EAAF5-F69E-410B-9CE4-23AB41B00E2A}.Debug|Win32.Build.0 = Debug|Win32
{C48EAAF5-F69E-410B-9CE4-23AB41B00E2A}.Release|Win32.ActiveCfg = Release|Win32
{C48EAAF5-F69E-410B-9CE4-23AB41B00E2A}.Release|Win32.Build.0 = Release|Win32
+ {4BF51C21-5A30-423B-82FE-1ED410E5769D}.Debug|Win32.ActiveCfg = Debug|Win32
+ {4BF51C21-5A30-423B-82FE-1ED410E5769D}.Debug|Win32.Build.0 = Debug|Win32
+ {4BF51C21-5A30-423B-82FE-1ED410E5769D}.Release|Win32.ActiveCfg = Release|Win32
+ {4BF51C21-5A30-423B-82FE-1ED410E5769D}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/pjproject.dsw b/pjproject.dsw
index 16d0bebe..63860798 100644
--- a/pjproject.dsw
+++ b/pjproject.dsw
@@ -27,6 +27,18 @@ Package=<4>
###############################################################################
+Project: "libmilenage"=.\third_party\build\milenage\libmilenage.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
Project: "libportaudio"=.\THIRD_PARTY\BUILD\PORTAUDIO\libportaudio.dsp - Package Owner=<4>
Package=<5>
@@ -254,6 +266,9 @@ Package=<4>
Begin Project Dependency
Project_Dep_Name libresample
End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libmilenage
+ End Project Dependency
}}}
###############################################################################
diff --git a/pjsip-apps/build/wince-evc4/wince_demos.vcw b/pjsip-apps/build/wince-evc4/wince_demos.vcw
index 73ee60cf..cea9ca49 100644
--- a/pjsip-apps/build/wince-evc4/wince_demos.vcw
+++ b/pjsip-apps/build/wince-evc4/wince_demos.vcw
@@ -27,6 +27,18 @@ Package=<4>
###############################################################################
+Project: "libmilenage"="..\..\..\third_party\build\milenage\libmilenage.vcp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
Project: "libportaudio"="..\..\..\THIRD_PARTY\BUILD\PORTAUDIO\libportaudio.vcp" - Package Owner=<4>
Package=<5>
@@ -242,6 +254,9 @@ Package=<4>
Begin Project Dependency
Project_Dep_Name libspeex
End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libmilenage
+ End Project Dependency
}}}
###############################################################################
diff --git a/pjsip/build/pjsip_core.dsp b/pjsip/build/pjsip_core.dsp
index 2cd4fc06..245985a2 100644
--- a/pjsip/build/pjsip_core.dsp
+++ b/pjsip/build/pjsip_core.dsp
@@ -164,6 +164,10 @@ SOURCE=..\src\pjsip\sip_transport_udp.c
# PROP Default_Filter ""
# Begin Source File
+SOURCE=..\src\pjsip\sip_auth_aka.c
+# End Source File
+# Begin Source File
+
SOURCE=..\src\pjsip\sip_auth_client.c
# End Source File
# Begin Source File
@@ -308,6 +312,10 @@ SOURCE=..\include\pjsip\sip_auth.h
# End Source File
# Begin Source File
+SOURCE=..\include\pjsip\sip_auth_aka.h
+# End Source File
+# Begin Source File
+
SOURCE=..\include\pjsip\sip_auth_msg.h
# End Source File
# Begin Source File
diff --git a/pjsip/include/pjsip.h b/pjsip/include/pjsip.h
index 867bb1e5..3e9b4137 100644
--- a/pjsip/include/pjsip.h
+++ b/pjsip/include/pjsip.h
@@ -45,6 +45,7 @@
/* Authentication. */
#include <pjsip/sip_auth.h>
+#include <pjsip/sip_auth_aka.h>
/* Transaction layer. */
#include <pjsip/sip_transaction.h>
diff --git a/pjsip/include/pjsip/sip_auth.h b/pjsip/include/pjsip/sip_auth.h
index 1ae6c1f6..521adfaa 100644
--- a/pjsip/include/pjsip/sip_auth.h
+++ b/pjsip/include/pjsip/sip_auth.h
@@ -46,11 +46,14 @@ PJ_BEGIN_DECL
#define PJSIP_MD5STRLEN 32
-/** Type of data in the credential information. */
+/** Type of data in the credential information in #pjsip_cred_info. */
typedef enum pjsip_cred_data_type
{
- PJSIP_CRED_DATA_PLAIN_PASSWD, /**< Plain text password. */
- PJSIP_CRED_DATA_DIGEST /**< Hashed digest. */
+ PJSIP_CRED_DATA_PLAIN_PASSWD=0, /**< Plain text password. */
+ PJSIP_CRED_DATA_DIGEST =1, /**< Hashed digest. */
+
+ PJSIP_CRED_DATA_EXT_AKA =16 /**< Extended AKA info is available */
+
} pjsip_cred_data_type;
/** Authentication's quality of protection (qop) type. */
@@ -63,13 +66,43 @@ typedef enum pjsip_auth_qop_type
} pjsip_auth_qop_type;
+/**
+ * Type of callback function to create authentication response.
+ * Application can specify this callback in \a cb field of the credential info
+ * (#pjsip_cred_info) and specifying PJSIP_CRED_DATA_DIGEST_CALLBACK as
+ * \a data_type. When this function is called, most of the fields in the
+ * \a auth authentication response will have been filled by the framework.
+ * Application normally should just need to calculate the response digest
+ * of the authentication response.
+ *
+ * @param pool Pool to allocate memory from if application needs to.
+ * @param chal The authentication challenge sent by server in 401
+ * or 401 response, in either Proxy-Authenticate or
+ * WWW-Authenticate header.
+ * @param cred The credential that has been selected by the framework
+ * to authenticate against the challenge.
+ * @param auth The authentication response which application needs to
+ * calculate the response digest.
+ *
+ * @return Application may return non-PJ_SUCCESS to abort the
+ * authentication process. When this happens, the
+ * framework will return failure to the original function
+ * that requested authentication.
+ */
+typedef pj_status_t (*pjsip_cred_cb)(pj_pool_t *pool,
+ const pjsip_digest_challenge *chal,
+ const pjsip_cred_info *cred,
+ const pj_str_t *method,
+ pjsip_digest_credential *auth);
+
+
/**
* This structure describes credential information.
* A credential information is a static, persistent information that identifies
* username and password required to authorize to a specific realm.
*
* Note that since PJSIP 0.7.0.1, it is possible to make a credential that is
- * valid for any realms, by setting the realm to star/asterisk character,
+ * valid for any realms, by setting the realm to star/wildcard character,
* i.e. realm = pj_str("*");.
*/
struct pjsip_cred_info
@@ -82,6 +115,21 @@ struct pjsip_cred_info
int data_type; /**< Type of data (0 for plaintext passwd). */
pj_str_t data; /**< The data, which can be a plaintext
password or a hashed digest. */
+
+ /** Extended data */
+ union {
+ /** Digest AKA credential information. Note that when AKA credential
+ * is being used, the \a data field of this #pjsip_cred_info is
+ * not used, but it still must be initialized to an empty string.
+ */
+ struct {
+ pj_str_t k; /**< Permanent key. */
+ pj_str_t op; /**< Operator variant key. */
+ pj_str_t amf; /**< Authentication Management Field */
+ pjsip_cred_cb cb; /**< Callback to create AKA digest. */
+ } aka;
+
+ } ext;
};
/**
@@ -150,6 +198,17 @@ typedef struct pjsip_auth_clt_sess
/**
+ * Duplicate a credential info.
+ *
+ * @param pool The memory pool.
+ * @param dst Destination credential.
+ * @param src Source credential.
+ */
+PJ_DECL(void) pjsip_cred_info_dup(pj_pool_t *pool,
+ pjsip_cred_info *dst,
+ const pjsip_cred_info *src);
+
+/**
* Type of function to lookup credential for the specified name.
*
* @param pool Pool to initialize the credential info.
@@ -349,22 +408,36 @@ PJ_DECL(pj_status_t) pjsip_auth_srv_challenge( pjsip_auth_srv *auth_srv,
pj_bool_t stale,
pjsip_tx_data *tdata);
+/**
+ * Helper function to create MD5 digest out of the specified
+ * parameters.
+ *
+ * @param result String to store the response digest. This string
+ * must have been preallocated by caller with the
+ * buffer at least PJSIP_MD5STRLEN (32 bytes) in size.
+ * @param nonce Optional nonce.
+ * @param nc Nonce count.
+ * @param cnonce Optional cnonce.
+ * @param qop Optional qop.
+ * @param uri URI.
+ * @param realm Realm.
+ * @param cred_info Credential info.
+ * @param method SIP method.
+ */
+PJ_DECL(void) pjsip_auth_create_digest(pj_str_t *result,
+ const pj_str_t *nonce,
+ const pj_str_t *nc,
+ const pj_str_t *cnonce,
+ const pj_str_t *qop,
+ const pj_str_t *uri,
+ const pj_str_t *realm,
+ const pjsip_cred_info *cred_info,
+ const pj_str_t *method);
/**
* @}
*/
-/* Internal function defined in sip_auth_client.c */
-void pjsip_auth_create_digest( pj_str_t *result,
- const pj_str_t *nonce,
- const pj_str_t *nc,
- const pj_str_t *cnonce,
- const pj_str_t *qop,
- const pj_str_t *uri,
- const pj_str_t *realm,
- const pjsip_cred_info *cred_info,
- const pj_str_t *method);
-
PJ_END_DECL
diff --git a/pjsip/include/pjsip/sip_auth_aka.h b/pjsip/include/pjsip/sip_auth_aka.h
new file mode 100644
index 00000000..c5c2a60d
--- /dev/null
+++ b/pjsip/include/pjsip/sip_auth_aka.h
@@ -0,0 +1,91 @@
+/* $Id$ */
+/*
+ * Copyright (C) 2003-2007 Benny Prijono <benny@prijono.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#ifndef __PJSIP_AUTH_SIP_AUTH_AKA_H__
+#define __PJSIP_AUTH_SIP_AUTH_AKA_H__
+
+/**
+ * @file sip_auth_aka.h
+ * @brief SIP Digest AKA Authorization Module.
+ */
+
+#include <pjsip/sip_auth.h>
+
+PJ_BEGIN_DECL
+
+/**
+ * @defgroup PJSIP_AUTH_AKA_API Digest AKA Authentication API's
+ * @ingroup PJSIP_AUTH_API
+ * @brief Digest AKA helper API.
+ * @{
+ *
+ * This module currently exports one function, #pjsip_auth_create_akav1_response(),
+ * which can be registered as the callback function in \a ext.aka.cb field
+ * of #pjsip_cred_info structure, to calculate the MD5-AKAv1 digest
+ * response.
+ */
+
+
+#define PJSIP_AKA_AKLEN 6
+#define PJSIP_AKA_AMFLEN 2
+#define PJSIP_AKA_AUTNLEN 16
+#define PJSIP_AKA_CKLEN 16
+#define PJSIP_AKA_IKLEN 16
+#define PJSIP_AKA_KLEN 16
+#define PJSIP_AKA_OPLEN 16
+#define PJSIP_AKA_RANDLEN 16
+#define PJSIP_AKA_RESLEN 8
+#define PJSIP_AKA_MACLEN 8
+
+/**
+ * This function creates MD5 AKAv1 response for the specified challenge
+ * in \a chal, based on the information in the credential \a cred.
+ * Application may register this function as \a ext.aka.cb field of
+ * #pjsip_cred_info structure to make PJSIP automatically call this
+ * function to calculate the response digest.
+ *
+ * @param pool Pool to allocate memory.
+ * @param chal The authentication challenge sent by server in 401
+ * or 401 response, in either Proxy-Authenticate or
+ * WWW-Authenticate header.
+ * @param cred The credential that has been selected by the framework
+ * to authenticate against the challenge.
+ * @param method The request method.
+ * @param auth The authentication credential where the digest response
+ * will be placed to.
+ *
+ * @return PJ_SUCCESS if response has been created successfully.
+ */
+PJ_DECL(pj_status_t) pjsip_auth_create_akav1(pj_pool_t *pool,
+ const pjsip_digest_challenge*chal,
+ const pjsip_cred_info *cred,
+ const pj_str_t *method,
+ pjsip_digest_credential *auth);
+
+
+/**
+ * @}
+ */
+
+
+
+PJ_END_DECL
+
+
+#endif /* __PJSIP_AUTH_SIP_AUTH_AKA_H__ */
+
diff --git a/pjsip/include/pjsip/sip_errno.h b/pjsip/include/pjsip/sip_errno.h
index 0e5ae2f1..0b793a9c 100644
--- a/pjsip/include/pjsip/sip_errno.h
+++ b/pjsip/include/pjsip/sip_errno.h
@@ -381,6 +381,16 @@ PJ_BEGIN_DECL
* keeps rejecting our authorization request with stale=true.
*/
#define PJSIP_EAUTHSTALECOUNT (PJSIP_ERRNO_START_PJSIP + 111) /* 171111 */
+/**
+ * @hideinitializer
+ * Invalid nonce value in the challenge.
+ */
+#define PJSIP_EAUTHINNONCE (PJSIP_ERRNO_START_PJSIP + 112) /* 171112 */
+/**
+ * @hideinitializer
+ * Invalid AKA credential.
+ */
+#define PJSIP_EAUTHINAKACRED (PJSIP_ERRNO_START_PJSIP + 113) /* 171113 */
/************************************************************
diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h
index fad79178..91856d2c 100644
--- a/pjsip/include/pjsua-lib/pjsua.h
+++ b/pjsip/include/pjsua-lib/pjsua.h
@@ -1029,20 +1029,8 @@ typedef struct pjsua_config
PJ_DECL(void) pjsua_config_default(pjsua_config *cfg);
-/**
- * Duplicate credential.
- *
- * @param pool The memory pool.
- * @param dst Destination credential.
- * @param src Source credential.
- *
- * \par Python:
- * Not applicable (for now). Probably we could just assign one credential
- * variable to another, but this has not been tested.
- */
-PJ_DECL(void) pjsip_cred_dup( pj_pool_t *pool,
- pjsip_cred_info *dst,
- const pjsip_cred_info *src);
+/* The implementation has been moved to sip_auth.h */
+#define pjsip_cred_dup pjsip_cred_info_dup
/**
diff --git a/pjsip/src/pjsip/sip_auth_aka.c b/pjsip/src/pjsip/sip_auth_aka.c
new file mode 100644
index 00000000..b88ddb7c
--- /dev/null
+++ b/pjsip/src/pjsip/sip_auth_aka.c
@@ -0,0 +1,121 @@
+/* $Id$ */
+/*
+ * Copyright (C) 2003-2007 Benny Prijono <benny@prijono.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include <pjsip/sip_auth_aka.h>
+#include <pjsip/sip_errno.h>
+#include <pjlib-util/base64.h>
+#include <pjlib-util/md5.h>
+#include <pj/assert.h>
+#include <pj/log.h>
+#include <pj/pool.h>
+#include <pj/string.h>
+
+#include "../../third_party/milenage/milenage.h"
+
+/*
+ * Create MD5-AKA1 digest response.
+ */
+PJ_DEF(pj_status_t) pjsip_auth_create_akav1( pj_pool_t *pool,
+ const pjsip_digest_challenge*chal,
+ const pjsip_cred_info *cred,
+ const pj_str_t *method,
+ pjsip_digest_credential *auth)
+{
+ pj_str_t nonce_bin;
+ pj_uint8_t *chal_rand, *chal_autn, *chal_mac;
+ pj_uint8_t res[PJSIP_AKA_RESLEN];
+ pj_uint8_t ck[PJSIP_AKA_CKLEN];
+ pj_uint8_t ik[PJSIP_AKA_IKLEN];
+ pj_uint8_t ak[PJSIP_AKA_AKLEN];
+ pj_uint8_t sqn[PJSIP_AKA_AUTNLEN];
+ pj_uint8_t xmac[PJSIP_AKA_MACLEN];
+ pjsip_cred_info aka_cred;
+ int i;
+ pj_status_t status;
+
+ /* Check the algorithm is supported. */
+ if (pj_stricmp2(&chal->algorithm, "md5") == 0) {
+ pjsip_auth_create_digest(&auth->response, &auth->nonce, &auth->nc,
+ &auth->cnonce, &auth->qop, &auth->uri,
+ &auth->realm, cred, method);
+ return PJ_SUCCESS;
+
+ } else if (pj_stricmp2(&chal->algorithm, "AKAv1-MD5") != 0) {
+ /* Unsupported algorithm */
+ return PJSIP_EINVALIDALGORITHM;
+ }
+
+ /* Decode nonce */
+ nonce_bin.slen = PJ_BASE64_TO_BASE256_LEN(chal->nonce.slen);
+ nonce_bin.ptr = pj_pool_alloc(pool, nonce_bin.slen + 1);
+ status = pj_base64_decode(&chal->nonce, (pj_uint8_t*)nonce_bin.ptr,
+ &nonce_bin.slen);
+ if (status != PJ_SUCCESS)
+ return PJSIP_EAUTHINNONCE;
+
+ if (nonce_bin.slen < PJSIP_AKA_RANDLEN + PJSIP_AKA_AUTNLEN + PJSIP_AKA_MACLEN)
+ return PJSIP_EAUTHINNONCE;
+
+ /* Get RAND, AUTN, and MAC */
+ chal_rand = (pj_uint8_t*) (nonce_bin.ptr + 0);
+ chal_autn = (pj_uint8_t*) (nonce_bin.ptr + PJSIP_AKA_RANDLEN);
+ chal_mac = (pj_uint8_t*) (nonce_bin.ptr + PJSIP_AKA_RANDLEN + PJSIP_AKA_AUTNLEN);
+
+ /* Verify credential */
+ PJ_ASSERT_RETURN(cred->ext.aka.k.slen == PJSIP_AKA_KLEN, PJSIP_EAUTHINAKACRED);
+ PJ_ASSERT_RETURN(cred->ext.aka.op.slen == PJSIP_AKA_OPLEN, PJSIP_EAUTHINAKACRED);
+
+ /* Given key K and random challenge RAND, compute response RES,
+ * confidentiality key CK, integrity key IK and anonymity key AK.
+ */
+ f2345((pj_uint8_t*)cred->ext.aka.k.ptr,
+ chal_rand,
+ res, ck, ik, ak,
+ (pj_uint8_t*)cred->ext.aka.op.ptr);
+
+ /* Compute sequence number SQN */
+ for (i=0; i<PJSIP_AKA_AUTNLEN; ++i)
+ sqn[i] = (pj_uint8_t) (chal_autn[i] ^ ak[i]);
+
+ /* Compute XMAC */
+ f1((pj_uint8_t*)cred->ext.aka.k.ptr, chal_rand, sqn,
+ (pj_uint8_t*)cred->ext.aka.amf.ptr, xmac,
+ (pj_uint8_t*)cred->ext.aka.op.ptr);
+
+ /* Verify MAC in the challenge */
+ if (pj_memcmp(chal_mac, xmac, PJSIP_AKA_MACLEN) != 0) {
+ return PJSIP_EAUTHINNONCE;
+ }
+
+ /* Build a temporary credential info to create MD5 digest, using
+ * "res" as the password.
+ */
+ pj_memcpy(&aka_cred, cred, sizeof(aka_cred));
+ aka_cred.data_type = PJSIP_CRED_DATA_PLAIN_PASSWD;
+ aka_cred.data.ptr = (char*)res;
+ aka_cred.data.slen = PJSIP_AKA_RESLEN;
+
+ /* Create a response */
+ pjsip_auth_create_digest(&auth->response, &chal->nonce,
+ &auth->nc, &auth->cnonce, &auth->qop, &auth->uri,
+ &chal->realm, &aka_cred, method);
+
+ /* Done */
+ return PJ_SUCCESS;
+}
+
diff --git a/pjsip/src/pjsip/sip_auth_client.c b/pjsip/src/pjsip/sip_auth_client.c
index 7978da27..88cd3e94 100644
--- a/pjsip/src/pjsip/sip_auth_client.c
+++ b/pjsip/src/pjsip/sip_auth_client.c
@@ -19,6 +19,7 @@
#include <pjsip/sip_auth.h>
#include <pjsip/sip_auth_parser.h> /* just to get pjsip_DIGEST_STR */
+#include <pjsip/sip_auth_aka.h>
#include <pjsip/sip_transport.h>
#include <pjsip/sip_endpoint.h>
#include <pjsip/sip_errno.h>
@@ -43,6 +44,28 @@
# define AUTH_TRACE_(expr)
#endif
+#define PASSWD_MASK 0x000F
+#define EXT_MASK 0x00F0
+
+
+PJ_DEF(void) pjsip_cred_info_dup(pj_pool_t *pool,
+ pjsip_cred_info *dst,
+ const pjsip_cred_info *src)
+{
+ pj_memcpy(dst, src, sizeof(pjsip_cred_info));
+
+ pj_strdup_with_null(pool, &dst->realm, &src->realm);
+ pj_strdup_with_null(pool, &dst->scheme, &src->scheme);
+ pj_strdup_with_null(pool, &dst->username, &src->username);
+ pj_strdup_with_null(pool, &dst->data, &src->data);
+
+ if ((dst->data_type & EXT_MASK) == PJSIP_CRED_DATA_EXT_AKA) {
+ pj_strdup(pool, &dst->ext.aka.k, &src->ext.aka.k);
+ pj_strdup(pool, &dst->ext.aka.op, &src->ext.aka.op);
+ pj_strdup(pool, &dst->ext.aka.amf, &src->ext.aka.amf);
+ }
+}
+
/* Transform digest to string.
* output must be at least PJSIP_MD5STRLEN+1 bytes.
@@ -63,15 +86,15 @@ static void digest2str(const unsigned char digest[], char *output)
* Create response digest based on the parameters and store the
* digest ASCII in 'result'.
*/
-void pjsip_auth_create_digest( pj_str_t *result,
- const pj_str_t *nonce,
- const pj_str_t *nc,
- const pj_str_t *cnonce,
- const pj_str_t *qop,
- const pj_str_t *uri,
- const pj_str_t *realm,
- const pjsip_cred_info *cred_info,
- const pj_str_t *method)
+PJ_DEF(void) pjsip_auth_create_digest( pj_str_t *result,
+ const pj_str_t *nonce,
+ const pj_str_t *nc,
+ const pj_str_t *cnonce,
+ const pj_str_t *qop,
+ const pj_str_t *uri,
+ const pj_str_t *realm,
+ const pjsip_cred_info *cred_info,
+ const pj_str_t *method)
{
char ha1[PJSIP_MD5STRLEN];
char ha2[PJSIP_MD5STRLEN];
@@ -82,7 +105,7 @@ void pjsip_auth_create_digest( pj_str_t *result,
AUTH_TRACE_((THIS_FILE, "Begin creating digest"));
- if (cred_info->data_type == PJSIP_CRED_DATA_PLAIN_PASSWD) {
+ if ((cred_info->data_type & PASSWD_MASK) == PJSIP_CRED_DATA_PLAIN_PASSWD) {
/***
*** ha1 = MD5(username ":" realm ":" password)
***/
@@ -96,9 +119,11 @@ void pjsip_auth_create_digest( pj_str_t *result,
digest2str(digest, ha1);
- } else if (cred_info->data_type == PJSIP_CRED_DATA_DIGEST) {
+ } else if ((cred_info->data_type & PASSWD_MASK) == PJSIP_CRED_DATA_DIGEST) {
pj_assert(cred_info->data.slen == 32);
pj_memcpy( ha1, cred_info->data.ptr, cred_info->data.slen );
+ } else {
+ pj_assert(!"Invalid data_type");
}
AUTH_TRACE_((THIS_FILE, " ha1=%.32s", ha1));
@@ -220,9 +245,17 @@ static pj_status_t respond_digest( pj_pool_t *pool,
if (chal->qop.slen == 0) {
/* Server doesn't require quality of protection. */
- /* Convert digest to string and store in chal->response. */
- pjsip_auth_create_digest( &cred->response, &cred->nonce, NULL, NULL,
- NULL, uri, &chal->realm, cred_info, method);
+ if ((cred_info->data_type & EXT_MASK) == PJSIP_CRED_DATA_EXT_AKA) {
+ /* Call application callback to create the response digest */
+ return (*cred_info->ext.aka.cb)(pool, chal, cred_info,
+ method, cred);
+ }
+ else {
+ /* Convert digest to string and store in chal->response. */
+ pjsip_auth_create_digest( &cred->response, &cred->nonce, NULL,
+ NULL, NULL, uri, &chal->realm,
+ cred_info, method);
+ }
} else if (has_auth_qop(pool, &chal->qop)) {
/* Server requires quality of protection.
@@ -239,9 +272,16 @@ static pj_status_t respond_digest( pj_pool_t *pool,
pj_strdup(pool, &cred->cnonce, &dummy_cnonce);
}
- pjsip_auth_create_digest( &cred->response, &cred->nonce, &cred->nc,
- cnonce, &pjsip_AUTH_STR, uri, &chal->realm,
- cred_info, method );
+ if ((cred_info->data_type & EXT_MASK) == PJSIP_CRED_DATA_EXT_AKA) {
+ /* Call application callback to create the response digest */
+ return (*cred_info->ext.aka.cb)(pool, chal, cred_info,
+ method, cred);
+ }
+ else {
+ pjsip_auth_create_digest( &cred->response, &cred->nonce,
+ &cred->nc, cnonce, &pjsip_AUTH_STR,
+ uri, &chal->realm, cred_info, method );
+ }
} else {
/* Server requires quality protection that we don't support. */
@@ -424,6 +464,35 @@ PJ_DEF(pj_status_t) pjsip_auth_clt_set_credentials( pjsip_auth_clt_sess *sess,
pj_pool_alloc(sess->pool, cred_cnt * sizeof(*c));
for (i=0; i<cred_cnt; ++i) {
sess->cred_info[i].data_type = c[i].data_type;
+
+ /* When data_type is PJSIP_CRED_DATA_EXT_AKA,
+ * callback must be specified.
+ */
+ if ((c[i].data_type & EXT_MASK) == PJSIP_CRED_DATA_EXT_AKA) {
+ /* Callback must be specified */
+ PJ_ASSERT_RETURN(c[i].ext.aka.cb != NULL, PJ_EINVAL);
+
+ /* Verify K len */
+ PJ_ASSERT_RETURN(c[i].ext.aka.k.slen == PJSIP_AKA_KLEN,
+ PJSIP_EAUTHINAKACRED);
+
+ /* Verify OP len */
+ PJ_ASSERT_RETURN(c[i].ext.aka.op.slen == PJSIP_AKA_OPLEN,
+ PJSIP_EAUTHINAKACRED);
+
+ /* Verify AMF len */
+ PJ_ASSERT_RETURN(c[i].ext.aka.amf.slen == PJSIP_AKA_AMFLEN,
+ PJSIP_EAUTHINAKACRED);
+
+ sess->cred_info[i].ext.aka.cb = c[i].ext.aka.cb;
+ pj_strdup(sess->pool, &sess->cred_info[i].ext.aka.k,
+ &c[i].ext.aka.k);
+ pj_strdup(sess->pool, &sess->cred_info[i].ext.aka.op,
+ &c[i].ext.aka.op);
+ pj_strdup(sess->pool, &sess->cred_info[i].ext.aka.amf,
+ &c[i].ext.aka.amf);
+ }
+
pj_strdup(sess->pool, &sess->cred_info[i].scheme, &c[i].scheme);
pj_strdup(sess->pool, &sess->cred_info[i].realm, &c[i].realm);
pj_strdup(sess->pool, &sess->cred_info[i].username, &c[i].username);
diff --git a/pjsip/src/pjsip/sip_errno.c b/pjsip/src/pjsip/sip_errno.c
index dd2724e9..2a6e9306 100644
--- a/pjsip/src/pjsip/sip_errno.c
+++ b/pjsip/src/pjsip/sip_errno.c
@@ -102,6 +102,8 @@ static const struct
PJ_BUILD_ERR( PJSIP_EAUTHINVALIDREALM, "Invalid authorization realm"),
PJ_BUILD_ERR( PJSIP_EAUTHINVALIDDIGEST,"Invalid authorization digest" ),
PJ_BUILD_ERR( PJSIP_EAUTHSTALECOUNT, "Maximum number of stale retries exceeded"),
+ PJ_BUILD_ERR( PJSIP_EAUTHINNONCE, "Invalid nonce value in authentication challenge"),
+ PJ_BUILD_ERR( PJSIP_EAUTHINAKACRED, "Invalid AKA credential"),
/* UA/dialog layer. */
PJ_BUILD_ERR( PJSIP_EMISSINGTAG, "Missing From/To tag parameter" ),
diff --git a/pjsip/src/pjsua-lib/pjsua_core.c b/pjsip/src/pjsua-lib/pjsua_core.c
index 80617605..29cee191 100644
--- a/pjsip/src/pjsua-lib/pjsua_core.c
+++ b/pjsip/src/pjsua-lib/pjsua_core.c
@@ -81,16 +81,6 @@ PJ_DEF(void) pjsua_config_default(pjsua_config *cfg)
cfg->thread_cnt = 1;
}
-PJ_DEF(void) pjsip_cred_dup( pj_pool_t *pool,
- pjsip_cred_info *dst,
- const pjsip_cred_info *src)
-{
- pj_strdup_with_null(pool, &dst->realm, &src->realm);
- pj_strdup_with_null(pool, &dst->scheme, &src->scheme);
- pj_strdup_with_null(pool, &dst->username, &src->username);
- pj_strdup_with_null(pool, &dst->data, &src->data);
-}
-
PJ_DEF(void) pjsua_config_dup(pj_pool_t *pool,
pjsua_config *dst,
const pjsua_config *src)
diff --git a/third_party/README.txt b/third_party/README.txt
index b53b7afc..cb0a93ea 100644
--- a/third_party/README.txt
+++ b/third_party/README.txt
@@ -15,5 +15,4 @@ speex: SVN -r12832
portaudio: SVN -r1186
gsm: gsm-1.0.12
ilbc: from RFC
-plc_steveu: Steve Underwood's PLC
resample: lib-resample, I think version 1.7
diff --git a/third_party/build/Makefile b/third_party/build/Makefile
index 82ca9855..98e2c5d2 100644
--- a/third_party/build/Makefile
+++ b/third_party/build/Makefile
@@ -1,4 +1,4 @@
-DIRS = resample
+DIRS = resample milenage
include ../../build.mak
include $(PJDIR)/build/common.mak
diff --git a/third_party/build/milenage/Makefile b/third_party/build/milenage/Makefile
new file mode 100644
index 00000000..068f2da4
--- /dev/null
+++ b/third_party/build/milenage/Makefile
@@ -0,0 +1,59 @@
+include ../../../build.mak
+include ../../../build/common.mak
+
+export LIBDIR := ../../lib
+
+RULES_MAK := $(PJDIR)/build/rules.mak
+
+export MILENAGE_LIB := ../../lib/libmilenage-$(TARGET_NAME)$(LIBEXT)
+
+###############################################################################
+# Gather all flags.
+#
+export _CFLAGS := $(CC_CFLAGS) $(OS_CFLAGS) $(HOST_CFLAGS) $(M_CFLAGS) \
+ $(CFLAGS) $(CC_INC). $(CC_INC)../../milenage/include \
+ $(CC_INC)../../../pjlib/include
+export _CXXFLAGS:= $(_CFLAGS) $(CC_CXXFLAGS) $(OS_CXXFLAGS) $(M_CXXFLAGS) \
+ $(HOST_CXXFLAGS) $(CXXFLAGS)
+export _LDFLAGS := $(CC_LDFLAGS) $(OS_LDFLAGS) $(M_LDFLAGS) $(HOST_LDFLAGS) \
+ $(LDFLAGS)
+
+export MILENAGE_SRCDIR = ../../milenage
+export MILENAGE_OBJS = milenage.o rijndael.o
+export MILENAGE_CFLAGS = $(_CFLAGS)
+
+
+export CC_OUT CC AR RANLIB HOST_MV HOST_RM HOST_RMDIR HOST_MKDIR OBJEXT LD LDOUT
+###############################################################################
+# Main entry
+#
+# $(TARGET) is defined in os-$(OS_NAME).mak file in current directory.
+#
+TARGETS := libmilenage
+
+all: $(TARGETS)
+
+doc:
+ cd .. && doxygen docs/doxygen.cfg
+
+dep: depend
+distclean: realclean
+
+.PHONY: dep depend libmilenage clean realclean distclean
+
+libmilenage:
+ $(MAKE) -f $(RULES_MAK) APP=MILENAGE app=libmilenage $(MILENAGE_LIB)
+
+clean print_lib:
+ $(MAKE) -f $(RULES_MAK) APP=MILENAGE app=libmilenage $@
+
+realclean:
+ $(subst @@,$(subst /,$(HOST_PSEP),.ilbc-$(TARGET_NAME).depend),$(HOST_RMR))
+
+ $(MAKE) -f $(RULES_MAK) APP=MILENAGE app=libmilenage $@
+
+depend:
+ $(MAKE) -f $(RULES_MAK) APP=MILENAGE app=libmilenage $@
+ echo '$(MILENAGE_LIB): .libmilenage-$(TARGET_NAME).depend' >> .libmilenage-$(TARGET_NAME).depend; \
+
+
diff --git a/third_party/build/milenage/libmilenage.dsp b/third_party/build/milenage/libmilenage.dsp
new file mode 100644
index 00000000..6a1306dd
--- /dev/null
+++ b/third_party/build/milenage/libmilenage.dsp
@@ -0,0 +1,108 @@
+# Microsoft Developer Studio Project File - Name="libmilenage" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=libmilenage - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "libmilenage.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "libmilenage.mak" CFG="libmilenage - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "libmilenage - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "libmilenage - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "libmilenage - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "../../lib"
+# PROP BASE Intermediate_Dir "output/libmilenage-i386-win32-vc6-release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "../../lib"
+# PROP Intermediate_Dir "output/libmilenage-i386-win32-vc6-release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo /out:"../../lib/libmilenage-i386-win32-vc6-release.lib"
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "output/libmilenage-i386-win32-vc6-debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "../../lib"
+# PROP Intermediate_Dir "output/libmilenage-i386-win32-vc6-debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo /out:"../../lib/libmilenage-i386-win32-vc6-debug.lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "libmilenage - Win32 Release"
+# Name "libmilenage - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\..\milenage\milenage.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\milenage\rijndael.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\..\milenage\milenage.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\milenage\rijndael.h
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/third_party/build/milenage/libmilenage.vcp b/third_party/build/milenage/libmilenage.vcp
new file mode 100644
index 00000000..2570213d
--- /dev/null
+++ b/third_party/build/milenage/libmilenage.vcp
@@ -0,0 +1,962 @@
+# Microsoft eMbedded Visual Tools Project File - Name="libmilenage" - Package Owner=<4>
+# Microsoft eMbedded Visual Tools Generated Build File, Format Version 6.02
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (WCE x86) Static Library" 0x8304
+# TARGTYPE "Win32 (WCE MIPS16) Static Library" 0x8904
+# TARGTYPE "Win32 (WCE SH4) Static Library" 0x8604
+# TARGTYPE "Win32 (WCE MIPSII) Static Library" 0xa104
+# TARGTYPE "Win32 (WCE MIPSIV_FP) Static Library" 0x9204
+# TARGTYPE "Win32 (WCE SH3) Static Library" 0x8104
+# TARGTYPE "Win32 (WCE ARMV4) Static Library" 0xa304
+# TARGTYPE "Win32 (WCE ARMV4I) Static Library" 0xa504
+# TARGTYPE "Win32 (WCE emulator) Static Library" 0xa604
+# TARGTYPE "Win32 (WCE MIPSII_FP) Static Library" 0xa204
+# TARGTYPE "Win32 (WCE ARMV4T) Static Library" 0xa404
+# TARGTYPE "Win32 (WCE MIPSIV) Static Library" 0x9604
+
+CFG=libmilenage - Win32 (WCE MIPSII_FP) Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "libmilenage.vcn".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "libmilenage.vcn" CFG="libmilenage - Win32 (WCE MIPSII_FP) Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "libmilenage - Win32 (WCE MIPSII_FP) Release" (based on "Win32 (WCE MIPSII_FP) Static Library")
+!MESSAGE "libmilenage - Win32 (WCE MIPSII_FP) Debug" (based on "Win32 (WCE MIPSII_FP) Static Library")
+!MESSAGE "libmilenage - Win32 (WCE MIPSII) Release" (based on "Win32 (WCE MIPSII) Static Library")
+!MESSAGE "libmilenage - Win32 (WCE MIPSII) Debug" (based on "Win32 (WCE MIPSII) Static Library")
+!MESSAGE "libmilenage - Win32 (WCE SH4) Release" (based on "Win32 (WCE SH4) Static Library")
+!MESSAGE "libmilenage - Win32 (WCE SH4) Debug" (based on "Win32 (WCE SH4) Static Library")
+!MESSAGE "libmilenage - Win32 (WCE SH3) Release" (based on "Win32 (WCE SH3) Static Library")
+!MESSAGE "libmilenage - Win32 (WCE SH3) Debug" (based on "Win32 (WCE SH3) Static Library")
+!MESSAGE "libmilenage - Win32 (WCE MIPSIV) Release" (based on "Win32 (WCE MIPSIV) Static Library")
+!MESSAGE "libmilenage - Win32 (WCE MIPSIV) Debug" (based on "Win32 (WCE MIPSIV) Static Library")
+!MESSAGE "libmilenage - Win32 (WCE emulator) Release" (based on "Win32 (WCE emulator) Static Library")
+!MESSAGE "libmilenage - Win32 (WCE emulator) Debug" (based on "Win32 (WCE emulator) Static Library")
+!MESSAGE "libmilenage - Win32 (WCE ARMV4I) Release" (based on "Win32 (WCE ARMV4I) Static Library")
+!MESSAGE "libmilenage - Win32 (WCE ARMV4I) Debug" (based on "Win32 (WCE ARMV4I) Static Library")
+!MESSAGE "libmilenage - Win32 (WCE MIPSIV_FP) Release" (based on "Win32 (WCE MIPSIV_FP) Static Library")
+!MESSAGE "libmilenage - Win32 (WCE MIPSIV_FP) Debug" (based on "Win32 (WCE MIPSIV_FP) Static Library")
+!MESSAGE "libmilenage - Win32 (WCE ARMV4) Release" (based on "Win32 (WCE ARMV4) Static Library")
+!MESSAGE "libmilenage - Win32 (WCE ARMV4) Debug" (based on "Win32 (WCE ARMV4) Static Library")
+!MESSAGE "libmilenage - Win32 (WCE MIPS16) Release" (based on "Win32 (WCE MIPS16) Static Library")
+!MESSAGE "libmilenage - Win32 (WCE MIPS16) Debug" (based on "Win32 (WCE MIPS16) Static Library")
+!MESSAGE "libmilenage - Win32 (WCE ARMV4T) Release" (based on "Win32 (WCE ARMV4T) Static Library")
+!MESSAGE "libmilenage - Win32 (WCE ARMV4T) Debug" (based on "Win32 (WCE ARMV4T) Static Library")
+!MESSAGE "libmilenage - Win32 (WCE x86) Release" (based on "Win32 (WCE x86) Static Library")
+!MESSAGE "libmilenage - Win32 (WCE x86) Debug" (based on "Win32 (WCE x86) Static Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+# PROP ATL_Project 2
+
+!IF "$(CFG)" == "libmilenage - Win32 (WCE MIPSII_FP) Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "output\MIPSII_FPRel"
+# PROP BASE Intermediate_Dir "output\MIPSII_FPRel"
+# PROP BASE CPU_ID "{D8AC856C-B213-4895-9E83-9EC51A55201E}"
+# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP BASE Target_Dir "output\"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "output\MIPSII_FPRel"
+# PROP Intermediate_Dir "output\MIPSII_FPRel"
+# PROP CPU_ID "{D8AC856C-B213-4895-9E83-9EC51A55201E}"
+# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP Target_Dir "output\"
+CPP=clmips.exe
+# ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "MIPS" /D "_MIPS_" /D "R4000" /D "MIPSII" /D "MIPSII_FP" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "_LIB" /YX /QMmips2 /QMFPE- /O2 /M$(CECrtMT) /c
+# ADD CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "MIPS" /D "_MIPS_" /D "R4000" /D "MIPSII" /D "MIPSII_FP" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "_LIB" /YX /QMmips2 /QMFPE- /O2 /M$(CECrtMT) /c
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE MIPSII_FP) Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "output\MIPSII_FPDbg"
+# PROP BASE Intermediate_Dir "output\MIPSII_FPDbg"
+# PROP BASE CPU_ID "{D8AC856C-B213-4895-9E83-9EC51A55201E}"
+# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP BASE Target_Dir "output\"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "output\MIPSII_FPDbg"
+# PROP Intermediate_Dir "output\MIPSII_FPDbg"
+# PROP CPU_ID "{D8AC856C-B213-4895-9E83-9EC51A55201E}"
+# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP Target_Dir "output\"
+CPP=clmips.exe
+# ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "MIPS" /D "_MIPS_" /D "R4000" /D "MIPSII" /D "MIPSII_FP" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /QMmips2 /QMFPE- /M$(CECrtMTDebug) /c
+# ADD CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "MIPS" /D "_MIPS_" /D "R4000" /D "MIPSII" /D "MIPSII_FP" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /QMmips2 /QMFPE- /M$(CECrtMTDebug) /c
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE MIPSII) Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "output\MIPSIIRel"
+# PROP BASE Intermediate_Dir "output\MIPSIIRel"
+# PROP BASE CPU_ID "{689DDC64-9D9D-11D5-96F8-00207802C01C}"
+# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP BASE Target_Dir "output\"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "output\MIPSIIRel"
+# PROP Intermediate_Dir "output\MIPSIIRel"
+# PROP CPU_ID "{689DDC64-9D9D-11D5-96F8-00207802C01C}"
+# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP Target_Dir "output\"
+CPP=clmips.exe
+# ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "MIPS" /D "_MIPS_" /D "R4000" /D "MIPSII" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "_LIB" /YX /QMmips2 /QMFPE /O2 /M$(CECrtMT) /c
+# ADD CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "MIPS" /D "_MIPS_" /D "R4000" /D "MIPSII" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "_LIB" /YX /QMmips2 /QMFPE /O2 /M$(CECrtMT) /c
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE MIPSII) Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "output\MIPSIIDbg"
+# PROP BASE Intermediate_Dir "output\MIPSIIDbg"
+# PROP BASE CPU_ID "{689DDC64-9D9D-11D5-96F8-00207802C01C}"
+# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP BASE Target_Dir "output\"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "output\MIPSIIDbg"
+# PROP Intermediate_Dir "output\MIPSIIDbg"
+# PROP CPU_ID "{689DDC64-9D9D-11D5-96F8-00207802C01C}"
+# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP Target_Dir "output\"
+CPP=clmips.exe
+# ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "MIPS" /D "_MIPS_" /D "R4000" /D "MIPSII" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /QMmips2 /QMFPE /M$(CECrtMTDebug) /c
+# ADD CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "MIPS" /D "_MIPS_" /D "R4000" /D "MIPSII" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /QMmips2 /QMFPE /M$(CECrtMTDebug) /c
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE SH4) Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "output\SH4Rel"
+# PROP BASE Intermediate_Dir "output\SH4Rel"
+# PROP BASE CPU_ID "{D6519021-710F-11D3-99F2-00105A0DF099}"
+# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP BASE Target_Dir "output\"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "output\SH4Rel"
+# PROP Intermediate_Dir "output\SH4Rel"
+# PROP CPU_ID "{D6519021-710F-11D3-99F2-00105A0DF099}"
+# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP Target_Dir "output\"
+CPP=shcl.exe
+# ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "SHx" /D "SH4" /D "_SH4_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "_LIB" /YX /Qsh4 /O2 /M$(CECrtMT) /c
+# ADD CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "SHx" /D "SH4" /D "_SH4_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "_LIB" /YX /Qsh4 /O2 /M$(CECrtMT) /c
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE SH4) Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "output\SH4Dbg"
+# PROP BASE Intermediate_Dir "output\SH4Dbg"
+# PROP BASE CPU_ID "{D6519021-710F-11D3-99F2-00105A0DF099}"
+# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP BASE Target_Dir "output\"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "output\SH4Dbg"
+# PROP Intermediate_Dir "output\SH4Dbg"
+# PROP CPU_ID "{D6519021-710F-11D3-99F2-00105A0DF099}"
+# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP Target_Dir "output\"
+CPP=shcl.exe
+# ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "SHx" /D "SH4" /D "_SH4_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /Qsh4 /M$(CECrtMTDebug) /c
+# ADD CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "SHx" /D "SH4" /D "_SH4_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /Qsh4 /M$(CECrtMTDebug) /c
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE SH3) Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "output\SH3Rel"
+# PROP BASE Intermediate_Dir "output\SH3Rel"
+# PROP BASE CPU_ID "{D6519020-710F-11D3-99F2-00105A0DF099}"
+# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP BASE Target_Dir "output\"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "output\SH3Rel"
+# PROP Intermediate_Dir "output\SH3Rel"
+# PROP CPU_ID "{D6519020-710F-11D3-99F2-00105A0DF099}"
+# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP Target_Dir "output\"
+CPP=shcl.exe
+# ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "SHx" /D "SH3" /D "_SH3_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "_LIB" /YX /O2 /M$(CECrtMT) /c
+# ADD CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "SHx" /D "SH3" /D "_SH3_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "_LIB" /YX /O2 /M$(CECrtMT) /c
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE SH3) Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "output\SH3Dbg"
+# PROP BASE Intermediate_Dir "output\SH3Dbg"
+# PROP BASE CPU_ID "{D6519020-710F-11D3-99F2-00105A0DF099}"
+# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP BASE Target_Dir "output\"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "output\SH3Dbg"
+# PROP Intermediate_Dir "output\SH3Dbg"
+# PROP CPU_ID "{D6519020-710F-11D3-99F2-00105A0DF099}"
+# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP Target_Dir "output\"
+CPP=shcl.exe
+# ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "SHx" /D "SH3" /D "_SH3_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /M$(CECrtMTDebug) /c
+# ADD CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "SHx" /D "SH3" /D "_SH3_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /M$(CECrtMTDebug) /c
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE MIPSIV) Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "output\MIPSIVRel"
+# PROP BASE Intermediate_Dir "output\MIPSIVRel"
+# PROP BASE CPU_ID "{0B2FE524-26C5-4194-8CEF-B1582DEB5A98}"
+# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP BASE Target_Dir "output\"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "output\MIPSIVRel"
+# PROP Intermediate_Dir "output\MIPSIVRel"
+# PROP CPU_ID "{0B2FE524-26C5-4194-8CEF-B1582DEB5A98}"
+# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP Target_Dir "output\"
+CPP=clmips.exe
+# ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "MIPS" /D "_MIPS_" /D "_MIPS64" /D "R4000" /D "MIPSIV" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "_LIB" /YX /QMmips4 /QMn32 /QMFPE /O2 /M$(CECrtMT) /c
+# ADD CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "MIPS" /D "_MIPS_" /D "_MIPS64" /D "R4000" /D "MIPSIV" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "_LIB" /YX /QMmips4 /QMn32 /QMFPE /O2 /M$(CECrtMT) /c
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE MIPSIV) Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "output\MIPSIVDbg"
+# PROP BASE Intermediate_Dir "output\MIPSIVDbg"
+# PROP BASE CPU_ID "{0B2FE524-26C5-4194-8CEF-B1582DEB5A98}"
+# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP BASE Target_Dir "output\"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "output\MIPSIVDbg"
+# PROP Intermediate_Dir "output\MIPSIVDbg"
+# PROP CPU_ID "{0B2FE524-26C5-4194-8CEF-B1582DEB5A98}"
+# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP Target_Dir "output\"
+CPP=clmips.exe
+# ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "MIPS" /D "_MIPS_" /D "_MIPS64" /D "R4000" /D "MIPSIV" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /QMmips4 /QMn32 /QMFPE /M$(CECrtMTDebug) /c
+# ADD CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "MIPS" /D "_MIPS_" /D "_MIPS64" /D "R4000" /D "MIPSIV" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /QMmips4 /QMn32 /QMFPE /M$(CECrtMTDebug) /c
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE emulator) Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "output\emulatorRel"
+# PROP BASE Intermediate_Dir "output\emulatorRel"
+# PROP BASE CPU_ID "{32E52003-403E-442D-BE48-DE10F8C6131D}"
+# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP BASE Target_Dir "output\"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "output\emulatorRel"
+# PROP Intermediate_Dir "output\emulatorRel"
+# PROP CPU_ID "{32E52003-403E-442D-BE48-DE10F8C6131D}"
+# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP Target_Dir "output\"
+CPP=cl.exe
+# ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "_i386_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /D "NDEBUG" /D "_LIB" /YX /Gs8192 /GF /O2 /c
+# ADD CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "_i386_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /D "NDEBUG" /D "_LIB" /YX /Gs8192 /GF /O2 /c
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE emulator) Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "output\emulatorDbg"
+# PROP BASE Intermediate_Dir "output\emulatorDbg"
+# PROP BASE CPU_ID "{32E52003-403E-442D-BE48-DE10F8C6131D}"
+# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP BASE Target_Dir "output\"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "output\emulatorDbg"
+# PROP Intermediate_Dir "output\emulatorDbg"
+# PROP CPU_ID "{32E52003-403E-442D-BE48-DE10F8C6131D}"
+# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP Target_Dir "output\"
+CPP=cl.exe
+# ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "_i386_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /D "_LIB" /YX /Gs8192 /GF /c
+# ADD CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "_i386_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /D "_LIB" /YX /Gs8192 /GF /c
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE ARMV4I) Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "output\ARMV4IRel"
+# PROP BASE Intermediate_Dir "output\ARMV4IRel"
+# PROP BASE CPU_ID "{DC70F430-E78B-494F-A9D5-62ADC56443B8}"
+# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP BASE Target_Dir "output\"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "output\ARMV4IRel"
+# PROP Intermediate_Dir "output\ARMV4IRel"
+# PROP CPU_ID "{DC70F430-E78B-494F-A9D5-62ADC56443B8}"
+# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP Target_Dir "output\"
+CPP=clarm.exe
+# ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "ARM" /D "_ARM_" /D "$(CePlatform)" /D "ARMV4I" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "_LIB" /YX /QRarch4T /QRinterwork-return /O2 /M$(CECrtMT) /c
+# ADD CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "ARM" /D "_ARM_" /D "$(CePlatform)" /D "ARMV4I" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "_LIB" /YX /QRarch4T /QRinterwork-return /O2 /M$(CECrtMT) /c
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE ARMV4I) Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "output\ARMV4IDbg"
+# PROP BASE Intermediate_Dir "output\ARMV4IDbg"
+# PROP BASE CPU_ID "{DC70F430-E78B-494F-A9D5-62ADC56443B8}"
+# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP BASE Target_Dir "output\"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "output\ARMV4IDbg"
+# PROP Intermediate_Dir "output\ARMV4IDbg"
+# PROP CPU_ID "{DC70F430-E78B-494F-A9D5-62ADC56443B8}"
+# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP Target_Dir "output\"
+CPP=clarm.exe
+# ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "ARM" /D "_ARM_" /D "$(CePlatform)" /D "ARMV4I" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /QRarch4T /QRinterwork-return /M$(CECrtMTDebug) /c
+# ADD CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "ARM" /D "_ARM_" /D "$(CePlatform)" /D "ARMV4I" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /QRarch4T /QRinterwork-return /M$(CECrtMTDebug) /c
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE MIPSIV_FP) Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "output\MIPSIV_FPRel"
+# PROP BASE Intermediate_Dir "output\MIPSIV_FPRel"
+# PROP BASE CPU_ID "{046A430D-7770-48AB-89B5-24C2D300B03F}"
+# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP BASE Target_Dir "output\"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "output\MIPSIV_FPRel"
+# PROP Intermediate_Dir "output\MIPSIV_FPRel"
+# PROP CPU_ID "{046A430D-7770-48AB-89B5-24C2D300B03F}"
+# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP Target_Dir "output\"
+CPP=clmips.exe
+# ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "MIPS" /D "_MIPS_" /D "_MIPS64" /D "R4000" /D "MIPSIV" /D "MIPSIV_FP" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "_LIB" /YX /QMmips4 /QMn32 /QMFPE- /O2 /M$(CECrtMT) /c
+# ADD CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "MIPS" /D "_MIPS_" /D "_MIPS64" /D "R4000" /D "MIPSIV" /D "MIPSIV_FP" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "_LIB" /YX /QMmips4 /QMn32 /QMFPE- /O2 /M$(CECrtMT) /c
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE MIPSIV_FP) Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "output\MIPSIV_FPDbg"
+# PROP BASE Intermediate_Dir "output\MIPSIV_FPDbg"
+# PROP BASE CPU_ID "{046A430D-7770-48AB-89B5-24C2D300B03F}"
+# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP BASE Target_Dir "output\"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "output\MIPSIV_FPDbg"
+# PROP Intermediate_Dir "output\MIPSIV_FPDbg"
+# PROP CPU_ID "{046A430D-7770-48AB-89B5-24C2D300B03F}"
+# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP Target_Dir "output\"
+CPP=clmips.exe
+# ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "MIPS" /D "_MIPS_" /D "_MIPS64" /D "R4000" /D "MIPSIV" /D "MIPSIV_FP" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /QMmips4 /QMn32 /QMFPE- /M$(CECrtMTDebug) /c
+# ADD CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "MIPS" /D "_MIPS_" /D "_MIPS64" /D "R4000" /D "MIPSIV" /D "MIPSIV_FP" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /QMmips4 /QMn32 /QMFPE- /M$(CECrtMTDebug) /c
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE ARMV4) Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "output\ARMV4Rel"
+# PROP BASE Intermediate_Dir "output\ARMV4Rel"
+# PROP BASE CPU_ID "{ECBEA43D-CD7B-4852-AD55-D4227B5D624B}"
+# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP BASE Target_Dir "output\"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "output\ARMV4Rel"
+# PROP Intermediate_Dir "output\ARMV4Rel"
+# PROP CPU_ID "{ECBEA43D-CD7B-4852-AD55-D4227B5D624B}"
+# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP Target_Dir "output\"
+CPP=clarm.exe
+# ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "NDEBUG" /D "ARM" /D "_ARM_" /D "ARMV4" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /O2 /M$(CECrtMT) /c
+# ADD CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "NDEBUG" /D "ARM" /D "_ARM_" /D "ARMV4" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /O2 /M$(CECrtMT) /c
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE ARMV4) Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "output\ARMV4Dbg"
+# PROP BASE Intermediate_Dir "output\ARMV4Dbg"
+# PROP BASE CPU_ID "{ECBEA43D-CD7B-4852-AD55-D4227B5D624B}"
+# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP BASE Target_Dir "output\"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "output\ARMV4Dbg"
+# PROP Intermediate_Dir "output\ARMV4Dbg"
+# PROP CPU_ID "{ECBEA43D-CD7B-4852-AD55-D4227B5D624B}"
+# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP Target_Dir "output\"
+CPP=clarm.exe
+# ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D "ARMV4" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /M$(CECrtMTDebug) /c
+# ADD CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D "ARMV4" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /M$(CECrtMTDebug) /c
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE MIPS16) Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "output\MIPS16Rel"
+# PROP BASE Intermediate_Dir "output\MIPS16Rel"
+# PROP BASE CPU_ID "{D6519013-710F-11D3-99F2-00105A0DF099}"
+# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP BASE Target_Dir "output\"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "output\MIPS16Rel"
+# PROP Intermediate_Dir "output\MIPS16Rel"
+# PROP CPU_ID "{D6519013-710F-11D3-99F2-00105A0DF099}"
+# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP Target_Dir "output\"
+CPP=clmips.exe
+# ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "MIPS" /D "_MIPS_" /D "R4000" /D "MIPSII" /D "MIPS16" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "_MIPS16_" /D "MIPS16SUPPORT" /D "_LIB" /YX /QMmips16 /O2 /M$(CECrtMT) /c
+# ADD CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "MIPS" /D "_MIPS_" /D "R4000" /D "MIPSII" /D "MIPS16" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "_MIPS16_" /D "MIPS16SUPPORT" /D "_LIB" /YX /QMmips16 /O2 /M$(CECrtMT) /c
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE MIPS16) Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "output\MIPS16Dbg"
+# PROP BASE Intermediate_Dir "output\MIPS16Dbg"
+# PROP BASE CPU_ID "{D6519013-710F-11D3-99F2-00105A0DF099}"
+# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP BASE Target_Dir "output\"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "output\MIPS16Dbg"
+# PROP Intermediate_Dir "output\MIPS16Dbg"
+# PROP CPU_ID "{D6519013-710F-11D3-99F2-00105A0DF099}"
+# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP Target_Dir "output\"
+CPP=clmips.exe
+# ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "MIPS" /D "_MIPS_" /D "R4000" /D "MIPSII" /D "MIPS16" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_MIPS16_" /D "MIPS16SUPPORT" /D "_LIB" /YX /QMmips16 /M$(CECrtMTDebug) /c
+# ADD CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "MIPS" /D "_MIPS_" /D "R4000" /D "MIPSII" /D "MIPS16" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_MIPS16_" /D "MIPS16SUPPORT" /D "_LIB" /YX /QMmips16 /M$(CECrtMTDebug) /c
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE ARMV4T) Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "output\ARMV4TRel"
+# PROP BASE Intermediate_Dir "output\ARMV4TRel"
+# PROP BASE CPU_ID "{F52316A9-3B7C-4FE7-A67F-68350B41240D}"
+# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP BASE Target_Dir "output\"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "output\ARMV4TRel"
+# PROP Intermediate_Dir "output\ARMV4TRel"
+# PROP CPU_ID "{F52316A9-3B7C-4FE7-A67F-68350B41240D}"
+# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP Target_Dir "output\"
+CPP=clthumb.exe
+# ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "ARM" /D "_ARM_" /D "$(CePlatform)" /D "THUMB" /D "_THUMB_" /D "ARMV4T" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "_LIB" /YX /QRarch4T /QRinterwork-return /O2 /M$(CECrtMT) /c
+# ADD CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "ARM" /D "_ARM_" /D "$(CePlatform)" /D "THUMB" /D "_THUMB_" /D "ARMV4T" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "_LIB" /YX /QRarch4T /QRinterwork-return /O2 /M$(CECrtMT) /c
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE ARMV4T) Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "output\ARMV4TDbg"
+# PROP BASE Intermediate_Dir "output\ARMV4TDbg"
+# PROP BASE CPU_ID "{F52316A9-3B7C-4FE7-A67F-68350B41240D}"
+# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP BASE Target_Dir "output\"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "output\ARMV4TDbg"
+# PROP Intermediate_Dir "output\ARMV4TDbg"
+# PROP CPU_ID "{F52316A9-3B7C-4FE7-A67F-68350B41240D}"
+# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP Target_Dir "output\"
+CPP=clthumb.exe
+# ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "ARM" /D "_ARM_" /D "$(CePlatform)" /D "THUMB" /D "_THUMB_" /D "ARMV4T" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /QRarch4T /QRinterwork-return /M$(CECrtMTDebug) /c
+# ADD CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "ARM" /D "_ARM_" /D "$(CePlatform)" /D "THUMB" /D "_THUMB_" /D "ARMV4T" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /QRarch4T /QRinterwork-return /M$(CECrtMTDebug) /c
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE x86) Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "output\X86Rel"
+# PROP BASE Intermediate_Dir "output\X86Rel"
+# PROP BASE CPU_ID "{D6518FF3-710F-11D3-99F2-00105A0DF099}"
+# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP BASE Target_Dir "output\"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "output\X86Rel"
+# PROP Intermediate_Dir "output\X86Rel"
+# PROP CPU_ID "{D6518FF3-710F-11D3-99F2-00105A0DF099}"
+# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP Target_Dir "output\"
+CPP=cl.exe
+# ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "_i386_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /D "NDEBUG" /D "_LIB" /YX /Gs8192 /GF /O2 /c
+# ADD CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "_i386_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /D "NDEBUG" /D "_LIB" /YX /Gs8192 /GF /O2 /c
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE x86) Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "output\X86Dbg"
+# PROP BASE Intermediate_Dir "output\X86Dbg"
+# PROP BASE CPU_ID "{D6518FF3-710F-11D3-99F2-00105A0DF099}"
+# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP BASE Target_Dir "output\"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "output\X86Dbg"
+# PROP Intermediate_Dir "output\X86Dbg"
+# PROP CPU_ID "{D6518FF3-710F-11D3-99F2-00105A0DF099}"
+# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
+# PROP Target_Dir "output\"
+CPP=cl.exe
+# ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "_i386_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /D "_LIB" /YX /Gs8192 /GF /c
+# ADD CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "_i386_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /D "_LIB" /YX /Gs8192 /GF /c
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+
+!ENDIF
+
+# Begin Target
+
+# Name "libmilenage - Win32 (WCE MIPSII_FP) Release"
+# Name "libmilenage - Win32 (WCE MIPSII_FP) Debug"
+# Name "libmilenage - Win32 (WCE MIPSII) Release"
+# Name "libmilenage - Win32 (WCE MIPSII) Debug"
+# Name "libmilenage - Win32 (WCE SH4) Release"
+# Name "libmilenage - Win32 (WCE SH4) Debug"
+# Name "libmilenage - Win32 (WCE SH3) Release"
+# Name "libmilenage - Win32 (WCE SH3) Debug"
+# Name "libmilenage - Win32 (WCE MIPSIV) Release"
+# Name "libmilenage - Win32 (WCE MIPSIV) Debug"
+# Name "libmilenage - Win32 (WCE emulator) Release"
+# Name "libmilenage - Win32 (WCE emulator) Debug"
+# Name "libmilenage - Win32 (WCE ARMV4I) Release"
+# Name "libmilenage - Win32 (WCE ARMV4I) Debug"
+# Name "libmilenage - Win32 (WCE MIPSIV_FP) Release"
+# Name "libmilenage - Win32 (WCE MIPSIV_FP) Debug"
+# Name "libmilenage - Win32 (WCE ARMV4) Release"
+# Name "libmilenage - Win32 (WCE ARMV4) Debug"
+# Name "libmilenage - Win32 (WCE MIPS16) Release"
+# Name "libmilenage - Win32 (WCE MIPS16) Debug"
+# Name "libmilenage - Win32 (WCE ARMV4T) Release"
+# Name "libmilenage - Win32 (WCE ARMV4T) Debug"
+# Name "libmilenage - Win32 (WCE x86) Release"
+# Name "libmilenage - Win32 (WCE x86) Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\..\milenage\milenage.c
+
+!IF "$(CFG)" == "libmilenage - Win32 (WCE MIPSII_FP) Release"
+
+DEP_CPP_MILEN=\
+ "..\..\milenage\milenage.h"\
+ "..\..\milenage\rijndael.h"\
+
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE MIPSII_FP) Debug"
+
+DEP_CPP_MILEN=\
+ "..\..\milenage\milenage.h"\
+ "..\..\milenage\rijndael.h"\
+
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE MIPSII) Release"
+
+DEP_CPP_MILEN=\
+ "..\..\milenage\milenage.h"\
+ "..\..\milenage\rijndael.h"\
+
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE MIPSII) Debug"
+
+DEP_CPP_MILEN=\
+ "..\..\milenage\milenage.h"\
+ "..\..\milenage\rijndael.h"\
+
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE SH4) Release"
+
+DEP_CPP_MILEN=\
+ "..\..\milenage\milenage.h"\
+ "..\..\milenage\rijndael.h"\
+
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE SH4) Debug"
+
+DEP_CPP_MILEN=\
+ "..\..\milenage\milenage.h"\
+ "..\..\milenage\rijndael.h"\
+
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE SH3) Release"
+
+DEP_CPP_MILEN=\
+ "..\..\milenage\milenage.h"\
+ "..\..\milenage\rijndael.h"\
+
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE SH3) Debug"
+
+DEP_CPP_MILEN=\
+ "..\..\milenage\milenage.h"\
+ "..\..\milenage\rijndael.h"\
+
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE MIPSIV) Release"
+
+DEP_CPP_MILEN=\
+ "..\..\milenage\milenage.h"\
+ "..\..\milenage\rijndael.h"\
+
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE MIPSIV) Debug"
+
+DEP_CPP_MILEN=\
+ "..\..\milenage\milenage.h"\
+ "..\..\milenage\rijndael.h"\
+
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE emulator) Release"
+
+DEP_CPP_MILEN=\
+ "..\..\milenage\milenage.h"\
+ "..\..\milenage\rijndael.h"\
+
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE emulator) Debug"
+
+DEP_CPP_MILEN=\
+ "..\..\milenage\milenage.h"\
+ "..\..\milenage\rijndael.h"\
+
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE ARMV4I) Release"
+
+DEP_CPP_MILEN=\
+ "..\..\milenage\milenage.h"\
+ "..\..\milenage\rijndael.h"\
+
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE ARMV4I) Debug"
+
+DEP_CPP_MILEN=\
+ "..\..\milenage\milenage.h"\
+ "..\..\milenage\rijndael.h"\
+
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE MIPSIV_FP) Release"
+
+DEP_CPP_MILEN=\
+ "..\..\milenage\milenage.h"\
+ "..\..\milenage\rijndael.h"\
+
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE MIPSIV_FP) Debug"
+
+DEP_CPP_MILEN=\
+ "..\..\milenage\milenage.h"\
+ "..\..\milenage\rijndael.h"\
+
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE ARMV4) Release"
+
+DEP_CPP_MILEN=\
+ "..\..\milenage\milenage.h"\
+ "..\..\milenage\rijndael.h"\
+
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE ARMV4) Debug"
+
+DEP_CPP_MILEN=\
+ "..\..\milenage\milenage.h"\
+ "..\..\milenage\rijndael.h"\
+
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE MIPS16) Release"
+
+DEP_CPP_MILEN=\
+ "..\..\milenage\milenage.h"\
+ "..\..\milenage\rijndael.h"\
+
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE MIPS16) Debug"
+
+DEP_CPP_MILEN=\
+ "..\..\milenage\milenage.h"\
+ "..\..\milenage\rijndael.h"\
+
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE ARMV4T) Release"
+
+DEP_CPP_MILEN=\
+ "..\..\milenage\milenage.h"\
+ "..\..\milenage\rijndael.h"\
+
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE ARMV4T) Debug"
+
+DEP_CPP_MILEN=\
+ "..\..\milenage\milenage.h"\
+ "..\..\milenage\rijndael.h"\
+
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE x86) Release"
+
+DEP_CPP_MILEN=\
+ "..\..\milenage\milenage.h"\
+ "..\..\milenage\rijndael.h"\
+
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE x86) Debug"
+
+DEP_CPP_MILEN=\
+ "..\..\milenage\milenage.h"\
+ "..\..\milenage\rijndael.h"\
+
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\milenage\rijndael.c
+
+!IF "$(CFG)" == "libmilenage - Win32 (WCE MIPSII_FP) Release"
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE MIPSII_FP) Debug"
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE MIPSII) Release"
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE MIPSII) Debug"
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE SH4) Release"
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE SH4) Debug"
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE SH3) Release"
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE SH3) Debug"
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE MIPSIV) Release"
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE MIPSIV) Debug"
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE emulator) Release"
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE emulator) Debug"
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE ARMV4I) Release"
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE ARMV4I) Debug"
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE MIPSIV_FP) Release"
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE MIPSIV_FP) Debug"
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE ARMV4) Release"
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE ARMV4) Debug"
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE MIPS16) Release"
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE MIPS16) Debug"
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE ARMV4T) Release"
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE ARMV4T) Debug"
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE x86) Release"
+
+!ELSEIF "$(CFG)" == "libmilenage - Win32 (WCE x86) Debug"
+
+!ENDIF
+
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\..\milenage\milenage.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\milenage\rijndael.h
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/third_party/build/milenage/libmilenage.vcproj b/third_party/build/milenage/libmilenage.vcproj
new file mode 100644
index 00000000..e3cf587c
--- /dev/null
+++ b/third_party/build/milenage/libmilenage.vcproj
@@ -0,0 +1,229 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="libmilenage"
+ ProjectGUID="{4BF51C21-5A30-423B-82FE-1ED410E5769D}"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\../../lib"
+ IntermediateDirectory=".\output/libmilenage-i386-win32-vc8-debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ PrecompiledHeaderFile=".\output/libmilenage-i386-win32-vc8-debug/libmilenage.pch"
+ AssemblerListingLocation=".\output/libmilenage-i386-win32-vc8-debug/"
+ ObjectFile=".\output/libmilenage-i386-win32-vc8-debug/"
+ ProgramDataBaseFileName=".\output/libmilenage-i386-win32-vc8-debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../lib/libmilenage-i386-win32-vc8-debug.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\../../lib/libmilenage.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\../../lib"
+ IntermediateDirectory=".\output/libmilenage-i386-win32-vc8-release"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ PrecompiledHeaderFile=".\output/libmilenage-i386-win32-vc8-release/libmilenage.pch"
+ AssemblerListingLocation=".\output/libmilenage-i386-win32-vc8-release/"
+ ObjectFile=".\output/libmilenage-i386-win32-vc8-release/"
+ ProgramDataBaseFileName=".\output/libmilenage-i386-win32-vc8-release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../lib/libmilenage-i386-win32-vc8-release.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\../../lib/libmilenage.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="..\..\milenage\milenage.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\milenage\rijndael.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath="..\..\milenage\milenage.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\milenage\rijndael.h"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/third_party/build/os-darwinos.mak b/third_party/build/os-darwinos.mak
index 2e7dfe06..8aaea281 100644
--- a/third_party/build/os-darwinos.mak
+++ b/third_party/build/os-darwinos.mak
@@ -1,4 +1,3 @@
-DIRS = resample
DIRS += gsm
DIRS += ilbc
DIRS += speex
diff --git a/third_party/build/os-linux.mak b/third_party/build/os-linux.mak
index 2e7dfe06..8aaea281 100644
--- a/third_party/build/os-linux.mak
+++ b/third_party/build/os-linux.mak
@@ -1,4 +1,3 @@
-DIRS = resample
DIRS += gsm
DIRS += ilbc
DIRS += speex
diff --git a/third_party/build/os-win32.mak b/third_party/build/os-win32.mak
index 2e7dfe06..8aaea281 100644
--- a/third_party/build/os-win32.mak
+++ b/third_party/build/os-win32.mak
@@ -1,4 +1,3 @@
-DIRS = resample
DIRS += gsm
DIRS += ilbc
DIRS += speex
diff --git a/third_party/milenage/milenage.c b/third_party/milenage/milenage.c
new file mode 100644
index 00000000..66dae9bb
--- /dev/null
+++ b/third_party/milenage/milenage.c
@@ -0,0 +1,284 @@
+/*-------------------------------------------------------------------
+ * Example algorithms f1, f1*, f2, f3, f4, f5, f5*
+ *-------------------------------------------------------------------
+ *
+ * A sample implementation of the example 3GPP authentication and
+ * key agreement functions f1, f1*, f2, f3, f4, f5 and f5*. This is
+ * a byte-oriented implementation of the functions, and of the block
+ * cipher kernel function Rijndael.
+ *
+ * This has been coded for clarity, not necessarily for efficiency.
+ *
+ * The functions f2, f3, f4 and f5 share the same inputs and have
+ * been coded together as a single function. f1, f1* and f5* are
+ * all coded separately.
+ *
+ *-----------------------------------------------------------------*/
+
+#include "milenage.h"
+#include "rijndael.h"
+
+/*--------------------------- prototypes --------------------------*/
+
+
+
+/*-------------------------------------------------------------------
+ * Algorithm f1
+ *-------------------------------------------------------------------
+ *
+ * Computes network authentication code MAC-A from key K, random
+ * challenge RAND, sequence number SQN and authentication management
+ * field AMF.
+ *
+ *-----------------------------------------------------------------*/
+
+void f1 ( u8 k[16], u8 rand[16], u8 sqn[6], u8 amf[2],
+ u8 mac_a[8], u8 op[16] )
+{
+ u8 op_c[16];
+ u8 temp[16];
+ u8 in1[16];
+ u8 out1[16];
+ u8 rijndaelInput[16];
+ u8 i;
+
+ RijndaelKeySchedule( k );
+
+ ComputeOPc( op_c, op );
+
+ for (i=0; i<16; i++)
+ rijndaelInput[i] = rand[i] ^ op_c[i];
+ RijndaelEncrypt( rijndaelInput, temp );
+
+ for (i=0; i<6; i++)
+ {
+ in1[i] = sqn[i];
+ in1[i+8] = sqn[i];
+ }
+ for (i=0; i<2; i++)
+ {
+ in1[i+6] = amf[i];
+ in1[i+14] = amf[i];
+ }
+
+ /* XOR op_c and in1, rotate by r1=64, and XOR *
+ * on the constant c1 (which is all zeroes) */
+
+ for (i=0; i<16; i++)
+ rijndaelInput[(i+8) % 16] = in1[i] ^ op_c[i];
+
+ /* XOR on the value temp computed before */
+
+ for (i=0; i<16; i++)
+ rijndaelInput[i] ^= temp[i];
+
+ RijndaelEncrypt( rijndaelInput, out1 );
+ for (i=0; i<16; i++)
+ out1[i] ^= op_c[i];
+
+ for (i=0; i<8; i++)
+ mac_a[i] = out1[i];
+
+ return;
+} /* end of function f1 */
+
+
+
+/*-------------------------------------------------------------------
+ * Algorithms f2-f5
+ *-------------------------------------------------------------------
+ *
+ * Takes key K and random challenge RAND, and returns response RES,
+ * confidentiality key CK, integrity key IK and anonymity key AK.
+ *
+ *-----------------------------------------------------------------*/
+
+void f2345 ( u8 k[16], u8 rand[16],
+ u8 res[8], u8 ck[16], u8 ik[16], u8 ak[6], u8 op[16] )
+{
+ u8 op_c[16];
+ u8 temp[16];
+ u8 out[16];
+ u8 rijndaelInput[16];
+ u8 i;
+
+ RijndaelKeySchedule( k );
+
+ ComputeOPc( op_c, op );
+
+ for (i=0; i<16; i++)
+ rijndaelInput[i] = rand[i] ^ op_c[i];
+ RijndaelEncrypt( rijndaelInput, temp );
+
+ /* To obtain output block OUT2: XOR OPc and TEMP, *
+ * rotate by r2=0, and XOR on the constant c2 (which *
+ * is all zeroes except that the last bit is 1). */
+
+ for (i=0; i<16; i++)
+ rijndaelInput[i] = temp[i] ^ op_c[i];
+ rijndaelInput[15] ^= 1;
+
+ RijndaelEncrypt( rijndaelInput, out );
+ for (i=0; i<16; i++)
+ out[i] ^= op_c[i];
+
+ for (i=0; i<8; i++)
+ res[i] = out[i+8];
+ for (i=0; i<6; i++)
+ ak[i] = out[i];
+
+ /* To obtain output block OUT3: XOR OPc and TEMP, *
+ * rotate by r3=32, and XOR on the constant c3 (which *
+ * is all zeroes except that the next to last bit is 1). */
+
+ for (i=0; i<16; i++)
+ rijndaelInput[(i+12) % 16] = temp[i] ^ op_c[i];
+ rijndaelInput[15] ^= 2;
+
+ RijndaelEncrypt( rijndaelInput, out );
+ for (i=0; i<16; i++)
+ out[i] ^= op_c[i];
+
+ for (i=0; i<16; i++)
+ ck[i] = out[i];
+
+ /* To obtain output block OUT4: XOR OPc and TEMP, *
+ * rotate by r4=64, and XOR on the constant c4 (which *
+ * is all zeroes except that the 2nd from last bit is 1). */
+
+ for (i=0; i<16; i++)
+ rijndaelInput[(i+8) % 16] = temp[i] ^ op_c[i];
+ rijndaelInput[15] ^= 4;
+
+ RijndaelEncrypt( rijndaelInput, out );
+ for (i=0; i<16; i++)
+ out[i] ^= op_c[i];
+
+ for (i=0; i<16; i++)
+ ik[i] = out[i];
+
+ return;
+} /* end of function f2345 */
+
+
+/*-------------------------------------------------------------------
+ * Algorithm f1*
+ *-------------------------------------------------------------------
+ *
+ * Computes resynch authentication code MAC-S from key K, random
+ * challenge RAND, sequence number SQN and authentication management
+ * field AMF.
+ *
+ *-----------------------------------------------------------------*/
+
+void f1star( u8 k[16], u8 rand[16], u8 sqn[6], u8 amf[2],
+ u8 mac_s[8], u8 op[16] )
+{
+ u8 op_c[16];
+ u8 temp[16];
+ u8 in1[16];
+ u8 out1[16];
+ u8 rijndaelInput[16];
+ u8 i;
+
+ RijndaelKeySchedule( k );
+
+ ComputeOPc( op_c, op );
+
+ for (i=0; i<16; i++)
+ rijndaelInput[i] = rand[i] ^ op_c[i];
+ RijndaelEncrypt( rijndaelInput, temp );
+
+ for (i=0; i<6; i++)
+ {
+ in1[i] = sqn[i];
+ in1[i+8] = sqn[i];
+ }
+ for (i=0; i<2; i++)
+ {
+ in1[i+6] = amf[i];
+ in1[i+14] = amf[i];
+ }
+
+ /* XOR op_c and in1, rotate by r1=64, and XOR *
+ * on the constant c1 (which is all zeroes) */
+
+ for (i=0; i<16; i++)
+ rijndaelInput[(i+8) % 16] = in1[i] ^ op_c[i];
+
+ /* XOR on the value temp computed before */
+
+ for (i=0; i<16; i++)
+ rijndaelInput[i] ^= temp[i];
+
+ RijndaelEncrypt( rijndaelInput, out1 );
+ for (i=0; i<16; i++)
+ out1[i] ^= op_c[i];
+
+ for (i=0; i<8; i++)
+ mac_s[i] = out1[i+8];
+
+ return;
+} /* end of function f1star */
+
+
+/*-------------------------------------------------------------------
+ * Algorithm f5*
+ *-------------------------------------------------------------------
+ *
+ * Takes key K and random challenge RAND, and returns resynch
+ * anonymity key AK.
+ *
+ *-----------------------------------------------------------------*/
+
+void f5star( u8 k[16], u8 rand[16],
+ u8 ak[6], u8 op[16] )
+{
+ u8 op_c[16];
+ u8 temp[16];
+ u8 out[16];
+ u8 rijndaelInput[16];
+ u8 i;
+
+ RijndaelKeySchedule( k );
+
+ ComputeOPc( op_c, op );
+
+ for (i=0; i<16; i++)
+ rijndaelInput[i] = rand[i] ^ op_c[i];
+ RijndaelEncrypt( rijndaelInput, temp );
+
+ /* To obtain output block OUT5: XOR OPc and TEMP, *
+ * rotate by r5=96, and XOR on the constant c5 (which *
+ * is all zeroes except that the 3rd from last bit is 1). */
+
+ for (i=0; i<16; i++)
+ rijndaelInput[(i+4) % 16] = temp[i] ^ op_c[i];
+ rijndaelInput[15] ^= 8;
+
+ RijndaelEncrypt( rijndaelInput, out );
+ for (i=0; i<16; i++)
+ out[i] ^= op_c[i];
+
+ for (i=0; i<6; i++)
+ ak[i] = out[i];
+
+ return;
+} /* end of function f5star */
+
+
+/*-------------------------------------------------------------------
+ * Function to compute OPc from OP and K. Assumes key schedule has
+ already been performed.
+ *-----------------------------------------------------------------*/
+
+void ComputeOPc( u8 op_c[16], u8 op[16] )
+{
+ u8 i;
+
+ RijndaelEncrypt( op, op_c );
+ for (i=0; i<16; i++)
+ op_c[i] ^= op[i];
+
+ return;
+} /* end of function ComputeOPc */
diff --git a/third_party/milenage/milenage.h b/third_party/milenage/milenage.h
new file mode 100644
index 00000000..a5f407f3
--- /dev/null
+++ b/third_party/milenage/milenage.h
@@ -0,0 +1,35 @@
+/*-------------------------------------------------------------------
+ * Example algorithms f1, f1*, f2, f3, f4, f5, f5*
+ *-------------------------------------------------------------------
+ *
+ * A sample implementation of the example 3GPP authentication and
+ * key agreement functions f1, f1*, f2, f3, f4, f5 and f5*. This is
+ * a byte-oriented implementation of the functions, and of the block
+ * cipher kernel function Rijndael.
+ *
+ * This has been coded for clarity, not necessarily for efficiency.
+ *
+ * The functions f2, f3, f4 and f5 share the same inputs and have
+ * been coded together as a single function. f1, f1* and f5* are
+ * all coded separately.
+ *
+ *-----------------------------------------------------------------*/
+
+#ifndef MILENAGE_H
+#define MILENAGE_H
+
+typedef unsigned char u8;
+
+
+void f1 ( u8 k[16], u8 rand[16], u8 sqn[6], u8 amf[2],
+ u8 mac_a[8], u8 op[16] );
+void f2345 ( u8 k[16], u8 rand[16],
+ u8 res[8], u8 ck[16], u8 ik[16], u8 ak[6], u8 op[16] );
+void f1star( u8 k[16], u8 rand[16], u8 sqn[6], u8 amf[2],
+ u8 mac_s[8], u8 op[16] );
+void f5star( u8 k[16], u8 rand[16],
+ u8 ak[6], u8 op[16] );
+void ComputeOPc( u8 op_c[16], u8 op[16] );
+
+
+#endif
diff --git a/third_party/milenage/rijndael.c b/third_party/milenage/rijndael.c
new file mode 100644
index 00000000..72ff15f2
--- /dev/null
+++ b/third_party/milenage/rijndael.c
@@ -0,0 +1,440 @@
+/*-------------------------------------------------------------------
+ * Rijndael Implementation
+ *-------------------------------------------------------------------
+ *
+ * A sample 32-bit orientated implementation of Rijndael, the
+ * suggested kernel for the example 3GPP authentication and key
+ * agreement functions.
+ *
+ * This implementation draws on the description in section 5.2 of
+ * the AES proposal and also on the implementation by
+ * Dr B. R. Gladman <brg@gladman.uk.net> 9th October 2000.
+ * It uses a number of large (4k) lookup tables to implement the
+ * algorithm in an efficient manner.
+ *
+ * Note: in this implementation the State is stored in four 32-bit
+ * words, one per column of the State, with the top byte of the
+ * column being the _least_ significant byte of the word.
+ *
+*-----------------------------------------------------------------*/
+
+#define LITTLE_ENDIAN /* For INTEL architecture */
+
+typedef unsigned char u8;
+typedef unsigned int u32;
+
+/* Circular byte rotates of 32 bit values */
+
+#define rot1(x) ((x << 8) | (x >> 24))
+#define rot2(x) ((x << 16) | (x >> 16))
+#define rot3(x) ((x << 24) | (x >> 8))
+
+/* Extract a byte from a 32-bit u32 */
+
+#define byte0(x) ((u8)(x))
+#define byte1(x) ((u8)(x >> 8))
+#define byte2(x) ((u8)(x >> 16))
+#define byte3(x) ((u8)(x >> 24))
+
+
+/* Put or get a 32 bit u32 (v) in machine order from a byte *
+ * address in (x) */
+
+#ifdef LITTLE_ENDIAN
+
+#define u32_in(x) (*(u32*)(x))
+#define u32_out(x,y) (*(u32*)(x) = y)
+
+#else
+
+/* Invert byte order in a 32 bit variable */
+
+__inline u32 byte_swap(const u32 x)
+{
+ return rot1(x) & 0x00ff00ff | rot3(x) & 0xff00ff00;
+}
+__inline u32 u32_in(const u8 x[])
+{
+ return byte_swap(*(u32*)x);
+};
+__inline void u32_out(u8 x[], const u32 v)
+{
+ *(u32*)x = byte_swap(v);
+};
+
+#endif
+
+/*--------------- The lookup tables ----------------------------*/
+
+static u32 rnd_con[10] =
+{
+ 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1B, 0x36
+};
+
+static u32 ft_tab[4][256] =
+{
+ {
+ 0xA56363C6,0x847C7CF8,0x997777EE,0x8D7B7BF6,0x0DF2F2FF,0xBD6B6BD6,0xB16F6FDE,0x54C5C591,
+ 0x50303060,0x03010102,0xA96767CE,0x7D2B2B56,0x19FEFEE7,0x62D7D7B5,0xE6ABAB4D,0x9A7676EC,
+ 0x45CACA8F,0x9D82821F,0x40C9C989,0x877D7DFA,0x15FAFAEF,0xEB5959B2,0xC947478E,0x0BF0F0FB,
+ 0xECADAD41,0x67D4D4B3,0xFDA2A25F,0xEAAFAF45,0xBF9C9C23,0xF7A4A453,0x967272E4,0x5BC0C09B,
+ 0xC2B7B775,0x1CFDFDE1,0xAE93933D,0x6A26264C,0x5A36366C,0x413F3F7E,0x02F7F7F5,0x4FCCCC83,
+ 0x5C343468,0xF4A5A551,0x34E5E5D1,0x08F1F1F9,0x937171E2,0x73D8D8AB,0x53313162,0x3F15152A,
+ 0x0C040408,0x52C7C795,0x65232346,0x5EC3C39D,0x28181830,0xA1969637,0x0F05050A,0xB59A9A2F,
+ 0x0907070E,0x36121224,0x9B80801B,0x3DE2E2DF,0x26EBEBCD,0x6927274E,0xCDB2B27F,0x9F7575EA,
+ 0x1B090912,0x9E83831D,0x742C2C58,0x2E1A1A34,0x2D1B1B36,0xB26E6EDC,0xEE5A5AB4,0xFBA0A05B,
+ 0xF65252A4,0x4D3B3B76,0x61D6D6B7,0xCEB3B37D,0x7B292952,0x3EE3E3DD,0x712F2F5E,0x97848413,
+ 0xF55353A6,0x68D1D1B9,0000000000,0x2CEDEDC1,0x60202040,0x1FFCFCE3,0xC8B1B179,0xED5B5BB6,
+ 0xBE6A6AD4,0x46CBCB8D,0xD9BEBE67,0x4B393972,0xDE4A4A94,0xD44C4C98,0xE85858B0,0x4ACFCF85,
+ 0x6BD0D0BB,0x2AEFEFC5,0xE5AAAA4F,0x16FBFBED,0xC5434386,0xD74D4D9A,0x55333366,0x94858511,
+ 0xCF45458A,0x10F9F9E9,0x06020204,0x817F7FFE,0xF05050A0,0x443C3C78,0xBA9F9F25,0xE3A8A84B,
+ 0xF35151A2,0xFEA3A35D,0xC0404080,0x8A8F8F05,0xAD92923F,0xBC9D9D21,0x48383870,0x04F5F5F1,
+ 0xDFBCBC63,0xC1B6B677,0x75DADAAF,0x63212142,0x30101020,0x1AFFFFE5,0x0EF3F3FD,0x6DD2D2BF,
+ 0x4CCDCD81,0x140C0C18,0x35131326,0x2FECECC3,0xE15F5FBE,0xA2979735,0xCC444488,0x3917172E,
+ 0x57C4C493,0xF2A7A755,0x827E7EFC,0x473D3D7A,0xAC6464C8,0xE75D5DBA,0x2B191932,0x957373E6,
+ 0xA06060C0,0x98818119,0xD14F4F9E,0x7FDCDCA3,0x66222244,0x7E2A2A54,0xAB90903B,0x8388880B,
+ 0xCA46468C,0x29EEEEC7,0xD3B8B86B,0x3C141428,0x79DEDEA7,0xE25E5EBC,0x1D0B0B16,0x76DBDBAD,
+ 0x3BE0E0DB,0x56323264,0x4E3A3A74,0x1E0A0A14,0xDB494992,0x0A06060C,0x6C242448,0xE45C5CB8,
+ 0x5DC2C29F,0x6ED3D3BD,0xEFACAC43,0xA66262C4,0xA8919139,0xA4959531,0x37E4E4D3,0x8B7979F2,
+ 0x32E7E7D5,0x43C8C88B,0x5937376E,0xB76D6DDA,0x8C8D8D01,0x64D5D5B1,0xD24E4E9C,0xE0A9A949,
+ 0xB46C6CD8,0xFA5656AC,0x07F4F4F3,0x25EAEACF,0xAF6565CA,0x8E7A7AF4,0xE9AEAE47,0x18080810,
+ 0xD5BABA6F,0x887878F0,0x6F25254A,0x722E2E5C,0x241C1C38,0xF1A6A657,0xC7B4B473,0x51C6C697,
+ 0x23E8E8CB,0x7CDDDDA1,0x9C7474E8,0x211F1F3E,0xDD4B4B96,0xDCBDBD61,0x868B8B0D,0x858A8A0F,
+ 0x907070E0,0x423E3E7C,0xC4B5B571,0xAA6666CC,0xD8484890,0x05030306,0x01F6F6F7,0x120E0E1C,
+ 0xA36161C2,0x5F35356A,0xF95757AE,0xD0B9B969,0x91868617,0x58C1C199,0x271D1D3A,0xB99E9E27,
+ 0x38E1E1D9,0x13F8F8EB,0xB398982B,0x33111122,0xBB6969D2,0x70D9D9A9,0x898E8E07,0xA7949433,
+ 0xB69B9B2D,0x221E1E3C,0x92878715,0x20E9E9C9,0x49CECE87,0xFF5555AA,0x78282850,0x7ADFDFA5,
+ 0x8F8C8C03,0xF8A1A159,0x80898909,0x170D0D1A,0xDABFBF65,0x31E6E6D7,0xC6424284,0xB86868D0,
+ 0xC3414182,0xB0999929,0x772D2D5A,0x110F0F1E,0xCBB0B07B,0xFC5454A8,0xD6BBBB6D,0x3A16162C
+ },
+ {
+ 0x6363C6A5,0x7C7CF884,0x7777EE99,0x7B7BF68D,0xF2F2FF0D,0x6B6BD6BD,0x6F6FDEB1,0xC5C59154,
+ 0x30306050,0x01010203,0x6767CEA9,0x2B2B567D,0xFEFEE719,0xD7D7B562,0xABAB4DE6,0x7676EC9A,
+ 0xCACA8F45,0x82821F9D,0xC9C98940,0x7D7DFA87,0xFAFAEF15,0x5959B2EB,0x47478EC9,0xF0F0FB0B,
+ 0xADAD41EC,0xD4D4B367,0xA2A25FFD,0xAFAF45EA,0x9C9C23BF,0xA4A453F7,0x7272E496,0xC0C09B5B,
+ 0xB7B775C2,0xFDFDE11C,0x93933DAE,0x26264C6A,0x36366C5A,0x3F3F7E41,0xF7F7F502,0xCCCC834F,
+ 0x3434685C,0xA5A551F4,0xE5E5D134,0xF1F1F908,0x7171E293,0xD8D8AB73,0x31316253,0x15152A3F,
+ 0x0404080C,0xC7C79552,0x23234665,0xC3C39D5E,0x18183028,0x969637A1,0x05050A0F,0x9A9A2FB5,
+ 0x07070E09,0x12122436,0x80801B9B,0xE2E2DF3D,0xEBEBCD26,0x27274E69,0xB2B27FCD,0x7575EA9F,
+ 0x0909121B,0x83831D9E,0x2C2C5874,0x1A1A342E,0x1B1B362D,0x6E6EDCB2,0x5A5AB4EE,0xA0A05BFB,
+ 0x5252A4F6,0x3B3B764D,0xD6D6B761,0xB3B37DCE,0x2929527B,0xE3E3DD3E,0x2F2F5E71,0x84841397,
+ 0x5353A6F5,0xD1D1B968,0000000000,0xEDEDC12C,0x20204060,0xFCFCE31F,0xB1B179C8,0x5B5BB6ED,
+ 0x6A6AD4BE,0xCBCB8D46,0xBEBE67D9,0x3939724B,0x4A4A94DE,0x4C4C98D4,0x5858B0E8,0xCFCF854A,
+ 0xD0D0BB6B,0xEFEFC52A,0xAAAA4FE5,0xFBFBED16,0x434386C5,0x4D4D9AD7,0x33336655,0x85851194,
+ 0x45458ACF,0xF9F9E910,0x02020406,0x7F7FFE81,0x5050A0F0,0x3C3C7844,0x9F9F25BA,0xA8A84BE3,
+ 0x5151A2F3,0xA3A35DFE,0x404080C0,0x8F8F058A,0x92923FAD,0x9D9D21BC,0x38387048,0xF5F5F104,
+ 0xBCBC63DF,0xB6B677C1,0xDADAAF75,0x21214263,0x10102030,0xFFFFE51A,0xF3F3FD0E,0xD2D2BF6D,
+ 0xCDCD814C,0x0C0C1814,0x13132635,0xECECC32F,0x5F5FBEE1,0x979735A2,0x444488CC,0x17172E39,
+ 0xC4C49357,0xA7A755F2,0x7E7EFC82,0x3D3D7A47,0x6464C8AC,0x5D5DBAE7,0x1919322B,0x7373E695,
+ 0x6060C0A0,0x81811998,0x4F4F9ED1,0xDCDCA37F,0x22224466,0x2A2A547E,0x90903BAB,0x88880B83,
+ 0x46468CCA,0xEEEEC729,0xB8B86BD3,0x1414283C,0xDEDEA779,0x5E5EBCE2,0x0B0B161D,0xDBDBAD76,
+ 0xE0E0DB3B,0x32326456,0x3A3A744E,0x0A0A141E,0x494992DB,0x06060C0A,0x2424486C,0x5C5CB8E4,
+ 0xC2C29F5D,0xD3D3BD6E,0xACAC43EF,0x6262C4A6,0x919139A8,0x959531A4,0xE4E4D337,0x7979F28B,
+ 0xE7E7D532,0xC8C88B43,0x37376E59,0x6D6DDAB7,0x8D8D018C,0xD5D5B164,0x4E4E9CD2,0xA9A949E0,
+ 0x6C6CD8B4,0x5656ACFA,0xF4F4F307,0xEAEACF25,0x6565CAAF,0x7A7AF48E,0xAEAE47E9,0x08081018,
+ 0xBABA6FD5,0x7878F088,0x25254A6F,0x2E2E5C72,0x1C1C3824,0xA6A657F1,0xB4B473C7,0xC6C69751,
+ 0xE8E8CB23,0xDDDDA17C,0x7474E89C,0x1F1F3E21,0x4B4B96DD,0xBDBD61DC,0x8B8B0D86,0x8A8A0F85,
+ 0x7070E090,0x3E3E7C42,0xB5B571C4,0x6666CCAA,0x484890D8,0x03030605,0xF6F6F701,0x0E0E1C12,
+ 0x6161C2A3,0x35356A5F,0x5757AEF9,0xB9B969D0,0x86861791,0xC1C19958,0x1D1D3A27,0x9E9E27B9,
+ 0xE1E1D938,0xF8F8EB13,0x98982BB3,0x11112233,0x6969D2BB,0xD9D9A970,0x8E8E0789,0x949433A7,
+ 0x9B9B2DB6,0x1E1E3C22,0x87871592,0xE9E9C920,0xCECE8749,0x5555AAFF,0x28285078,0xDFDFA57A,
+ 0x8C8C038F,0xA1A159F8,0x89890980,0x0D0D1A17,0xBFBF65DA,0xE6E6D731,0x424284C6,0x6868D0B8,
+ 0x414182C3,0x999929B0,0x2D2D5A77,0x0F0F1E11,0xB0B07BCB,0x5454A8FC,0xBBBB6DD6,0x16162C3A
+ },
+ {
+ 0x63C6A563,0x7CF8847C,0x77EE9977,0x7BF68D7B,0xF2FF0DF2,0x6BD6BD6B,0x6FDEB16F,0xC59154C5,
+ 0x30605030,0x01020301,0x67CEA967,0x2B567D2B,0xFEE719FE,0xD7B562D7,0xAB4DE6AB,0x76EC9A76,
+ 0xCA8F45CA,0x821F9D82,0xC98940C9,0x7DFA877D,0xFAEF15FA,0x59B2EB59,0x478EC947,0xF0FB0BF0,
+ 0xAD41ECAD,0xD4B367D4,0xA25FFDA2,0xAF45EAAF,0x9C23BF9C,0xA453F7A4,0x72E49672,0xC09B5BC0,
+ 0xB775C2B7,0xFDE11CFD,0x933DAE93,0x264C6A26,0x366C5A36,0x3F7E413F,0xF7F502F7,0xCC834FCC,
+ 0x34685C34,0xA551F4A5,0xE5D134E5,0xF1F908F1,0x71E29371,0xD8AB73D8,0x31625331,0x152A3F15,
+ 0x04080C04,0xC79552C7,0x23466523,0xC39D5EC3,0x18302818,0x9637A196,0x050A0F05,0x9A2FB59A,
+ 0x070E0907,0x12243612,0x801B9B80,0xE2DF3DE2,0xEBCD26EB,0x274E6927,0xB27FCDB2,0x75EA9F75,
+ 0x09121B09,0x831D9E83,0x2C58742C,0x1A342E1A,0x1B362D1B,0x6EDCB26E,0x5AB4EE5A,0xA05BFBA0,
+ 0x52A4F652,0x3B764D3B,0xD6B761D6,0xB37DCEB3,0x29527B29,0xE3DD3EE3,0x2F5E712F,0x84139784,
+ 0x53A6F553,0xD1B968D1,0000000000,0xEDC12CED,0x20406020,0xFCE31FFC,0xB179C8B1,0x5BB6ED5B,
+ 0x6AD4BE6A,0xCB8D46CB,0xBE67D9BE,0x39724B39,0x4A94DE4A,0x4C98D44C,0x58B0E858,0xCF854ACF,
+ 0xD0BB6BD0,0xEFC52AEF,0xAA4FE5AA,0xFBED16FB,0x4386C543,0x4D9AD74D,0x33665533,0x85119485,
+ 0x458ACF45,0xF9E910F9,0x02040602,0x7FFE817F,0x50A0F050,0x3C78443C,0x9F25BA9F,0xA84BE3A8,
+ 0x51A2F351,0xA35DFEA3,0x4080C040,0x8F058A8F,0x923FAD92,0x9D21BC9D,0x38704838,0xF5F104F5,
+ 0xBC63DFBC,0xB677C1B6,0xDAAF75DA,0x21426321,0x10203010,0xFFE51AFF,0xF3FD0EF3,0xD2BF6DD2,
+ 0xCD814CCD,0x0C18140C,0x13263513,0xECC32FEC,0x5FBEE15F,0x9735A297,0x4488CC44,0x172E3917,
+ 0xC49357C4,0xA755F2A7,0x7EFC827E,0x3D7A473D,0x64C8AC64,0x5DBAE75D,0x19322B19,0x73E69573,
+ 0x60C0A060,0x81199881,0x4F9ED14F,0xDCA37FDC,0x22446622,0x2A547E2A,0x903BAB90,0x880B8388,
+ 0x468CCA46,0xEEC729EE,0xB86BD3B8,0x14283C14,0xDEA779DE,0x5EBCE25E,0x0B161D0B,0xDBAD76DB,
+ 0xE0DB3BE0,0x32645632,0x3A744E3A,0x0A141E0A,0x4992DB49,0x060C0A06,0x24486C24,0x5CB8E45C,
+ 0xC29F5DC2,0xD3BD6ED3,0xAC43EFAC,0x62C4A662,0x9139A891,0x9531A495,0xE4D337E4,0x79F28B79,
+ 0xE7D532E7,0xC88B43C8,0x376E5937,0x6DDAB76D,0x8D018C8D,0xD5B164D5,0x4E9CD24E,0xA949E0A9,
+ 0x6CD8B46C,0x56ACFA56,0xF4F307F4,0xEACF25EA,0x65CAAF65,0x7AF48E7A,0xAE47E9AE,0x08101808,
+ 0xBA6FD5BA,0x78F08878,0x254A6F25,0x2E5C722E,0x1C38241C,0xA657F1A6,0xB473C7B4,0xC69751C6,
+ 0xE8CB23E8,0xDDA17CDD,0x74E89C74,0x1F3E211F,0x4B96DD4B,0xBD61DCBD,0x8B0D868B,0x8A0F858A,
+ 0x70E09070,0x3E7C423E,0xB571C4B5,0x66CCAA66,0x4890D848,0x03060503,0xF6F701F6,0x0E1C120E,
+ 0x61C2A361,0x356A5F35,0x57AEF957,0xB969D0B9,0x86179186,0xC19958C1,0x1D3A271D,0x9E27B99E,
+ 0xE1D938E1,0xF8EB13F8,0x982BB398,0x11223311,0x69D2BB69,0xD9A970D9,0x8E07898E,0x9433A794,
+ 0x9B2DB69B,0x1E3C221E,0x87159287,0xE9C920E9,0xCE8749CE,0x55AAFF55,0x28507828,0xDFA57ADF,
+ 0x8C038F8C,0xA159F8A1,0x89098089,0x0D1A170D,0xBF65DABF,0xE6D731E6,0x4284C642,0x68D0B868,
+ 0x4182C341,0x9929B099,0x2D5A772D,0x0F1E110F,0xB07BCBB0,0x54A8FC54,0xBB6DD6BB,0x162C3A16
+ },
+ {
+ 0xC6A56363,0xF8847C7C,0xEE997777,0xF68D7B7B,0xFF0DF2F2,0xD6BD6B6B,0xDEB16F6F,0x9154C5C5,
+ 0x60503030,0x02030101,0xCEA96767,0x567D2B2B,0xE719FEFE,0xB562D7D7,0x4DE6ABAB,0xEC9A7676,
+ 0x8F45CACA,0x1F9D8282,0x8940C9C9,0xFA877D7D,0xEF15FAFA,0xB2EB5959,0x8EC94747,0xFB0BF0F0,
+ 0x41ECADAD,0xB367D4D4,0x5FFDA2A2,0x45EAAFAF,0x23BF9C9C,0x53F7A4A4,0xE4967272,0x9B5BC0C0,
+ 0x75C2B7B7,0xE11CFDFD,0x3DAE9393,0x4C6A2626,0x6C5A3636,0x7E413F3F,0xF502F7F7,0x834FCCCC,
+ 0x685C3434,0x51F4A5A5,0xD134E5E5,0xF908F1F1,0xE2937171,0xAB73D8D8,0x62533131,0x2A3F1515,
+ 0x080C0404,0x9552C7C7,0x46652323,0x9D5EC3C3,0x30281818,0x37A19696,0x0A0F0505,0x2FB59A9A,
+ 0x0E090707,0x24361212,0x1B9B8080,0xDF3DE2E2,0xCD26EBEB,0x4E692727,0x7FCDB2B2,0xEA9F7575,
+ 0x121B0909,0x1D9E8383,0x58742C2C,0x342E1A1A,0x362D1B1B,0xDCB26E6E,0xB4EE5A5A,0x5BFBA0A0,
+ 0xA4F65252,0x764D3B3B,0xB761D6D6,0x7DCEB3B3,0x527B2929,0xDD3EE3E3,0x5E712F2F,0x13978484,
+ 0xA6F55353,0xB968D1D1,0000000000,0xC12CEDED,0x40602020,0xE31FFCFC,0x79C8B1B1,0xB6ED5B5B,
+ 0xD4BE6A6A,0x8D46CBCB,0x67D9BEBE,0x724B3939,0x94DE4A4A,0x98D44C4C,0xB0E85858,0x854ACFCF,
+ 0xBB6BD0D0,0xC52AEFEF,0x4FE5AAAA,0xED16FBFB,0x86C54343,0x9AD74D4D,0x66553333,0x11948585,
+ 0x8ACF4545,0xE910F9F9,0x04060202,0xFE817F7F,0xA0F05050,0x78443C3C,0x25BA9F9F,0x4BE3A8A8,
+ 0xA2F35151,0x5DFEA3A3,0x80C04040,0x058A8F8F,0x3FAD9292,0x21BC9D9D,0x70483838,0xF104F5F5,
+ 0x63DFBCBC,0x77C1B6B6,0xAF75DADA,0x42632121,0x20301010,0xE51AFFFF,0xFD0EF3F3,0xBF6DD2D2,
+ 0x814CCDCD,0x18140C0C,0x26351313,0xC32FECEC,0xBEE15F5F,0x35A29797,0x88CC4444,0x2E391717,
+ 0x9357C4C4,0x55F2A7A7,0xFC827E7E,0x7A473D3D,0xC8AC6464,0xBAE75D5D,0x322B1919,0xE6957373,
+ 0xC0A06060,0x19988181,0x9ED14F4F,0xA37FDCDC,0x44662222,0x547E2A2A,0x3BAB9090,0x0B838888,
+ 0x8CCA4646,0xC729EEEE,0x6BD3B8B8,0x283C1414,0xA779DEDE,0xBCE25E5E,0x161D0B0B,0xAD76DBDB,
+ 0xDB3BE0E0,0x64563232,0x744E3A3A,0x141E0A0A,0x92DB4949,0x0C0A0606,0x486C2424,0xB8E45C5C,
+ 0x9F5DC2C2,0xBD6ED3D3,0x43EFACAC,0xC4A66262,0x39A89191,0x31A49595,0xD337E4E4,0xF28B7979,
+ 0xD532E7E7,0x8B43C8C8,0x6E593737,0xDAB76D6D,0x018C8D8D,0xB164D5D5,0x9CD24E4E,0x49E0A9A9,
+ 0xD8B46C6C,0xACFA5656,0xF307F4F4,0xCF25EAEA,0xCAAF6565,0xF48E7A7A,0x47E9AEAE,0x10180808,
+ 0x6FD5BABA,0xF0887878,0x4A6F2525,0x5C722E2E,0x38241C1C,0x57F1A6A6,0x73C7B4B4,0x9751C6C6,
+ 0xCB23E8E8,0xA17CDDDD,0xE89C7474,0x3E211F1F,0x96DD4B4B,0x61DCBDBD,0x0D868B8B,0x0F858A8A,
+ 0xE0907070,0x7C423E3E,0x71C4B5B5,0xCCAA6666,0x90D84848,0x06050303,0xF701F6F6,0x1C120E0E,
+ 0xC2A36161,0x6A5F3535,0xAEF95757,0x69D0B9B9,0x17918686,0x9958C1C1,0x3A271D1D,0x27B99E9E,
+ 0xD938E1E1,0xEB13F8F8,0x2BB39898,0x22331111,0xD2BB6969,0xA970D9D9,0x07898E8E,0x33A79494,
+ 0x2DB69B9B,0x3C221E1E,0x15928787,0xC920E9E9,0x8749CECE,0xAAFF5555,0x50782828,0xA57ADFDF,
+ 0x038F8C8C,0x59F8A1A1,0x09808989,0x1A170D0D,0x65DABFBF,0xD731E6E6,0x84C64242,0xD0B86868,
+ 0x82C34141,0x29B09999,0x5A772D2D,0x1E110F0F,0x7BCBB0B0,0xA8FC5454,0x6DD6BBBB,0x2C3A1616
+ }
+};
+
+static u32 fl_tab[4][256] =
+{
+ {
+ 0x00000063,0x0000007C,0x00000077,0x0000007B,0x000000F2,0x0000006B,0x0000006F,0x000000C5,
+ 0x00000030,0x00000001,0x00000067,0x0000002B,0x000000FE,0x000000D7,0x000000AB,0x00000076,
+ 0x000000CA,0x00000082,0x000000C9,0x0000007D,0x000000FA,0x00000059,0x00000047,0x000000F0,
+ 0x000000AD,0x000000D4,0x000000A2,0x000000AF,0x0000009C,0x000000A4,0x00000072,0x000000C0,
+ 0x000000B7,0x000000FD,0x00000093,0x00000026,0x00000036,0x0000003F,0x000000F7,0x000000CC,
+ 0x00000034,0x000000A5,0x000000E5,0x000000F1,0x00000071,0x000000D8,0x00000031,0x00000015,
+ 0x00000004,0x000000C7,0x00000023,0x000000C3,0x00000018,0x00000096,0x00000005,0x0000009A,
+ 0x00000007,0x00000012,0x00000080,0x000000E2,0x000000EB,0x00000027,0x000000B2,0x00000075,
+ 0x00000009,0x00000083,0x0000002C,0x0000001A,0x0000001B,0x0000006E,0x0000005A,0x000000A0,
+ 0x00000052,0x0000003B,0x000000D6,0x000000B3,0x00000029,0x000000E3,0x0000002F,0x00000084,
+ 0x00000053,0x000000D1,0x00000000,0x000000ED,0x00000020,0x000000FC,0x000000B1,0x0000005B,
+ 0x0000006A,0x000000CB,0x000000BE,0x00000039,0x0000004A,0x0000004C,0x00000058,0x000000CF,
+ 0x000000D0,0x000000EF,0x000000AA,0x000000FB,0x00000043,0x0000004D,0x00000033,0x00000085,
+ 0x00000045,0x000000F9,0x00000002,0x0000007F,0x00000050,0x0000003C,0x0000009F,0x000000A8,
+ 0x00000051,0x000000A3,0x00000040,0x0000008F,0x00000092,0x0000009D,0x00000038,0x000000F5,
+ 0x000000BC,0x000000B6,0x000000DA,0x00000021,0x00000010,0x000000FF,0x000000F3,0x000000D2,
+ 0x000000CD,0x0000000C,0x00000013,0x000000EC,0x0000005F,0x00000097,0x00000044,0x00000017,
+ 0x000000C4,0x000000A7,0x0000007E,0x0000003D,0x00000064,0x0000005D,0x00000019,0x00000073,
+ 0x00000060,0x00000081,0x0000004F,0x000000DC,0x00000022,0x0000002A,0x00000090,0x00000088,
+ 0x00000046,0x000000EE,0x000000B8,0x00000014,0x000000DE,0x0000005E,0x0000000B,0x000000DB,
+ 0x000000E0,0x00000032,0x0000003A,0x0000000A,0x00000049,0x00000006,0x00000024,0x0000005C,
+ 0x000000C2,0x000000D3,0x000000AC,0x00000062,0x00000091,0x00000095,0x000000E4,0x00000079,
+ 0x000000E7,0x000000C8,0x00000037,0x0000006D,0x0000008D,0x000000D5,0x0000004E,0x000000A9,
+ 0x0000006C,0x00000056,0x000000F4,0x000000EA,0x00000065,0x0000007A,0x000000AE,0x00000008,
+ 0x000000BA,0x00000078,0x00000025,0x0000002E,0x0000001C,0x000000A6,0x000000B4,0x000000C6,
+ 0x000000E8,0x000000DD,0x00000074,0x0000001F,0x0000004B,0x000000BD,0x0000008B,0x0000008A,
+ 0x00000070,0x0000003E,0x000000B5,0x00000066,0x00000048,0x00000003,0x000000F6,0x0000000E,
+ 0x00000061,0x00000035,0x00000057,0x000000B9,0x00000086,0x000000C1,0x0000001D,0x0000009E,
+ 0x000000E1,0x000000F8,0x00000098,0x00000011,0x00000069,0x000000D9,0x0000008E,0x00000094,
+ 0x0000009B,0x0000001E,0x00000087,0x000000E9,0x000000CE,0x00000055,0x00000028,0x000000DF,
+ 0x0000008C,0x000000A1,0x00000089,0x0000000D,0x000000BF,0x000000E6,0x00000042,0x00000068,
+ 0x00000041,0x00000099,0x0000002D,0x0000000F,0x000000B0,0x00000054,0x000000BB,0x00000016
+ },
+ {
+ 0x00006300,0x00007C00,0x00007700,0x00007B00,0x0000F200,0x00006B00,0x00006F00,0x0000C500,
+ 0x00003000,0x00000100,0x00006700,0x00002B00,0x0000FE00,0x0000D700,0x0000AB00,0x00007600,
+ 0x0000CA00,0x00008200,0x0000C900,0x00007D00,0x0000FA00,0x00005900,0x00004700,0x0000F000,
+ 0x0000AD00,0x0000D400,0x0000A200,0x0000AF00,0x00009C00,0x0000A400,0x00007200,0x0000C000,
+ 0x0000B700,0x0000FD00,0x00009300,0x00002600,0x00003600,0x00003F00,0x0000F700,0x0000CC00,
+ 0x00003400,0x0000A500,0x0000E500,0x0000F100,0x00007100,0x0000D800,0x00003100,0x00001500,
+ 0x00000400,0x0000C700,0x00002300,0x0000C300,0x00001800,0x00009600,0x00000500,0x00009A00,
+ 0x00000700,0x00001200,0x00008000,0x0000E200,0x0000EB00,0x00002700,0x0000B200,0x00007500,
+ 0x00000900,0x00008300,0x00002C00,0x00001A00,0x00001B00,0x00006E00,0x00005A00,0x0000A000,
+ 0x00005200,0x00003B00,0x0000D600,0x0000B300,0x00002900,0x0000E300,0x00002F00,0x00008400,
+ 0x00005300,0x0000D100,0000000000,0x0000ED00,0x00002000,0x0000FC00,0x0000B100,0x00005B00,
+ 0x00006A00,0x0000CB00,0x0000BE00,0x00003900,0x00004A00,0x00004C00,0x00005800,0x0000CF00,
+ 0x0000D000,0x0000EF00,0x0000AA00,0x0000FB00,0x00004300,0x00004D00,0x00003300,0x00008500,
+ 0x00004500,0x0000F900,0x00000200,0x00007F00,0x00005000,0x00003C00,0x00009F00,0x0000A800,
+ 0x00005100,0x0000A300,0x00004000,0x00008F00,0x00009200,0x00009D00,0x00003800,0x0000F500,
+ 0x0000BC00,0x0000B600,0x0000DA00,0x00002100,0x00001000,0x0000FF00,0x0000F300,0x0000D200,
+ 0x0000CD00,0x00000C00,0x00001300,0x0000EC00,0x00005F00,0x00009700,0x00004400,0x00001700,
+ 0x0000C400,0x0000A700,0x00007E00,0x00003D00,0x00006400,0x00005D00,0x00001900,0x00007300,
+ 0x00006000,0x00008100,0x00004F00,0x0000DC00,0x00002200,0x00002A00,0x00009000,0x00008800,
+ 0x00004600,0x0000EE00,0x0000B800,0x00001400,0x0000DE00,0x00005E00,0x00000B00,0x0000DB00,
+ 0x0000E000,0x00003200,0x00003A00,0x00000A00,0x00004900,0x00000600,0x00002400,0x00005C00,
+ 0x0000C200,0x0000D300,0x0000AC00,0x00006200,0x00009100,0x00009500,0x0000E400,0x00007900,
+ 0x0000E700,0x0000C800,0x00003700,0x00006D00,0x00008D00,0x0000D500,0x00004E00,0x0000A900,
+ 0x00006C00,0x00005600,0x0000F400,0x0000EA00,0x00006500,0x00007A00,0x0000AE00,0x00000800,
+ 0x0000BA00,0x00007800,0x00002500,0x00002E00,0x00001C00,0x0000A600,0x0000B400,0x0000C600,
+ 0x0000E800,0x0000DD00,0x00007400,0x00001F00,0x00004B00,0x0000BD00,0x00008B00,0x00008A00,
+ 0x00007000,0x00003E00,0x0000B500,0x00006600,0x00004800,0x00000300,0x0000F600,0x00000E00,
+ 0x00006100,0x00003500,0x00005700,0x0000B900,0x00008600,0x0000C100,0x00001D00,0x00009E00,
+ 0x0000E100,0x0000F800,0x00009800,0x00001100,0x00006900,0x0000D900,0x00008E00,0x00009400,
+ 0x00009B00,0x00001E00,0x00008700,0x0000E900,0x0000CE00,0x00005500,0x00002800,0x0000DF00,
+ 0x00008C00,0x0000A100,0x00008900,0x00000D00,0x0000BF00,0x0000E600,0x00004200,0x00006800,
+ 0x00004100,0x00009900,0x00002D00,0x00000F00,0x0000B000,0x00005400,0x0000BB00,0x00001600
+ },
+ {
+ 0x00630000,0x007C0000,0x00770000,0x007B0000,0x00F20000,0x006B0000,0x006F0000,0x00C50000,
+ 0x00300000,0x00010000,0x00670000,0x002B0000,0x00FE0000,0x00D70000,0x00AB0000,0x00760000,
+ 0x00CA0000,0x00820000,0x00C90000,0x007D0000,0x00FA0000,0x00590000,0x00470000,0x00F00000,
+ 0x00AD0000,0x00D40000,0x00A20000,0x00AF0000,0x009C0000,0x00A40000,0x00720000,0x00C00000,
+ 0x00B70000,0x00FD0000,0x00930000,0x00260000,0x00360000,0x003F0000,0x00F70000,0x00CC0000,
+ 0x00340000,0x00A50000,0x00E50000,0x00F10000,0x00710000,0x00D80000,0x00310000,0x00150000,
+ 0x00040000,0x00C70000,0x00230000,0x00C30000,0x00180000,0x00960000,0x00050000,0x009A0000,
+ 0x00070000,0x00120000,0x00800000,0x00E20000,0x00EB0000,0x00270000,0x00B20000,0x00750000,
+ 0x00090000,0x00830000,0x002C0000,0x001A0000,0x001B0000,0x006E0000,0x005A0000,0x00A00000,
+ 0x00520000,0x003B0000,0x00D60000,0x00B30000,0x00290000,0x00E30000,0x002F0000,0x00840000,
+ 0x00530000,0x00D10000,0000000000,0x00ED0000,0x00200000,0x00FC0000,0x00B10000,0x005B0000,
+ 0x006A0000,0x00CB0000,0x00BE0000,0x00390000,0x004A0000,0x004C0000,0x00580000,0x00CF0000,
+ 0x00D00000,0x00EF0000,0x00AA0000,0x00FB0000,0x00430000,0x004D0000,0x00330000,0x00850000,
+ 0x00450000,0x00F90000,0x00020000,0x007F0000,0x00500000,0x003C0000,0x009F0000,0x00A80000,
+ 0x00510000,0x00A30000,0x00400000,0x008F0000,0x00920000,0x009D0000,0x00380000,0x00F50000,
+ 0x00BC0000,0x00B60000,0x00DA0000,0x00210000,0x00100000,0x00FF0000,0x00F30000,0x00D20000,
+ 0x00CD0000,0x000C0000,0x00130000,0x00EC0000,0x005F0000,0x00970000,0x00440000,0x00170000,
+ 0x00C40000,0x00A70000,0x007E0000,0x003D0000,0x00640000,0x005D0000,0x00190000,0x00730000,
+ 0x00600000,0x00810000,0x004F0000,0x00DC0000,0x00220000,0x002A0000,0x00900000,0x00880000,
+ 0x00460000,0x00EE0000,0x00B80000,0x00140000,0x00DE0000,0x005E0000,0x000B0000,0x00DB0000,
+ 0x00E00000,0x00320000,0x003A0000,0x000A0000,0x00490000,0x00060000,0x00240000,0x005C0000,
+ 0x00C20000,0x00D30000,0x00AC0000,0x00620000,0x00910000,0x00950000,0x00E40000,0x00790000,
+ 0x00E70000,0x00C80000,0x00370000,0x006D0000,0x008D0000,0x00D50000,0x004E0000,0x00A90000,
+ 0x006C0000,0x00560000,0x00F40000,0x00EA0000,0x00650000,0x007A0000,0x00AE0000,0x00080000,
+ 0x00BA0000,0x00780000,0x00250000,0x002E0000,0x001C0000,0x00A60000,0x00B40000,0x00C60000,
+ 0x00E80000,0x00DD0000,0x00740000,0x001F0000,0x004B0000,0x00BD0000,0x008B0000,0x008A0000,
+ 0x00700000,0x003E0000,0x00B50000,0x00660000,0x00480000,0x00030000,0x00F60000,0x000E0000,
+ 0x00610000,0x00350000,0x00570000,0x00B90000,0x00860000,0x00C10000,0x001D0000,0x009E0000,
+ 0x00E10000,0x00F80000,0x00980000,0x00110000,0x00690000,0x00D90000,0x008E0000,0x00940000,
+ 0x009B0000,0x001E0000,0x00870000,0x00E90000,0x00CE0000,0x00550000,0x00280000,0x00DF0000,
+ 0x008C0000,0x00A10000,0x00890000,0x000D0000,0x00BF0000,0x00E60000,0x00420000,0x00680000,
+ 0x00410000,0x00990000,0x002D0000,0x000F0000,0x00B00000,0x00540000,0x00BB0000,0x00160000
+ },
+ {
+ 0x63000000,0x7C000000,0x77000000,0x7B000000,0xF2000000,0x6B000000,0x6F000000,0xC5000000,
+ 0x30000000,0x01000000,0x67000000,0x2B000000,0xFE000000,0xD7000000,0xAB000000,0x76000000,
+ 0xCA000000,0x82000000,0xC9000000,0x7D000000,0xFA000000,0x59000000,0x47000000,0xF0000000,
+ 0xAD000000,0xD4000000,0xA2000000,0xAF000000,0x9C000000,0xA4000000,0x72000000,0xC0000000,
+ 0xB7000000,0xFD000000,0x93000000,0x26000000,0x36000000,0x3F000000,0xF7000000,0xCC000000,
+ 0x34000000,0xA5000000,0xE5000000,0xF1000000,0x71000000,0xD8000000,0x31000000,0x15000000,
+ 0x04000000,0xC7000000,0x23000000,0xC3000000,0x18000000,0x96000000,0x05000000,0x9A000000,
+ 0x07000000,0x12000000,0x80000000,0xE2000000,0xEB000000,0x27000000,0xB2000000,0x75000000,
+ 0x09000000,0x83000000,0x2C000000,0x1A000000,0x1B000000,0x6E000000,0x5A000000,0xA0000000,
+ 0x52000000,0x3B000000,0xD6000000,0xB3000000,0x29000000,0xE3000000,0x2F000000,0x84000000,
+ 0x53000000,0xD1000000,0000000000,0xED000000,0x20000000,0xFC000000,0xB1000000,0x5B000000,
+ 0x6A000000,0xCB000000,0xBE000000,0x39000000,0x4A000000,0x4C000000,0x58000000,0xCF000000,
+ 0xD0000000,0xEF000000,0xAA000000,0xFB000000,0x43000000,0x4D000000,0x33000000,0x85000000,
+ 0x45000000,0xF9000000,0x02000000,0x7F000000,0x50000000,0x3C000000,0x9F000000,0xA8000000,
+ 0x51000000,0xA3000000,0x40000000,0x8F000000,0x92000000,0x9D000000,0x38000000,0xF5000000,
+ 0xBC000000,0xB6000000,0xDA000000,0x21000000,0x10000000,0xFF000000,0xF3000000,0xD2000000,
+ 0xCD000000,0x0C000000,0x13000000,0xEC000000,0x5F000000,0x97000000,0x44000000,0x17000000,
+ 0xC4000000,0xA7000000,0x7E000000,0x3D000000,0x64000000,0x5D000000,0x19000000,0x73000000,
+ 0x60000000,0x81000000,0x4F000000,0xDC000000,0x22000000,0x2A000000,0x90000000,0x88000000,
+ 0x46000000,0xEE000000,0xB8000000,0x14000000,0xDE000000,0x5E000000,0x0B000000,0xDB000000,
+ 0xE0000000,0x32000000,0x3A000000,0x0A000000,0x49000000,0x06000000,0x24000000,0x5C000000,
+ 0xC2000000,0xD3000000,0xAC000000,0x62000000,0x91000000,0x95000000,0xE4000000,0x79000000,
+ 0xE7000000,0xC8000000,0x37000000,0x6D000000,0x8D000000,0xD5000000,0x4E000000,0xA9000000,
+ 0x6C000000,0x56000000,0xF4000000,0xEA000000,0x65000000,0x7A000000,0xAE000000,0x08000000,
+ 0xBA000000,0x78000000,0x25000000,0x2E000000,0x1C000000,0xA6000000,0xB4000000,0xC6000000,
+ 0xE8000000,0xDD000000,0x74000000,0x1F000000,0x4B000000,0xBD000000,0x8B000000,0x8A000000,
+ 0x70000000,0x3E000000,0xB5000000,0x66000000,0x48000000,0x03000000,0xF6000000,0x0E000000,
+ 0x61000000,0x35000000,0x57000000,0xB9000000,0x86000000,0xC1000000,0x1D000000,0x9E000000,
+ 0xE1000000,0xF8000000,0x98000000,0x11000000,0x69000000,0xD9000000,0x8E000000,0x94000000,
+ 0x9B000000,0x1E000000,0x87000000,0xE9000000,0xCE000000,0x55000000,0x28000000,0xDF000000,
+ 0x8C000000,0xA1000000,0x89000000,0x0D000000,0xBF000000,0xE6000000,0x42000000,0x68000000,
+ 0x41000000,0x99000000,0x2D000000,0x0F000000,0xB0000000,0x54000000,0xBB000000,0x16000000
+ }
+};
+
+/*----------------- The workspace ------------------------------*/
+
+static u32 Ekey[44]; /* The expanded key */
+
+/*------ The round Function. 4 table lookups and 4 Exors ------*/
+#define f_rnd(x, n) \
+ ( ft_tab[0][byte0(x[n])] \
+ ^ ft_tab[1][byte1(x[(n + 1) & 3])] \
+ ^ ft_tab[2][byte2(x[(n + 2) & 3])] \
+ ^ ft_tab[3][byte3(x[(n + 3) & 3])] )
+
+#define f_round(bo, bi, k) \
+ bo[0] = f_rnd(bi, 0) ^ k[0]; \
+ bo[1] = f_rnd(bi, 1) ^ k[1]; \
+ bo[2] = f_rnd(bi, 2) ^ k[2]; \
+ bo[3] = f_rnd(bi, 3) ^ k[3]; \
+ k += 4
+
+/*--- The S Box lookup used in constructing the Key schedule ---*/
+#define ls_box(x) \
+ ( fl_tab[0][byte0(x)] \
+ ^ fl_tab[1][byte1(x)] \
+ ^ fl_tab[2][byte2(x)] \
+ ^ fl_tab[3][byte3(x)] )
+
+/*------------ The last round function (no MixColumn) ----------*/
+#define lf_rnd(x, n) \
+ ( fl_tab[0][byte0(x[n])] \
+ ^ fl_tab[1][byte1(x[(n + 1) & 3])] \
+ ^ fl_tab[2][byte2(x[(n + 2) & 3])] \
+ ^ fl_tab[3][byte3(x[(n + 3) & 3])] )
+
+
+/*-----------------------------------------------------------
+ * RijndaelKeySchedule
+ * Initialise the key schedule from a supplied key
+ */
+void RijndaelKeySchedule(u8 key[16])
+{
+ u32 t;
+ u32 *ek=Ekey, /* pointer to the expanded key */
+ *rc=rnd_con; /* pointer to the round constant */
+
+ Ekey[0] = u32_in(key );
+ Ekey[1] = u32_in(key + 4);
+ Ekey[2] = u32_in(key + 8);
+ Ekey[3] = u32_in(key + 12);
+
+ while(ek < Ekey + 40)
+ {
+ t = rot3(ek[3]);
+ ek[4] = ek[0] ^ ls_box(t) ^ *rc++;
+ ek[5] = ek[1] ^ ek[4];
+ ek[6] = ek[2] ^ ek[5];
+ ek[7] = ek[3] ^ ek[6];
+ ek += 4;
+ }
+}
+
+/*-----------------------------------------------------------
+ * RijndaelEncrypt
+ * Encrypt an input block
+ */
+void RijndaelEncrypt(u8 in[16], u8 out[16])
+{
+ u32 b0[4], b1[4], *kp = Ekey;
+
+ b0[0] = u32_in(in ) ^ *kp++;
+ b0[1] = u32_in(in + 4) ^ *kp++;
+ b0[2] = u32_in(in + 8) ^ *kp++;
+ b0[3] = u32_in(in + 12) ^ *kp++;
+
+ f_round(b1, b0, kp);
+ f_round(b0, b1, kp);
+ f_round(b1, b0, kp);
+ f_round(b0, b1, kp);
+ f_round(b1, b0, kp);
+ f_round(b0, b1, kp);
+ f_round(b1, b0, kp);
+ f_round(b0, b1, kp);
+ f_round(b1, b0, kp);
+
+ u32_out(out, lf_rnd(b1, 0) ^ kp[0]);
+ u32_out(out + 4, lf_rnd(b1, 1) ^ kp[1]);
+ u32_out(out + 8, lf_rnd(b1, 2) ^ kp[2]);
+ u32_out(out + 12, lf_rnd(b1, 3) ^ kp[3]);
+}
diff --git a/third_party/milenage/rijndael.h b/third_party/milenage/rijndael.h
new file mode 100644
index 00000000..4e728a5b
--- /dev/null
+++ b/third_party/milenage/rijndael.h
@@ -0,0 +1,26 @@
+/*-------------------------------------------------------------------
+ * Example algorithms f1, f1*, f2, f3, f4, f5, f5*
+ *-------------------------------------------------------------------
+ *
+ * A sample implementation of the example 3GPP authentication and
+ * key agreement functions f1, f1*, f2, f3, f4, f5 and f5*. This is
+ * a byte-oriented implementation of the functions, and of the block
+ * cipher kernel function Rijndael.
+ *
+ * This has been coded for clarity, not necessarily for efficiency.
+ *
+ * The functions f2, f3, f4 and f5 share the same inputs and have
+ * been coded together as a single function. f1, f1* and f5* are
+ * all coded separately.
+ *
+ *-----------------------------------------------------------------*/
+
+#ifndef RIJNDAEL_H
+#define RIJNDAEL_H
+
+
+void RijndaelKeySchedule( u8 key[16] );
+void RijndaelEncrypt( u8 input[16], u8 output[16] );
+
+
+#endif