changeset 96:2bbef4d20678

Small updates to secret annotator
author Sigurd Meldgaard <stm@daimi.au.dk>
date Mon, 08 Jun 2009 15:38:00 +0200
parents f683af7aea18
children 2ac1028c5c1a
files pysmcl/secret_annotator.py
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/pysmcl/secret_annotator.py	Mon Jun 08 13:14:17 2009 +0200
+++ b/pysmcl/secret_annotator.py	Mon Jun 08 15:38:00 2009 +0200
@@ -10,7 +10,8 @@
     Returns True if the expression exp should be considered secret
     given that the variables in *secret_variables* are secret.
     """
-    non_compromising_functions = set(["len", "open", "result"])
+    non_compromising_functions = set(["len", "open", "result",
+                                      "invariant", "precondition"])
     if(isinstance(exp, ast.BoolOp)):
         return (expr_secret(exp.values[0], secret_variables)
                  or expr_secret(exp.values[1], secret_variables))
@@ -35,14 +36,16 @@
                            exp)
         if(exp.func.id in non_compromising_functions):
             return False
-        func = eval(exp.func.id)
-        if(func.secret):
-            return True
+        #func = eval(exp.func.id)
+        #if(func.secret):
+        #    return True
         elif(any([expr_secret(i, secret_variables) for i in exp.args])):
             util.error("Call of non-secret\
  function with secret argument", exp)
         else:
             return True # For now
+    elif isinstance(exp, ast.Str):
+        return False
     else:
         assert False, "Not implemented of type %s" % type(exp)