@syferit/llvm 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +29 -29
- package/dist/irTransformer.js +228 -228
- package/dist/nativeSourceTransformer.js +140 -140
- package/package.json +9 -3
package/dist/index.js
CHANGED
|
@@ -4,8 +4,8 @@ export * from './nativeSourceTransformer.js';
|
|
|
4
4
|
import { LlvmIrTransformer } from './irTransformer.js';
|
|
5
5
|
import { NativeSourceTransformer } from './nativeSourceTransformer.js';
|
|
6
6
|
export function protectLlvmIr(irCode, options) {
|
|
7
|
-
function
|
|
8
|
-
const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:
|
|
7
|
+
function attestLlvmIrTransformer_d0e5(_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:dbf8a997-0d2ad887]",
|
|
9
9
|
_tokVec = [_tok0, _tok1, _tok2, _tok3];
|
|
10
10
|
let _h = 2166136261;
|
|
11
11
|
for (let _s = 0; _s < _tokVec.length; _s++) {
|
|
@@ -23,16 +23,16 @@ export function protectLlvmIr(irCode, options) {
|
|
|
23
23
|
_h = (_h ^ _h >>> 16) >>> 0;
|
|
24
24
|
if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
|
|
25
25
|
if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
|
|
26
|
-
if ((_h >>> 4 & 15) !==
|
|
27
|
-
throw new Error("ASSERTION_INVARIANT:
|
|
26
|
+
if ((_h >>> 4 & 15) !== 7) {
|
|
27
|
+
throw new Error("ASSERTION_INVARIANT: Enclave boundary attestation failed cryptographic handshake");
|
|
28
28
|
}
|
|
29
29
|
return _h;
|
|
30
30
|
}
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
return (
|
|
34
|
-
function
|
|
35
|
-
const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:
|
|
31
|
+
const __keyDerivationStateVector_d0e5 = attestLlvmIrTransformer_d0e5(1800647645, 707972615, 1648536327, 1572995649);
|
|
32
|
+
const _transformerBitmask_82d = new LlvmIrTransformer(options);
|
|
33
|
+
return (__keyDerivationStateVector_d0e5 & 255) === 124 ? _transformerBitmask_82d.transform(irCode) : (() => {
|
|
34
|
+
function verifyRingBufferSequence_795d(_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:aa4a05f1-44a40fb6]",
|
|
36
36
|
_tokVec = [_tok0, _tok1, _tok2, _tok3];
|
|
37
37
|
let _h = 2166136261;
|
|
38
38
|
for (let _s = 0; _s < _tokVec.length; _s++) {
|
|
@@ -50,21 +50,21 @@ export function protectLlvmIr(irCode, options) {
|
|
|
50
50
|
_h = (_h ^ _h >>> 16) >>> 0;
|
|
51
51
|
if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
|
|
52
52
|
if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
|
|
53
|
-
if ((_h >>> 4 & 15) !==
|
|
53
|
+
if ((_h >>> 4 & 15) !== 12) {
|
|
54
54
|
throw new Error("ASSERTION_INVARIANT: Ring buffer HMAC monotonic counter mismatch");
|
|
55
55
|
}
|
|
56
56
|
return _h;
|
|
57
57
|
}
|
|
58
|
-
const
|
|
59
|
-
if ((
|
|
58
|
+
const __tpmPcrBankAttestation_795d = verifyRingBufferSequence_795d(448164111, 988066157, 816988713, 798564453);
|
|
59
|
+
if ((__tpmPcrBankAttestation_795d & 255) !== 193) {
|
|
60
60
|
throw new Error("INVARIANT_SYNC_ERR: State quorum failure");
|
|
61
61
|
}
|
|
62
62
|
throw new Error("CRITICAL_STATE_FAULT: Memory integrity frame violation");
|
|
63
63
|
})();
|
|
64
64
|
}
|
|
65
65
|
export function protectNativeSource(sourceCode, options) {
|
|
66
|
-
function
|
|
67
|
-
const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:
|
|
66
|
+
function attestEnclaveDigestEnvelope_4ad2(_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:ac1cb41c-bc30e0c7]",
|
|
68
68
|
_tokVec = [_tok0, _tok1, _tok2, _tok3];
|
|
69
69
|
let _h = 2166136261;
|
|
70
70
|
for (let _s = 0; _s < _tokVec.length; _s++) {
|
|
@@ -82,22 +82,22 @@ export function protectNativeSource(sourceCode, options) {
|
|
|
82
82
|
_h = (_h ^ _h >>> 16) >>> 0;
|
|
83
83
|
if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
|
|
84
84
|
if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
|
|
85
|
-
if ((_h >>> 4 & 15) !==
|
|
86
|
-
throw new Error("ASSERTION_INVARIANT:
|
|
85
|
+
if ((_h >>> 4 & 15) !== 11) {
|
|
86
|
+
throw new Error("ASSERTION_INVARIANT: Ring buffer HMAC monotonic counter mismatch");
|
|
87
87
|
}
|
|
88
88
|
return _h;
|
|
89
89
|
}
|
|
90
|
-
const
|
|
91
|
-
const
|
|
92
|
-
function
|
|
93
|
-
const _row =
|
|
94
|
-
return String.fromCharCode(..._row.map((_b, _idx) => (_b ^ (
|
|
90
|
+
const __hmacFrameVector_4ad2 = attestEnclaveDigestEnvelope_4ad2(804492855, 1154207357, 136951531, 886723619);
|
|
91
|
+
const _sboxTable_4ad2 = [[209, 81, 228], [177, 47, 201, 43, 52, 235, 121, 220, 160, 93, 190, 243, 231, 112, 28, 119, 83], [153, 5, 189, 17, 241, 137, 23, 78, 77, 224, 105, 201, 217, 83, 255, 93]];
|
|
92
|
+
function _sboxResolve_4ad2(_slot) {
|
|
93
|
+
const _row = _sboxTable_4ad2[_slot];
|
|
94
|
+
return String.fromCharCode(..._row.map((_b, _idx) => (_b ^ (__hmacFrameVector_4ad2 >>> (_idx & 3) * 8) + Math.imul(_idx + _slot, 37) & 255) & 255));
|
|
95
95
|
}
|
|
96
|
-
const
|
|
97
|
-
const
|
|
98
|
-
return (
|
|
99
|
-
function
|
|
100
|
-
const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:
|
|
96
|
+
const _keyDerivationStateSequence_a9d = options?.targetLanguage ?? _sboxResolve_4ad2(33219 ^ (__hmacFrameVector_4ad2 & 65535 ^ 32113));
|
|
97
|
+
const _sgxEcallCounter_244 = new NativeSourceTransformer(options);
|
|
98
|
+
return (__hmacFrameVector_4ad2 & 255) === 178 ? _sgxEcallCounter_244.transform(sourceCode, _keyDerivationStateSequence_a9d) : (() => {
|
|
99
|
+
function verifyTpmPcrBankVector_82bf(_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:33e6011d-a435337b]",
|
|
101
101
|
_tokVec = [_tok0, _tok1, _tok2, _tok3];
|
|
102
102
|
let _h = 2166136261;
|
|
103
103
|
for (let _s = 0; _s < _tokVec.length; _s++) {
|
|
@@ -115,13 +115,13 @@ export function protectNativeSource(sourceCode, options) {
|
|
|
115
115
|
_h = (_h ^ _h >>> 16) >>> 0;
|
|
116
116
|
if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
|
|
117
117
|
if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
|
|
118
|
-
if ((_h >>> 4 & 15) !==
|
|
118
|
+
if ((_h >>> 4 & 15) !== 4) {
|
|
119
119
|
throw new Error("ASSERTION_INVARIANT: Enclave boundary attestation failed cryptographic handshake");
|
|
120
120
|
}
|
|
121
121
|
return _h;
|
|
122
122
|
}
|
|
123
|
-
const
|
|
124
|
-
if ((
|
|
123
|
+
const __enclaveDigestEnvelope_82bf = verifyTpmPcrBankVector_82bf(772817923, 1170665507, 1253773895, 896336543);
|
|
124
|
+
if ((__enclaveDigestEnvelope_82bf & 255) !== 78) {
|
|
125
125
|
throw new Error("INVARIANT_SYNC_ERR: State quorum failure");
|
|
126
126
|
}
|
|
127
127
|
throw new Error("CRITICAL_STATE_FAULT: Memory integrity frame violation");
|