changeset 211:84b397ddef2e

secret_analysis handle arrays in assignments
author Sigurd Meldgaard <stm@daimi.au.dk>
date Tue, 22 Dec 2009 14:04:32 +0100
parents 35619b409e2e
children ab8d20c4309d
files pysmcl/secret_annotator.py
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pysmcl/secret_annotator.py	Tue Dec 22 13:57:07 2009 +0100
+++ b/pysmcl/secret_annotator.py	Tue Dec 22 14:04:32 2009 +0100
@@ -86,10 +86,17 @@
     if(getattr(node, "imported_secrets", False)):
         ins = ins | node.imported_secrets
     if(isinstance(node, ast.Assign)):
+        target = node.targets[0]
+        if(isinstance(target, ast.Subscript)): #treat arrays as their values
+            name = target.value.id
+        elif(isinstance(target, ast.Name)):
+            name = target.id
+        else:
+            error(node, "Unhandled type of assignment")
         if(expr_secret(node.value, ins)):
-            ins = ins | set([node.targets[0].id])
+                ins = ins | set([name])
         else:
-            ins = ins - set([node.targets[0].id])
+            ins = ins - set([name])
 
     if(isinstance(node, ast.Expr)):
            expr_secret(node.value, ins)