- Code cleanup.

This commit is contained in:
ccremers 2005-03-11 20:27:57 +00:00
parent 60795919c1
commit 3c5b91e3e3

View File

@ -298,14 +298,15 @@ def DescribeContext (filep, protocols, claim):
# returns 1 if it really requires these protocols # returns 1 if it really requires these protocols
# #
def RequiresAllProtocols (protocols, claim): def RequiresAllProtocols (protocols, claim):
# check for single results # check for single results
if ClaimToResultMap[claim] == 0: if ClaimToResultMap[claim] == 0:
# claim was always false # claim was always false (already attack on single prot.)
return 0 return False
# check for simple cases # check for simple cases
if TupleWidth <= 2: if TupleWidth <= 2:
# nothing to remove # nothing to remove
return 1 return True
# test the claims when removing some others # test the claims when removing some others
# for TupleWidth size list, we can remove TupleWidth-1 # for TupleWidth size list, we can remove TupleWidth-1
@ -321,8 +322,8 @@ def RequiresAllProtocols (protocols, claim):
simplerresults = ScytherEval (simplercase) simplerresults = ScytherEval (simplercase)
if claim in simplerresults.keys() and simplerresults[claim] == 0: if claim in simplerresults.keys() and simplerresults[claim] == 0:
# Redundant protocol was not necessary for attack! # Redundant protocol was not necessary for attack!
return 0 return False
return 1 return True
@ -334,7 +335,7 @@ def RequiresAllProtocols (protocols, claim):
# Returns number of new attacks found # Returns number of new attacks found
# #
def SignalAttack (protocols, claim): def SignalAttack (protocols, claim):
if RequiresAllProtocols (protocols, claim) == 0: if not RequiresAllProtocols (protocols, claim):
return 0 return 0
ClearProgress (TupleCount, safetxt) ClearProgress (TupleCount, safetxt)