@ai-ecoverse/slicc-kernel 1.125.8 → 1.125.10

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/dist/node.js CHANGED
@@ -4340,6 +4340,17 @@ var S_IFIFO = 4096;
4340
4340
  var PERM_MASK = 4095;
4341
4341
  var S_ISGID3 = 1024;
4342
4342
  var READ_ATTEMPTS = 3;
4343
+ async function swapped(op) {
4344
+ for (let attempt = 1; ; attempt++) {
4345
+ try {
4346
+ return await op();
4347
+ } catch (err) {
4348
+ if (err?.name !== "NotFoundError" || attempt >= READ_ATTEMPTS) {
4349
+ throw err;
4350
+ }
4351
+ }
4352
+ }
4353
+ }
4343
4354
  var MAX_LINKS5 = 40;
4344
4355
  var CHECK_MS = 1e3;
4345
4356
  var ABSENT_MS = 2;
@@ -5121,10 +5132,14 @@ var OpfsFs = class {
5121
5132
  return { ...stat, ...ownOf(meta) ?? inherit(entries) };
5122
5133
  }
5123
5134
  stat(path) {
5124
- return this.unreplaced(async () => this.describe(await this.located(path, true)));
5135
+ return this.unreplaced(
5136
+ () => swapped(async () => this.describe(await this.located(path, true)))
5137
+ );
5125
5138
  }
5126
5139
  lstat(path) {
5127
- return this.unreplaced(async () => this.describe(await this.located(path, false)));
5140
+ return this.unreplaced(
5141
+ () => swapped(async () => this.describe(await this.located(path, false)))
5142
+ );
5128
5143
  }
5129
5144
  async exists(path) {
5130
5145
  return this.locate(path, true).then(
@@ -5150,8 +5165,17 @@ var OpfsFs = class {
5150
5165
  }
5151
5166
  reading(path, op) {
5152
5167
  return this.unreplaced(async () => {
5153
- const handle = await this.existing(path);
5154
- return this.retrying(path, () => op(handle), false);
5168
+ for (let attempt = 1; ; attempt++) {
5169
+ const found = await this.locate(path, true);
5170
+ const handle = found.handle;
5171
+ if (handle.kind === "directory") throw fsError("EISDIR", path);
5172
+ try {
5173
+ return await this.retrying(path, () => op(handle), false);
5174
+ } catch (err) {
5175
+ if (err.code !== "ENOENT" || attempt >= READ_ATTEMPTS) throw err;
5176
+ this.files.delete(found.path);
5177
+ }
5178
+ }
5155
5179
  });
5156
5180
  }
5157
5181
  async existing(path, writing = false) {
@@ -5655,10 +5679,10 @@ var OpfsFs = class {
5655
5679
  }));
5656
5680
  }
5657
5681
  async utimes(path, atime, mtime) {
5658
- await this.setTimes(await this.locate(path, true), atime, mtime);
5682
+ await swapped(async () => this.setTimes(await this.locate(path, true), atime, mtime));
5659
5683
  }
5660
5684
  async lutimes(path, atime, mtime) {
5661
- await this.setTimes(await this.locate(path, false), atime, mtime);
5685
+ await swapped(async () => this.setTimes(await this.locate(path, false), atime, mtime));
5662
5686
  }
