Exemple #1
0
def gen_tv(ccw, blocks_per_segment, dest_dir):
    args = [
        '--lib_path',
        str(cnd_dir / 'lib'),
        '--aead',
        'isapa128av20',
        '--hash',
        'asconhashv12',
        '--io',
        str(ccw),
        str(ccw),
        '--key_size',
        '128',
        '--npub_size',
        '128',
        '--nsec_size',
        '0',
        '--message_digest_size',
        '256',
        '--tag_size',
        '128',
        '--block_size',
        '64',
        '--block_size_ad',
        '64',
        '--dest',
        str(dest_dir),
        '--max_ad',
        '80',
        '--max_d',
        '80',
        '--max_io_per_line',
        '8',
        '--verify_lib',
    ]

    if blocks_per_segment:
        args += ['--max_block_per_sgmt', str(blocks_per_segment)]

    # ========================================================================
    # Message format
    # This format is only correct for encryption. We swap the ad/ct order
    # manually in a post processing step down below
    msg_format = '--msg_format npub data ad tag'.split()
    gen_test_routine = '--gen_test_routine 1 22 0'.split()
    gen_test_hash = '--gen_hash 1 22 0'.split()
    gen_test_combined = '--gen_test_combined 1 22 0'.split()

    # ========================================================================
    # Add option arguments together
    args += msg_format
    args += gen_test_routine
    args += gen_test_hash
    args += gen_test_combined

    return cli.run_cryptotvgen(args)
Exemple #2
0
def gen_tv(ccw, blocks_per_segment, dest_dir):
    args = [
        '--lib_path',
        str(cnd_dir / 'lib'),
        '--aead',
        'dummy_lwc',
        '--hash',
        'dummy_lwc',
        '--io',
        str(ccw),
        str(ccw),
        '--key_size',
        '128',
        '--npub_size',
        '96',
        '--nsec_size',
        '0',
        '--message_digest_size',
        '256',
        '--tag_size',
        '128',
        '--block_size',
        '128',
        '--block_size_ad',
        '128',
        '--dest',
        str(dest_dir),
        '--max_ad',
        '80',
        '--max_d',
        '80',
        '--max_io_per_line',
        '8',
        '--verify_lib',
    ]

    if blocks_per_segment:
        args += ['--max_block_per_sgmt', str(blocks_per_segment)]

    msg_format = '--msg_format npub ad data tag'.split()

    gen_test_combined = '--gen_test_combined 1 33 0'.split()
    # gen_hash = '--gen_hash 1 20 2'.split()
    args += msg_format
    args += gen_test_combined

    # TODO
    # args += gen_hash

    return cli.run_cryptotvgen(args)
Exemple #3
0
    #     1,      0,          100,        500,        0
    #     ''']
    # gen_single = ['--gen_single',
    #     '1',                                # AEAD Encrypt(0)/AEAD Decrypt(1)/Hash(2)
    #     '000102030405060708090A0B0C0D0E0F', #Key
    #     '000102030405060708090A0B',         #Npub
    #     '000102030405060708090A0B0C0D0E0F', #Nsec (Ignored: nsec_size=0)
    #     '000102030405060708090A0B0C0D0E0F', #AD
    #     '000102030405060708090A0B0C0D0E0F', #DATA
    #     ]
    # gen_single_hash = ['--gen_single',
    #     '2',                                # AEAD Encrypt(0)/AEAD Decrypt(1)/Hash(2)
    #     '00000000000000000000000000000000', #Key
    #     '000000000000000000000000',         #Npub
    #     '00000000000000000000000000000000', #Nsec (Ignored: nsec_size=0)
    #     '00000000000000000000000000000000', #AD
    #     '000102030405060708090A0B0C0D0E0F', #DATA
    #     ]

    gen_test_combined = '--gen_test_combined 1 33 0'.split()
    # gen_hash = '--gen_hash 1 20 2'.split()
    # ========================================================================
    # Add option arguments together
    args += msg_format
    args += gen_test_combined
    # Add other test routines below
    # args += gen_hash
    # ========================================================================
    # Call program
    cli.run_cryptotvgen(args)
Exemple #4
0
        for mess_size in range(2 * block_size_message // 8):
            return_string += f"1,0,{ad_size},{mess_size},0:"
    return return_string


def blanket_message_hash_test():
    return_string = ""
    for hash_size in range(4 * block_size_msg_digest // 8):
        return_string += f"0,0,0,{hash_size},1:"
    return return_string


if __name__ == '__main__':
    # Print the help text
    if (len(sys.argv) > 1 and sys.argv[1] == '-h'):
        sys.exit(cli.run_cryptotvgen(sys.argv[1:]))
    # Create the list of arguments for cryptotvgen
    args = [
        '--lib_path',
        str(script_dir.parents[1] / 'isap_ref' / 'lib'),
        '--aead',
        aead_lib_name,
        '--io',
        f'{PDI_width}',
        f'{SDI_width}',
        '--key_size',
        f'{key_size}',
        '--block_size',
        f'{block_size_message}',
        '--block_size_ad',
        f'{block_size_ad}',
Exemple #5
0
def build_libs():
    args = ['--prepare_libs', '--candidates_dir', str(cnd_dir)]
    return cli.run_cryptotvgen(args)