Commit 4f1d1530 authored by Cypres TAC's avatar Cypres TAC
Browse files

from spec. update-locContactMsg clea js lib

parent 5129a47e
Pipeline #229706 canceled with stage
in 1 minute and 44 seconds
......@@ -105,9 +105,11 @@ async function cleaRenewLSP(config) {
if (config.locContactMsg) {
const phone = parseBcd(config.locContactMsg.locationPhone, 8);
loc_msg.set(phone, 0);
const pin = parseBcd(config.locContactMsg.locationPin, 4);
loc_msg.set(pin, 8);
// Max digit is 15, the last 4 bits are set to 0 (pad)
loc_msg[7] = loc_msg[7] & 0xF0;
loc_msg[8] = config.locContactMsg.locationRegion & 0xFF;
const pin = parseBcd(config.locContactMsg.locationPin, 3);
loc_msg.set(pin, 9);
encrypted_loc_msg = await encrypt(new Uint8Array(0), loc_msg, config.PK_MCTA);
msg.set(new Uint8Array(encrypted_loc_msg), 44);
}
......
......@@ -81,6 +81,18 @@
<label for="locationPhone">Location phone (optional):</label>
<input type="text" id="locationPhone" name="locationPhone"/>
</div>
<div>
<label for="locationRegion">Location Region (mandatory if location phone is present):</label>
<select id="locationRegion">
<option value="10">Auvergne Rhône-Alpes</option>
<option value="11">Bourgogne-Franche-Comté</option>
<option value="12">Centre-Val de Loire</option>
<option value="13">Corse</option>
<option value="14">Grand Est</option>
<option value="15">Hauts-de-France</option>
<option value="16">Ile-de-France</option>
</select>
</div>
<div>
<label for="locationPin">Location PIN (mandatory if location phone is present):</label>
<input type="text" id="locationPin" name="locationPin"/>
......
......@@ -35,7 +35,8 @@
if (phone) {
conf.locContactMsg = {
locationPhone: parseInt(phone),
locationPhone: parseInt(phone),
locationRegion: parseInt($("#locationRegion").val()),
locationPin: parseInt($("#locationPin").val())
}
}
......
......@@ -23,9 +23,10 @@ async function generateLsps(conf_tests) {
conf.SK_L = hexToBytes(conf.SK_L);
conf.PK_SA = hexToBytes(conf.PK_SA);
conf.PK_MCTA = hexToBytes(conf.PK_MCTA);
if ((("locationPhone" in conf) == true) && (("locationPIN" in conf) == true)) {
if ((("locationPhone" in conf) == true) && (("locationRegion" in conf) == true) && (("locationPIN" in conf) == true)) {
conf['locContactMsg'] = {
locationPhone: conf.locationPhone,
locationRegion: conf.locationRegion,
locationPin: conf.locationPIN
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment