Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to transform time-variant code #11

Open
casciand opened this issue Oct 26, 2024 · 1 comment
Open

Failure to transform time-variant code #11

casciand opened this issue Oct 26, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@casciand
Copy link

Hello,

It is stated in your paper that Lif "cannot transform a program that contains memory indexation data dependent on secret inputs", since such code is not publicly safe and cannot be made data invariant with control-flow linearization. However, I believe there are cases with data-dependent indexation that can be made operation invariant at the least. For example, the branch in the following code is not linearized by Lif even though, intuitively, it could be by using a ctsel primitive.

int main() {
  int data[2] = {0, 1};  // Public
  __attribute__((annotate("secret"))) int key = 1;  // Tainted

  if (data[key]) {  // Tainted branch is not linearized
    return 1;
  }

  return 0;
}

Of course, this example can be extended so that the code inside the branch performs more computation than a trivial return statement.

Lif reports the data-dependent index, but chooses not to linearize the branch. Is this intended behavior?

@luigidcsoares
Copy link
Collaborator

Hi @casciand,

Thanks for reporting this. What we meant by "cannot transform a program that contains memory indexation data dependent on secret inputs" is that this kind of code cannot be made safe just through control-flow linearization, as you said.

But, operation invariance should still be guaranteed. This is most likely a bug in the implementation of taint analysis. Looks related to issue #9, regarding dealing with loads and stores. See ghostrider/dijkstra for an example where the same (I think) issue happens and we had to deal with it manually.

@luigidcsoares luigidcsoares added the bug Something isn't working label Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants