efiencrypt 0.0.1 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # efiencrypt
2
2
 
3
+ [![npm](https://img.shields.io/npm/v/efiencrypt)](https://www.npmjs.com/package/efiencrypt)
4
+
3
5
  **Encrypts an EFI binary using a hash derived from user-defined data (random data, disk sectors, SMBIOS fields, ...)**
4
6
 
5
7
  `efiencrypt` is a small utility that:
@@ -2382,7 +2382,7 @@ const spawnProcess = (command, args, options) => new Promise((resolve, reject) =
2382
2382
  if (!code && !signal) {
2383
2383
  resolve();
2384
2384
  } else {
2385
- throw new Error("Command failed");
2385
+ reject(new Error("Command failed"));
2386
2386
  }
2387
2387
  });
2388
2388
  });
@@ -2414,7 +2414,7 @@ const build = async (config) => {
2414
2414
  await genCode(config);
2415
2415
  }
2416
2416
  if (!config.skipExtract) {
2417
- const extract = (await import("./extract-BW1V8DVW.js")).extract;
2417
+ const extract = (await import("./extract-BvhlZgSs.js")).extract;
2418
2418
  await extract(config.buildFolder);
2419
2419
  }
2420
2420
  if (!config.skipMake) {
package/efiencrypt CHANGED
@@ -5,7 +5,7 @@ import require$$2, { join, resolve } from "node:path";
5
5
  import require$$3 from "node:fs";
6
6
  import require$$4 from "node:process";
7
7
  import { createRequire } from "node:module";
8
- import { b as build } from "./build-laCVTTyp.js";
8
+ import { b as build } from "./build-CUHiK1Y8.js";
9
9
  function getDefaultExportFromCjs(x) {
10
10
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
11
11
  }
@@ -61,25 +61,25 @@ function requireArgument() {
61
61
  * @param {string} name
62
62
  * @param {string} [description]
63
63
  */
64
- constructor(name, description) {
65
- this.description = description || "";
64
+ constructor(name2, description2) {
65
+ this.description = description2 || "";
66
66
  this.variadic = false;
67
67
  this.parseArg = void 0;
68
68
  this.defaultValue = void 0;
69
69
  this.defaultValueDescription = void 0;
70
70
  this.argChoices = void 0;
71
- switch (name[0]) {
71
+ switch (name2[0]) {
72
72
  case "<":
73
73
  this.required = true;
74
- this._name = name.slice(1, -1);
74
+ this._name = name2.slice(1, -1);
75
75
  break;
76
76
  case "[":
77
77
  this.required = false;
78
- this._name = name.slice(1, -1);
78
+ this._name = name2.slice(1, -1);
79
79
  break;
80
80
  default:
81
81
  this.required = true;
82
- this._name = name;
82
+ this._name = name2;
83
83
  break;
84
84
  }
85
85
  if (this._name.endsWith("...")) {
@@ -112,9 +112,9 @@ function requireArgument() {
112
112
  * @param {string} [description]
113
113
  * @return {Argument}
114
114
  */
115
- default(value, description) {
115
+ default(value, description2) {
116
116
  this.defaultValue = value;
117
- this.defaultValueDescription = description;
117
+ this.defaultValueDescription = description2;
118
118
  return this;
119
119
  }
120
120
  /**
@@ -538,8 +538,8 @@ function requireHelp() {
538
538
  formatHelp(cmd, helper) {
539
539
  const termWidth = helper.padWidth(cmd, helper);
540
540
  const helpWidth = helper.helpWidth ?? 80;
541
- function callFormatItem(term, description) {
542
- return helper.formatItem(term, termWidth, description, helper);
541
+ function callFormatItem(term, description2) {
542
+ return helper.formatItem(term, termWidth, description2, helper);
543
543
  }
544
544
  let output = [
545
545
  `${helper.styleTitle("Usage:")} ${helper.styleUsage(helper.commandUsage(cmd))}`,
@@ -710,10 +710,10 @@ function requireHelp() {
710
710
  * @param {Help} helper
711
711
  * @returns {string}
712
712
  */
713
- formatItem(term, termWidth, description, helper) {
713
+ formatItem(term, termWidth, description2, helper) {
714
714
  const itemIndent = 2;
715
715
  const itemIndentStr = " ".repeat(itemIndent);
716
- if (!description) return itemIndentStr + term;
716
+ if (!description2) return itemIndentStr + term;
717
717
  const paddedTerm = term.padEnd(
718
718
  termWidth + term.length - helper.displayWidth(term)
719
719
  );
@@ -721,10 +721,10 @@ function requireHelp() {
721
721
  const helpWidth = this.helpWidth ?? 80;
722
722
  const remainingWidth = helpWidth - termWidth - spacerWidth - itemIndent;
723
723
  let formattedDescription;
724
- if (remainingWidth < this.minWidthToWrap || helper.preformatted(description)) {
725
- formattedDescription = description;
724
+ if (remainingWidth < this.minWidthToWrap || helper.preformatted(description2)) {
725
+ formattedDescription = description2;
726
726
  } else {
727
- const wrappedDescription = helper.boxWrap(description, remainingWidth);
727
+ const wrappedDescription = helper.boxWrap(description2, remainingWidth);
728
728
  formattedDescription = wrappedDescription.replace(
729
729
  /\n/g,
730
730
  "\n" + " ".repeat(termWidth + spacerWidth)
@@ -792,9 +792,9 @@ function requireOption() {
792
792
  * @param {string} flags
793
793
  * @param {string} [description]
794
794
  */
795
- constructor(flags, description) {
795
+ constructor(flags, description2) {
796
796
  this.flags = flags;
797
- this.description = description || "";
797
+ this.description = description2 || "";
798
798
  this.required = flags.includes("<");
799
799
  this.optional = flags.includes("[");
800
800
  this.variadic = /\w\.\.\.[>\]]$/.test(flags);
@@ -824,9 +824,9 @@ function requireOption() {
824
824
  * @param {string} [description]
825
825
  * @return {Option}
826
826
  */
827
- default(value, description) {
827
+ default(value, description2) {
828
828
  this.defaultValue = value;
829
- this.defaultValueDescription = description;
829
+ this.defaultValueDescription = description2;
830
830
  return this;
831
831
  }
832
832
  /**
@@ -889,8 +889,8 @@ function requireOption() {
889
889
  * @param {string} name
890
890
  * @return {Option}
891
891
  */
892
- env(name) {
893
- this.envVar = name;
892
+ env(name2) {
893
+ this.envVar = name2;
894
894
  return this;
895
895
  }
896
896
  /**
@@ -1194,7 +1194,7 @@ function requireCommand() {
1194
1194
  *
1195
1195
  * @param {string} [name]
1196
1196
  */
1197
- constructor(name) {
1197
+ constructor(name2) {
1198
1198
  super();
1199
1199
  this.commands = [];
1200
1200
  this.options = [];
@@ -1207,7 +1207,7 @@ function requireCommand() {
1207
1207
  this.rawArgs = [];
1208
1208
  this.processedArgs = [];
1209
1209
  this._scriptPath = null;
1210
- this._name = name || "";
1210
+ this._name = name2 || "";
1211
1211
  this._optionValues = {};
1212
1212
  this._optionValueSources = {};
1213
1213
  this._storeOptionsAsProperties = false;
@@ -1312,8 +1312,8 @@ function requireCommand() {
1312
1312
  desc = null;
1313
1313
  }
1314
1314
  opts = opts || {};
1315
- const [, name, args] = nameAndArgs.match(/([^ ]+) *(.*)/);
1316
- const cmd = this.createCommand(name);
1315
+ const [, name2, args] = nameAndArgs.match(/([^ ]+) *(.*)/);
1316
+ const cmd = this.createCommand(name2);
1317
1317
  if (desc) {
1318
1318
  cmd.description(desc);
1319
1319
  cmd._executableHandler = true;
@@ -1337,8 +1337,8 @@ function requireCommand() {
1337
1337
  * @param {string} [name]
1338
1338
  * @return {Command} new command
1339
1339
  */
1340
- createCommand(name) {
1341
- return new Command2(name);
1340
+ createCommand(name2) {
1341
+ return new Command2(name2);
1342
1342
  }
1343
1343
  /**
1344
1344
  * You can customise the help with a subclass of Help by overriding createHelp,
@@ -1444,8 +1444,8 @@ function requireCommand() {
1444
1444
  * @param {string} [description]
1445
1445
  * @return {Argument} new argument
1446
1446
  */
1447
- createArgument(name, description) {
1448
- return new Argument2(name, description);
1447
+ createArgument(name2, description2) {
1448
+ return new Argument2(name2, description2);
1449
1449
  }
1450
1450
  /**
1451
1451
  * Define argument syntax for command.
@@ -1463,8 +1463,8 @@ function requireCommand() {
1463
1463
  * @param {*} [defaultValue]
1464
1464
  * @return {Command} `this` command for chaining
1465
1465
  */
1466
- argument(name, description, parseArg, defaultValue) {
1467
- const argument2 = this.createArgument(name, description);
1466
+ argument(name2, description2, parseArg, defaultValue) {
1467
+ const argument2 = this.createArgument(name2, description2);
1468
1468
  if (typeof parseArg === "function") {
1469
1469
  argument2.default(defaultValue).argParser(parseArg);
1470
1470
  } else {
@@ -1524,7 +1524,7 @@ function requireCommand() {
1524
1524
  * @param {string} [description] - custom description
1525
1525
  * @return {Command} `this` command for chaining
1526
1526
  */
1527
- helpCommand(enableOrNameAndArgs, description) {
1527
+ helpCommand(enableOrNameAndArgs, description2) {
1528
1528
  if (typeof enableOrNameAndArgs === "boolean") {
1529
1529
  this._addImplicitHelpCommand = enableOrNameAndArgs;
1530
1530
  if (enableOrNameAndArgs && this._defaultCommandGroup) {
@@ -1534,14 +1534,14 @@ function requireCommand() {
1534
1534
  }
1535
1535
  const nameAndArgs = enableOrNameAndArgs ?? "help [command]";
1536
1536
  const [, helpName, helpArgs] = nameAndArgs.match(/([^ ]+) *(.*)/);
1537
- const helpDescription = description ?? "display help for command";
1537
+ const helpDescription = description2 ?? "display help for command";
1538
1538
  const helpCommand = this.createCommand(helpName);
1539
1539
  helpCommand.helpOption(false);
1540
1540
  if (helpArgs) helpCommand.arguments(helpArgs);
1541
1541
  if (helpDescription) helpCommand.description(helpDescription);
1542
1542
  this._addImplicitHelpCommand = true;
1543
1543
  this._helpCommand = helpCommand;
1544
- if (enableOrNameAndArgs || description) this._initCommandGroup(helpCommand);
1544
+ if (enableOrNameAndArgs || description2) this._initCommandGroup(helpCommand);
1545
1545
  return this;
1546
1546
  }
1547
1547
  /**
@@ -1669,8 +1669,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
1669
1669
  * @param {string} [description]
1670
1670
  * @return {Option} new option
1671
1671
  */
1672
- createOption(flags, description) {
1673
- return new Option2(flags, description);
1672
+ createOption(flags, description2) {
1673
+ return new Option2(flags, description2);
1674
1674
  }
1675
1675
  /**
1676
1676
  * Wrap parseArgs to catch 'commander.invalidArgument'.
@@ -1721,7 +1721,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1721
1721
  return [cmd.name()].concat(cmd.aliases());
1722
1722
  };
1723
1723
  const alreadyUsed = knownBy(command2).find(
1724
- (name) => this._findCommand(name)
1724
+ (name2) => this._findCommand(name2)
1725
1725
  );
1726
1726
  if (alreadyUsed) {
1727
1727
  const existingCmd = knownBy(this._findCommand(alreadyUsed)).join("|");
@@ -1742,24 +1742,24 @@ Expecting one of '${allowedValues.join("', '")}'`);
1742
1742
  addOption(option2) {
1743
1743
  this._registerOption(option2);
1744
1744
  const oname = option2.name();
1745
- const name = option2.attributeName();
1745
+ const name2 = option2.attributeName();
1746
1746
  if (option2.negate) {
1747
1747
  const positiveLongFlag = option2.long.replace(/^--no-/, "--");
1748
1748
  if (!this._findOption(positiveLongFlag)) {
1749
1749
  this.setOptionValueWithSource(
1750
- name,
1750
+ name2,
1751
1751
  option2.defaultValue === void 0 ? true : option2.defaultValue,
1752
1752
  "default"
1753
1753
  );
1754
1754
  }
1755
1755
  } else if (option2.defaultValue !== void 0) {
1756
- this.setOptionValueWithSource(name, option2.defaultValue, "default");
1756
+ this.setOptionValueWithSource(name2, option2.defaultValue, "default");
1757
1757
  }
1758
1758
  const handleOptionValue = (val, invalidValueMessage, valueSource) => {
1759
1759
  if (val == null && option2.presetArg !== void 0) {
1760
1760
  val = option2.presetArg;
1761
1761
  }
1762
- const oldValue = this.getOptionValue(name);
1762
+ const oldValue = this.getOptionValue(name2);
1763
1763
  if (val !== null && option2.parseArg) {
1764
1764
  val = this._callParseArg(option2, val, oldValue, invalidValueMessage);
1765
1765
  } else if (val !== null && option2.variadic) {
@@ -1774,7 +1774,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1774
1774
  val = "";
1775
1775
  }
1776
1776
  }
1777
- this.setOptionValueWithSource(name, val, valueSource);
1777
+ this.setOptionValueWithSource(name2, val, valueSource);
1778
1778
  };
1779
1779
  this.on("option:" + oname, (val) => {
1780
1780
  const invalidValueMessage = `error: option '${option2.flags}' argument '${val}' is invalid.`;
@@ -1794,13 +1794,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
1794
1794
  * @return {Command} `this` command for chaining
1795
1795
  * @private
1796
1796
  */
1797
- _optionEx(config, flags, description, fn, defaultValue) {
1797
+ _optionEx(config, flags, description2, fn, defaultValue) {
1798
1798
  if (typeof flags === "object" && flags instanceof Option2) {
1799
1799
  throw new Error(
1800
1800
  "To add an Option object use addOption() instead of option() or requiredOption()"
1801
1801
  );
1802
1802
  }
1803
- const option2 = this.createOption(flags, description);
1803
+ const option2 = this.createOption(flags, description2);
1804
1804
  option2.makeOptionMandatory(!!config.mandatory);
1805
1805
  if (typeof fn === "function") {
1806
1806
  option2.default(defaultValue).argParser(fn);
@@ -1837,8 +1837,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
1837
1837
  * @param {*} [defaultValue]
1838
1838
  * @return {Command} `this` command for chaining
1839
1839
  */
1840
- option(flags, description, parseArg, defaultValue) {
1841
- return this._optionEx({}, flags, description, parseArg, defaultValue);
1840
+ option(flags, description2, parseArg, defaultValue) {
1841
+ return this._optionEx({}, flags, description2, parseArg, defaultValue);
1842
1842
  }
1843
1843
  /**
1844
1844
  * Add a required option which must have a value after parsing. This usually means
@@ -1852,11 +1852,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
1852
1852
  * @param {*} [defaultValue]
1853
1853
  * @return {Command} `this` command for chaining
1854
1854
  */
1855
- requiredOption(flags, description, parseArg, defaultValue) {
1855
+ requiredOption(flags, description2, parseArg, defaultValue) {
1856
1856
  return this._optionEx(
1857
1857
  { mandatory: true },
1858
1858
  flags,
1859
- description,
1859
+ description2,
1860
1860
  parseArg,
1861
1861
  defaultValue
1862
1862
  );
@@ -2550,10 +2550,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
2550
2550
  * @private
2551
2551
  * @return {Command | undefined}
2552
2552
  */
2553
- _findCommand(name) {
2554
- if (!name) return void 0;
2553
+ _findCommand(name2) {
2554
+ if (!name2) return void 0;
2555
2555
  return this.commands.find(
2556
- (cmd) => cmd._name === name || cmd._aliases.includes(name)
2556
+ (cmd) => cmd._name === name2 || cmd._aliases.includes(name2)
2557
2557
  );
2558
2558
  }
2559
2559
  /**
@@ -2834,8 +2834,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
2834
2834
  * @param {string} name
2835
2835
  * @private
2836
2836
  */
2837
- missingArgument(name) {
2838
- const message = `error: missing required argument '${name}'`;
2837
+ missingArgument(name2) {
2838
+ const message = `error: missing required argument '${name2}'`;
2839
2839
  this.error(message, { code: "commander.missingArgument" });
2840
2840
  }
2841
2841
  /**
@@ -2959,12 +2959,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
2959
2959
  * @param {string} [description]
2960
2960
  * @return {(this | string | undefined)} `this` command for chaining, or version string if no arguments
2961
2961
  */
2962
- version(str, flags, description) {
2962
+ version(str, flags, description2) {
2963
2963
  if (str === void 0) return this._version;
2964
2964
  this._version = str;
2965
2965
  flags = flags || "-V, --version";
2966
- description = description || "output the version number";
2967
- const versionOption = this.createOption(flags, description);
2966
+ description2 = description2 || "output the version number";
2967
+ const versionOption = this.createOption(flags, description2);
2968
2968
  this._versionOptionName = versionOption.attributeName();
2969
2969
  this._registerOption(versionOption);
2970
2970
  this.on("option:" + versionOption.name(), () => {
@@ -3266,7 +3266,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
3266
3266
  * @param {string} [description]
3267
3267
  * @return {Command} `this` command for chaining
3268
3268
  */
3269
- helpOption(flags, description) {
3269
+ helpOption(flags, description2) {
3270
3270
  if (typeof flags === "boolean") {
3271
3271
  if (flags) {
3272
3272
  if (this._helpOption === null) this._helpOption = void 0;
@@ -3280,9 +3280,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
3280
3280
  }
3281
3281
  this._helpOption = this.createOption(
3282
3282
  flags ?? "-h, --help",
3283
- description ?? "display help for command"
3283
+ description2 ?? "display help for command"
3284
3284
  );
3285
- if (flags || description) this._initOptionGroup(this._helpOption);
3285
+ if (flags || description2) this._initOptionGroup(this._helpOption);
3286
3286
  return this;
3287
3287
  }
3288
3288
  /**
@@ -3429,9 +3429,9 @@ function requireCommander() {
3429
3429
  const { Help: Help2 } = requireHelp();
3430
3430
  const { Option: Option2 } = requireOption();
3431
3431
  commander$1.program = new Command2();
3432
- commander$1.createCommand = (name) => new Command2(name);
3433
- commander$1.createOption = (flags, description) => new Option2(flags, description);
3434
- commander$1.createArgument = (name, description) => new Argument2(name, description);
3432
+ commander$1.createCommand = (name2) => new Command2(name2);
3433
+ commander$1.createOption = (flags, description2) => new Option2(flags, description2);
3434
+ commander$1.createArgument = (name2, description2) => new Argument2(name2, description2);
3435
3435
  commander$1.Command = Command2;
3436
3436
  commander$1.Option = Option2;
3437
3437
  commander$1.Argument = Argument2;
@@ -3457,7 +3457,10 @@ const {
3457
3457
  Option,
3458
3458
  Help
3459
3459
  } = commander;
3460
- program.description("Encrypts an EFI binary using a hash derived from user‑defined data (smbios, disk, ...)").showHelpAfterError(true).option("-c, --config-file <configFile>", "configuration file").option("-i, --input-file <inputFile>", "path to the input efi file to embed").option("-o, --output-file <outputFile>", "path to the output efi file to write").option("-s, --smbios <smbios>", "path to the input smbios dump file").option("-b, --build-folder <buildFolder>", "folder where to build the code").option("--skip-gen-code", "skip generating code").option("--skip-extract", "skip extracting source code").option("--skip-make", "skip calling make").action(async (options) => {
3460
+ const name = "efiencrypt";
3461
+ const version = "1.0.1";
3462
+ const description = "Encrypts an EFI binary using a hash derived from user-defined data (random data, disk sectors, SMBIOS fields, ...)";
3463
+ program.name(name).description(description).showHelpAfterError(true).option("-c, --config-file <configFile>", "configuration file").option("-i, --input-file <inputFile>", "path to the input efi file to embed").option("-o, --output-file <outputFile>", "path to the output efi file to write").option("-s, --smbios <smbios>", "path to the input smbios dump file").option("-b, --build-folder <buildFolder>", "folder where to build the code").option("--skip-gen-code", "skip generating code").option("--skip-extract", "skip extracting source code").option("--skip-make", "skip calling make").version(version).action(async (options) => {
3461
3464
  try {
3462
3465
  let config = {};
3463
3466
  if (options.configFile) {
@@ -11758,7 +11758,7 @@ ENTRY(efi_call10)
11758
11758
  const __vite_glob_0_175 = '/*++\n\nCopyright (c) 1998 Intel Corporation\n\nModule Name:\n\n initplat.c\n\nAbstract:\n\n\n\n\nRevision History\n\n--*/\n\n#include "lib.h"\n\nVOID\nInitializeLibPlatform (\n IN EFI_HANDLE ImageHandle EFI_UNUSED,\n IN EFI_SYSTEM_TABLE *SystemTable EFI_UNUSED\n )\n{\n}\n\n';
11759
11759
  const __vite_glob_0_176 = '/*++\n\nCopyright (c) 1998 Intel Corporation\n\nModule Name:\n\n math.c\n\nAbstract:\n\n\n\n\nRevision History\n\n--*/\n\n#include "lib.h"\n\n\n//\n// Declare runtime functions\n//\n\n#ifdef RUNTIME_CODE\n#ifndef __GNUC__\n#pragma RUNTIME_CODE(LShiftU64)\n#pragma RUNTIME_CODE(RShiftU64)\n#pragma RUNTIME_CODE(MultU64x32)\n#pragma RUNTIME_CODE(DivU64x32)\n#endif\n#endif\n\n//\n//\n//\n\nUINT64\nLShiftU64 (\n IN UINT64 Operand,\n IN UINTN Count\n )\n// Left shift 64bit by 32bit and get a 64bit result\n{\n#if defined(__GNUC__) || defined(_MSC_EXTENSIONS)\n return Operand << Count;\n#else\n UINT64 Result;\n _asm {\n mov eax, dword ptr Operand[0]\n mov edx, dword ptr Operand[4]\n mov ecx, Count\n and ecx, 63\n\n shld edx, eax, cl\n shl eax, cl\n\n cmp ecx, 32\n jc short ls10\n\n mov edx, eax\n xor eax, eax\n\nls10:\n mov dword ptr Result[0], eax\n mov dword ptr Result[4], edx\n }\n\n return Result;\n#endif\n}\n\nUINT64\nRShiftU64 (\n IN UINT64 Operand,\n IN UINTN Count\n )\n// Right shift 64bit by 32bit and get a 64bit result\n{\n#if defined(__GNUC__) || defined(_MSC_EXTENSIONS)\n return Operand >> Count;\n#else\n UINT64 Result;\n _asm {\n mov eax, dword ptr Operand[0]\n mov edx, dword ptr Operand[4]\n mov ecx, Count\n and ecx, 63\n\n shrd eax, edx, cl\n shr edx, cl\n\n cmp ecx, 32\n jc short rs10\n\n mov eax, edx\n xor edx, edx\n\nrs10:\n mov dword ptr Result[0], eax\n mov dword ptr Result[4], edx\n }\n\n return Result;\n#endif\n}\n\n\nUINT64\nMultU64x32 (\n IN UINT64 Multiplicand,\n IN UINTN Multiplier\n )\n// Multiple 64bit by 32bit and get a 64bit result\n{\n#if defined(__GNUC__) || defined(_MSC_EXTENSIONS)\n return Multiplicand * Multiplier;\n#else\n UINT64 Result;\n _asm {\n mov eax, dword ptr Multiplicand[0]\n mul Multiplier\n mov dword ptr Result[0], eax\n mov dword ptr Result[4], edx\n mov eax, dword ptr Multiplicand[4]\n mul Multiplier\n add dword ptr Result[4], eax\n }\n\n return Result;\n#endif\n}\n\nUINT64\nDivU64x32 (\n IN UINT64 Dividend,\n IN UINTN Divisor,\n OUT UINTN *Remainder OPTIONAL\n )\n// divide 64bit by 32bit and get a 64bit result\n// N.B. only works for 31bit divisors!!\n{\n#if defined(__GNUC__) || defined(_MSC_EXTENSIONS)\n if (Remainder)\n *Remainder = Dividend % Divisor;\n return Dividend / Divisor;\n#else\n UINT32 Rem;\n UINT32 bit; \n\n ASSERT (Divisor != 0);\n ASSERT ((Divisor >> 31) == 0);\n\n //\n // For each bit in the dividend\n //\n\n Rem = 0;\n for (bit=0; bit < 64; bit++) {\n _asm {\n shl dword ptr Dividend[0], 1 ; shift rem:dividend left one\n rcl dword ptr Dividend[4], 1 \n rcl dword ptr Rem, 1 \n\n mov eax, Rem\n cmp eax, Divisor ; Is Rem >= Divisor?\n cmc ; No - do nothing\n sbb eax, eax ; Else, \n sub dword ptr Dividend[0], eax ; set low bit in dividen\n and eax, Divisor ; and\n sub Rem, eax ; subtract divisor \n }\n }\n\n if (Remainder) {\n *Remainder = Rem;\n }\n\n return Dividend;\n#endif\n}\n';
11760
11760
  const __vite_glob_0_177 = ' .text\n .globl setjmp\n#ifndef __MINGW32__\n .type setjmp, @function\n#else\n .def setjmp; .scl 2; .type 32; .endef\n#endif\nsetjmp:\n pop %rsi\n movq %rbx,0x00(%rdi)\n movq %rsp,0x08(%rdi)\n push %rsi\n movq %rbp,0x10(%rdi)\n movq %r12,0x18(%rdi)\n movq %r13,0x20(%rdi)\n movq %r14,0x28(%rdi)\n movq %r15,0x30(%rdi)\n movq %rsi,0x38(%rdi)\n xor %rax,%rax\n ret\n\n .globl longjmp\n#ifndef __MINGW32__\n .type longjmp, @function\n#else\n .def longjmp; .scl 2; .type 32; .endef\n#endif\nlongjmp:\n movl %esi, %eax\n movq 0x00(%rdi), %rbx\n movq 0x08(%rdi), %rsp\n movq 0x10(%rdi), %rbp\n movq 0x18(%rdi), %r12\n movq 0x20(%rdi), %r13\n movq 0x28(%rdi), %r14\n movq 0x30(%rdi), %r15\n xor %rdx,%rdx\n mov $1,%rcx\n cmp %rax,%rdx\n cmove %rcx,%rax\n jmp *0x38(%rdi)\n\n#if defined(__ELF__) && defined(__linux__)\n .section .note.GNU-stack,"",%progbits\n#endif\n';
11761
- const __vite_glob_0_178 = '#include <efi.h>\n#include <efilib.h>\n#include "aes.h"\n#include "gen-code.h"\n\nwchar_t *errorMsg = L"Error %d: %r\\n";\n\nEFI_STATUS\nefi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table)\n{\n EFI_STATUS status = 0;\n\n InitializeLib(image_handle, system_table);\n\n UINT8 *payload = AllocatePool(enc_payload_len);\n CHECK_ERROR(!payload);\n\n sha256_context_t hash;\n sha256_init(&hash);\n status = gen_compute_hash(&hash, image_handle);\n sha256_finalize(&hash);\n\n aes_context_t decCTX;\n aes_context_init(&decCTX, (uint8_t *)hash.hash);\n aes_cbc_decrypt(\n &decCTX,\n iv,\n enc_payload,\n enc_payload_len,\n payload);\n sha256_init(&hash); // erase the key just after decryption\n size_t payload_len = aes_remove_padding(payload, enc_payload_len);\n\n EFI_HANDLE payloadHandle = NULL;\n status = uefi_call_wrapper(gBS->LoadImage, 6,\n FALSE,\n image_handle,\n NULL,\n payload,\n payload_len,\n &payloadHandle);\n CHECK_ERROR(!payloadHandle);\n\n FREE_POOL(payload);\n\n status = uefi_call_wrapper(gBS->StartImage, 3, payloadHandle, NULL, NULL);\n CHECK_ERROR(0);\n\n return 0;\n}\n';
11761
+ const __vite_glob_0_178 = '#include <efi.h>\n#include <efilib.h>\n#include "aes.h"\n#include "gen-code.h"\n\nwchar_t *errorMsg = L"Error %d: %r\\n";\n\nEFI_STATUS\nefi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table)\n{\n EFI_STATUS status = 0;\n\n InitializeLib(image_handle, system_table);\n\n UINT8 *payload = AllocatePool(enc_payload_len);\n CHECK_ERROR(!payload);\n\n sha256_context_t hash;\n sha256_init(&hash);\n status = gen_compute_hash(&hash, image_handle);\n sha256_finalize(&hash);\n\n aes_context_t decCTX;\n aes_context_init(&decCTX, (uint8_t *)hash.hash);\n aes_cbc_decrypt(\n &decCTX,\n iv,\n enc_payload,\n enc_payload_len,\n payload);\n sha256_init(&hash); // erase the key just after decryption\n size_t payload_len = aes_remove_padding(payload, enc_payload_len);\n\n EFI_GUID GUID_LOADED_IMAGE = EFI_LOADED_IMAGE_PROTOCOL_GUID;\n EFI_GUID GUID_DEVICE_PATH = EFI_DEVICE_PATH_PROTOCOL_GUID;\n EFI_LOADED_IMAGE_PROTOCOL *loadedImage = NULL;\n EFI_DEVICE_PATH_PROTOCOL *bootDevice = NULL;\n HANDLE_PROTOCOL(image_handle, GUID_LOADED_IMAGE, &loadedImage);\n if (loadedImage) {\n HANDLE_PROTOCOL(loadedImage->DeviceHandle, GUID_DEVICE_PATH, &bootDevice);\n }\n\n EFI_HANDLE payloadHandle = NULL;\n status = uefi_call_wrapper(gBS->LoadImage, 6,\n FALSE,\n image_handle,\n bootDevice,\n payload,\n payload_len,\n &payloadHandle);\n CHECK_ERROR(!payloadHandle);\n\n FREE_POOL(payload);\n\n status = uefi_call_wrapper(gBS->StartImage, 3, payloadHandle, NULL, NULL);\n CHECK_ERROR(0);\n\n return 0;\n}\n';
11762
11762
  const __vite_glob_0_179 = `/*
11763
11763
  * SHA-256 hash in x86-64 assembly
11764
11764
  *
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { b } from "./build-laCVTTyp.js";
1
+ import { b } from "./build-CUHiK1Y8.js";
2
2
  export {
3
3
  b as build
4
4
  };
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"efiencrypt","version":"0.0.1","description":"Encrypts an EFI binary using a hash derived from user-defined data (random data, disk sectors, SMBIOS fields, ...)","type":"module","license":"MIT","bin":{"efiencrypt":"efiencrypt"},"repository":{"url":"https://github.com/davdiv/efiencrypt"},"exports":{".":{"types":"./index.d.ts","default":"./index.js"},"./smbios":{"types":"./smbios.d.ts","default":"./smbios.js"},"./schema.json":"./schema.json"}}
1
+ {"name":"efiencrypt","version":"1.0.1","description":"Encrypts an EFI binary using a hash derived from user-defined data (random data, disk sectors, SMBIOS fields, ...)","type":"module","license":"MIT","bin":{"efiencrypt":"efiencrypt"},"repository":{"url":"https://github.com/davdiv/efiencrypt"},"exports":{".":{"types":"./index.d.ts","default":"./index.js"},"./smbios":{"types":"./smbios.d.ts","default":"./smbios.js"},"./schema.json":"./schema.json"}}