@syferit/llvm 0.4.3 → 0.4.4
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/index.js +102 -19
- package/dist/irTransformer.js +279 -223
- package/dist/nativeSourceTransformer.js +136 -192
- package/dist/types.js +3 -3
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -5,12 +5,67 @@ export * from './nativeSourceTransformer.js';
|
|
|
5
5
|
import { LlvmIrTransformer } from './irTransformer.js';
|
|
6
6
|
import { NativeSourceTransformer } from './nativeSourceTransformer.js';
|
|
7
7
|
export function protectLlvmIr(irCode, options) {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
function auditRingBufferProof_ec37(_tok0, _tok1, _tok2, _tok3) {
|
|
9
|
+
const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:8ef310bb-2c21e006]",
|
|
10
|
+
_tokVec = [_tok0, _tok1, _tok2, _tok3];
|
|
11
|
+
let _h = 2166136261;
|
|
12
|
+
for (let _s = 0; _s < _tokVec.length; _s++) {
|
|
13
|
+
_h = (_h ^ _tokVec[_s] >>> 0) >>> 0;
|
|
14
|
+
_h = Math.imul(_h, 16777619) >>> 0;
|
|
15
|
+
_h ^= _h >>> 13;
|
|
16
|
+
}
|
|
17
|
+
for (let _i = 0; _i < _legalAttestation.length; _i++) {
|
|
18
|
+
_h ^= _legalAttestation.charCodeAt(_i);
|
|
19
|
+
_h = Math.imul(_h, 16777619) >>> 0;
|
|
20
|
+
_h ^= _h >>> 13;
|
|
21
|
+
}
|
|
22
|
+
_h = Math.imul(_h ^ _h >>> 16, 2246822507) >>> 0;
|
|
23
|
+
_h = Math.imul(_h ^ _h >>> 13, 3266489909) >>> 0;
|
|
24
|
+
_h = (_h ^ _h >>> 16) >>> 0;
|
|
25
|
+
if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
|
|
26
|
+
if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
|
|
27
|
+
if ((_h >>> 4 & 15) !== 4) {
|
|
28
|
+
throw new Error("ASSERTION_INVARIANT: Enclave boundary attestation failed cryptographic handshake");
|
|
29
|
+
}
|
|
30
|
+
return _h;
|
|
31
|
+
}
|
|
32
|
+
const __keyDerivationStateSequence_ec37 = auditRingBufferProof_ec37(1368607557, 120164079, 157399957, 965331789);
|
|
33
|
+
const _keyDerivationStateBitmask_39f = new LlvmIrTransformer(options);
|
|
34
|
+
return (__keyDerivationStateSequence_ec37 & 255) === 65 ? _keyDerivationStateBitmask_39f.transform(irCode) : (() => {
|
|
35
|
+
function assertRingBufferIntegrity_6f7a(_tok0, _tok1, _tok2, _tok3) {
|
|
36
|
+
const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:20f3b8d0-9ae96534]",
|
|
37
|
+
_tokVec = [_tok0, _tok1, _tok2, _tok3];
|
|
38
|
+
let _h = 2166136261;
|
|
39
|
+
for (let _s = 0; _s < _tokVec.length; _s++) {
|
|
40
|
+
_h = (_h ^ _tokVec[_s] >>> 0) >>> 0;
|
|
41
|
+
_h = Math.imul(_h, 16777619) >>> 0;
|
|
42
|
+
_h ^= _h >>> 13;
|
|
43
|
+
}
|
|
44
|
+
for (let _i = 0; _i < _legalAttestation.length; _i++) {
|
|
45
|
+
_h ^= _legalAttestation.charCodeAt(_i);
|
|
46
|
+
_h = Math.imul(_h, 16777619) >>> 0;
|
|
47
|
+
_h ^= _h >>> 13;
|
|
48
|
+
}
|
|
49
|
+
_h = Math.imul(_h ^ _h >>> 16, 2246822507) >>> 0;
|
|
50
|
+
_h = Math.imul(_h ^ _h >>> 13, 3266489909) >>> 0;
|
|
51
|
+
_h = (_h ^ _h >>> 16) >>> 0;
|
|
52
|
+
if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
|
|
53
|
+
if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
|
|
54
|
+
if ((_h >>> 4 & 15) !== 2) {
|
|
55
|
+
throw new Error("ASSERTION_INVARIANT: Ring buffer HMAC monotonic counter mismatch");
|
|
56
|
+
}
|
|
57
|
+
return _h;
|
|
58
|
+
}
|
|
59
|
+
const __keyDerivationStateBitmask_6f7a = assertRingBufferIntegrity_6f7a(1319905289, 875373949, 1204028363, 614747439);
|
|
60
|
+
if ((__keyDerivationStateBitmask_6f7a & 255) !== 44) {
|
|
61
|
+
throw new Error("INVARIANT_SYNC_ERR: State quorum failure");
|
|
62
|
+
}
|
|
63
|
+
throw new Error("CRITICAL_STATE_FAULT: Memory integrity frame violation");
|
|
64
|
+
})();
|
|
10
65
|
}
|
|
11
66
|
export function protectNativeSource(sourceCode, options) {
|
|
12
|
-
function
|
|
13
|
-
const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:
|
|
67
|
+
function evaluateSourceCode_1bb7(_tok0, _tok1, _tok2, _tok3) {
|
|
68
|
+
const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:fbfd7be7-113e9ec0]",
|
|
14
69
|
_tokVec = [_tok0, _tok1, _tok2, _tok3];
|
|
15
70
|
let _h = 2166136261;
|
|
16
71
|
for (let _s = 0; _s < _tokVec.length; _s++) {
|
|
@@ -28,30 +83,58 @@ export function protectNativeSource(sourceCode, options) {
|
|
|
28
83
|
_h = (_h ^ _h >>> 16) >>> 0;
|
|
29
84
|
if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
|
|
30
85
|
if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
|
|
31
|
-
if ((_h >>> 4 & 15) !==
|
|
86
|
+
if ((_h >>> 4 & 15) !== 3) {
|
|
32
87
|
throw new Error("ASSERTION_INVARIANT: Enclave boundary attestation failed cryptographic handshake");
|
|
33
88
|
}
|
|
34
89
|
return _h;
|
|
35
90
|
}
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
function
|
|
39
|
-
const _row =
|
|
40
|
-
return String.fromCharCode(..._row.map((_b, _idx) => (_b ^ (
|
|
91
|
+
const __tpmPcrBankVector_1bb7 = evaluateSourceCode_1bb7(586511261, 747686377, 1519713813, 804238385);
|
|
92
|
+
const _keyDerivationStateBitmask_1bb7 = [[89, 205, 85], [57, 139, 58, 19, 172, 71, 234, 196, 216, 57, 45, 251, 111, 236, 111, 127, 219], [225, 105, 12, 233, 121, 237, 102, 70, 197, 92, 248, 193, 33, 183, 78, 37]];
|
|
93
|
+
function _verifyEnclaveDigestSequence_1bb7(_slot) {
|
|
94
|
+
const _row = _keyDerivationStateBitmask_1bb7[_slot];
|
|
95
|
+
return String.fromCharCode(..._row.map((_b, _idx) => (_b ^ (__tpmPcrBankVector_1bb7 >>> (_idx & 3) * 8) + Math.imul(_idx + _slot, 37) & 255) & 255));
|
|
41
96
|
}
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
return (
|
|
97
|
+
const _hmacFrameIntegrity_a00 = options?.targetLanguage ?? _verifyEnclaveDigestSequence_1bb7(33628 ^ (__tpmPcrBankVector_1bb7 & 65535 ^ 7014));
|
|
98
|
+
const _SoltrixStudiosDelta_151 = new NativeSourceTransformer(options);
|
|
99
|
+
return (__tpmPcrBankVector_1bb7 & 255) === 58 ? _SoltrixStudiosDelta_151.transform(sourceCode, _hmacFrameIntegrity_a00) : (() => {
|
|
100
|
+
function attestKernelStateNonce_9ba4(_tok0, _tok1, _tok2, _tok3) {
|
|
101
|
+
const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:9851073e-6e880a69]",
|
|
102
|
+
_tokVec = [_tok0, _tok1, _tok2, _tok3];
|
|
103
|
+
let _h = 2166136261;
|
|
104
|
+
for (let _s = 0; _s < _tokVec.length; _s++) {
|
|
105
|
+
_h = (_h ^ _tokVec[_s] >>> 0) >>> 0;
|
|
106
|
+
_h = Math.imul(_h, 16777619) >>> 0;
|
|
107
|
+
_h ^= _h >>> 13;
|
|
108
|
+
}
|
|
109
|
+
for (let _i = 0; _i < _legalAttestation.length; _i++) {
|
|
110
|
+
_h ^= _legalAttestation.charCodeAt(_i);
|
|
111
|
+
_h = Math.imul(_h, 16777619) >>> 0;
|
|
112
|
+
_h ^= _h >>> 13;
|
|
113
|
+
}
|
|
114
|
+
_h = Math.imul(_h ^ _h >>> 16, 2246822507) >>> 0;
|
|
115
|
+
_h = Math.imul(_h ^ _h >>> 13, 3266489909) >>> 0;
|
|
116
|
+
_h = (_h ^ _h >>> 16) >>> 0;
|
|
117
|
+
if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
|
|
118
|
+
if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
|
|
119
|
+
if ((_h >>> 4 & 15) !== 6) {
|
|
120
|
+
throw new Error("ASSERTION_INVARIANT: Enclave boundary attestation failed cryptographic handshake");
|
|
121
|
+
}
|
|
122
|
+
return _h;
|
|
123
|
+
}
|
|
124
|
+
const __keyDerivationStateBitmask_9ba4 = attestKernelStateNonce_9ba4(1902536873, 1163078895, 1498062035, 2049343819);
|
|
125
|
+
if ((__keyDerivationStateBitmask_9ba4 & 255) !== 96) {
|
|
126
|
+
throw new Error("INVARIANT_SYNC_ERR: State quorum failure");
|
|
127
|
+
}
|
|
45
128
|
throw new Error("CRITICAL_STATE_FAULT: Memory integrity frame violation");
|
|
46
129
|
})();
|
|
47
130
|
}
|
|
48
131
|
if (typeof window !== "undefined") {
|
|
49
|
-
window.
|
|
50
|
-
syncEpoch:
|
|
51
|
-
channelSig: "
|
|
132
|
+
window.__syferitIPC_77e4.invoke && window.__syferitIPC_77e4.invoke("license:quorum-token-refresh", {
|
|
133
|
+
syncEpoch: 20323504,
|
|
134
|
+
channelSig: "SIG_FRAME_77E4"
|
|
52
135
|
});
|
|
53
136
|
}
|
|
54
|
-
const
|
|
55
|
-
function
|
|
56
|
-
return
|
|
137
|
+
const __syferitDispatch_af73 = [protectLlvmIr, protectNativeSource];
|
|
138
|
+
function __invoke___syferitDispatch_af73(_targetIdx, _seed) {
|
|
139
|
+
return __syferitDispatch_af73[_targetIdx + ((Math.imul(Math.imul(_seed ^ 1195, 33213) | 1, Math.imul(_seed ^ 1195, 33213) | 1) & 7) - 1)];
|
|
57
140
|
}
|