def run(scheme, precomp_bitslicing, use_hardware_crypto):
    os.system('make clean')
    path = f'crypto_sign/{scheme}/m4'
    binary = f'crypto_sign_{scheme}_m4_stack.bin'
    if precomp_bitslicing:
        precomp_bitslicing = 1
    else:
        precomp_bitslicing = 0
    if use_hardware_crypto:
        use_hardware_crypto = 1
    else:
        use_hardware_crypto = 0
    subprocess.check_call(f'make PRECOMPUTE_BITSLICING={precomp_bitslicing} USE_HARDWARE_CRYPTO={use_hardware_crypto} IMPLEMENTATION_PATH={path} CRYPTO_ITERATIONS={iterations} bin/{binary}', shell=True)
    os.system(f'./flash.sh bin/{binary}')
    with serial.Serial('/dev/ttyUSB0', 115200, timeout=20) as dev:
        logs = []
        iteration = 0
        log = b''
        while (iteration < iterations):
            device_output = dev.read()
            sys.stdout.buffer.write(device_output)
            sys.stdout.flush()
            log += device_output
            if (device_output == b'#'):
                logs.append(log)
                log = b''
                iteration += 1
    return logs
def run(scheme, precomp_bitslicing, use_hardware_crypto):
    os.system('make clean')
    path = f'crypto_sign/{scheme}/m4'
    binary = f'crypto_sign_{scheme}_m4_stack.bin'
    if precomp_bitslicing:
        precomp_bitslicing = 1
    else:
        precomp_bitslicing = 0
    if use_hardware_crypto:
        use_hardware_crypto = 1
    else:
        use_hardware_crypto = 0
    subprocess.check_call(f'make PRECOMPUTE_BITSLICING={precomp_bitslicing} USE_HARDWARE_CRYPTO={use_hardware_crypto} IMPLEMENTATION_PATH={path} CRYPTO_ITERATIONS={iterations} bin/{binary}', shell=True)
    os.system(f'./flash.sh bin/{binary}')
    with serial.Serial('/dev/ttyUSB0', 115200, timeout=20) as dev:
        logs = []
        iteration = 0
        log = b
        while (iteration < iterations):
            device_output = dev.read()
            sys.stdout.buffer.write(device_output)
            sys.stdout.flush()
            log += device_output
            if (device_output == b'#'):
                logs.append(log)
                log = b
                iteration += 1
    return logs