diff --git a/amt-setupbin-0.1.0.js b/amt-setupbin-0.1.0.js index 8759cd0..c8a17b1 100644 --- a/amt-setupbin-0.1.0.js +++ b/amt-setupbin-0.1.0.js @@ -21,7 +21,7 @@ var AmtSetupBinSetupGuids = [ // - Setup.bin should always start with "CurrentMEBx Pwd", "newMebx Pwd", "manageability selection" (if present). // Intel(R) AMT variable identifiers -// Type: 0 = Binar Stringy, 1 = Char, 2 = Short, 3 = Int +// Type: 0 = Binar String, 1 = Char, 2 = Short, 3 = Int var AmtSetupBinVarIds = { 1: { @@ -75,7 +75,7 @@ var AmtSetupBinVarIds = { 0 : "Disabled", 1 : "KVM", 255 : "All" }], 27: [1, "Opt-in Remote IT Consent Policy", // 0 = Disabled, 1 = Enabled. Allows user consent to be configured remotely. { 0 : "Disabled", 1 : "Enabled"} ], - 28: [1, "ME Provision Halt Active", // 0 = Stop, 1 = Start. The "ME provisioning Halt/Activate" command must appear in the file only after "PKIDNSSuffix", "ConfigServerFQDN" and "Provisioning Server Address" + 28: [1, "ME Provision Halt/Active", // 0 = Stop, 1 = Start. The "ME provisioning Halt/Activate" command must appear in the file only after "PKIDNSSuffix", "ConfigServerFQDN" and "Provisioning Server Address" { 0 : "Stop", 1 : "Start"}], 29: [1, "Manual Setup and Configuration", // 0 = Automated, 1 = Manual { 0 : "Automated", 1 : "Manual"}], @@ -116,9 +116,11 @@ var AmtSetupBinDecode = function (file) { // RecordNumber(4) - uniquely identifies the record among all records in the file. The field contains a non-negative ordinal value. The value of this field is always zero in the Local Provisioning File Header Record. // MajorVersion(1) - identifies the major version of the file format specification. This is a positive integer that is greater than or equal to 1. The Major Version number is incremented to indicate that changes have been introduced that will cause code written against a lower Major Version number to fail. // MinorVersion(1) - identifies the minor version of the file format specification. This is an integer that is greater than or equal to 0. The Minor Version number is incremented to indicate that changes have been introduced that will not cause code written against the same Major Version and a lower Minor Version number to fail. The purpose of this behavior is to allow a single local provisioning file to be used for multiple generations of Intel® AMT platform. + // Flags (2) - file Flags, 1 = Do not consume records // DataRecordCount(4) - indicates the total number of data records written in the file when it was created. // DataRecordsConsumed(4) - is a counter value that begins at 0 and is incremented by 1 by each platform BIOS when it consumes a data record from the file. This value is used to determine the offset of the next data record in the file. // DataRecordChunkCount(2) - contains the number of 512-byte chunks in each data record. All data records are the same length. + // Reserved (2) - reserved // ModuleList - contains a list of module identifiers. A module’s identifier appears in the list if and only if the data records contain entries for that module. Each module identifier is two bytes in length. The list is terminated by an identifier value of 0. var obj = {}, UUID = file.substring(0, 16); @@ -197,14 +199,21 @@ var AmtSetupBinDecode = function (file) { var AmtSetupBinEncode = function (obj) { if (obj.fileType < 1 && obj.fileType > AmtSetupBinSetupGuids.length) return null; var out = [], r = AmtSetupBinSetupGuids[obj.fileType - 1], reccount = 0; + + // Get the list of modules used + var modulesInUse = []; + for (var i in obj.records) { var rec = obj.records[i]; for (var j in rec.variables) { var v = rec.variables[j]; if (modulesInUse.indexOf(v.moduleid) == -1) { modulesInUse.push(v.moduleid); } } } + r += ShortToStrX(obj.recordChunkCount); - r += ShortToStrX(obj.recordHeaderByteCount); + r += ShortToStrX(42 + (modulesInUse.length * 2)); // Header is 42 bytes long + 2 bytes for each additional modules in use. r += IntToStrX(obj.recordNumber); r += String.fromCharCode(obj.majorVersion, obj.minorVersion); r += ShortToStrX(obj.flags); // Flags: 1 = Do not consume records r += IntToStrX(obj.records.length); r += IntToStrX(obj.dataRecordsConsumed); r += ShortToStrX(obj.dataRecordChunkCount); + r += ShortToStrX(0); // Reserved + for (var i in modulesInUse) { r += ShortToStrX(modulesInUse[i]); } // Write each module in use. Needs to be null terminated, but the padding that follows will do that. while (r.length < 512) { r += '\0'; } // Pad the header out.push(r); diff --git a/index.html b/index.html index 4a12f69..c13d3d2 100644 --- a/index.html +++ b/index.html @@ -12537,9 +12537,12 @@ var hash = rstr2hex(val.substring(1, hashsize + 1)); var hashnamesize = val.charCodeAt(1 + hashsize); var hashname = val.substring(2 + hashsize, 2 + hashsize + hashnamesize) - val = ["SHA1", "SHA256", "SHA384"][hashtype - 1] + ', ' + hashname + ', ' + hash; + val = ['SHA1', 'SHA256', 'SHA384'][hashtype - 1] + ', ' + hashname + ', ' + hash; } } + if (v.moduleid == 2 && v.varid == 17) { + val = val.charCodeAt(3) + '.' + val.charCodeAt(2) + '.' + val.charCodeAt(1) + '.' + val.charCodeAt(0); + } x += '

' + val + '

' + v['desc'] + '

'; } @@ -12636,6 +12639,10 @@ Q('idx_d16valc3').value = hashname; } usb_ond16checkhash(); + } else if (modid == 2 && varid == 17) { // Provisioning server address + QV('d16genericvalue', true); + var ip = setupbin.records[i].variables[j].value; + idx_d16value1.value = idx_d16value2.value = ip.charCodeAt(3) + '.' + ip.charCodeAt(2) + '.' + ip.charCodeAt(1) + '.' + ip.charCodeAt(0); } else { QV('d16genericvalue', true); idx_d16value1.value = idx_d16value2.value = setupbin.records[i].variables[j].value; @@ -12651,11 +12658,16 @@ var varid = +ids[1]; var value = ''; var vardescription = AmtSetupBinVarIds[modid][varid]; - if (modid == 2 && varid == 8) { + if ((modid == 2) && (varid == 8)) { value = String.fromCharCode(Q('idx_d16valc1').value) + hex2rstr(Q('idx_d16valc2').value) + String.fromCharCode(Q('idx_d16valc3').value.length) + Q('idx_d16valc3').value; } else { if (vardescription[2]) { value = idx_d16value1.value; } else { value = idx_d16value2.value; } } + if ((modid == 2) && (varid == 17)) { // Provisioning server address + var ipSplit = value.split('.'); + if (ipSplit.length != 4) return; + value = String.fromCharCode(parseInt(ipSplit[3]), parseInt(ipSplit[2]), parseInt(ipSplit[1]), parseInt(ipSplit[0])); + } setupbin.records[selectedRecord].variables[selectedVariable].value = value; } if (r == 2) { setupbin.records[selectedRecord].variables.splice(selectedVariable, 1); } // Delete @@ -12679,11 +12691,16 @@ var varid = +ids[1]; var value = ''; var vardescription = AmtSetupBinVarIds[modid][varid]; - if (modid == 2 && varid == 8) { + if ((modid == 2) && (varid == 8)) { value = String.fromCharCode(Q('idx_d16valc1').value) + hex2rstr(Q('idx_d16valc2').value) + String.fromCharCode(Q('idx_d16valc3').value.length) + Q('idx_d16valc3').value; } else { if (vardescription[2]) { value = idx_d16value1.value; } else { value = idx_d16value2.value; } } + if ((modid == 2) && (varid == 17)) { // Provisioning server address + var ipSplit = value.split('.'); + if (ipSplit.length != 4) return; + value = String.fromCharCode(parseInt(ipSplit[3]), parseInt(ipSplit[2]), parseInt(ipSplit[1]), parseInt(ipSplit[0])); + } // Create a new variable var v = {};