changeset 203:c0211fca3161

secret_annotator: handle lists and non-direct function calls.
author Sigurd Meldgaard <stm@daimi.au.dk>
date Thu, 17 Dec 2009 13:29:39 +0100
parents 544c4eb0a3a2
children 8a5e8b44a79d
files pysmcl/secret_annotator.py
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pysmcl/secret_annotator.py	Wed Dec 16 18:18:01 2009 +0100
+++ b/pysmcl/secret_annotator.py	Thu Dec 17 13:29:39 2009 +0100
@@ -24,8 +24,10 @@
     """
     if(secret_variables is None):
         secret_variables = ast.get_ancestor(exp, ast.stmt).in_values[analysis_key]
-
-    if(isinstance(exp, ast.BoolOp)):
+    
+    if(isinstance(exp, ast.List)):
+        return any([expr_secret(i, secret_variables) for i in exp.elts])
+    elif(isinstance(exp, ast.BoolOp)):
         return (expr_secret(exp.values[0], secret_variables)
                  or expr_secret(exp.values[1], secret_variables))
     elif(isinstance(exp, ast.BinOp)):
@@ -43,6 +45,8 @@
     elif(isinstance(exp, ast.Num)):
         return False
     elif(isinstance(exp, ast.Call)):
+        if(not isinstance(exp.func, ast.Name)):
+            return False # but bad_calls will warn us via bad_calls.py
         function_name = exp.func.id
         if(function_name in non_compromising_functions):
             return False