startConfigurationHBased fix for Intel AMT TLS ACM activation.

Ylian Saint-Hilaire committed Nov 11, 2021 at 12:42 UTC 2e29cfe67e0ee3be9379cdb8af10f9a2ee6b5134
2 files changed +12 -12
agents/modules_meshcmd/amt-mei.js
+6 -6
@@ -456,13 +456,13 @@ function amt_heci()
456 for (var i = 4; i < arguments.length; ++i) { optional.push(arguments[i]); }
457
458 // Format the command
459 - var data = Buffer.alloc(4 + 64 + 4 + 4 + 320);
460 - data.writeUInt32LE((certHash.length == 48) ? 3 : 2, 0); // Write certificate hash type: SHA256 = 2, SHA384 = 3
461 - certHash.copy(data, 4); // Write the hash
462 - data.writeUInt32LE(hostVpn ? 1 : 0, 68); // Write is HostVPN is enabled
459 + var data = Buffer.alloc(1 + 64 + 4 + 4 + 320);
460 + data[0] = (certHash.length == 48) ? 3 : 2 // Write certificate hash type: SHA256 = 2, SHA384 = 3
461 + certHash.copy(data, 1); // Write the hash
462 + data.writeUInt32LE(hostVpn ? 1 : 0, 65); // Write is HostVPN is enabled
463 if (dnsSuffixList != null) {
464 - data.writeUInt32LE(dnsSuffixList.length, 72); // Write the number of DNS Suffix, from 0 to 4
465 - var ptr = 76;
464 + data.writeUInt32LE(dnsSuffixList.length, 69); // Write the number of DNS Suffix, from 0 to 4
465 + var ptr = 73;
466 for (var i = 0; i < dnsSuffixList.length; i++) { ptr += data.write(dnsSuffixList[i], ptr) + 1; } // Write up to 4 DNS Suffix with null seperation.
467 }
468
agents/modules_meshcore/amt-mei.js
+6 -6
@@ -456,13 +456,13 @@ function amt_heci()
456 for (var i = 4; i < arguments.length; ++i) { optional.push(arguments[i]); }
457
458 // Format the command
459 - var data = Buffer.alloc(4 + 64 + 4 + 4 + 320);
460 - data.writeUInt32LE((certHash.length == 48) ? 3 : 2, 0); // Write certificate hash type: SHA256 = 2, SHA384 = 3
461 - certHash.copy(data, 4); // Write the hash
462 - data.writeUInt32LE(hostVpn ? 1 : 0, 68); // Write is HostVPN is enabled
459 + var data = Buffer.alloc(1 + 64 + 4 + 4 + 320);
460 + data[0] = (certHash.length == 48) ? 3 : 2 // Write certificate hash type: SHA256 = 2, SHA384 = 3
461 + certHash.copy(data, 1); // Write the hash
462 + data.writeUInt32LE(hostVpn ? 1 : 0, 65); // Write is HostVPN is enabled
463 if (dnsSuffixList != null) {
464 - data.writeUInt32LE(dnsSuffixList.length, 72); // Write the number of DNS Suffix, from 0 to 4
465 - var ptr = 76;
464 + data.writeUInt32LE(dnsSuffixList.length, 69); // Write the number of DNS Suffix, from 0 to 4
465 + var ptr = 73;
466 for (var i = 0; i < dnsSuffixList.length; i++) { ptr += data.write(dnsSuffixList[i], ptr) + 1; } // Write up to 4 DNS Suffix with null seperation.
467 }
468