Skip to content

Is there a way to specify when a value should be declassified? #1

@bjohannesmeyer

Description

@bjohannesmeyer

As an example, suppose we want to verify xor in xor.c:

#include <smack.h>
#include "../ct-verif.h"

void xor(int *key, int *out) {
  // key is secret, out is public
  *out = key[0];
  *out ^= key[1];
}

void xor_wrapper(int *key, int *out) {
  public_in(__SMACK_value(key));
  public_in(__SMACK_value(out));
  public_in(__SMACK_values(out,1));
  public_out(__SMACK_values(out,1));
  declassified_out(__SMACK_values(out,1));

  xor(key, out);
}

The xor function xors the two secret values in key and stores the result in the public out. It does this by erroneously storing the intermediate value in out, thereby leaking key[0]. However, ct-verif verifies this program with the following command in an examples subdirectory: WD=${PWD} ENTRYPOINTS=xor_wrapper EXAMPLE=xor.c make -C ../../bin verify.

Is this a problem? It seems like it would be since key[0] is leaked, but I may be doing something wrong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions