def batcher_main(argv, prefix=None): global TEST_STATEMENT, THRESHOLD_FLAG, CODEGEN_FLAG, PROOFGEN_FLAG, PRECOMP_CHECK, VERBOSE, CHOOSE_STRATEGY global filePrefix if len(argv) == 1: print("%s [ file.bv ] -b -c -p" % argv[0]) print("-b : estimate threshold for a given signature scheme with 1 to N signatures.") print("-c : generate the output for the code generator (temporary).") print("-d : check for further precomputations in final batch equation.") print("-p : generate the proof for the signature scheme.") print("-s : select strategy for the ordering of techniques. Options: basic, score, what else?") exit(-1) # main for batch input parser try: print(argv) file = str(argv[1]) if prefix: filePrefix = prefix for i in argv: if i == "-b": THRESHOLD_FLAG = True elif i == "-c": CODEGEN_FLAG = True elif i == "-v": VERBOSE = True elif i == "-p": PROOFGEN_FLAG = True elif i == "-d": PRECOMP_CHECK = True elif i == "-s": CHOOSE_STRATEGY = True elif i == "-t": TEST_STATEMENT = True if not TEST_STATEMENT: ast_struct = parseFile(file) except Exception as exc: print("An error occured while processing batch inputs: ", exc) exit(-1) if TEST_STATEMENT: debug = levels.all statement = argv[2] parser = BatchParser() final = parser.parse(statement) print("Final statement(%s): '%s'" % (type(final), final)) exit(0) verify_eq, N = [], None; cnt = 0 for n in ast_struct[ OTHER ]: if 'verify' in str(n.left): result = handleVerifyEq(n, cnt); cnt += 1 if type(result) != list: verify_eq.append(result) else: verify_eq.extend(result) # verify variables = ast_struct[ TYPE ] for eq in verify_eq: bte = BasicTypeExist( variables ) ASTVisitor( bte ).preorder( eq ) bte.report( eq ) cte = PairingTypeCheck( variables ) ASTVisitor( cte ).preorder( eq ) cte.report( eq ) # process settings for i in range(len(verify_eq)): if VERBOSE: print("\nRunning batcher....\n") runBatcher(file + str(i), verify_eq[i], ast_struct, i)
def benchmark_batcher(argv, prefix=None): global THRESHOLD_FLAG, PROOFGEN_FLAG, PRECOMP_CHECK, VERBOSE, CHOOSE_STRATEGY global filePrefix ast_struct = None THRESHOLD_FLAG = PROOFGEN_FLAG = PRECOMP_CHECK = VERBOSE = CHOOSE_STRATEGY = False # main for batch input parser print(argv) file = argv[1] if prefix: filePrefix = prefix for i in argv: if i == "-b": THRESHOLD_FLAG = True elif i == "-v": VERBOSE = True elif i == "-p": PROOFGEN_FLAG = True elif i == "-s": CHOOSE_STRATEGY = True ast_struct = parseFile(file) verify_eq, N = [], None cnt = 0 for n in ast_struct[OTHER]: if 'verify' in str(n.left): result = handleVerifyEq(n, cnt) cnt += 1 if type(result) != list: verify_eq.append(result) else: verify_eq.extend(result) # verify variables = ast_struct[TYPE] for eq in verify_eq: bte = BasicTypeExist(variables) ASTVisitor(bte).preorder(eq) bte.report(eq) cte = PairingTypeCheck(variables) ASTVisitor(cte).preorder(eq) cte.report(eq) # process settings for i in range(len(verify_eq)): runBatcher(file + str(i), verify_eq[i], ast_struct, i) return
def benchmark_batcher(argv, prefix=None): global THRESHOLD_FLAG, PROOFGEN_FLAG, PRECOMP_CHECK, VERBOSE, CHOOSE_STRATEGY global filePrefix ast_struct = None THRESHOLD_FLAG = PROOFGEN_FLAG = PRECOMP_CHECK = VERBOSE = CHOOSE_STRATEGY = False # main for batch input parser print(argv) file = argv[1] if prefix: filePrefix = prefix for i in argv: if i == "-b": THRESHOLD_FLAG = True elif i == "-v": VERBOSE = True elif i == "-p": PROOFGEN_FLAG = True elif i == "-s": CHOOSE_STRATEGY = True ast_struct = parseFile(file) verify_eq, N = [], None; cnt = 0 for n in ast_struct[ OTHER ]: if 'verify' in str(n.left): result = handleVerifyEq(n, cnt); cnt += 1 if type(result) != list: verify_eq.append(result) else: verify_eq.extend(result) # verify variables = ast_struct[ TYPE ] for eq in verify_eq: bte = BasicTypeExist( variables ) ASTVisitor( bte ).preorder( eq ) bte.report( eq ) cte = PairingTypeCheck( variables ) ASTVisitor( cte ).preorder( eq ) cte.report( eq ) # process settings for i in range(len(verify_eq)): runBatcher(file + str(i), verify_eq[i], ast_struct, i) return
def batcher_main(argv, prefix=None): global TEST_STATEMENT, THRESHOLD_FLAG, CODEGEN_FLAG, PROOFGEN_FLAG, PRECOMP_CHECK, VERBOSE, CHOOSE_STRATEGY global filePrefix if len(argv) == 1: print("%s [ file.bv ] -b -c -p" % argv[0]) print( "-b : estimate threshold for a given signature scheme with 1 to N signatures." ) print("-c : generate the output for the code generator (temporary).") print( "-d : check for further precomputations in final batch equation.") print("-p : generate the proof for the signature scheme.") print( "-s : select strategy for the ordering of techniques. Options: basic, score, what else?" ) exit(-1) # main for batch input parser try: print(argv) file = str(argv[1]) if prefix: filePrefix = prefix for i in argv: if i == "-b": THRESHOLD_FLAG = True elif i == "-c": CODEGEN_FLAG = True elif i == "-v": VERBOSE = True elif i == "-p": PROOFGEN_FLAG = True elif i == "-d": PRECOMP_CHECK = True elif i == "-s": CHOOSE_STRATEGY = True elif i == "-t": TEST_STATEMENT = True if not TEST_STATEMENT: ast_struct = parseFile(file) except Exception as exc: print("An error occured while processing batch inputs: ", exc) exit(-1) if TEST_STATEMENT: debug = levels.all statement = argv[2] parser = BatchParser() final = parser.parse(statement) print("Final statement(%s): '%s'" % (type(final), final)) exit(0) verify_eq, N = [], None cnt = 0 for n in ast_struct[OTHER]: if 'verify' in str(n.left): result = handleVerifyEq(n, cnt) cnt += 1 if type(result) != list: verify_eq.append(result) else: verify_eq.extend(result) # verify variables = ast_struct[TYPE] for eq in verify_eq: bte = BasicTypeExist(variables) ASTVisitor(bte).preorder(eq) bte.report(eq) cte = PairingTypeCheck(variables) ASTVisitor(cte).preorder(eq) cte.report(eq) # process settings for i in range(len(verify_eq)): if VERBOSE: print("\nRunning batcher....\n") runBatcher(file + str(i), verify_eq[i], ast_struct, i)