def get_tests(config={}):
    tests = make_mac_tests(Poly1305_Basic, "Poly1305", test_data_basic)
    tests += make_mac_tests(Poly1305_New, "Poly1305", test_data_aes)
    tests += make_mac_tests(Poly1305_New, "Poly1305", test_data_chacha20)
    tests += [ Poly1305AES_MC() ]
    tests += list_test_cases(Poly1305Test_AES)
    tests += list_test_cases(Poly1305Test_ChaCha20)
    return tests
Example #2
0
def get_tests(config={}):
    global test_data
    import types
    from common import make_mac_tests

    # A test vector contains multiple results, each one for a
    # different hash algorithm.
    # Here we expand each test vector into multiple ones,
    # and add the relevant parameters that will be passed to new()
    exp_test_data = []
    for row in test_data:
        for modname in row[2].keys():
            t = list(row)
            t[2] = row[2][modname]
            try:
                t.append(dict(digestmod=globals()[modname]))
                exp_test_data.append(t)
            except AttributeError:
                sys.stderr.write("SelfTest: warning: not testing HMAC-%s"
                                 " (not available)\n" % modname)
    tests = make_mac_tests(HMAC, "HMAC", exp_test_data)
    tests.append(HMAC_Module_and_Instance_Test(hash_modules))
    tests.append(HMAC_None())

    tests.append(ByteArrayTests())
    if _memoryview is not types.NoneType:
        tests.append(MemoryViewTests())

    return tests
Example #3
0
def get_tests(config={}):
    global test_data
    import types
    from common import make_mac_tests

    # A test vector contains multiple results, each one for a
    # different hash algorithm.
    # Here we expand each test vector into multiple ones,
    # and add the relevant parameters that will be passed to new()
    exp_test_data = []
    for row in test_data:
        for modname in row[2].keys():
            t = list(row)
            t[2] = row[2][modname]
            try:
                t.append(dict(digestmod=globals()[modname]))
                exp_test_data.append(t)
            except AttributeError:
                sys.stderr.write("SelfTest: warning: not testing HMAC-%s"
                                 " (not available)\n" % modname)
    tests = make_mac_tests(HMAC, "HMAC", exp_test_data)
    tests.append(HMAC_Module_and_Instance_Test(hash_modules))
    tests.append(HMAC_None())

    tests.append(ByteArrayTests())
    if _memoryview is not types.NoneType:
        tests.append(MemoryViewTests())

    return tests
Example #4
0
def get_tests(config={}):
    global test_data
    from common import make_mac_tests

    # Add new() parameters to the back of each test vector
    params_test_data = []
    for row in test_data:
        t = list(row)
        t[4] = dict(ciphermod=t[4])
        params_test_data.append(t)

    return make_mac_tests(CMAC, "CMAC", params_test_data)
Example #5
0
def get_tests(config={}):
    global test_data
    from common import make_mac_tests

    # Add new() parameters to the back of each test vector
    params_test_data = []
    for row in test_data:
        t = list(row)
        t[4] = dict(ciphermod=t[4])
        params_test_data.append(t)

    return make_mac_tests(CMAC, "CMAC", params_test_data)
def get_tests(config={}):
    global test_data
    from Crypto.Hash import HMAC, MD5, SHA as SHA1, SHA256
    from common import make_mac_tests
    hashmods = dict(MD5=MD5, SHA1=SHA1, SHA256=SHA256, default=None)
    try:
        from Crypto.Hash import SHA224, SHA384, SHA512
        hashmods.update(dict(SHA224=SHA224, SHA384=SHA384, SHA512=SHA512))
        test_data += hashlib_test_data
    except ImportError:
        import sys
        sys.stderr.write("SelfTest: warning: not testing HMAC-SHA224/384/512 (not available)\n")
    return make_mac_tests(HMAC, "HMAC", test_data, hashmods)
Example #7
0
def get_tests(config={}):
    global test_data
    from Crypto.Hash import HMAC, MD5, SHA as SHA1, SHA256
    from common import make_mac_tests
    hashmods = dict(MD5=MD5, SHA1=SHA1, SHA256=SHA256, default=None)
    try:
        from Crypto.Hash import SHA224, SHA384, SHA512
        hashmods.update(dict(SHA224=SHA224, SHA384=SHA384, SHA512=SHA512))
        test_data += hashlib_test_data
    except ImportError:
        import sys
        sys.stderr.write("SelfTest: warning: not testing HMAC-SHA224/384/512 (not available)\n")
    return make_mac_tests(HMAC, "HMAC", test_data, hashmods)
Example #8
0
def get_tests(config={}):
    global test_data
    import types
    from common import make_mac_tests
    
    wycheproof_warnings = config.get('wycheproof_warnings')

    # Add new() parameters to the back of each test vector
    params_test_data = []
    for row in test_data:
        t = list(row)
        t[4] = dict(ciphermod=t[4])
        params_test_data.append(t)

    tests = make_mac_tests(CMAC, "CMAC", params_test_data)
    tests.append(MultipleUpdates())
    tests.append(ByteArrayTests())
    if _memoryview is not types.NoneType:
        tests.append(MemoryViewTests())
    tests += [ TestVectorsWycheproof(wycheproof_warnings) ]
    return tests
def get_tests(config={}):
    global test_data
    from common import make_mac_tests

    # A test vector contains multiple results, each one for a
    # different hash algorithm.
    # Here we expand each test vector into multiple ones,
    # and add the relevant parameters that will be passed to new()
    exp_test_data = []
    for row in test_data:
        for modname in row[2].keys():
            t = list(row)
            t[2] = row[2][modname]
            try:
                t.append(dict(digestmod=globals()[modname]))
                exp_test_data.append(t)
            except AttributeError:
                import sys
                sys.stderr.write("SelfTest: warning: not testing HMAC-%s (not available)\n" % modname)

    return make_mac_tests(HMAC, "HMAC", exp_test_data)
Example #10
0
def get_tests(config={}):
    from Crypto.Hash import HMAC, MD5, SHA as SHA1, SHA256
    from common import make_mac_tests
    hashmods = dict(MD5=MD5, SHA1=SHA1, SHA256=SHA256, default=None)
    return make_mac_tests(HMAC, "HMAC", test_data, hashmods)
Example #11
0
def get_tests(config={}):
    from Crypto.Hash import HMAC, MD5, SHA as SHA1, SHA256
    from common import make_mac_tests
    hashmods = dict(MD5=MD5, SHA1=SHA1, SHA256=SHA256, default=None)
    return make_mac_tests(HMAC, "HMAC", test_data, hashmods)