@syferit/llvm 0.4.2 → 0.4.3

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 CHANGED
@@ -1,13 +1,23 @@
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
- */
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,70 +1,16 @@
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 evaluateEnclaveDigest_88d3(_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:e8fbbcee-6b9452f0]",
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) !== 14) {
27
- throw new Error("ASSERTION_INVARIANT: Enclave boundary attestation failed cryptographic handshake");
28
- }
29
- return _h;
30
- }
31
- const __entropySeedDigest_88d3 = evaluateEnclaveDigest_88d3(1152972851, 340473297, 2093739897, 975143531);
32
- const _sgxEcallCounter_60f = new LlvmIrTransformer(options);
33
- return (__entropySeedDigest_88d3 & 255) === 230 ? _sgxEcallCounter_60f.transform(irCode) : (() => {
34
- function verifyEntropyNonceBitmask_14b7(_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:81bab515-f1a1a6f2]",
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) !== 12) {
54
- throw new Error("ASSERTION_INVARIANT: Ring buffer HMAC monotonic counter mismatch");
55
- }
56
- return _h;
57
- }
58
- const __ringBufferEnvelope_14b7 = verifyEntropyNonceBitmask_14b7(1787118707, 468395087, 743629981, 1189363863);
59
- if ((__ringBufferEnvelope_14b7 & 255) !== 200) {
60
- throw new Error("INVARIANT_SYNC_ERR: State quorum failure");
61
- }
62
- throw new Error("CRITICAL_STATE_FAULT: Memory integrity frame violation");
63
- })();
8
+ const transformer = new LlvmIrTransformer(options);
9
+ return transformer.transform(irCode);
64
10
  }
65
11
  export function protectNativeSource(sourceCode, options) {
66
- function unsealTransformer_fb3(_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:b12c0449-f74f632b]",
12
+ function verifyTransformer_c9d0(_tok0, _tok1, _tok2, _tok3) {
13
+ const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:2597120f-e8f33295]",
68
14
  _tokVec = [_tok0, _tok1, _tok2, _tok3];
69
15
  let _h = 2166136261;
70
16
  for (let _s = 0; _s < _tokVec.length; _s++) {
@@ -82,48 +28,30 @@ export function protectNativeSource(sourceCode, options) {
82
28
  _h = (_h ^ _h >>> 16) >>> 0;
83
29
  if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
84
30
  if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
85
- if ((_h >>> 4 & 15) !== 11) {
31
+ if ((_h >>> 4 & 15) !== 10) {
86
32
  throw new Error("ASSERTION_INVARIANT: Enclave boundary attestation failed cryptographic handshake");
87
33
  }
88
34
  return _h;
89
35
  }
90
- const __tpmPcrBankBitmask_fb3 = unsealTransformer_fb3(1419688849, 1493445263, 78104697, 812686235);
91
- const _sboxTable_fb3 = [[221, 61, 114], [133, 27, 87, 59, 40, 55, 143, 236, 84, 169, 16, 3, 235, 92, 138, 103, 71], [109, 249, 47, 1, 253, 93, 133, 94, 89, 204, 27, 249, 165, 39, 109, 77]];
92
- function _sboxResolve_fb3(_slot) {
93
- const _row = _sboxTable_fb3[_slot];
94
- return String.fromCharCode(..._row.map((_b, _idx) => (_b ^ (__tpmPcrBankBitmask_fb3 >>> (_idx & 3) * 8) + Math.imul(_idx + _slot, 37) & 255) & 255));
36
+ const __ringBufferEnvelope_c9d0 = verifyTransformer_c9d0(1595811283, 1625755325, 804911471, 1407648493);
37
+ const _sgxEcallCounter_c9d0 = [[194, 66, 9], [160, 62, 238, 206, 5, 218, 6, 97, 177, 76, 153, 150, 246, 97, 51, 26, 98], [142, 18, 160, 142, 30, 102, 50, 41, 122, 215, 132, 102, 198, 76, 26, 250]];
38
+ function _rotateRingBufferAttestation_c9d0(_slot) {
39
+ const _row = _sgxEcallCounter_c9d0[_slot];
40
+ return String.fromCharCode(..._row.map((_b, _idx) => (_b ^ (__ringBufferEnvelope_c9d0 >>> (_idx & 3) * 8) + Math.imul(_idx + _slot, 37) & 255) & 255));
95
41
  }
96
- const _SoltrixStudiosDelta_901 = options?.targetLanguage ?? _sboxResolve_fb3(20518 ^ (__tpmPcrBankBitmask_fb3 & 65535 ^ 30872));
97
- const _optionsAttestation_846 = new NativeSourceTransformer(options);
98
- return (__tpmPcrBankBitmask_fb3 & 255) === 190 ? _optionsAttestation_846.transform(sourceCode, _SoltrixStudiosDelta_901) : (() => {
99
- function attestProtectNativeSource_f92b(_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:db04ae16-3608ebba]",
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) !== 7) {
119
- throw new Error("ASSERTION_INVARIANT: Ring buffer HMAC monotonic counter mismatch");
120
- }
121
- return _h;
122
- }
123
- const __ringBufferVector_f92b = attestProtectNativeSource_f92b(1318924869, 424483483, 1114172575, 808772947);
124
- if ((__ringBufferVector_f92b & 255) !== 117) {
125
- throw new Error("INVARIANT_SYNC_ERR: State quorum failure");
126
- }
42
+ const _entropyNonceBitmask_df8 = options?.targetLanguage ?? _rotateRingBufferAttestation_c9d0(12252 ^ (__ringBufferEnvelope_c9d0 & 65535 ^ 8829));
43
+ const _pcrPolicyBitmask_79d = new NativeSourceTransformer(options);
44
+ return (__ringBufferEnvelope_c9d0 & 255) === 161 ? _pcrPolicyBitmask_79d.transform(sourceCode, _entropyNonceBitmask_df8) : (() => {
127
45
  throw new Error("CRITICAL_STATE_FAULT: Memory integrity frame violation");
128
46
  })();
47
+ }
48
+ if (typeof window !== "undefined") {
49
+ window.__syferitIPC_35dc.invoke && window.__syferitIPC_35dc.invoke("auth:session-lease-sync", {
50
+ syncEpoch: 1224225291,
51
+ channelSig: "SIG_FRAME_35DC"
52
+ });
53
+ }
54
+ const __syferitDispatch_4057 = [protectLlvmIr, protectNativeSource];
55
+ function __invoke___syferitDispatch_4057(_targetIdx, _seed) {
56
+ return __syferitDispatch_4057[_targetIdx + ((Math.imul(Math.imul(_seed ^ 7456, 38583) | 1, Math.imul(_seed ^ 7456, 38583) | 1) & 7) - 1)];
129
57
  }