changeset 204:8a5e8b44a79d

secret_analysis: ideal_functionality's secret argument is used. Instead of letting all the arguments be secret
author Sigurd Meldgaard <stm@daimi.au.dk>
date Thu, 17 Dec 2009 15:43:24 +0100
parents c0211fca3161
children b406cd25f674
files pysmcl/secret_annotator.py
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/pysmcl/secret_annotator.py	Thu Dec 17 13:29:39 2009 +0100
+++ b/pysmcl/secret_annotator.py	Thu Dec 17 15:43:24 2009 +0100
@@ -94,13 +94,18 @@
        node.value.func.id == "mark_secret"):
         # Todo - handle non-names...
         ins = ins | set([i.id for i in node.value.args])
-    if (isinstance(node, ast.FunctionDef)):
-        ins = ins | set([arg.id for arg in node.args.args])
     return ins
 
 
 def secret_analysis(function):
-    arguments = set(i.id for i in function.args.args)
-    function.body[0].imported_secrets = arguments
+    decorator = ast.get_ideal_functionality(function)
+    param_range = {}
+    secrets = set()
+    if not decorator is None:
+        for keyword in decorator.keywords:
+            if keyword.arg == 'secrets':
+                secrets = set(ast.literal_eval(keyword.value))
+                break
+    function.body[0].imported_secrets = secrets
     pysmcl.flow.analyze(function, secret_join,
                         secret_combine, analysis_key, set())