#include "includes.h"
#include "common.h"
+#include "crypto/aes_wrap.h"
#include "crypto/milenage.h"
-extern int wpa_debug_level;
-
-
/**
* milenage_opc - Determine OPc from OP and K
* @op: OP = 128-bit operator variant algorithm configuration field
* @k: K = 128-bit subscriber key
* @opc: Buffer for OPc = 128-bit value derived from OP and K
*/
-static void milenage_opc(const u8 *op, const u8 *k, u8 *opc)
+static int milenage_opc(const u8 *op, const u8 *k, u8 *opc)
{
int i;
/* OP_C = OP XOR E_K(OP) */
- aes_128_encrypt_block(k, op, opc);
+ if (aes_128_encrypt_block(k, op, opc) < 0)
+ return -1;
for (i = 0; i < 16; i++)
opc[i] ^= op[i];
+ return 0;
}
}
};
-#define NUM_GSM_TESTS (sizeof(gsm_test_sets) / sizeof(gsm_test_sets[0]))
+#define NUM_GSM_TESTS ARRAY_SIZE(gsm_test_sets)
struct milenage_test_set {
}
};
-#define NUM_TESTS (sizeof(test_sets) / sizeof(test_sets[0]))
+#define NUM_TESTS ARRAY_SIZE(test_sets)
int main(int argc, char *argv[])