Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,35 @@ Compiles an expression, making it the default for `evaluate()`.
* Throws `mexce_parsing_exception` on syntax errors, providing the position of the error.
* Throws `std::logic_error` if the expression string is empty.

#### `set_protected_expression()`
Compiles sensitive source supplied by an authenticated formula producer.
* **Signature:** `void set_protected_expression(const std::string& expression);`
* **Behavior:**
* Compiles through the x64 SSE2 backend using a scrubbed working buffer and discards live reconstructable compiler state.
* Does not retain the caller-owned source; the caller remains responsible for its lifetime and erasure.
* Rejects x87 and CSE options and disables expression and byte-code introspection for the compiled formula.
* Allocator remnants and generated machine code can still reveal the formula to a debugger; this API reduces plaintext residency but does not prevent extraction by code running in the same process.

```cpp
double x = 2.0;
mexce::evaluator eval;
eval.bind(x, "x");

std::string decrypted_source = "sin(x) + x * x";
eval.set_protected_expression(decrypted_source);
securely_erase_application_buffer(
decrypted_source); // Application-supplied secure erasure.

const double result = eval.evaluate();
```

`set_protected_expression()` erases MEXCE's working copy. The application must
erase `decrypted_source` with its own non-optimizable memory-erasure routine;
calling `std::string::clear()` alone is not sufficient.

#### `evaluate()`
Executes the expression most recently compiled by `set_expression()`.
Executes the expression most recently compiled by `set_expression()` or
`set_protected_expression()`.
* **Signature:** `double evaluate();`

#### `evaluate(const std::string&)`
Expand Down
Loading
Loading