@syferit/llvm 0.4.2 → 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.d.ts +21 -11
- package/dist/index.js +39 -28
- package/dist/irTransformer.js +242 -235
- package/dist/nativeSourceTransformer.js +140 -188
- package/dist/types.js +8 -1
- package/package.json +2 -2
- package/dist/irTransformer.d.ts +0 -21
- package/dist/nativeSourceTransformer.d.ts +0 -26
- package/dist/types.d.ts +0 -16
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
// [Protected by Soltrix Studios — Syferit Code Defense Engine | https://syferit.soltrixstudios.com]
|
|
2
|
+
import type { SyferitOptions } from '@syferit/core';
|
|
3
|
+
export type NativeTargetLanguage = 'llvm-ir' | 'c' | 'cpp' | 'rust';
|
|
4
|
+
export interface NativeProtectionOptions extends SyferitOptions {
|
|
5
|
+
targetLanguage?: NativeTargetLanguage;
|
|
6
|
+
}
|
|
7
|
+
export interface NativeTransformResult {
|
|
8
|
+
code: string;
|
|
9
|
+
transformedCount: number;
|
|
10
|
+
seedUsed: number;
|
|
11
|
+
inoculationInjected: boolean;
|
|
12
|
+
stateKeyDerived: number;
|
|
13
|
+
}
|
|
14
|
+
export declare class LlvmIrTransformer {
|
|
15
|
+
constructor(options?: NativeProtectionOptions);
|
|
16
|
+
transform(irCode: string): NativeTransformResult;
|
|
17
|
+
}
|
|
18
|
+
export declare class NativeSourceTransformer {
|
|
19
|
+
constructor(options?: NativeProtectionOptions);
|
|
20
|
+
transform(sourceCode: string, lang?: NativeTargetLanguage): NativeTransformResult;
|
|
21
|
+
}
|
|
8
22
|
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
23
|
export declare function protectNativeSource(sourceCode: string, options?: NativeProtectionOptions): NativeTransformResult;
|
|
13
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
// [Protected by Soltrix Studios — Syferit Code Defense Engine | https://syferit.soltrixstudios.com]
|
|
1
2
|
export * from './types.js';
|
|
2
3
|
export * from './irTransformer.js';
|
|
3
4
|
export * from './nativeSourceTransformer.js';
|
|
4
5
|
import { LlvmIrTransformer } from './irTransformer.js';
|
|
5
6
|
import { NativeSourceTransformer } from './nativeSourceTransformer.js';
|
|
6
7
|
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:
|
|
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]",
|
|
9
10
|
_tokVec = [_tok0, _tok1, _tok2, _tok3];
|
|
10
11
|
let _h = 2166136261;
|
|
11
12
|
for (let _s = 0; _s < _tokVec.length; _s++) {
|
|
@@ -23,16 +24,16 @@ export function protectLlvmIr(irCode, options) {
|
|
|
23
24
|
_h = (_h ^ _h >>> 16) >>> 0;
|
|
24
25
|
if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
|
|
25
26
|
if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
|
|
26
|
-
if ((_h >>> 4 & 15) !==
|
|
27
|
+
if ((_h >>> 4 & 15) !== 4) {
|
|
27
28
|
throw new Error("ASSERTION_INVARIANT: Enclave boundary attestation failed cryptographic handshake");
|
|
28
29
|
}
|
|
29
30
|
return _h;
|
|
30
31
|
}
|
|
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:
|
|
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]",
|
|
36
37
|
_tokVec = [_tok0, _tok1, _tok2, _tok3];
|
|
37
38
|
let _h = 2166136261;
|
|
38
39
|
for (let _s = 0; _s < _tokVec.length; _s++) {
|
|
@@ -50,21 +51,21 @@ export function protectLlvmIr(irCode, options) {
|
|
|
50
51
|
_h = (_h ^ _h >>> 16) >>> 0;
|
|
51
52
|
if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
|
|
52
53
|
if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
|
|
53
|
-
if ((_h >>> 4 & 15) !==
|
|
54
|
+
if ((_h >>> 4 & 15) !== 2) {
|
|
54
55
|
throw new Error("ASSERTION_INVARIANT: Ring buffer HMAC monotonic counter mismatch");
|
|
55
56
|
}
|
|
56
57
|
return _h;
|
|
57
58
|
}
|
|
58
|
-
const
|
|
59
|
-
if ((
|
|
59
|
+
const __keyDerivationStateBitmask_6f7a = assertRingBufferIntegrity_6f7a(1319905289, 875373949, 1204028363, 614747439);
|
|
60
|
+
if ((__keyDerivationStateBitmask_6f7a & 255) !== 44) {
|
|
60
61
|
throw new Error("INVARIANT_SYNC_ERR: State quorum failure");
|
|
61
62
|
}
|
|
62
63
|
throw new Error("CRITICAL_STATE_FAULT: Memory integrity frame violation");
|
|
63
64
|
})();
|
|
64
65
|
}
|
|
65
66
|
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:
|
|
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]",
|
|
68
69
|
_tokVec = [_tok0, _tok1, _tok2, _tok3];
|
|
69
70
|
let _h = 2166136261;
|
|
70
71
|
for (let _s = 0; _s < _tokVec.length; _s++) {
|
|
@@ -82,22 +83,22 @@ export function protectNativeSource(sourceCode, options) {
|
|
|
82
83
|
_h = (_h ^ _h >>> 16) >>> 0;
|
|
83
84
|
if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
|
|
84
85
|
if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
|
|
85
|
-
if ((_h >>> 4 & 15) !==
|
|
86
|
+
if ((_h >>> 4 & 15) !== 3) {
|
|
86
87
|
throw new Error("ASSERTION_INVARIANT: Enclave boundary attestation failed cryptographic handshake");
|
|
87
88
|
}
|
|
88
89
|
return _h;
|
|
89
90
|
}
|
|
90
|
-
const
|
|
91
|
-
const
|
|
92
|
-
function
|
|
93
|
-
const _row =
|
|
94
|
-
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));
|
|
95
96
|
}
|
|
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:
|
|
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]",
|
|
101
102
|
_tokVec = [_tok0, _tok1, _tok2, _tok3];
|
|
102
103
|
let _h = 2166136261;
|
|
103
104
|
for (let _s = 0; _s < _tokVec.length; _s++) {
|
|
@@ -115,15 +116,25 @@ export function protectNativeSource(sourceCode, options) {
|
|
|
115
116
|
_h = (_h ^ _h >>> 16) >>> 0;
|
|
116
117
|
if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
|
|
117
118
|
if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
|
|
118
|
-
if ((_h >>> 4 & 15) !==
|
|
119
|
-
throw new Error("ASSERTION_INVARIANT:
|
|
119
|
+
if ((_h >>> 4 & 15) !== 6) {
|
|
120
|
+
throw new Error("ASSERTION_INVARIANT: Enclave boundary attestation failed cryptographic handshake");
|
|
120
121
|
}
|
|
121
122
|
return _h;
|
|
122
123
|
}
|
|
123
|
-
const
|
|
124
|
-
if ((
|
|
124
|
+
const __keyDerivationStateBitmask_9ba4 = attestKernelStateNonce_9ba4(1902536873, 1163078895, 1498062035, 2049343819);
|
|
125
|
+
if ((__keyDerivationStateBitmask_9ba4 & 255) !== 96) {
|
|
125
126
|
throw new Error("INVARIANT_SYNC_ERR: State quorum failure");
|
|
126
127
|
}
|
|
127
128
|
throw new Error("CRITICAL_STATE_FAULT: Memory integrity frame violation");
|
|
128
129
|
})();
|
|
130
|
+
}
|
|
131
|
+
if (typeof window !== "undefined") {
|
|
132
|
+
window.__syferitIPC_77e4.invoke && window.__syferitIPC_77e4.invoke("license:quorum-token-refresh", {
|
|
133
|
+
syncEpoch: 20323504,
|
|
134
|
+
channelSig: "SIG_FRAME_77E4"
|
|
135
|
+
});
|
|
136
|
+
}
|
|
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)];
|
|
129
140
|
}
|