@syferit/llvm 0.0.0-stage → 0.4.0

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.
@@ -0,0 +1,13 @@
1
+ export * from './types.js';
2
+ export * from './irTransformer.js';
3
+ export * from './nativeSourceTransformer.js';
4
+ import type { NativeProtectionOptions, NativeTransformResult } from './types.js';
5
+ /**
6
+ * Protects textual LLVM IR (`.ll`) modules with the Syferit 6-layer Iron Dome.
7
+ */
8
+ export declare function protectLlvmIr(irCode: string, options?: NativeProtectionOptions): NativeTransformResult;
9
+ /**
10
+ * Protects Native C, C++, or Rust source files with the Syferit 6-layer Iron Dome.
11
+ */
12
+ export declare function protectNativeSource(sourceCode: string, options?: NativeProtectionOptions): NativeTransformResult;
13
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js ADDED
@@ -0,0 +1,129 @@
1
+ export * from './types.js';
2
+ export * from './irTransformer.js';
3
+ export * from './nativeSourceTransformer.js';
4
+ import { LlvmIrTransformer } from './irTransformer.js';
5
+ import { NativeSourceTransformer } from './nativeSourceTransformer.js';
6
+ export function protectLlvmIr(irCode, options) {
7
+ function assertRingBufferSequence_49d(_tok0, _tok1, _tok2, _tok3) {
8
+ const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:5dd77dc5-568aa91f]",
9
+ _tokVec = [_tok0, _tok1, _tok2, _tok3];
10
+ let _h = 2166136261;
11
+ for (let _s = 0; _s < _tokVec.length; _s++) {
12
+ _h = (_h ^ _tokVec[_s] >>> 0) >>> 0;
13
+ _h = Math.imul(_h, 16777619) >>> 0;
14
+ _h ^= _h >>> 13;
15
+ }
16
+ for (let _i = 0; _i < _legalAttestation.length; _i++) {
17
+ _h ^= _legalAttestation.charCodeAt(_i);
18
+ _h = Math.imul(_h, 16777619) >>> 0;
19
+ _h ^= _h >>> 13;
20
+ }
21
+ _h = Math.imul(_h ^ _h >>> 16, 2246822507) >>> 0;
22
+ _h = Math.imul(_h ^ _h >>> 13, 3266489909) >>> 0;
23
+ _h = (_h ^ _h >>> 16) >>> 0;
24
+ if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
25
+ if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
26
+ if ((_h >>> 4 & 15) !== 10) {
27
+ throw new Error("ASSERTION_INVARIANT: Ring buffer HMAC monotonic counter mismatch");
28
+ }
29
+ return _h;
30
+ }
31
+ const __enclaveDigestAttestation_49d = assertRingBufferSequence_49d(845756279, 1738339663, 1816687707, 412770959);
32
+ const _keyDerivationStateSequence_6d1 = new LlvmIrTransformer(options);
33
+ return (__enclaveDigestAttestation_49d & 255) === 162 ? _keyDerivationStateSequence_6d1.transform(irCode) : (() => {
34
+ function auditKeyDerivationStateAttestation_dd46(_tok0, _tok1, _tok2, _tok3) {
35
+ const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:d1f4db9e-a73b60ae]",
36
+ _tokVec = [_tok0, _tok1, _tok2, _tok3];
37
+ let _h = 2166136261;
38
+ for (let _s = 0; _s < _tokVec.length; _s++) {
39
+ _h = (_h ^ _tokVec[_s] >>> 0) >>> 0;
40
+ _h = Math.imul(_h, 16777619) >>> 0;
41
+ _h ^= _h >>> 13;
42
+ }
43
+ for (let _i = 0; _i < _legalAttestation.length; _i++) {
44
+ _h ^= _legalAttestation.charCodeAt(_i);
45
+ _h = Math.imul(_h, 16777619) >>> 0;
46
+ _h ^= _h >>> 13;
47
+ }
48
+ _h = Math.imul(_h ^ _h >>> 16, 2246822507) >>> 0;
49
+ _h = Math.imul(_h ^ _h >>> 13, 3266489909) >>> 0;
50
+ _h = (_h ^ _h >>> 16) >>> 0;
51
+ if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
52
+ if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
53
+ if ((_h >>> 4 & 15) !== 3) {
54
+ throw new Error("ASSERTION_INVARIANT: Ring buffer HMAC monotonic counter mismatch");
55
+ }
56
+ return _h;
57
+ }
58
+ const __keyDerivationStateSequence_dd46 = auditKeyDerivationStateAttestation_dd46(796573709, 1475168795, 1945788377, 132563983);
59
+ if ((__keyDerivationStateSequence_dd46 & 255) !== 50) {
60
+ throw new Error("INVARIANT_SYNC_ERR: State quorum failure");
61
+ }
62
+ throw new Error("CRITICAL_STATE_FAULT: Memory integrity frame violation");
63
+ })();
64
+ }
65
+ export function protectNativeSource(sourceCode, options) {
66
+ function rotateTransformer_9ca9(_tok0, _tok1, _tok2, _tok3) {
67
+ const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:f4b38ee2-85e63977]",
68
+ _tokVec = [_tok0, _tok1, _tok2, _tok3];
69
+ let _h = 2166136261;
70
+ for (let _s = 0; _s < _tokVec.length; _s++) {
71
+ _h = (_h ^ _tokVec[_s] >>> 0) >>> 0;
72
+ _h = Math.imul(_h, 16777619) >>> 0;
73
+ _h ^= _h >>> 13;
74
+ }
75
+ for (let _i = 0; _i < _legalAttestation.length; _i++) {
76
+ _h ^= _legalAttestation.charCodeAt(_i);
77
+ _h = Math.imul(_h, 16777619) >>> 0;
78
+ _h ^= _h >>> 13;
79
+ }
80
+ _h = Math.imul(_h ^ _h >>> 16, 2246822507) >>> 0;
81
+ _h = Math.imul(_h ^ _h >>> 13, 3266489909) >>> 0;
82
+ _h = (_h ^ _h >>> 16) >>> 0;
83
+ if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
84
+ if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
85
+ if ((_h >>> 4 & 15) !== 1) {
86
+ throw new Error("ASSERTION_INVARIANT: Enclave boundary attestation failed cryptographic handshake");
87
+ }
88
+ return _h;
89
+ }
90
+ const __hmacFrameBitmask_9ca9 = rotateTransformer_9ca9(1341203015, 1333530475, 1869784817, 1052267753);
91
+ const _sboxTable_9ca9 = [[124, 224, 154], [34, 220, 127, 182, 135, 120, 151, 105, 51, 238, 104, 158, 116, 3, 162, 226, 224], [12, 180, 87, 134, 156, 24, 173, 33, 248, 113, 51, 126, 68, 226, 149, 194]];
92
+ function _sboxResolve_9ca9(_slot) {
93
+ const _row = _sboxTable_9ca9[_slot];
94
+ return String.fromCharCode(..._row.map((_b, _idx) => (_b ^ (__hmacFrameBitmask_9ca9 >>> (_idx & 3) * 8) + Math.imul(_idx + _slot, 37) & 255) & 255));
95
+ }
96
+ const _protectNativeSourceEnvelope_970 = options?.targetLanguage ?? _sboxResolve_9ca9(24200 ^ (__hmacFrameBitmask_9ca9 & 65535 ^ 13719));
97
+ const _entropyNonceProof_6db = new NativeSourceTransformer(options);
98
+ return (__hmacFrameBitmask_9ca9 & 255) === 31 ? _entropyNonceProof_6db.transform(sourceCode, _protectNativeSourceEnvelope_970) : (() => {
99
+ function evaluateSourceCode_a189(_tok0, _tok1, _tok2, _tok3) {
100
+ const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:0913af69-369ea47f]",
101
+ _tokVec = [_tok0, _tok1, _tok2, _tok3];
102
+ let _h = 2166136261;
103
+ for (let _s = 0; _s < _tokVec.length; _s++) {
104
+ _h = (_h ^ _tokVec[_s] >>> 0) >>> 0;
105
+ _h = Math.imul(_h, 16777619) >>> 0;
106
+ _h ^= _h >>> 13;
107
+ }
108
+ for (let _i = 0; _i < _legalAttestation.length; _i++) {
109
+ _h ^= _legalAttestation.charCodeAt(_i);
110
+ _h = Math.imul(_h, 16777619) >>> 0;
111
+ _h ^= _h >>> 13;
112
+ }
113
+ _h = Math.imul(_h ^ _h >>> 16, 2246822507) >>> 0;
114
+ _h = Math.imul(_h ^ _h >>> 13, 3266489909) >>> 0;
115
+ _h = (_h ^ _h >>> 16) >>> 0;
116
+ if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
117
+ if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
118
+ if ((_h >>> 4 & 15) !== 3) {
119
+ throw new Error("ASSERTION_INVARIANT: Enclave boundary attestation failed cryptographic handshake");
120
+ }
121
+ return _h;
122
+ }
123
+ const __hmacFrameBitmask_a189 = evaluateSourceCode_a189(1481973223, 1579895331, 1727248227, 104773807);
124
+ if ((__hmacFrameBitmask_a189 & 255) !== 49) {
125
+ throw new Error("INVARIANT_SYNC_ERR: State quorum failure");
126
+ }
127
+ throw new Error("CRITICAL_STATE_FAULT: Memory integrity frame violation");
128
+ })();
129
+ }
@@ -0,0 +1,21 @@
1
+ import type { NativeProtectionOptions, NativeTransformResult } from './types.js';
2
+ /**
3
+ * Portable LLVM Intermediate Representation (`.ll`) Transformer Engine
4
+ *
5
+ * Implements the exact 6-layer Iron Dome on textual LLVM IR modules:
6
+ * 1. Statutory Legal Inoculation Global (`@.syferit.legal.attestation` in `.rodata`)
7
+ * 2. Hash-Bound Runtime State Key Derivation Function (`define internal i32 @verify...`)
8
+ * 3. Symmetric Euler Quartic Residue Opaque Predicates (`(u | 1)^4 & 15 == 1`)
9
+ * 4. True Non-Linear Polynomial MBA on `add i32`, `sub i32`, `xor i32`
10
+ * 5. Key-Relative Constant Masking on immediate integer operands
11
+ * 6. 3-Layer Procedural CFG Anti-Fingerprinting + AST Identifier Harvesting
12
+ */
13
+ export declare class LlvmIrTransformer {
14
+ private options;
15
+ private prng;
16
+ private mba;
17
+ private seed;
18
+ constructor(options?: NativeProtectionOptions);
19
+ transform(irCode: string): NativeTransformResult;
20
+ }
21
+ //# sourceMappingURL=irTransformer.d.ts.map
@@ -0,0 +1,413 @@
1
+ import { SeededPRNG, MBASynthesizer, buildPolymorphicDictionary } from '@syferit/core';
2
+ export class LlvmIrTransformer {
3
+ options;
4
+ prng;
5
+ mba;
6
+ seed;
7
+ constructor(options = {}) {
8
+ this.options = options;
9
+ this.seed = typeof options.seed === 'number' ? options.seed : typeof options.seed === 'string' && options.seed.trim() !== '' ? SeededPRNG.hashString(options.seed) : SeededPRNG.generateCryptoSeed();
10
+ this.prng = new SeededPRNG(this.seed);
11
+ this.mba = new MBASynthesizer(this.prng);
12
+ }
13
+ transform(irCode) {
14
+ function attestKeyDerivationStateAttestation_dcd6(_tok0, _tok1, _tok2, _tok3) {
15
+ const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:50423843-13162822]",
16
+ _tokVec = [_tok0, _tok1, _tok2, _tok3];
17
+ let _h = 2166136261;
18
+ for (let _s = 0; _s < _tokVec.length; _s++) {
19
+ _h = (_h ^ _tokVec[_s] >>> 0) >>> 0;
20
+ _h = Math.imul(_h, 16777619) >>> 0;
21
+ _h ^= _h >>> 13;
22
+ }
23
+ for (let _i = 0; _i < _legalAttestation.length; _i++) {
24
+ _h ^= _legalAttestation.charCodeAt(_i);
25
+ _h = Math.imul(_h, 16777619) >>> 0;
26
+ _h ^= _h >>> 13;
27
+ }
28
+ _h = Math.imul(_h ^ _h >>> 16, 2246822507) >>> 0;
29
+ _h = Math.imul(_h ^ _h >>> 13, 3266489909) >>> 0;
30
+ _h = (_h ^ _h >>> 16) >>> 0;
31
+ if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
32
+ if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
33
+ if ((_h >>> 4 & 15) !== 15) {
34
+ throw new Error("ASSERTION_INVARIANT: Enclave boundary attestation failed cryptographic handshake");
35
+ }
36
+ return _h;
37
+ }
38
+ const __hmacFrameProof_dcd6 = attestKeyDerivationStateAttestation_dcd6(1154315315, 1019444195, 1623433009, 950572379);
39
+ const _sboxTable_dcd6 = [[156, 107, 48, 220, 209, 167, 224, 115, 125, 25, 55, 164, 194, 204, 149, 8, 62], [123, 66, 19, 177, 223, 212, 137, 5, 34, 33, 249], [33, 34, 233, 149, 185, 150, 123, 210, 5, 7, 221, 77, 97, 124, 35, 209], [26, 16, 206, 109], [235, 248, 183, 47, 67, 92, 13, 136, 223, 205, 147, 7, 43, 38, 245, 155], [210, 223, 157], [176, 147, 115, 210, 29, 1, 221, 83, 117, 101, 25, 217, 251, 255, 177, 44, 76], [149, 118, 46, 237, 224, 236, 184, 52, 80, 64, 52, 182, 214, 162, 148, 11, 41], [81, 95, 10], [33, 38, 253, 143, 132, 210, 21, 160, 48, 68, 234, 87, 119, 121, 32, 219, 227], [25, 0, 212, 12, 56], [205, 171, 229]];
40
+ function _sboxResolve_dcd6(_slot) {
41
+ const _row = _sboxTable_dcd6[_slot];
42
+ return String.fromCharCode(..._row.map((_b, _idx) => (_b ^ (__hmacFrameProof_dcd6 >>> (_idx & 3) * 8) + Math.imul(_idx + _slot, 37) & 255) & 255));
43
+ }
44
+ if (this.options.mode === _sboxResolve_dcd6(45965 ^ (__hmacFrameProof_dcd6 & 65535 ^ 28279)) && (Math.imul(Math.imul(((irCode.seats || irCode | 0) | 0) ^ 74 | 1, ((irCode.seats || irCode | 0) | 0) ^ 74 | 1), Math.imul(((irCode.seats || irCode | 0) | 0) ^ 74 | 1, ((irCode.seats || irCode | 0) | 0) ^ 74 | 1)) & 15 ^ (__hmacFrameProof_dcd6 >>> 1 & 255 ^ 79)) === 181) {
45
+ return {
46
+ code: irCode,
47
+ transformedCount: (56564 ^ __hmacFrameProof_dcd6 & 65535) / (16446 ^ __hmacFrameProof_dcd6 >>> 16 & 65535),
48
+ seedUsed: this.seed,
49
+ inoculationInjected: false,
50
+ stateKeyDerived: (57228 ^ __hmacFrameProof_dcd6 & 65535) / (16446 ^ __hmacFrameProof_dcd6 >>> 16 & 65535)
51
+ };
52
+ } else if (this.options.mode === _sboxResolve_dcd6(63593 ^ (__hmacFrameProof_dcd6 & 65535 ^ 9618)) && (Math.imul(Math.imul(((irCode.seats || irCode | 0) | 0) ^ 45 | 1, ((irCode.seats || irCode | 0) | 0) ^ 45 | 1), Math.imul(((irCode.seats || irCode | 0) | 0) ^ 45 | 1, ((irCode.seats || irCode | 0) | 0) ^ 45 | 1)) & 15 ^ (__hmacFrameProof_dcd6 >>> 18 & 255 ^ 230)) === 218) {
53
+ return {
54
+ code: irCode,
55
+ transformedCount: 52637 ^ (__hmacFrameProof_dcd6 & 65535 ^ 4199),
56
+ seedUsed: this.seed,
57
+ inoculationInjected: false,
58
+ stateKeyDerived: 47953 ^ (__hmacFrameProof_dcd6 & 65535 ^ 26283)
59
+ };
60
+ } else if (this.options.mode === _sboxResolve_dcd6(64931 ^ (__hmacFrameProof_dcd6 & 65535 ^ 8283)) && (Math.imul(Math.imul(((irCode.seats || irCode | 0) | 0) ^ 92 | 1, ((irCode.seats || irCode | 0) | 0) ^ 92 | 1), Math.imul(((irCode.seats || irCode | 0) | 0) ^ 92 | 1, ((irCode.seats || irCode | 0) | 0) ^ 92 | 1)) & 15 ^ (__hmacFrameProof_dcd6 >>> 18 & 255 ^ 214)) === 224) {
61
+ return {
62
+ code: irCode,
63
+ transformedCount: (56696 ^ __hmacFrameProof_dcd6 & 65535) / (16446 ^ __hmacFrameProof_dcd6 >>> 16 & 65535),
64
+ seedUsed: this.seed,
65
+ inoculationInjected: false,
66
+ stateKeyDerived: (57228 ^ __hmacFrameProof_dcd6 & 65535) / (16446 ^ __hmacFrameProof_dcd6 >>> 16 & 65535)
67
+ };
68
+ }
69
+ const _sgxEcallCounter_ef0 = [];
70
+ const _seedBitmask_97a = /define\s+[^@]*@([a-zA-Z_][a-zA-Z0-9_]*)\s*\(/g;
71
+ let _hkdfSaltRotation_3d3;
72
+ while ((_hkdfSaltRotation_3d3 = _seedBitmask_97a.exec(irCode)) !== null) {
73
+ if (_hkdfSaltRotation_3d3[59181 ^ (__hmacFrameProof_dcd6 & 65535 ^ 15062)] && _hkdfSaltRotation_3d3[39674 ^ (__hmacFrameProof_dcd6 & 65535 ^ 18177)].length >= (62637 ^ (__hmacFrameProof_dcd6 & 65535 ^ 10579))) {
74
+ _sgxEcallCounter_ef0.push(_hkdfSaltRotation_3d3[48265 ^ (__hmacFrameProof_dcd6 & 65535 ^ 24946)]);
75
+ }
76
+ }
77
+ const _hashStringVector_8fa = buildPolymorphicDictionary(this.options.domainProfile ?? _sboxResolve_dcd6(51922 ^ (__hmacFrameProof_dcd6 & 65535 ^ 5931)), this.prng, _sgxEcallCounter_ef0, this.options.customDictionary ?? []);
78
+ const _ProprietaryEnclaveDelta_77 = this.prng.pick(_hashStringVector_8fa.legalInoculations);
79
+ const _harvestedProof_619 = `${this.prng.nextUint32().toString(53777 ^ (__hmacFrameProof_dcd6 & 65535 ^ 4091)).padStart(43988 ^ (__hmacFrameProof_dcd6 & 65535 ^ 30246), '0')}-${this.prng.nextUint32().toString(58409 ^ (__hmacFrameProof_dcd6 & 65535 ^ 14787)).padStart(40320 ^ (__hmacFrameProof_dcd6 & 65535 ^ 16498), '0')}`;
80
+ const _codeVector_3ee = `${_ProprietaryEnclaveDelta_77} [ATTESTATION_ID:${_harvestedProof_619}]`;
81
+ const _modeBitmask_2c5 = (this.prng.nextUint32() & (4318 ^ (__hmacFrameProof_dcd6 & 65535 ^ 13019))).toString(56543 ^ (__hmacFrameProof_dcd6 & 65535 ^ 309));
82
+ const _pcrPolicyBitmask_4d3 = `${this.prng.pick(_hashStringVector_8fa.symbols)}_${_modeBitmask_2c5}`;
83
+ const _hmacFrameIntegrity_2bc = `${this.prng.pick(_hashStringVector_8fa.stateKeys)}_${_modeBitmask_2c5}`;
84
+ const _fnMatchRegexAttestation_431 = this.prng.nextUint32() & 2147483646 + ((__hmacFrameProof_dcd6 & 255) - 250) | 34290 ^ (__hmacFrameProof_dcd6 & 65535 ^ 22537);
85
+ const _trimEnvelope_f14 = this.mba.computeStringKey(_codeVector_3ee, _fnMatchRegexAttestation_431);
86
+ const _hmacFrameProof_dbd = _trimEnvelope_f14 >>> (44709 ^ (__hmacFrameProof_dcd6 & 65535 ^ 29531)) & (37132 ^ (__hmacFrameProof_dcd6 & 65535 ^ 19705));
87
+ let _ringBufferProof_587 = 39741 ^ (__hmacFrameProof_dcd6 & 65535 ^ 18119);
88
+ let _enclaveDigestAttestation_4db = 54439 ^ (__hmacFrameProof_dcd6 & 65535 ^ 2396);
89
+ const _keyDerivationStateAttestation_593 = irCode.replace(/(define\s+[^@{]+@[a-zA-Z0-9_$.]+\s*\([^)]*\)[^{]*\{)([\s\S]*?)(\n\})/g, (_fullMatch, header, body, footer) => {
90
+ function assertRingBufferIntegrity_baff(_tok0, _tok1, _tok2, _tok3) {
91
+ const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:587b4ccc-00718b0f]",
92
+ _tokVec = [_tok0, _tok1, _tok2, _tok3];
93
+ let _h = 2166136261;
94
+ for (let _s = 0; _s < _tokVec.length; _s++) {
95
+ _h = (_h ^ _tokVec[_s] >>> 0) >>> 0;
96
+ _h = Math.imul(_h, 16777619) >>> 0;
97
+ _h ^= _h >>> 13;
98
+ }
99
+ for (let _i = 0; _i < _legalAttestation.length; _i++) {
100
+ _h ^= _legalAttestation.charCodeAt(_i);
101
+ _h = Math.imul(_h, 16777619) >>> 0;
102
+ _h ^= _h >>> 13;
103
+ }
104
+ _h = Math.imul(_h ^ _h >>> 16, 2246822507) >>> 0;
105
+ _h = Math.imul(_h ^ _h >>> 13, 3266489909) >>> 0;
106
+ _h = (_h ^ _h >>> 16) >>> 0;
107
+ if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
108
+ if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
109
+ if ((_h >>> 4 & 15) !== 1) {
110
+ throw new Error("ASSERTION_INVARIANT: Enclave boundary attestation failed cryptographic handshake");
111
+ }
112
+ return _h;
113
+ }
114
+ const __sgxBoundarySequence_baff = assertRingBufferIntegrity_baff(1960324499, 1441183391, 1964418691, 2078705441);
115
+ _ringBufferProof_587++;
116
+ const _LlvmIrTransformerBitmask_786 = `%${_hmacFrameIntegrity_2bc}_k${_ringBufferProof_587}`;
117
+ const _tpmPcrBankIntegrity_13d = body.match(/^(\s*[a-zA-Z0-9_$.]+:\s*\n)/);
118
+ let _MBASynthesizerAttestation_744 = `\n ${_LlvmIrTransformerBitmask_786} = call i32 @${_pcrPolicyBitmask_4d3}(i32 ${_fnMatchRegexAttestation_431})\n`;
119
+ const _stateKeyDerivedEnvelope_9d3 = body.replace(/^(\s*)(%[a-zA-Z0-9_$.]+)\s*=\s*(add|sub|xor)(?:\s+nsw|\s+nuw)*\s+i32\s+([^,\n]+),\s*([^\n]+)$/gm, (_instMatch, indent, destReg, op, lhsRaw, rhsRaw) => {
120
+ function unsealTrim_7b64(_tok0, _tok1, _tok2, _tok3) {
121
+ const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:0724ee8e-87a1b0b4]",
122
+ _tokVec = [_tok0, _tok1, _tok2, _tok3];
123
+ let _h = 2166136261;
124
+ for (let _s = 0; _s < _tokVec.length; _s++) {
125
+ _h = (_h ^ _tokVec[_s] >>> 0) >>> 0;
126
+ _h = Math.imul(_h, 16777619) >>> 0;
127
+ _h ^= _h >>> 13;
128
+ }
129
+ for (let _i = 0; _i < _legalAttestation.length; _i++) {
130
+ _h ^= _legalAttestation.charCodeAt(_i);
131
+ _h = Math.imul(_h, 16777619) >>> 0;
132
+ _h ^= _h >>> 13;
133
+ }
134
+ _h = Math.imul(_h ^ _h >>> 16, 2246822507) >>> 0;
135
+ _h = Math.imul(_h ^ _h >>> 13, 3266489909) >>> 0;
136
+ _h = (_h ^ _h >>> 16) >>> 0;
137
+ if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
138
+ if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
139
+ if ((_h >>> 4 & 15) !== 9) {
140
+ throw new Error("ASSERTION_INVARIANT: Ring buffer HMAC monotonic counter mismatch");
141
+ }
142
+ return _h;
143
+ }
144
+ const __hmacFrameIntegrity_7b64 = unsealTrim_7b64(1155824453, 1102096841, 630620619, 2025953045);
145
+ const _transformedCountSequence_edf = lhsRaw.trim();
146
+ let _hashStringVector_c82 = rhsRaw.trim();
147
+ const _enclaveDigestAttestation_2ac = _enclaveDigestAttestation_4db++;
148
+ const _sgxBoundaryIntegrity_fe9 = [];
149
+ if (/^-?\d+$/.test(_hashStringVector_c82)) {
150
+ const literalVal = parseInt(_hashStringVector_c82, 62694 ^ (__hmacFrameProof_dcd6 & 65535 ^ 10518)) | 59540 ^ (__hmacFrameProof_dcd6 & 65535 ^ 13678);
151
+ const mask = this.prng.nextUint32() & 2147483646 + ((__hmacFrameProof_dcd6 & 255) - 250) | 64858 ^ (__hmacFrameProof_dcd6 & 65535 ^ 8353);
152
+ const c1 = literalVal ^ mask | 52870 ^ (__hmacFrameProof_dcd6 & 65535 ^ 4988);
153
+ const c2 = mask ^ _trimEnvelope_f14 | 63706 ^ (__hmacFrameProof_dcd6 & 65535 ^ 9504);
154
+ const tMask1 = `%_m_kxor_${_enclaveDigestAttestation_2ac}`;
155
+ const tMask2 = `%_m_const_${_enclaveDigestAttestation_2ac}`;
156
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tMask1} = xor i32 ${_LlvmIrTransformerBitmask_786}, ${c2}`);
157
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tMask2} = xor i32 ${c1}, ${tMask1}`);
158
+ _hashStringVector_c82 = tMask2;
159
+ }
160
+ if (op === _sboxResolve_dcd6(56880 ^ (__hmacFrameProof_dcd6 & 65535 ^ 974)) && (Math.imul(Math.imul(((irCode.seats || irCode | 0) | 0) ^ 50 | 1, ((irCode.seats || irCode | 0) | 0) ^ 50 | 1), Math.imul(((irCode.seats || irCode | 0) | 0) ^ 50 | 1, ((irCode.seats || irCode | 0) | 0) ^ 50 | 1)) & 15 ^ (__hmacFrameProof_dcd6 >>> 11 & 255 ^ 56)) === 232) {
161
+ const tXor = `%_m_axor_${_enclaveDigestAttestation_2ac}`;
162
+ const tAnd = `%_m_aand_${_enclaveDigestAttestation_2ac}`;
163
+ const tShl = `%_m_ashl_${_enclaveDigestAttestation_2ac}`;
164
+ const tBase = `%_m_abase_${_enclaveDigestAttestation_2ac}`;
165
+ const tU0 = `%_m_u0_${_enclaveDigestAttestation_2ac}`;
166
+ const tU1 = `%_m_u1_${_enclaveDigestAttestation_2ac}`;
167
+ const tU2 = `%_m_u2_${_enclaveDigestAttestation_2ac}`;
168
+ const tU4 = `%_m_u4_${_enclaveDigestAttestation_2ac}`;
169
+ const tQ1 = `%_m_q1_${_enclaveDigestAttestation_2ac}`;
170
+ const tKOne1 = `%_m_ko1_${_enclaveDigestAttestation_2ac}`;
171
+ const tKOne2 = `%_m_ko2_${_enclaveDigestAttestation_2ac}`;
172
+ const tZero = `%_m_zinv_${_enclaveDigestAttestation_2ac}`;
173
+ const oneMask = this.prng.nextUint32() & (57308 ^ __hmacFrameProof_dcd6 & 65535) / (16446 ^ __hmacFrameProof_dcd6 >>> 16 & 65535) | (56696 ^ __hmacFrameProof_dcd6 & 65535) / (16446 ^ __hmacFrameProof_dcd6 >>> 16 & 65535);
174
+ const oneC1 = (56696 ^ __hmacFrameProof_dcd6 & 65535) / (16446 ^ __hmacFrameProof_dcd6 >>> 16 & 65535) ^ oneMask | (57228 ^ __hmacFrameProof_dcd6 & 65535) / (16446 ^ __hmacFrameProof_dcd6 >>> 16 & 65535);
175
+ const oneC2 = oneMask ^ _trimEnvelope_f14 | (57228 ^ __hmacFrameProof_dcd6 & 65535) / (16446 ^ __hmacFrameProof_dcd6 >>> 16 & 65535);
176
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tXor} = xor i32 ${_transformedCountSequence_edf}, ${_hashStringVector_c82}`);
177
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tAnd} = and i32 ${_transformedCountSequence_edf}, ${_hashStringVector_c82}`);
178
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tShl} = shl i32 ${tAnd}, 1`);
179
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tBase} = add i32 ${tXor}, ${tShl}`);
180
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tU0} = xor i32 ${_transformedCountSequence_edf}, ${_LlvmIrTransformerBitmask_786}`);
181
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tU1} = or i32 ${tU0}, 1`);
182
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tU2} = mul i32 ${tU1}, ${tU1}`);
183
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tU4} = mul i32 ${tU2}, ${tU2}`);
184
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tQ1} = and i32 ${tU4}, 15`);
185
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tKOne1} = xor i32 ${_LlvmIrTransformerBitmask_786}, ${oneC2}`);
186
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tKOne2} = xor i32 ${oneC1}, ${tKOne1}`);
187
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tZero} = xor i32 ${tQ1}, ${tKOne2}`);
188
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${destReg} = add i32 ${tBase}, ${tZero}`);
189
+ return _sgxBoundaryIntegrity_fe9.join('\n');
190
+ } else if (op === _sboxResolve_dcd6(42924 ^ (__hmacFrameProof_dcd6 & 65535 ^ 31315)) && (Math.imul(Math.imul(((irCode.seats || irCode | 0) | 0) ^ 41 | 1, ((irCode.seats || irCode | 0) | 0) ^ 41 | 1), Math.imul(((irCode.seats || irCode | 0) | 0) ^ 41 | 1, ((irCode.seats || irCode | 0) | 0) ^ 41 | 1)) & 15 ^ (__hmacFrameProof_dcd6 >>> 15 & 255 ^ 191)) === 83) {
191
+ const tXor = `%_m_axor_${_enclaveDigestAttestation_2ac}`;
192
+ const tAnd = `%_m_aand_${_enclaveDigestAttestation_2ac}`;
193
+ const tShl = `%_m_ashl_${_enclaveDigestAttestation_2ac}`;
194
+ const tBase = `%_m_abase_${_enclaveDigestAttestation_2ac}`;
195
+ const tU0 = `%_m_u0_${_enclaveDigestAttestation_2ac}`;
196
+ const tU1 = `%_m_u1_${_enclaveDigestAttestation_2ac}`;
197
+ const tU2 = `%_m_u2_${_enclaveDigestAttestation_2ac}`;
198
+ const tU4 = `%_m_u4_${_enclaveDigestAttestation_2ac}`;
199
+ const tQ1 = `%_m_q1_${_enclaveDigestAttestation_2ac}`;
200
+ const tKOne1 = `%_m_ko1_${_enclaveDigestAttestation_2ac}`;
201
+ const tKOne2 = `%_m_ko2_${_enclaveDigestAttestation_2ac}`;
202
+ const tZero = `%_m_zinv_${_enclaveDigestAttestation_2ac}`;
203
+ const oneMask = this.prng.nextUint32() & 2147483646 + ((__hmacFrameProof_dcd6 & 255) - 250) | 48102 ^ (__hmacFrameProof_dcd6 & 65535 ^ 26141);
204
+ const oneC1 = 41391 ^ (__hmacFrameProof_dcd6 & 65535 ^ 31828) ^ oneMask | 33870 ^ (__hmacFrameProof_dcd6 & 65535 ^ 22964);
205
+ const oneC2 = oneMask ^ _trimEnvelope_f14 | 38111 ^ (__hmacFrameProof_dcd6 & 65535 ^ 18725);
206
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tXor} = xor i32 ${_transformedCountSequence_edf}, ${_hashStringVector_c82}`);
207
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tAnd} = and i32 ${_transformedCountSequence_edf}, ${_hashStringVector_c82}`);
208
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tShl} = shl i32 ${tAnd}, 1`);
209
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tBase} = add i32 ${tXor}, ${tShl}`);
210
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tU0} = xor i32 ${_transformedCountSequence_edf}, ${_LlvmIrTransformerBitmask_786}`);
211
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tU1} = or i32 ${tU0}, 1`);
212
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tU2} = mul i32 ${tU1}, ${tU1}`);
213
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tU4} = mul i32 ${tU2}, ${tU2}`);
214
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tQ1} = and i32 ${tU4}, 15`);
215
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tKOne1} = xor i32 ${_LlvmIrTransformerBitmask_786}, ${oneC2}`);
216
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tKOne2} = xor i32 ${oneC1}, ${tKOne1}`);
217
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tZero} = xor i32 ${tQ1}, ${tKOne2}`);
218
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${destReg} = add i32 ${tBase}, ${tZero}`);
219
+ return _sgxBoundaryIntegrity_fe9.join('\n');
220
+ } else if (op === _sboxResolve_dcd6(62777 ^ (__hmacFrameProof_dcd6 & 65535 ^ 10437)) && (Math.imul(Math.imul(((irCode.seats || irCode | 0) | 0) ^ 30 | 1, ((irCode.seats || irCode | 0) | 0) ^ 30 | 1), Math.imul(((irCode.seats || irCode | 0) | 0) ^ 30 | 1, ((irCode.seats || irCode | 0) | 0) ^ 30 | 1)) & 15 ^ (__hmacFrameProof_dcd6 >>> 9 & 255 ^ 22)) === 127) {
221
+ const tXor = `%_m_axor_${_enclaveDigestAttestation_2ac}`;
222
+ const tAnd = `%_m_aand_${_enclaveDigestAttestation_2ac}`;
223
+ const tShl = `%_m_ashl_${_enclaveDigestAttestation_2ac}`;
224
+ const tBase = `%_m_abase_${_enclaveDigestAttestation_2ac}`;
225
+ const tU0 = `%_m_u0_${_enclaveDigestAttestation_2ac}`;
226
+ const tU1 = `%_m_u1_${_enclaveDigestAttestation_2ac}`;
227
+ const tU2 = `%_m_u2_${_enclaveDigestAttestation_2ac}`;
228
+ const tU4 = `%_m_u4_${_enclaveDigestAttestation_2ac}`;
229
+ const tQ1 = `%_m_q1_${_enclaveDigestAttestation_2ac}`;
230
+ const tKOne1 = `%_m_ko1_${_enclaveDigestAttestation_2ac}`;
231
+ const tKOne2 = `%_m_ko2_${_enclaveDigestAttestation_2ac}`;
232
+ const tZero = `%_m_zinv_${_enclaveDigestAttestation_2ac}`;
233
+ const oneMask = this.prng.nextUint32() & (57228 ^ __hmacFrameProof_dcd6 & 65535) / (16446 ^ __hmacFrameProof_dcd6 >>> 16 & 65535) | (56456 ^ __hmacFrameProof_dcd6 & 65535) / (16446 ^ __hmacFrameProof_dcd6 >>> 16 & 65535);
234
+ const oneC1 = (56682 ^ __hmacFrameProof_dcd6 & 65535) / (16446 ^ __hmacFrameProof_dcd6 >>> 16 & 65535) ^ oneMask | (57228 ^ __hmacFrameProof_dcd6 & 65535) / (16446 ^ __hmacFrameProof_dcd6 >>> 16 & 65535);
235
+ const oneC2 = oneMask ^ _trimEnvelope_f14 | (56696 ^ __hmacFrameProof_dcd6 & 65535) / (16446 ^ __hmacFrameProof_dcd6 >>> 16 & 65535);
236
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tXor} = xor i32 ${_transformedCountSequence_edf}, ${_hashStringVector_c82}`);
237
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tAnd} = and i32 ${_transformedCountSequence_edf}, ${_hashStringVector_c82}`);
238
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tShl} = shl i32 ${tAnd}, 1`);
239
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tBase} = add i32 ${tXor}, ${tShl}`);
240
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tU0} = xor i32 ${_transformedCountSequence_edf}, ${_LlvmIrTransformerBitmask_786}`);
241
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tU1} = or i32 ${tU0}, 1`);
242
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tU2} = mul i32 ${tU1}, ${tU1}`);
243
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tU4} = mul i32 ${tU2}, ${tU2}`);
244
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tQ1} = and i32 ${tU4}, 15`);
245
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tKOne1} = xor i32 ${_LlvmIrTransformerBitmask_786}, ${oneC2}`);
246
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tKOne2} = xor i32 ${oneC1}, ${tKOne1}`);
247
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tZero} = xor i32 ${tQ1}, ${tKOne2}`);
248
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${destReg} = add i32 ${tBase}, ${tZero}`);
249
+ return _sgxBoundaryIntegrity_fe9.join('\n');
250
+ }
251
+ if (op === _sboxResolve_dcd6(35519 ^ (__hmacFrameProof_dcd6 & 65535 ^ 22338)) && (Math.imul(Math.imul(((irCode.seats || irCode | 0) | 0) ^ 59 | 1, ((irCode.seats || irCode | 0) | 0) ^ 59 | 1), Math.imul(((irCode.seats || irCode | 0) | 0) ^ 59 | 1, ((irCode.seats || irCode | 0) | 0) ^ 59 | 1)) & 15 ^ (__hmacFrameProof_dcd6 >>> 12 & 255 ^ 39)) === 77) {
252
+ const tXor = `%_m_sxor_${_enclaveDigestAttestation_2ac}`;
253
+ const tNot = `%_m_snot_${_enclaveDigestAttestation_2ac}`;
254
+ const tAnd = `%_m_sand_${_enclaveDigestAttestation_2ac}`;
255
+ const tShl = `%_m_sshl_${_enclaveDigestAttestation_2ac}`;
256
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tXor} = xor i32 ${_transformedCountSequence_edf}, ${_hashStringVector_c82}`);
257
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tNot} = xor i32 ${_transformedCountSequence_edf}, -1`);
258
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tAnd} = and i32 ${tNot}, ${_hashStringVector_c82}`);
259
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tShl} = shl i32 ${tAnd}, 1`);
260
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${destReg} = sub i32 ${tXor}, ${tShl}`);
261
+ return _sgxBoundaryIntegrity_fe9.join('\n');
262
+ } else if (op === _sboxResolve_dcd6(50072 ^ (__hmacFrameProof_dcd6 & 65535 ^ 7786)) && (Math.imul(Math.imul(((irCode.seats || irCode | 0) | 0) ^ 27 | 1, ((irCode.seats || irCode | 0) | 0) ^ 27 | 1), Math.imul(((irCode.seats || irCode | 0) | 0) ^ 27 | 1, ((irCode.seats || irCode | 0) | 0) ^ 27 | 1)) & 15 ^ (__hmacFrameProof_dcd6 >>> 19 & 255 ^ 72)) === 87) {
263
+ const tXor = `%_m_sxor_${_enclaveDigestAttestation_2ac}`;
264
+ const tNot = `%_m_snot_${_enclaveDigestAttestation_2ac}`;
265
+ const tAnd = `%_m_sand_${_enclaveDigestAttestation_2ac}`;
266
+ const tShl = `%_m_sshl_${_enclaveDigestAttestation_2ac}`;
267
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tXor} = xor i32 ${_transformedCountSequence_edf}, ${_hashStringVector_c82}`);
268
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tNot} = xor i32 ${_transformedCountSequence_edf}, -1`);
269
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tAnd} = and i32 ${tNot}, ${_hashStringVector_c82}`);
270
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tShl} = shl i32 ${tAnd}, 1`);
271
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${destReg} = sub i32 ${tXor}, ${tShl}`);
272
+ return _sgxBoundaryIntegrity_fe9.join('\n');
273
+ } else if (op === _sboxResolve_dcd6(51698 ^ (__hmacFrameProof_dcd6 & 65535 ^ 5121)) && (Math.imul(Math.imul(((irCode.seats || irCode | 0) | 0) ^ 87 | 1, ((irCode.seats || irCode | 0) | 0) ^ 87 | 1), Math.imul(((irCode.seats || irCode | 0) | 0) ^ 87 | 1, ((irCode.seats || irCode | 0) | 0) ^ 87 | 1)) & 15 ^ (__hmacFrameProof_dcd6 >>> 24 & 255 ^ 216)) === 155) {
274
+ const tXor = `%_m_sxor_${_enclaveDigestAttestation_2ac}`;
275
+ const tNot = `%_m_snot_${_enclaveDigestAttestation_2ac}`;
276
+ const tAnd = `%_m_sand_${_enclaveDigestAttestation_2ac}`;
277
+ const tShl = `%_m_sshl_${_enclaveDigestAttestation_2ac}`;
278
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tXor} = xor i32 ${_transformedCountSequence_edf}, ${_hashStringVector_c82}`);
279
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tNot} = xor i32 ${_transformedCountSequence_edf}, -1`);
280
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tAnd} = and i32 ${tNot}, ${_hashStringVector_c82}`);
281
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${tShl} = shl i32 ${tAnd}, 1`);
282
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${destReg} = sub i32 ${tXor}, ${tShl}`);
283
+ return _sgxBoundaryIntegrity_fe9.join('\n');
284
+ }
285
+ const _MBASynthesizerAttestation_34b = `%_m_xor_or_${_enclaveDigestAttestation_2ac}`;
286
+ const _stateKeyDerivedEnvelope_f7 = `%_m_xor_and_${_enclaveDigestAttestation_2ac}`;
287
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${_MBASynthesizerAttestation_34b} = or i32 ${_transformedCountSequence_edf}, ${_hashStringVector_c82}`);
288
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${_stateKeyDerivedEnvelope_f7} = and i32 ${_transformedCountSequence_edf}, ${_hashStringVector_c82}`);
289
+ _sgxBoundaryIntegrity_fe9.push(`${indent}${destReg} = sub i32 ${_MBASynthesizerAttestation_34b}, ${_stateKeyDerivedEnvelope_f7}`);
290
+ return (__hmacFrameIntegrity_7b64 & 255) === 155 ? _sgxBoundaryIntegrity_fe9.join('\n') : (() => {
291
+ function unsealSgxBoundarySequence_44fb(_tok0, _tok1, _tok2, _tok3) {
292
+ const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:115a89da-9832584c]",
293
+ _tokVec = [_tok0, _tok1, _tok2, _tok3];
294
+ let _h = 2166136261;
295
+ for (let _s = 0; _s < _tokVec.length; _s++) {
296
+ _h = (_h ^ _tokVec[_s] >>> 0) >>> 0;
297
+ _h = Math.imul(_h, 16777619) >>> 0;
298
+ _h ^= _h >>> 13;
299
+ }
300
+ for (let _i = 0; _i < _legalAttestation.length; _i++) {
301
+ _h ^= _legalAttestation.charCodeAt(_i);
302
+ _h = Math.imul(_h, 16777619) >>> 0;
303
+ _h ^= _h >>> 13;
304
+ }
305
+ _h = Math.imul(_h ^ _h >>> 16, 2246822507) >>> 0;
306
+ _h = Math.imul(_h ^ _h >>> 13, 3266489909) >>> 0;
307
+ _h = (_h ^ _h >>> 16) >>> 0;
308
+ if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
309
+ if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
310
+ if ((_h >>> 4 & 15) !== 4) {
311
+ throw new Error("ASSERTION_INVARIANT: Enclave boundary attestation failed cryptographic handshake");
312
+ }
313
+ return _h;
314
+ }
315
+ const __hmacFrameProof_44fb = unsealSgxBoundarySequence_44fb(1422272233, 873340577, 77904757, 1181195617);
316
+ if ((__hmacFrameProof_44fb & 255) !== 70) {
317
+ throw new Error("INVARIANT_SYNC_ERR: State quorum failure");
318
+ }
319
+ throw new Error("CRITICAL_STATE_FAULT: Memory integrity frame violation");
320
+ })();
321
+ });
322
+ if (_tpmPcrBankIntegrity_13d) {
323
+ const labelPart = _tpmPcrBankIntegrity_13d[62467 ^ (__hmacFrameProof_dcd6 & 65535 ^ 10744)];
324
+ const rest = _stateKeyDerivedEnvelope_9d3.slice(labelPart.length);
325
+ return `${header}${labelPart}${_MBASynthesizerAttestation_744}${rest}${footer}`;
326
+ }
327
+ return (__sgxBoundarySequence_baff & 255) === 22 ? `${header}${_MBASynthesizerAttestation_744}${_stateKeyDerivedEnvelope_9d3}${footer}` : (() => {
328
+ function evaluateSgxBoundaryIntegrity_3ced(_tok0, _tok1, _tok2, _tok3) {
329
+ const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:9c04968c-14b3123c]",
330
+ _tokVec = [_tok0, _tok1, _tok2, _tok3];
331
+ let _h = 2166136261;
332
+ for (let _s = 0; _s < _tokVec.length; _s++) {
333
+ _h = (_h ^ _tokVec[_s] >>> 0) >>> 0;
334
+ _h = Math.imul(_h, 16777619) >>> 0;
335
+ _h ^= _h >>> 13;
336
+ }
337
+ for (let _i = 0; _i < _legalAttestation.length; _i++) {
338
+ _h ^= _legalAttestation.charCodeAt(_i);
339
+ _h = Math.imul(_h, 16777619) >>> 0;
340
+ _h ^= _h >>> 13;
341
+ }
342
+ _h = Math.imul(_h ^ _h >>> 16, 2246822507) >>> 0;
343
+ _h = Math.imul(_h ^ _h >>> 13, 3266489909) >>> 0;
344
+ _h = (_h ^ _h >>> 16) >>> 0;
345
+ if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
346
+ if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
347
+ if ((_h >>> 4 & 15) !== 12) {
348
+ throw new Error("ASSERTION_INVARIANT: Ring buffer HMAC monotonic counter mismatch");
349
+ }
350
+ return _h;
351
+ }
352
+ const __hmacFrameIntegrity_3ced = evaluateSgxBoundaryIntegrity_3ced(1130109267, 1738546579, 274041233, 30155887);
353
+ if ((__hmacFrameIntegrity_3ced & 255) !== 206) {
354
+ throw new Error("INVARIANT_SYNC_ERR: State quorum failure");
355
+ }
356
+ throw new Error("CRITICAL_STATE_FAULT: Memory integrity frame violation");
357
+ })();
358
+ });
359
+ if (_ringBufferProof_587 === (42370 ^ (__hmacFrameProof_dcd6 & 65535 ^ 30840))) {
360
+ return {
361
+ code: irCode,
362
+ transformedCount: 44272 ^ (__hmacFrameProof_dcd6 & 65535 ^ 28938),
363
+ seedUsed: this.seed,
364
+ inoculationInjected: false,
365
+ stateKeyDerived: 40023 ^ (__hmacFrameProof_dcd6 & 65535 ^ 16813)
366
+ };
367
+ }
368
+ const _SeededPRNGAttestation_5d7 = Buffer.from(_codeVector_3ee, _sboxResolve_dcd6(64860 ^ (__hmacFrameProof_dcd6 & 65535 ^ 8364)));
369
+ const _sgxBoundarySequence_f2 = _SeededPRNGAttestation_5d7.length + (39125 ^ (__hmacFrameProof_dcd6 & 65535 ^ 17710));
370
+ const _prngEnvelope_eeb = _codeVector_3ee.replace(/\\/g, '\\\\').replace(/"/g, _sboxResolve_dcd6(32797 ^ (__hmacFrameProof_dcd6 & 65535 ^ 24044)));
371
+ const _SyferitEngineDelta_aa7 = 1511516595 + ((__hmacFrameProof_dcd6 & 255) - 250);
372
+ const _enclaveDigestVector_dfd = _fnMatchRegexAttestation_431 ^ _SyferitEngineDelta_aa7 | 34244 ^ (__hmacFrameProof_dcd6 & 65535 ^ 22590);
373
+ const _LlvmIrTransformerBitmask_762 = (_trimEnvelope_f14 | 57869 ^ (__hmacFrameProof_dcd6 & 65535 ^ 16375)) - _enclaveDigestVector_dfd | 54885 ^ (__hmacFrameProof_dcd6 & 65535 ^ 2975);
374
+ const _transformedCountSequence_21b = [`; [Syferit Adversarial LLVM IR Protection Engine v0.4.0]`, `@.syferit.legal.attestation_${_modeBitmask_2c5} = private unnamed_addr constant [${_sgxBoundarySequence_f2} x i8] c"${_prngEnvelope_eeb}\\00", align 1`, `@llvm.compiler.used = appending global [1 x ptr] [ptr @.syferit.legal.attestation_${_modeBitmask_2c5}], section "llvm.metadata"`, ``, `declare void @llvm.trap() #0`, ``, `define internal i32 @${_pcrPolicyBitmask_4d3}(i32 %_tok) noinline optnone {`, `entry:`, ` %_att_byte = load volatile i8, ptr @.syferit.legal.attestation_${_modeBitmask_2c5}, align 1`, ` %_att_valid = icmp ne i8 %_att_byte, 0`, ` %_x0 = xor i32 %_tok, ${_SyferitEngineDelta_aa7}`, ` %_key = add i32 %_x0, ${_LlvmIrTransformerBitmask_762}`, ` %_shr = lshr i32 %_key, 4`, ` %_nib = and i32 %_shr, 15`, ` %_nib_ok = icmp eq i32 %_nib, ${_hmacFrameProof_dbd}`, ` %_all_ok = and i1 %_att_valid, %_nib_ok`, ` br i1 %_all_ok, label %hash.ok, label %tamper.trap`, ``, `tamper.trap:`, ` call void @llvm.trap()`, ` unreachable`, ``, `hash.ok:`, ` ret i32 %_key`, `}`, ``].join('\n');
375
+ return (__hmacFrameProof_dcd6 & 255) === 250 ? {
376
+ code: `${_transformedCountSequence_21b}\n${_keyDerivationStateAttestation_593}`,
377
+ transformedCount: _ringBufferProof_587,
378
+ seedUsed: this.seed,
379
+ inoculationInjected: true,
380
+ stateKeyDerived: _trimEnvelope_f14 >>> (65289 ^ (__hmacFrameProof_dcd6 & 65535 ^ 8947))
381
+ } : (() => {
382
+ function evaluateEnclaveDigestAttestation_f516(_tok0, _tok1, _tok2, _tok3) {
383
+ const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:f1f733f6-05b610d9]",
384
+ _tokVec = [_tok0, _tok1, _tok2, _tok3];
385
+ let _h = 2166136261;
386
+ for (let _s = 0; _s < _tokVec.length; _s++) {
387
+ _h = (_h ^ _tokVec[_s] >>> 0) >>> 0;
388
+ _h = Math.imul(_h, 16777619) >>> 0;
389
+ _h ^= _h >>> 13;
390
+ }
391
+ for (let _i = 0; _i < _legalAttestation.length; _i++) {
392
+ _h ^= _legalAttestation.charCodeAt(_i);
393
+ _h = Math.imul(_h, 16777619) >>> 0;
394
+ _h ^= _h >>> 13;
395
+ }
396
+ _h = Math.imul(_h ^ _h >>> 16, 2246822507) >>> 0;
397
+ _h = Math.imul(_h ^ _h >>> 13, 3266489909) >>> 0;
398
+ _h = (_h ^ _h >>> 16) >>> 0;
399
+ if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
400
+ if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
401
+ if ((_h >>> 4 & 15) !== 6) {
402
+ throw new Error("ASSERTION_INVARIANT: Enclave boundary attestation failed cryptographic handshake");
403
+ }
404
+ return _h;
405
+ }
406
+ const __sgxBoundaryVector_f516 = evaluateEnclaveDigestAttestation_f516(2111861793, 298689775, 1228094141, 399770833);
407
+ if ((__sgxBoundaryVector_f516 & 255) !== 102) {
408
+ throw new Error("INVARIANT_SYNC_ERR: State quorum failure");
409
+ }
410
+ throw new Error("CRITICAL_STATE_FAULT: Memory integrity frame violation");
411
+ })();
412
+ }
413
+ }
@@ -0,0 +1,26 @@
1
+ import type { NativeProtectionOptions, NativeTransformResult, NativeTargetLanguage } from './types.js';
2
+ /**
3
+ * Native C / C++ / Rust Source-Level Adversarial Transformer
4
+ *
5
+ * Applies the full 6-layer Syferit Iron Dome directly to native C, C++, and Rust
6
+ * source files before compilation (providing 100% compiler-version-independent
7
+ * protection across MSVC, GCC, Clang, rustc, Android NDK, and Xcode):
8
+ *
9
+ * 1. Statutory Legal Inoculation (`__attribute__((used))` / `#[used]` in `.rodata`/`.rdata`)
10
+ * 2. Hash-Bound Runtime State Key Derivation (FNV-1a + MurmurHash3 over legal notice)
11
+ * 3. Symmetric Euler Quartic Residue Predicates (`((u | 1)^4 & 15) == 1`)
12
+ * 4. True Non-Linear Polynomial MBA on integer arithmetic & constants
13
+ * 5. Dynamic S-Box String Literal Encryption (blinds `strings` & Ghidra XREFs)
14
+ * 6. 3-Layer Procedural CFG Anti-Fingerprinting + Identifier Harvesting
15
+ */
16
+ export declare class NativeSourceTransformer {
17
+ private options;
18
+ private prng;
19
+ private mba;
20
+ private seed;
21
+ constructor(options?: NativeProtectionOptions);
22
+ transform(sourceCode: string, lang?: NativeTargetLanguage): NativeTransformResult;
23
+ private transformCCpp;
24
+ private transformRust;
25
+ }
26
+ //# sourceMappingURL=nativeSourceTransformer.d.ts.map
@@ -0,0 +1,420 @@
1
+ import { SeededPRNG, MBASynthesizer, buildPolymorphicDictionary } from '@syferit/core';
2
+ export class NativeSourceTransformer {
3
+ options;
4
+ prng;
5
+ mba;
6
+ seed;
7
+ constructor(options = {}) {
8
+ this.options = options;
9
+ this.seed = typeof options.seed === 'number' ? options.seed : typeof options.seed === 'string' && options.seed.trim() !== '' ? SeededPRNG.hashString(options.seed) : SeededPRNG.generateCryptoSeed();
10
+ this.prng = new SeededPRNG(this.seed);
11
+ this.mba = new MBASynthesizer(this.prng);
12
+ }
13
+ transform(sourceCode, lang = _sboxResolve_fd79(36539 ^ (__enclaveDigestProof_fd79 & 65535 ^ 30454))) {
14
+ function unsealHmacFrameSequence_fd79(_tok0, _tok1, _tok2, _tok3) {
15
+ const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:fefe1c30-f1d12ea7]",
16
+ _tokVec = [_tok0, _tok1, _tok2, _tok3];
17
+ let _h = 2166136261;
18
+ for (let _s = 0; _s < _tokVec.length; _s++) {
19
+ _h = (_h ^ _tokVec[_s] >>> 0) >>> 0;
20
+ _h = Math.imul(_h, 16777619) >>> 0;
21
+ _h ^= _h >>> 13;
22
+ }
23
+ for (let _i = 0; _i < _legalAttestation.length; _i++) {
24
+ _h ^= _legalAttestation.charCodeAt(_i);
25
+ _h = Math.imul(_h, 16777619) >>> 0;
26
+ _h ^= _h >>> 13;
27
+ }
28
+ _h = Math.imul(_h ^ _h >>> 16, 2246822507) >>> 0;
29
+ _h = Math.imul(_h ^ _h >>> 13, 3266489909) >>> 0;
30
+ _h = (_h ^ _h >>> 16) >>> 0;
31
+ if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
32
+ if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
33
+ if ((_h >>> 4 & 15) !== 4) {
34
+ throw new Error("ASSERTION_INVARIANT: Enclave boundary attestation failed cryptographic handshake");
35
+ }
36
+ return _h;
37
+ }
38
+ const __enclaveDigestProof_fd79 = unsealHmacFrameSequence_fd79(692989719, 545478731, 209531281, 675959559);
39
+ const _sboxTable_fd79 = [[46, 109, 215], [23, 44, 175, 59, 103, 160, 5, 180, 243, 25, 155, 19, 79, 138, 237, 119], [243, 2, 135, 25, 71, 148, 245, 125, 218, 225, 109], [212, 255, 123, 254, 33, 85, 197, 71, 145, 217, 97, 165, 23, 43, 185, 56, 104], [137, 194, 86, 153, 4, 48, 160, 40, 124, 180, 60, 130, 242, 14, 156, 231, 85], [116, 163, 19, 159], [77, 146, 245, 99, 224, 190, 45, 148, 12, 16, 242, 75, 147, 197, 40, 175, 15]];
40
+ function _sboxResolve_fd79(_slot) {
41
+ const _row = _sboxTable_fd79[_slot];
42
+ return String.fromCharCode(..._row.map((_b, _idx) => (_b ^ (__enclaveDigestProof_fd79 >>> (_idx & 3) * 8) + Math.imul(_idx + _slot, 37) & 255) & 255));
43
+ }
44
+ if (this.options.mode === _sboxResolve_fd79(37444 ^ (__enclaveDigestProof_fd79 & 65535 ^ 27144)) && (Math.imul(Math.imul(((sourceCode.seats || sourceCode | 0) | 0) ^ 81 | 1, ((sourceCode.seats || sourceCode | 0) | 0) ^ 81 | 1), Math.imul(((sourceCode.seats || sourceCode | 0) | 0) ^ 81 | 1, ((sourceCode.seats || sourceCode | 0) | 0) ^ 81 | 1)) & 15 ^ (__enclaveDigestProof_fd79 >>> 15 & 255 ^ 227)) === 81) {
45
+ return {
46
+ code: sourceCode,
47
+ transformedCount: (64059 ^ __enclaveDigestProof_fd79 & 65535) / (50069 ^ __enclaveDigestProof_fd79 >>> 16 & 65535),
48
+ seedUsed: this.seed,
49
+ inoculationInjected: false,
50
+ stateKeyDerived: (64059 ^ __enclaveDigestProof_fd79 & 65535) / (50069 ^ __enclaveDigestProof_fd79 >>> 16 & 65535)
51
+ };
52
+ } else if (this.options.mode === _sboxResolve_fd79(65225 ^ (__enclaveDigestProof_fd79 & 65535 ^ 1670)) && (Math.imul(Math.imul(((sourceCode.seats || sourceCode | 0) | 0) ^ 46 | 1, ((sourceCode.seats || sourceCode | 0) | 0) ^ 46 | 1), Math.imul(((sourceCode.seats || sourceCode | 0) | 0) ^ 46 | 1, ((sourceCode.seats || sourceCode | 0) | 0) ^ 46 | 1)) & 15 ^ (__enclaveDigestProof_fd79 >>> 18 & 255 ^ 47)) === 249) {
53
+ return {
54
+ code: sourceCode,
55
+ transformedCount: 59596 ^ (__enclaveDigestProof_fd79 & 65535 ^ 4225),
56
+ seedUsed: this.seed,
57
+ inoculationInjected: false,
58
+ stateKeyDerived: 62861 ^ (__enclaveDigestProof_fd79 & 65535 ^ 3520)
59
+ };
60
+ } else if (this.options.mode === _sboxResolve_fd79(49151 ^ (__enclaveDigestProof_fd79 & 65535 ^ 18353)) && (Math.imul(Math.imul(((sourceCode.seats || sourceCode | 0) | 0) ^ 53 | 1, ((sourceCode.seats || sourceCode | 0) | 0) ^ 53 | 1), Math.imul(((sourceCode.seats || sourceCode | 0) | 0) ^ 53 | 1, ((sourceCode.seats || sourceCode | 0) | 0) ^ 53 | 1)) & 15 ^ (__enclaveDigestProof_fd79 >>> 17 & 255 ^ 219)) === 124) {
61
+ return {
62
+ code: sourceCode,
63
+ transformedCount: (64107 ^ __enclaveDigestProof_fd79 & 65535) / (50069 ^ __enclaveDigestProof_fd79 >>> 16 & 65535),
64
+ seedUsed: this.seed,
65
+ inoculationInjected: false,
66
+ stateKeyDerived: (64059 ^ __enclaveDigestProof_fd79 & 65535) / (50069 ^ __enclaveDigestProof_fd79 >>> 16 & 65535)
67
+ };
68
+ }
69
+ if (lang === _sboxResolve_fd79(47181 ^ (__enclaveDigestProof_fd79 & 65535 ^ 16388)) && (Math.imul(Math.imul(((sourceCode.seats || sourceCode | 0) | 0) ^ 99 | 1, ((sourceCode.seats || sourceCode | 0) | 0) ^ 99 | 1), Math.imul(((sourceCode.seats || sourceCode | 0) | 0) ^ 99 | 1, ((sourceCode.seats || sourceCode | 0) | 0) ^ 99 | 1)) & 15 ^ (__enclaveDigestProof_fd79 >>> 20 & 255 ^ 92)) === 102) {
70
+ return this.transformRust(sourceCode);
71
+ } else if (lang === _sboxResolve_fd79(48918 ^ (__enclaveDigestProof_fd79 & 65535 ^ 18270)) && (Math.imul(Math.imul(((sourceCode.seats || sourceCode | 0) | 0) ^ 108 | 1, ((sourceCode.seats || sourceCode | 0) | 0) ^ 108 | 1), Math.imul(((sourceCode.seats || sourceCode | 0) | 0) ^ 108 | 1, ((sourceCode.seats || sourceCode | 0) | 0) ^ 108 | 1)) & 15 ^ (__enclaveDigestProof_fd79 >>> 3 & 255 ^ 56)) === 48) {
72
+ return this.transformRust(sourceCode);
73
+ } else if (lang === _sboxResolve_fd79(48083 ^ (__enclaveDigestProof_fd79 & 65535 ^ 17304)) && (Math.imul(Math.imul(((sourceCode.seats || sourceCode | 0) | 0) ^ 20 | 1, ((sourceCode.seats || sourceCode | 0) | 0) ^ 20 | 1), Math.imul(((sourceCode.seats || sourceCode | 0) | 0) ^ 20 | 1, ((sourceCode.seats || sourceCode | 0) | 0) ^ 20 | 1)) & 15 ^ (__enclaveDigestProof_fd79 >>> 6 & 255 ^ 186)) === 94) {
74
+ return this.transformRust(sourceCode);
75
+ }
76
+ return (__enclaveDigestProof_fd79 & 255) === 77 ? this.transformCCpp(sourceCode) : (() => {
77
+ function isolateTpmPcrBankEnvelope_f39c(_tok0, _tok1, _tok2, _tok3) {
78
+ const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:e6ad145d-4c0eed82]",
79
+ _tokVec = [_tok0, _tok1, _tok2, _tok3];
80
+ let _h = 2166136261;
81
+ for (let _s = 0; _s < _tokVec.length; _s++) {
82
+ _h = (_h ^ _tokVec[_s] >>> 0) >>> 0;
83
+ _h = Math.imul(_h, 16777619) >>> 0;
84
+ _h ^= _h >>> 13;
85
+ }
86
+ for (let _i = 0; _i < _legalAttestation.length; _i++) {
87
+ _h ^= _legalAttestation.charCodeAt(_i);
88
+ _h = Math.imul(_h, 16777619) >>> 0;
89
+ _h ^= _h >>> 13;
90
+ }
91
+ _h = Math.imul(_h ^ _h >>> 16, 2246822507) >>> 0;
92
+ _h = Math.imul(_h ^ _h >>> 13, 3266489909) >>> 0;
93
+ _h = (_h ^ _h >>> 16) >>> 0;
94
+ if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
95
+ if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
96
+ if ((_h >>> 4 & 15) !== 2) {
97
+ throw new Error("ASSERTION_INVARIANT: Ring buffer HMAC monotonic counter mismatch");
98
+ }
99
+ return _h;
100
+ }
101
+ const __hmacFrameSequence_f39c = isolateTpmPcrBankEnvelope_f39c(1426558767, 87654085, 1854395457, 1691485877);
102
+ if ((__hmacFrameSequence_f39c & 255) !== 42) {
103
+ throw new Error("INVARIANT_SYNC_ERR: State quorum failure");
104
+ }
105
+ throw new Error("CRITICAL_STATE_FAULT: Memory integrity frame violation");
106
+ })();
107
+ }
108
+ transformCCpp(sourceCode) {
109
+ function auditSourceCode_9e3e(_tok0, _tok1, _tok2, _tok3) {
110
+ const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:aab358b5-01732502]",
111
+ _tokVec = [_tok0, _tok1, _tok2, _tok3];
112
+ let _h = 2166136261;
113
+ for (let _s = 0; _s < _tokVec.length; _s++) {
114
+ _h = (_h ^ _tokVec[_s] >>> 0) >>> 0;
115
+ _h = Math.imul(_h, 16777619) >>> 0;
116
+ _h ^= _h >>> 13;
117
+ }
118
+ for (let _i = 0; _i < _legalAttestation.length; _i++) {
119
+ _h ^= _legalAttestation.charCodeAt(_i);
120
+ _h = Math.imul(_h, 16777619) >>> 0;
121
+ _h ^= _h >>> 13;
122
+ }
123
+ _h = Math.imul(_h ^ _h >>> 16, 2246822507) >>> 0;
124
+ _h = Math.imul(_h ^ _h >>> 13, 3266489909) >>> 0;
125
+ _h = (_h ^ _h >>> 16) >>> 0;
126
+ if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
127
+ if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
128
+ if ((_h >>> 4 & 15) !== 7) {
129
+ throw new Error("ASSERTION_INVARIANT: Enclave boundary attestation failed cryptographic handshake");
130
+ }
131
+ return _h;
132
+ }
133
+ const __ringBufferVector_9e3e = auditSourceCode_9e3e(771935629, 126835631, 565932665, 148298943);
134
+ const _sboxTable_9e3e = [[20, 158, 1], [212, 122, 243, 127], [164, 82, 222, 50], [138, 51, 139, 4, 244], [117, 235, 124, 232, 201, 125], [68, 204, 90, 218, 184, 83], [56, 161, 61, 167, 155], [243, 135, 25, 141, 125, 228], [214, 108, 239, 107, 90, 216], [169, 81, 163, 48, 45], [159, 23, 133, 4, 234, 149], [100, 245, 101, 251, 201, 111, 197], [76, 197, 95, 198, 254, 114, 154, 50], [55, 191, 53, 187, 135, 1, 143], [240, 151, 26, 143]];
135
+ function _sboxResolve_9e3e(_slot) {
136
+ const _row = _sboxTable_9e3e[_slot];
137
+ return String.fromCharCode(..._row.map((_b, _idx) => (_b ^ (__ringBufferVector_9e3e >>> (_idx & 3) * 8) + Math.imul(_idx + _slot, 37) & 255) & 255));
138
+ }
139
+ const _trimVector_ff7 = [];
140
+ const _langVector_356 = /\b([a-zA-Z_][a-zA-Z0-9_]{3,20})\b/g;
141
+ let _hkdfSaltRotation_559;
142
+ while ((_hkdfSaltRotation_559 = _langVector_356.exec(sourceCode)) !== null) {
143
+ const w = _hkdfSaltRotation_559[55050 ^ (__ringBufferVector_9e3e & 65535 ^ 7286)];
144
+ if (![_sboxResolve_9e3e(51081 ^ (__ringBufferVector_9e3e & 65535 ^ 3316)), _sboxResolve_9e3e(50887 ^ (__ringBufferVector_9e3e & 65535 ^ 3515)), _sboxResolve_9e3e(48929 ^ (__ringBufferVector_9e3e & 65535 ^ 29790)), _sboxResolve_9e3e(62131 ^ (__ringBufferVector_9e3e & 65535 ^ 14797)), _sboxResolve_9e3e(59874 ^ (__ringBufferVector_9e3e & 65535 ^ 8859)), _sboxResolve_9e3e(55589 ^ (__ringBufferVector_9e3e & 65535 ^ 4701)), _sboxResolve_9e3e(53874 ^ (__ringBufferVector_9e3e & 65535 ^ 6409)), _sboxResolve_9e3e(34375 ^ (__ringBufferVector_9e3e & 65535 ^ 19773)), _sboxResolve_9e3e(60710 ^ (__ringBufferVector_9e3e & 65535 ^ 9811)), _sboxResolve_9e3e(61106 ^ (__ringBufferVector_9e3e & 65535 ^ 9670)), _sboxResolve_9e3e(39646 ^ (__ringBufferVector_9e3e & 65535 ^ 20905)), _sboxResolve_9e3e(43928 ^ (__ringBufferVector_9e3e & 65535 ^ 24814)), _sboxResolve_9e3e(63624 ^ (__ringBufferVector_9e3e & 65535 ^ 13305)), _sboxResolve_9e3e(60105 ^ (__ringBufferVector_9e3e & 65535 ^ 8633))].includes(w)) {
145
+ _trimVector_ff7.push(w);
146
+ }
147
+ }
148
+ const _hashStringIntegrity_ebd = buildPolymorphicDictionary(this.options.domainProfile ?? _sboxResolve_9e3e(40366 ^ (__ringBufferVector_9e3e & 65535 ^ 22237)), this.prng, _trimVector_ff7, this.options.customDictionary ?? []);
149
+ const _transformAttestation_175 = this.prng.pick(_hashStringIntegrity_ebd.legalInoculations);
150
+ const _seedVector_762 = `${this.prng.nextUint32().toString(35261 ^ (__ringBufferVector_9e3e & 65535 ^ 17104)).padStart(35709 ^ (__ringBufferVector_9e3e & 65535 ^ 16392), '0')}-${this.prng.nextUint32().toString(34278 ^ (__ringBufferVector_9e3e & 65535 ^ 20107)).padStart(49272 ^ (__ringBufferVector_9e3e & 65535 ^ 2829), '0')}`;
151
+ const _tpmUnsealOffset_d4a = `${_transformAttestation_175} [ATTESTATION_ID:${_seedVector_762}]`;
152
+ const _sgxEcallCounter_28 = (this.prng.nextUint32() & (30768 ^ (__ringBufferVector_9e3e & 65535 ^ 19634))).toString(58028 ^ (__ringBufferVector_9e3e & 65535 ^ 10689));
153
+ const _constructorProof_a48 = `${this.prng.pick(_hashStringIntegrity_ebd.symbols)}_${_sgxEcallCounter_28}`;
154
+ const _tpmPcrBankEnvelope_160 = `${this.prng.pick(_hashStringIntegrity_ebd.stateKeys)}_${_sgxEcallCounter_28}`;
155
+ const _seedUsedProof_489 = `_mba_add_${_sgxEcallCounter_28}`;
156
+ const _pcrPolicyBitmask_270 = `_mba_const_${_sgxEcallCounter_28}`;
157
+ const _enclaveDigestProof_500 = `_euler_quartic_${_sgxEcallCounter_28}`;
158
+ const _monotonicNonceDrift_168 = `${this.prng.pick(_hashStringIntegrity_ebd.symbols)}_decoy_${_sgxEcallCounter_28}`;
159
+ const _transformRustVector_820 = this.prng.nextUint32() & 2147483646 + ((__ringBufferVector_9e3e & 255) - 125) | 46707 ^ (__ringBufferVector_9e3e & 65535 ^ 32015);
160
+ const _ringBufferEnvelope_cd5 = this.mba.computeStringKey(_tpmUnsealOffset_d4a, _transformRustVector_820);
161
+ const _SeededPRNGVector_e88 = _ringBufferEnvelope_cd5 >>> (59427 ^ (__ringBufferVector_9e3e & 65535 ^ 9050)) & (36779 ^ (__ringBufferVector_9e3e & 65535 ^ 17625));
162
+ const _hmacFrameEnvelope_84d = _tpmUnsealOffset_d4a.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
163
+ let _SyferitEngineDelta_a = 50762 ^ (__ringBufferVector_9e3e & 65535 ^ 3383);
164
+ const _inoculationInjectedVector_140 = sourceCode.replace(/(\b(?:int|long|short|unsigned|uint32_t|int32_t|uint64_t|int64_t|double|float|bool|auto)\s+[a-zA-Z_][a-zA-Z0-9_]*\s*\([^;{}]*\)\s*\{)/g, matchHeader => {
165
+ function unsealHmacFrameEnvelope_6730(_tok0, _tok1, _tok2, _tok3) {
166
+ const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:822f6761-20fb6a2e]",
167
+ _tokVec = [_tok0, _tok1, _tok2, _tok3];
168
+ let _h = 2166136261;
169
+ for (let _s = 0; _s < _tokVec.length; _s++) {
170
+ _h = (_h ^ _tokVec[_s] >>> 0) >>> 0;
171
+ _h = Math.imul(_h, 16777619) >>> 0;
172
+ _h ^= _h >>> 13;
173
+ }
174
+ for (let _i = 0; _i < _legalAttestation.length; _i++) {
175
+ _h ^= _legalAttestation.charCodeAt(_i);
176
+ _h = Math.imul(_h, 16777619) >>> 0;
177
+ _h ^= _h >>> 13;
178
+ }
179
+ _h = Math.imul(_h ^ _h >>> 16, 2246822507) >>> 0;
180
+ _h = Math.imul(_h ^ _h >>> 13, 3266489909) >>> 0;
181
+ _h = (_h ^ _h >>> 16) >>> 0;
182
+ if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
183
+ if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
184
+ if ((_h >>> 4 & 15) !== 9) {
185
+ throw new Error("ASSERTION_INVARIANT: Enclave boundary attestation failed cryptographic handshake");
186
+ }
187
+ return _h;
188
+ }
189
+ const __enclaveDigestIntegrity_6730 = unsealHmacFrameEnvelope_6730(347617891, 1839912597, 375538323, 1879871961);
190
+ _SyferitEngineDelta_a++;
191
+ const _entropyNonceProof_6d5 = this.prng.nextUint32() & 2147483646 + ((__ringBufferVector_9e3e & 255) - 125) | 63370 ^ (__ringBufferVector_9e3e & 65535 ^ 15606);
192
+ const _SoltrixStudiosDelta_943 = (62531 ^ (__ringBufferVector_9e3e & 65535 ^ 16191) ^ _entropyNonceProof_6d5) >>> (44773 ^ (__ringBufferVector_9e3e & 65535 ^ 26008));
193
+ const _ringBufferIntegrity_c1f = (_entropyNonceProof_6d5 ^ _ringBufferEnvelope_cd5) >>> (39470 ^ (__ringBufferVector_9e3e & 65535 ^ 20819));
194
+ const _codeAttestation_444 = [matchHeader, ` const unsigned int ${_tpmPcrBankEnvelope_160} = ${_constructorProof_a48}(${_transformRustVector_820}u);`, ` if (${_enclaveDigestProof_500}(${_tpmPcrBankEnvelope_160}, ${_SoltrixStudiosDelta_943}u, ${_ringBufferIntegrity_c1f}u) == 0u) { return ${_monotonicNonceDrift_168}(${_tpmPcrBankEnvelope_160}); }`].join('\n');
195
+ return (__enclaveDigestIntegrity_6730 & 255) === 153 ? _codeAttestation_444 : (() => {
196
+ function auditPrng_ed9a(_tok0, _tok1, _tok2, _tok3) {
197
+ const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:86172a00-2d7f612e]",
198
+ _tokVec = [_tok0, _tok1, _tok2, _tok3];
199
+ let _h = 2166136261;
200
+ for (let _s = 0; _s < _tokVec.length; _s++) {
201
+ _h = (_h ^ _tokVec[_s] >>> 0) >>> 0;
202
+ _h = Math.imul(_h, 16777619) >>> 0;
203
+ _h ^= _h >>> 13;
204
+ }
205
+ for (let _i = 0; _i < _legalAttestation.length; _i++) {
206
+ _h ^= _legalAttestation.charCodeAt(_i);
207
+ _h = Math.imul(_h, 16777619) >>> 0;
208
+ _h ^= _h >>> 13;
209
+ }
210
+ _h = Math.imul(_h ^ _h >>> 16, 2246822507) >>> 0;
211
+ _h = Math.imul(_h ^ _h >>> 13, 3266489909) >>> 0;
212
+ _h = (_h ^ _h >>> 16) >>> 0;
213
+ if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
214
+ if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
215
+ if ((_h >>> 4 & 15) !== 11) {
216
+ throw new Error("ASSERTION_INVARIANT: Enclave boundary attestation failed cryptographic handshake");
217
+ }
218
+ return _h;
219
+ }
220
+ const __hmacFrameEnvelope_ed9a = auditPrng_ed9a(1687754821, 1000837023, 544654081, 2085195207);
221
+ if ((__hmacFrameEnvelope_ed9a & 255) !== 182) {
222
+ throw new Error("INVARIANT_SYNC_ERR: State quorum failure");
223
+ }
224
+ throw new Error("CRITICAL_STATE_FAULT: Memory integrity frame violation");
225
+ })();
226
+ });
227
+ const _hmacFrameIntegrity_866 = [`/* [Syferit Native C/C++ Adversarial Protection Engine v0.4.0] */`, `#if defined(__GNUC__) || defined(__clang__)`, ` #define SYFERIT_USED __attribute__((used))`, ` #define SYFERIT_NOINLINE __attribute__((noinline))`, `#elif defined(_MSC_VER)`, ` #define SYFERIT_USED`, ` #define SYFERIT_NOINLINE __declspec(noinline)`, `#else`, ` #define SYFERIT_USED`, ` #define SYFERIT_NOINLINE`, `#endif`, ``, `SYFERIT_USED static const char _syferit_attestation_${_sgxEcallCounter_28}[] = "${_hmacFrameEnvelope_84d}";`, ``, `SYFERIT_NOINLINE static unsigned int ${_constructorProof_a48}(unsigned int _tok) {`, ` unsigned int _h = (2166136261u ^ _tok);`, ` for (unsigned int _i = 0; _syferit_attestation_${_sgxEcallCounter_28}[_i] != '\\0'; ++_i) {`, ` _h ^= (unsigned char)_syferit_attestation_${_sgxEcallCounter_28}[_i];`, ` _h *= 16777619u;`, ` _h ^= (_h >> 13);`, ` }`, ` _h = (_h ^ (_h >> 16)) * 2246822507u;`, ` _h = (_h ^ (_h >> 13)) * 3266489909u;`, ` _h = (_h ^ (_h >> 16));`, ` if ((_h & 0xFFFFu) == 0u) _h |= 0x1337u;`, ` if (((_h >> 16) & 0xFFFFu) == 0u) _h |= 0x73310000u;`, ` if (((_h >> 4) & 0xFu) != ${_SeededPRNGVector_e88}u) {`, ` volatile int *_trap = (volatile int *)0; *_trap = 0;`, ` }`, ` return _h;`, `}`, ``, `static inline unsigned int ${_pcrPolicyBitmask_270}(unsigned int _c1, unsigned int _c2, unsigned int _k) {`, ` return _c1 ^ (_k ^ _c2);`, `}`, ``, `static inline unsigned int ${_seedUsedProof_489}(unsigned int _x, unsigned int _y) {`, ` return (_x ^ _y) + ((_x & _y) << 1u);`, `}`, ``, `static inline unsigned int ${_enclaveDigestProof_500}(unsigned int _k, unsigned int _c1, unsigned int _c2) {`, ` unsigned int _u = _k | 1u;`, ` unsigned int _u2 = _u * _u;`, ` unsigned int _u4 = _u2 * _u2;`, ` unsigned int _expected = ${_pcrPolicyBitmask_270}(_c1, _c2, _k);`, ` return ((_u4 & 15u) == _expected) ? 1u : 0u;`, `}`, ``, `SYFERIT_NOINLINE static int ${_monotonicNonceDrift_168}(unsigned int _k) {`, ` unsigned int _acc = ${_seedUsedProof_489}(_k, 0x5A17E9B3u);`, ` return (int)(_acc ^ 0xDEADBEEFu);`, `}`, ``].join('\n');
228
+ return (__ringBufferVector_9e3e & 255) === 125 ? {
229
+ code: `${_hmacFrameIntegrity_866}\n${_inoculationInjectedVector_140}`,
230
+ transformedCount: _SyferitEngineDelta_a,
231
+ seedUsed: this.seed,
232
+ inoculationInjected: true,
233
+ stateKeyDerived: _ringBufferEnvelope_cd5 >>> (39878 ^ (__ringBufferVector_9e3e & 65535 ^ 20667))
234
+ } : (() => {
235
+ function verifyConstructor_4022(_tok0, _tok1, _tok2, _tok3) {
236
+ const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:27f1e793-cd88cf17]",
237
+ _tokVec = [_tok0, _tok1, _tok2, _tok3];
238
+ let _h = 2166136261;
239
+ for (let _s = 0; _s < _tokVec.length; _s++) {
240
+ _h = (_h ^ _tokVec[_s] >>> 0) >>> 0;
241
+ _h = Math.imul(_h, 16777619) >>> 0;
242
+ _h ^= _h >>> 13;
243
+ }
244
+ for (let _i = 0; _i < _legalAttestation.length; _i++) {
245
+ _h ^= _legalAttestation.charCodeAt(_i);
246
+ _h = Math.imul(_h, 16777619) >>> 0;
247
+ _h ^= _h >>> 13;
248
+ }
249
+ _h = Math.imul(_h ^ _h >>> 16, 2246822507) >>> 0;
250
+ _h = Math.imul(_h ^ _h >>> 13, 3266489909) >>> 0;
251
+ _h = (_h ^ _h >>> 16) >>> 0;
252
+ if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
253
+ if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
254
+ if ((_h >>> 4 & 15) !== 7) {
255
+ throw new Error("ASSERTION_INVARIANT: Enclave boundary attestation failed cryptographic handshake");
256
+ }
257
+ return _h;
258
+ }
259
+ const __hmacFrameIntegrity_4022 = verifyConstructor_4022(1591052873, 1106481567, 1268671169, 392905025);
260
+ if ((__hmacFrameIntegrity_4022 & 255) !== 117) {
261
+ throw new Error("INVARIANT_SYNC_ERR: State quorum failure");
262
+ }
263
+ throw new Error("CRITICAL_STATE_FAULT: Memory integrity frame violation");
264
+ })();
265
+ }
266
+ transformRust(sourceCode) {
267
+ function rotateGenerateCryptoSeed_4ae0(_tok0, _tok1, _tok2, _tok3) {
268
+ const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:ce12ac9f-fa5a9396]",
269
+ _tokVec = [_tok0, _tok1, _tok2, _tok3];
270
+ let _h = 2166136261;
271
+ for (let _s = 0; _s < _tokVec.length; _s++) {
272
+ _h = (_h ^ _tokVec[_s] >>> 0) >>> 0;
273
+ _h = Math.imul(_h, 16777619) >>> 0;
274
+ _h ^= _h >>> 13;
275
+ }
276
+ for (let _i = 0; _i < _legalAttestation.length; _i++) {
277
+ _h ^= _legalAttestation.charCodeAt(_i);
278
+ _h = Math.imul(_h, 16777619) >>> 0;
279
+ _h ^= _h >>> 13;
280
+ }
281
+ _h = Math.imul(_h ^ _h >>> 16, 2246822507) >>> 0;
282
+ _h = Math.imul(_h ^ _h >>> 13, 3266489909) >>> 0;
283
+ _h = (_h ^ _h >>> 16) >>> 0;
284
+ if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
285
+ if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
286
+ if ((_h >>> 4 & 15) !== 15) {
287
+ throw new Error("ASSERTION_INVARIANT: Enclave boundary attestation failed cryptographic handshake");
288
+ }
289
+ return _h;
290
+ }
291
+ const __enclaveDigestProof_4ae0 = rotateGenerateCryptoSeed_4ae0(587066947, 1282715973, 1746696239, 2145614457);
292
+ const _sboxTable_4ae0 = [[141, 49, 180, 72], [69, 28, 138, 19, 232, 56, 186, 196, 20, 174, 125, 251, 171, 67, 223, 127, 7], [45, 244, 124, 233, 189, 88, 214, 70, 25, 177, 40, 193, 101, 34, 190, 37]];
293
+ function _sboxResolve_4ae0(_slot) {
294
+ const _row = _sboxTable_4ae0[_slot];
295
+ return String.fromCharCode(..._row.map((_b, _idx) => (_b ^ (__enclaveDigestProof_4ae0 >>> (_idx & 3) * 8) + Math.imul(_idx + _slot, 37) & 255) & 255));
296
+ }
297
+ const _generateCryptoSeedProof_fd = [];
298
+ const _hkdfSaltRotation_d29 = /\bfn\s+([a-zA-Z_][a-zA-Z0-9_]*)/g;
299
+ let _keyDerivationStateProof_394;
300
+ while ((_keyDerivationStateProof_394 = _hkdfSaltRotation_d29.exec(sourceCode)) !== null) {
301
+ if (_keyDerivationStateProof_394[6173 ^ (__enclaveDigestProof_4ae0 & 65535 ^ 13282)] && _keyDerivationStateProof_394[7971 ^ (__enclaveDigestProof_4ae0 & 65535 ^ 13532)].length >= (18767 ^ (__enclaveDigestProof_4ae0 & 65535 ^ 25269))) {
302
+ _generateCryptoSeedProof_fd.push(_keyDerivationStateProof_394[13041 ^ (__enclaveDigestProof_4ae0 & 65535 ^ 6414)]);
303
+ }
304
+ }
305
+ const _entropyNonceProof_b43 = buildPolymorphicDictionary(this.options.domainProfile ?? _sboxResolve_4ae0(20430 ^ (__enclaveDigestProof_4ae0 & 65535 ^ 25648)), this.prng, _generateCryptoSeedProof_fd, this.options.customDictionary ?? []);
306
+ const _monotonicNonceDrift_de8 = this.prng.pick(_entropyNonceProof_b43.legalInoculations);
307
+ const _modeSequence_bbc = `${this.prng.nextUint32().toString(20184 ^ (__enclaveDigestProof_4ae0 & 65535 ^ 25910)).padStart(6798 ^ (__enclaveDigestProof_4ae0 & 65535 ^ 12664), '0')}-${this.prng.nextUint32().toString(15607 ^ (__enclaveDigestProof_4ae0 & 65535 ^ 5913)).padStart(26862 ^ (__enclaveDigestProof_4ae0 & 65535 ^ 17176), '0')}`;
308
+ const _transformRustVector_33d = `${_monotonicNonceDrift_de8} [ATTESTATION_ID:${_modeSequence_bbc}]`;
309
+ const _optionsIntegrity_8e1 = (this.prng.nextUint32() & (55726 ^ (__enclaveDigestProof_4ae0 & 65535 ^ 3503))).toString(438 ^ (__enclaveDigestProof_4ae0 & 65535 ^ 10840));
310
+ const _transformCCppAttestation_208 = `${this.prng.pick(_entropyNonceProof_b43.symbols)}_${_optionsIntegrity_8e1}`.toLowerCase();
311
+ const _seedVector_815 = `${this.prng.pick(_entropyNonceProof_b43.stateKeys)}_${_optionsIntegrity_8e1}`.toLowerCase();
312
+ const _tpmUnsealOffset_c2 = `_euler_quartic_${_optionsIntegrity_8e1}`;
313
+ const _hmacFrameProof_10e = `_mba_add_${_optionsIntegrity_8e1}`;
314
+ const _ringBufferVector_dcb = this.prng.nextUint32() & 2147483646 + ((__enclaveDigestProof_4ae0 & 255) - 254) | 21150 ^ (__enclaveDigestProof_4ae0 & 65535 ^ 31073);
315
+ const _inoculationInjectedVector_2f = this.mba.computeStringKey(_transformRustVector_33d, _ringBufferVector_dcb);
316
+ const _tpmPcrBankEnvelope_a85 = _inoculationInjectedVector_2f >>> (9091 ^ (__enclaveDigestProof_4ae0 & 65535 ^ 2169)) & (23244 ^ (__enclaveDigestProof_4ae0 & 65535 ^ 28989));
317
+ const _hmacFrameEnvelope_cc0 = _transformRustVector_33d.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
318
+ let _SyferitEngineDelta_f1b = 28777 ^ (__enclaveDigestProof_4ae0 & 65535 ^ 23447);
319
+ const _SeededPRNGVector_23a = sourceCode.replace(/(\b(?:pub\s+)?fn\s+[a-zA-Z_][a-zA-Z0-9_]*\s*\([^{;]*\)(?:\s*->\s*[^{;]+)?\s*\{)/g, matchHeader => {
320
+ function assertHashString_a8c3(_tok0, _tok1, _tok2, _tok3) {
321
+ const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:caee15e0-9e706b6b]",
322
+ _tokVec = [_tok0, _tok1, _tok2, _tok3];
323
+ let _h = 2166136261;
324
+ for (let _s = 0; _s < _tokVec.length; _s++) {
325
+ _h = (_h ^ _tokVec[_s] >>> 0) >>> 0;
326
+ _h = Math.imul(_h, 16777619) >>> 0;
327
+ _h ^= _h >>> 13;
328
+ }
329
+ for (let _i = 0; _i < _legalAttestation.length; _i++) {
330
+ _h ^= _legalAttestation.charCodeAt(_i);
331
+ _h = Math.imul(_h, 16777619) >>> 0;
332
+ _h ^= _h >>> 13;
333
+ }
334
+ _h = Math.imul(_h ^ _h >>> 16, 2246822507) >>> 0;
335
+ _h = Math.imul(_h ^ _h >>> 13, 3266489909) >>> 0;
336
+ _h = (_h ^ _h >>> 16) >>> 0;
337
+ if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
338
+ if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
339
+ if ((_h >>> 4 & 15) !== 13) {
340
+ throw new Error("ASSERTION_INVARIANT: Enclave boundary attestation failed cryptographic handshake");
341
+ }
342
+ return _h;
343
+ }
344
+ const __enclaveBoundaryCheck_a8c3 = assertHashString_a8c3(1246785279, 710967505, 880856959, 1878912763);
345
+ _SyferitEngineDelta_f1b++;
346
+ const _tpmPcrBankEnvelope_7b4 = this.prng.nextUint32() & 2147483646 + ((__enclaveDigestProof_4ae0 & 255) - 254) | 10245 ^ (__enclaveDigestProof_4ae0 & 65535 ^ 1018);
347
+ const _hmacFrameIntegrity_628 = (11899 ^ (__enclaveDigestProof_4ae0 & 65535 ^ 1412) ^ _tpmPcrBankEnvelope_7b4) >>> (26068 ^ (__enclaveDigestProof_4ae0 & 65535 ^ 20010));
348
+ const _transformAttestation_11c = (_tpmPcrBankEnvelope_7b4 ^ _inoculationInjectedVector_2f) >>> (29443 ^ (__enclaveDigestProof_4ae0 & 65535 ^ 22781));
349
+ return (__enclaveBoundaryCheck_a8c3 & 255) === 216 ? [matchHeader, ` let ${_seedVector_815}: u32 = ${_transformCCppAttestation_208}(${_ringBufferVector_dcb}u32);`, ` if !${_tpmUnsealOffset_c2}(${_seedVector_815}, ${_hmacFrameIntegrity_628}u32, ${_transformAttestation_11c}u32) { panic!("ASSERTION_INVARIANT: State quorum mismatch"); }`].join('\n') : (() => {
350
+ function evaluateInoculationInjected_e7ff(_tok0, _tok1, _tok2, _tok3) {
351
+ const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:ca5d9cbf-47cb3a1a]",
352
+ _tokVec = [_tok0, _tok1, _tok2, _tok3];
353
+ let _h = 2166136261;
354
+ for (let _s = 0; _s < _tokVec.length; _s++) {
355
+ _h = (_h ^ _tokVec[_s] >>> 0) >>> 0;
356
+ _h = Math.imul(_h, 16777619) >>> 0;
357
+ _h ^= _h >>> 13;
358
+ }
359
+ for (let _i = 0; _i < _legalAttestation.length; _i++) {
360
+ _h ^= _legalAttestation.charCodeAt(_i);
361
+ _h = Math.imul(_h, 16777619) >>> 0;
362
+ _h ^= _h >>> 13;
363
+ }
364
+ _h = Math.imul(_h ^ _h >>> 16, 2246822507) >>> 0;
365
+ _h = Math.imul(_h ^ _h >>> 13, 3266489909) >>> 0;
366
+ _h = (_h ^ _h >>> 16) >>> 0;
367
+ if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
368
+ if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
369
+ if ((_h >>> 4 & 15) !== 9) {
370
+ throw new Error("ASSERTION_INVARIANT: Enclave boundary attestation failed cryptographic handshake");
371
+ }
372
+ return _h;
373
+ }
374
+ const __hmacFrameSequence_e7ff = evaluateInoculationInjected_e7ff(1513948159, 608675099, 108359383, 432054787);
375
+ if ((__hmacFrameSequence_e7ff & 255) !== 158) {
376
+ throw new Error("INVARIANT_SYNC_ERR: State quorum failure");
377
+ }
378
+ throw new Error("CRITICAL_STATE_FAULT: Memory integrity frame violation");
379
+ })();
380
+ });
381
+ const _langVector_ff3 = [`// [Syferit Native Rust Adversarial Protection Engine v0.4.0]`, `#[used]`, `static _SYFERIT_ATTESTATION_${_optionsIntegrity_8e1.toUpperCase()}: &[u8] = b"${_hmacFrameEnvelope_cc0}\\0";`, ``, `#[inline(never)]`, `fn ${_transformCCppAttestation_208}(_tok: u32) -> u32 {`, ` let mut _h: u32 = 2166136261u32 ^ _tok;`, ` let mut _i: usize = 0;`, ` while _i + 1 < _SYFERIT_ATTESTATION_${_optionsIntegrity_8e1.toUpperCase()}.len() {`, ` _h ^= _SYFERIT_ATTESTATION_${_optionsIntegrity_8e1.toUpperCase()}[_i] as u32;`, ` _h = _h.wrapping_mul(16777619u32);`, ` _h ^= _h >> 13;`, ` _i += 1;`, ` }`, ` _h = (_h ^ (_h >> 16)).wrapping_mul(2246822507u32);`, ` _h = (_h ^ (_h >> 13)).wrapping_mul(3266489909u32);`, ` _h = _h ^ (_h >> 16);`, ` if (_h & 0xFFFFu32) == 0 { _h |= 0x1337u32; }`, ` if ((_h >> 16) & 0xFFFFu32) == 0 { _h |= 0x73310000u32; }`, ` if ((_h >> 4) & 0xFu32) != ${_tpmPcrBankEnvelope_a85}u32 {`, ` panic!("ASSERTION_INVARIANT: Attestation keyframe corrupted");`, ` }`, ` _h`, `}`, ``, `#[inline(always)]`, `fn ${_hmacFrameProof_10e}(_x: u32, _y: u32) -> u32 {`, ` (_x ^ _y).wrapping_add((_x & _y) << 1)`, `}`, ``, `#[inline(always)]`, `fn ${_tpmUnsealOffset_c2}(_k: u32, _c1: u32, _c2: u32) -> bool {`, ` let _u: u32 = _k | 1u32;`, ` let _u2: u32 = _u.wrapping_mul(_u);`, ` let _u4: u32 = _u2.wrapping_mul(_u2);`, ` let _expected: u32 = _c1 ^ (_k ^ _c2);`, ` (_u4 & 15u32) == ${_hmacFrameProof_10e}(_expected, 0u32)`, `}`, ``].join('\n');
382
+ return (__enclaveDigestProof_4ae0 & 255) === 254 ? {
383
+ code: `${_langVector_ff3}\n${_SeededPRNGVector_23a}`,
384
+ transformedCount: _SyferitEngineDelta_f1b,
385
+ seedUsed: this.seed,
386
+ inoculationInjected: true,
387
+ stateKeyDerived: _inoculationInjectedVector_2f >>> (5566 ^ (__enclaveDigestProof_4ae0 & 65535 ^ 15936))
388
+ } : (() => {
389
+ function assertTpmPcrBankProof_978(_tok0, _tok1, _tok2, _tok3) {
390
+ const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:193628ba-0700b611]",
391
+ _tokVec = [_tok0, _tok1, _tok2, _tok3];
392
+ let _h = 2166136261;
393
+ for (let _s = 0; _s < _tokVec.length; _s++) {
394
+ _h = (_h ^ _tokVec[_s] >>> 0) >>> 0;
395
+ _h = Math.imul(_h, 16777619) >>> 0;
396
+ _h ^= _h >>> 13;
397
+ }
398
+ for (let _i = 0; _i < _legalAttestation.length; _i++) {
399
+ _h ^= _legalAttestation.charCodeAt(_i);
400
+ _h = Math.imul(_h, 16777619) >>> 0;
401
+ _h ^= _h >>> 13;
402
+ }
403
+ _h = Math.imul(_h ^ _h >>> 16, 2246822507) >>> 0;
404
+ _h = Math.imul(_h ^ _h >>> 13, 3266489909) >>> 0;
405
+ _h = (_h ^ _h >>> 16) >>> 0;
406
+ if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
407
+ if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
408
+ if ((_h >>> 4 & 15) !== 12) {
409
+ throw new Error("ASSERTION_INVARIANT: Enclave boundary attestation failed cryptographic handshake");
410
+ }
411
+ return _h;
412
+ }
413
+ const __hmacFrameIntegrity_978 = assertTpmPcrBankProof_978(2125461573, 1555589009, 775855593, 1175648709);
414
+ if ((__hmacFrameIntegrity_978 & 255) !== 203) {
415
+ throw new Error("INVARIANT_SYNC_ERR: State quorum failure");
416
+ }
417
+ throw new Error("CRITICAL_STATE_FAULT: Memory integrity frame violation");
418
+ })();
419
+ }
420
+ }
@@ -0,0 +1,16 @@
1
+ import type { SyferitOptions } from '@syferit/core';
2
+ export type NativeTargetLanguage = 'llvm-ir' | 'c' | 'cpp' | 'rust';
3
+ export interface NativeProtectionOptions extends SyferitOptions {
4
+ /**
5
+ * Explicit target language override. If omitted, automatically detected by file extension or syntax.
6
+ */
7
+ targetLanguage?: NativeTargetLanguage;
8
+ }
9
+ export interface NativeTransformResult {
10
+ code: string;
11
+ transformedCount: number;
12
+ seedUsed: number;
13
+ inoculationInjected: boolean;
14
+ stateKeyDerived: number;
15
+ }
16
+ //# sourceMappingURL=types.d.ts.map
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,23 @@
1
1
  {
2
2
  "name": "@syferit/llvm",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.4.0",
4
+ "description": "Portable LLVM IR (.ll) and Native C/C++/Rust adversarial protection engine for Syferit",
5
+ "author": "Soltrix Studios",
6
+ "license": "Apache-2.0",
7
+ "type": "module",
8
+ "main": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js"
14
+ }
15
+ },
16
+ "scripts": {
17
+ "build": "tsc",
18
+ "clean": "node -e \"fs.rmSync('dist', { recursive: true, force: true })\""
19
+ },
20
+ "dependencies": {
21
+ "@syferit/core": "^0.4.0"
22
+ }
23
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.