libosmogsm: Ensure MILENAGE + XOR-3G K length is 128 bit

Since Change-Id Ie775fedba4a3fa12314c0f7c8a369662ef6a40df we are
supporting K-lengths != 128 bit.  However, our existing MILENAGE
and XOR-3G algorithms only support that key length, so let's add
some explicit checks for that.

Change-Id: Iae8b93cf059abda087101cdd01bbcf92d355753b
diff --git a/src/gsm/auth_milenage.c b/src/gsm/auth_milenage.c
index 84780c6..9e94293 100644
--- a/src/gsm/auth_milenage.c
+++ b/src/gsm/auth_milenage.c
@@ -19,6 +19,7 @@
  *
  */
 
+#include <errno.h>
 #include <osmocom/crypt/auth.h>
 #include <osmocom/core/bits.h>
 #include "milenage/common.h"
@@ -57,6 +58,11 @@
 
 	OSMO_ASSERT(aud->algo == OSMO_AUTH_ALG_MILENAGE);
 
+	if (aud->u.umts.k_len != 16)
+		return -EINVAL;
+	if (aud->u.umts.opc_len != 16)
+		return -EINVAL;
+
 	opc = gen_opc_if_needed(aud, gen_opc);
 	if (!opc)
 		return -1;
@@ -154,6 +160,11 @@
 
 	OSMO_ASSERT(aud->algo == OSMO_AUTH_ALG_MILENAGE);
 
+	if (aud->u.umts.k_len != 16)
+		return -EINVAL;
+	if (aud->u.umts.opc_len != 16)
+		return -EINVAL;
+
 	opc = gen_opc_if_needed(aud, gen_opc);
 
 	rc = milenage_auts(opc, aud->u.umts.k, rand_auts, auts, sqn_out);