5663
5687
  async setTimes(found, atime, mtime) {
5664
5688
  this.refuse(found.path);
@@ -7086,7 +7110,7 @@ function satisfies(version, range2) {
7086
7110
  }
7087
7111
 
7088
7112
  // src/version.ts
7089
- var KERNEL_VERSION = true ? "1.125.8" : "0.0.0-dev";
7113
+ var KERNEL_VERSION = true ? "1.125.10" : "0.0.0-dev";
7090
7114
  var OS_RELEASE = "6.0.0-slicc";
7091
7115
  function procVersion() {
7092
7116
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -17250,8 +17274,32 @@ var HASHES = {
17250
17274
  "2a8648ce3d040302": ["ECDSA", "SHA-256"],
17251
17275
  "2a8648ce3d040303": ["ECDSA", "SHA-384"],
17252
17276
  "2a8648ce3d040304": ["ECDSA", "SHA-512"],
17253
- "2b6570": ["Ed25519", ""]
17277
+ "2b6570": ["Ed25519", ""],
17278
+ "2a864886f70d01010a": ["RSA-PSS", "SHA-1"]
17254
17279
  };
17280
+ var PSS_HASHES = {
17281
+ "2b0e03021a": "SHA-1",
17282
+ "608648016503040201": "SHA-256",
17283
+ "608648016503040202": "SHA-384",
17284
+ "608648016503040203": "SHA-512"
17285
+ };
17286
+ function pssOf(der, algorithm) {
17287
+ const params = children2(der, algorithm, 2)?.[1];
17288
+ let hash = "SHA-1";
17289
+ let salt = 20;
17290
+ for (const field4 of params && der[params.start] === 48 ? children2(der, params, 3) ?? [] : []) {
17291
+ const inner = tlv2(der, field4.body);
17292
+ if (!inner) return void 0;
17293
+ if (der[field4.start] === 160) {
17294
+ const known = PSS_HASHES[oidOf(der, inner) ?? ""];
17295
+ if (!known) return void 0;
17296
+ hash = known;
17297
+ } else if (der[field4.start] === 162) {
17298
+ salt = der.subarray(inner.body, inner.end).reduce((n, b) => n * 256 + b, 0);
17299
+ }
17300
+ }
17301
+ return { hash, salt };
17302
+ }
17255
17303
  var CURVES = {
17256
17304
  "2a8648ce3d030107": ["P-256", 32],
17257
17305
  "2b81040022": ["P-384", 48],
@@ -17286,10 +17334,13 @@ function signedOf(der) {
17286
17334
  const spki = parts2?.tbs[5];
17287
17335
  if (!tbs || !algorithm || !value2 || !spki || der[value2.start] !== 3) return void 0;
17288
17336
  const known = HASHES[oidOf(der, algorithm) ?? ""];
17289
- if (!known) return "unknown";
17290
- const [scheme, hash] = known;
17337
+ if (!known) return void 0;
17338
+ const [scheme] = known;
17339
+ const pss = scheme === "RSA-PSS" ? pssOf(der, algorithm) : void 0;
17340
+ if (scheme === "RSA-PSS" && !pss) return void 0;
17341
+ const hash = pss?.hash ?? known[1];
17291
17342
  const curve = scheme === "ECDSA" ? curveOf(der, spki) : void 0;
17292
- if (scheme === "ECDSA" && !curve) return "unknown";
17343
+ if (scheme === "ECDSA" && !curve) return void 0;
17293
17344
  const signature = der.subarray(value2.body + 1, value2.end);
17294
17345
  return {
17295
17346
  tbs: raw(der, tbs),
@@ -17297,7 +17348,8 @@ function signedOf(der) {
17297
17348
  signature,
17298
17349
  scheme,
17299
17350
  hash,
17300
- ...curve ? { curve } : {}
17351
+ ...curve ? { curve } : {},
17352
+ ...pss ? { salt: pss.salt } : {}
17301
17353
  };
17302
17354
  }
17303
17355
  async function verifiesItself(s) {
@@ -17308,13 +17360,12 @@ async function verifiesItself(s) {
17308
17360
  ]);
17309
17361
  const signature = s.curve ? fixedEcdsa(s.signature, s.curve[1]) : s.signature;
17310
17362
  if (!signature) return false;
17311
- const params = s.scheme === "ECDSA" ? { name: "ECDSA", hash: s.hash } : { name: s.scheme };
17363
+ const params = s.scheme === "ECDSA" ? { name: "ECDSA", hash: s.hash } : s.salt === void 0 ? { name: s.scheme } : { name: s.scheme, saltLength: s.salt };
17312
17364
  return crypto.subtle.verify(params, key, new Uint8Array(signature), new Uint8Array(s.tbs));
17313
17365
  }
17314
17366
  async function selfSigned(der) {
17315
17367
  if (!selfIssued(der)) return false;
17316
17368
  const signed = signedOf(der);
17317
- if (signed === "unknown") return true;
17318
17369
  if (!signed) return false;
17319
17370
  return verifiesItself(signed).catch(() => false);
17320
17371
  }