@ai-ecoverse/slicc-kernel 1.133.2 → 1.133.3

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.
@@ -7034,7 +7034,7 @@ function satisfies(version, range2) {
7034
7034
  }
7035
7035
 
7036
7036
  // src/version.ts
7037
- var KERNEL_VERSION = true ? "1.133.2" : "0.0.0-dev";
7037
+ var KERNEL_VERSION = true ? "1.133.3" : "0.0.0-dev";
7038
7038
  var OS_RELEASE = "6.0.0-slicc";
7039
7039
  function procVersion() {
7040
7040
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -19490,10 +19490,32 @@ var KEY_ERRORS = [
19490
19490
  [-15232, "ERR_OSSL_BAD_DECRYPT"],
19491
19491
  [-15360, "ERR_OSSL_CRYPTO_INTERRUPTED_OR_CANCELLED"]
19492
19492
  ];
19493
- function keyRefused(err) {
19494
- const code = err instanceof TlsError ? err.code : 0;
19493
+ var PBE_OIDS = [
19494
+ [42, 134, 72, 134, 247, 13, 1, 5],
19495
+ [42, 134, 72, 134, 247, 13, 1, 12, 1]
19496
+ ];
19497
+ function hasBytes(hay, needle) {
19498
+ for (let i = 0; i + needle.length <= hay.length; i++) {
19499
+ if (needle.every((b, j) => hay[i + j] === b)) return true;
19500
+ }
19501
+ return false;
19502
+ }
19503
+ function encryptedKey(key) {
19504
+ if (key[0] === 48) return PBE_OIDS.some((oid2) => hasBytes(key, oid2));
19505
+ return new TextDecoder().decode(key).includes("ENCRYPTED");
19506
+ }
19507
+ var KEY_PARSE_RANGES = [
19508
+ [-16383, -14336],
19509
+ [-5375, -4096],
19510
+ [-28671, -24576],
19511
+ [-127, -96]
19512
+ ];
19513
+ var keyParse = (code) => code !== -15360 && KEY_PARSE_RANGES.some(([lo, hi]) => code >= lo && code <= hi);
19514
+ function keyRefused(err, locked) {
19515
+ const raw2 = err instanceof TlsError ? err.code : 0;
19516
+ const code = locked && keyParse(raw2) ? -15232 : raw2;
19495
19517
  const name2 = KEY_ERRORS.find(([n]) => n === code)?.[1] ?? "ERR_OSSL_UNSUPPORTED";
19496
- const text = code === -3 ? "the key does not match the certificate" : err.message;
19518
+ const text = code === -3 ? "the key does not match the certificate" : code === raw2 ? err.message : "bad decrypt";
19497
19519
  return new KernelError("EPROTO", `${name2}: ${text}`);
19498
19520
  }
19499
19521
  function takeCert(req) {
@@ -19524,7 +19546,7 @@ function withCert(session, cert) {
19524
19546
  try {
19525
19547
  session.ownCert(cert.chain, cert.key, cert.pass);
19526
19548
  } catch (err) {
19527
- throw keyRefused(err);
19549
+ throw keyRefused(err, cert.pass.length > 0 && encryptedKey(cert.key));
19528
19550
  }
19529
19551
  }
19530
19552
  function wipe(cert) {