Beispiel #1
0
def get_tests(config={}):
    tests = []
    tests += list_test_cases(FIPS_PKCS1_Verify_Tests)
    tests += list_test_cases(FIPS_PKCS1_Sign_Tests)
    tests += list_test_cases(PKCS1_Legacy_Module_Tests)
    tests += list_test_cases(PKCS1_All_Hashes_Tests)
    return tests
Beispiel #2
0
def get_tests(config={}):
    tests = []
    tests += list_test_cases(TestIntegerInt)

    try:
        from Crypto.Math import _Numbers_gmp as NumbersGMP

        class TestIntegerGMP(TestIntegerBase):
            def setUp(self):
                self.Numbers = NumbersGMP
                self.Integer = NumbersGMP.Integer
                TestIntegerBase.setUp(self)

        tests += list_test_cases(TestIntegerGMP)
    except (ImportError, OSError) as e:
        import sys
        sys.stdout.write("Skipping GMP tests (%s)\n" % str(e) )

    try:
        from Crypto.Math import _Numbers_custom as NumbersCustomModexp

        class TestIntegerCustomModexp(TestIntegerBase):
            def setUp(self):
                self.Numbers = NumbersCustomModexp
                self.Integer = NumbersCustomModexp.Integer
                TestIntegerBase.setUp(self)

        tests += list_test_cases(TestIntegerCustomModexp)
    except (ImportError, OSError) as e:
        import sys
        sys.stdout.write("Skipping custom modexp tests (%s)\n" % str(e) )

    tests += list_test_cases(TestIntegerGeneric)
    return tests
Beispiel #3
0
def get_tests(config={}):
    tests = []
    tests += list_test_cases(OfbTests)
    if config.get('slow_tests'):
        tests += list_test_cases(NistOfbVectors)
    tests += list_test_cases(SP800TestVectors)
    return tests
Beispiel #4
0
def get_tests(config={}):
    tests = []
    tests += list_test_cases(RSATest)
    try:
        from Crypto.PublicKey import _fastmath

        tests += list_test_cases(RSAFastMathTest)
    except ImportError:
        from distutils.sysconfig import get_config_var
        import inspect

        _fm_path = os.path.normpath(
            os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
            + "/../../PublicKey/_fastmath"
            + get_config_var("SO")
        )
        if os.path.exists(_fm_path):
            raise ImportError(
                "While the _fastmath module exists, importing "
                + "it failed. This may point to the gmp or mpir shared library "
                + "not being in the path. _fastmath was found at "
                + _fm_path
            )
    if config.get("slow_tests", 1):
        tests += list_test_cases(RSASlowMathTest)
    return tests
Beispiel #5
0
def get_tests(config={}):
    tests = []
    tests += list_test_cases(EaxTests)
    tests += list_test_cases(EaxFSMTests)
    tests += [TestVectors()]
    tests += list_test_cases(TestOtherCiphers)
    return tests
Beispiel #6
0
def get_tests(config={}):
    from Crypto.SelfTest.st_common import list_test_cases

    listTests = []
    listTests += list_test_cases(DerObjectTests)
    listTests += list_test_cases(DerSequenceTests)
    return listTests
Beispiel #7
0
def get_tests(config={}):
    tests = []
    tests += list_test_cases(TestEccPoint_NIST)
    tests += list_test_cases(TestEccPoint_PAI)
    tests += list_test_cases(TestEccKey)
    tests += list_test_cases(TestEccModule)
    return tests
Beispiel #8
0
def get_tests(config={}):
    tests = []
    tests += list_test_cases(PBKDF1_Tests)
    tests += list_test_cases(PBKDF2_Tests)
    tests += list_test_cases(S2V_Tests)
    tests += list_test_cases(HKDF_Tests)
    return tests
Beispiel #9
0
def get_tests(config={}):
    tests = []
    tests += list_test_cases(FIPS_DSA_Tests)
    tests += list_test_cases(FIPS_ECDSA_Tests)
    tests += list_test_cases(Det_DSA_Tests)
    tests += list_test_cases(Det_ECDSA_Tests)
    return tests
Beispiel #10
0
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
Beispiel #11
0
def get_tests(config={}):
    tests = []
    tests += list_test_cases(GcmTests)
    tests += list_test_cases(GcmFSMTests)
    tests += [TestVectors()]
    tests += list_test_cases(TestVectorsGueronKrasnov)
    tests += list_test_cases(NISTTestVectorsGCM)
    return tests
Beispiel #12
0
def get_tests(config={}):
    wycheproof_warnings = config.get('wycheproof_warnings')

    tests = []
    tests += list_test_cases(SivTests)
    tests += list_test_cases(SivFSMTests)
    tests += [ TestVectors() ]
    tests += [ TestVectorsWycheproof() ]
    return tests
def get_tests(config={}):
    wycheproof_warnings = config.get('wycheproof_warnings')

    tests = []
    tests += list_test_cases(ChaCha20Poly1305Tests)
    tests += list_test_cases(ChaCha20Poly1305FSMTests)
    tests += [TestVectorsRFC()]
    tests += [TestVectorsWycheproof(wycheproof_warnings)]
    tests += [TestOutput()]
    return tests
Beispiel #14
0
def get_tests(config={}):
    tests = []
    tests += list_test_cases(DSATest)
    try:
        from Crypto.PublicKey import _fastmath
        tests += list_test_cases(DSAFastMathTest)
    except ImportError:
        pass
    tests += list_test_cases(DSASlowMathTest)
    return tests
Beispiel #15
0
def get_tests(config={}):
    from Crypto.SelfTest.st_common import list_test_cases
    tests = list_test_cases(MiscTests)
    try:
        from Crypto.PublicKey import _fastmath
        tests += list_test_cases(FastmathTests)
    except ImportError:
        from Crypto.SelfTest.st_common import handle_fastmath_import_error
        handle_fastmath_import_error()
    return tests
Beispiel #16
0
def get_tests(config={}):
    tests = []
    tests += list_test_cases(RSATest)
    try:
        from Crypto.PublicKey import _fastmath
        tests += list_test_cases(RSAFastMathTest)
    except ImportError:
        pass
    tests += list_test_cases(RSASlowMathTest)
    return tests
Beispiel #17
0
def get_tests(config={}):
    wycheproof_warnings = config.get('wycheproof_warnings')

    tests = []
    tests += list_test_cases(EaxTests)
    tests += list_test_cases(EaxFSMTests)
    tests += [ TestVectorsPaper() ]
    tests += [ TestVectorsWycheproof(wycheproof_warnings) ]
    tests += list_test_cases(TestOtherCiphers)
    return tests
Beispiel #18
0
def get_tests(config={}):
    tests = []
    tests += list_test_cases(ChaCha20Test)
    tests += list_test_cases(XChaCha20Test)
    tests.append(ChaCha20_AGL_NIR())
    tests.append(ByteArrayTest())
    tests.append(MemoryviewTest())
    tests.append(TestOutput())

    return tests
Beispiel #19
0
def get_tests(config={}):
    wycheproof_warnings = config.get('wycheproof_warnings')

    tests = []
    tests += list_test_cases(CcmTests)
    tests += list_test_cases(CcmFSMTests)
    tests += [TestVectors()]
    tests += [TestVectorsWycheproof(wycheproof_warnings)]

    return tests
Beispiel #20
0
def get_tests(config={}):
    wycheproof_warnings = config.get('wycheproof_warnings')

    tests = []
    tests += list_test_cases(EaxTests)
    tests += list_test_cases(EaxFSMTests)
    tests += [TestVectorsPaper()]
    tests += [TestVectorsWycheproof(wycheproof_warnings)]
    tests += list_test_cases(TestOtherCiphers)
    return tests
def get_tests(config={}):
    tests = []
    tests += list_test_cases(DSATest)
    try:
        from Crypto.PublicKey import _fastmath
        tests += list_test_cases(DSAFastMathTest)
    except ImportError:
        from Crypto.SelfTest.st_common import handle_fastmath_import_error
        handle_fastmath_import_error()
    tests += list_test_cases(DSASlowMathTest)
    return tests
Beispiel #22
0
def get_tests(config={}):
    wycheproof_warnings = config.get('wycheproof_warnings')

    tests = []
    tests += list_test_cases(ChaCha20Poly1305Tests)
    tests += list_test_cases(XChaCha20Poly1305Tests)
    tests += list_test_cases(ChaCha20Poly1305FSMTests)
    tests += [TestVectorsRFC()]
    tests += [TestVectorsWycheproof(wycheproof_warnings)]
    tests += [TestOutput()]
    return tests
Beispiel #23
0
def get_tests(config={}):
    tests = []
    tests += list_test_cases(RSATest)
    try:
        from Crypto.PublicKey import _fastmath
        tests += list_test_cases(RSAFastMathTest)
    except ImportError:
        from Crypto.SelfTest.st_common import handle_fastmath_import_error
        handle_fastmath_import_error()
    if config.get('slow_tests',1):
        tests += list_test_cases(RSASlowMathTest)
    return tests
Beispiel #24
0
def get_tests(config={}):
    wycheproof_warnings = config.get('wycheproof_warnings')

    tests = []
    tests += list_test_cases(GcmTests)
    tests += list_test_cases(GcmFSMTests)
    tests += [TestVectors()]
    tests += [TestVectorsWycheproof(wycheproof_warnings)]
    tests += list_test_cases(TestVectorsGueronKrasnov)
    if config.get('slow_tests'):
        tests += list_test_cases(NISTTestVectorsGCM)
    return tests
Beispiel #25
0
def get_tests(config={}):

    if not config.get('slow_tests'):
        PBKDF2_Tests._testData = PBKDF2_Tests._testData[:3]
        scrypt_Tests.data = scrypt_Tests.data[:3]

    tests = []
    tests += list_test_cases(PBKDF1_Tests)
    tests += list_test_cases(PBKDF2_Tests)
    tests += list_test_cases(S2V_Tests)
    tests += list_test_cases(HKDF_Tests)
    tests += list_test_cases(scrypt_Tests)

    return tests
Beispiel #26
0
def get_tests(config={}):

    if not config.get('slow_tests'):
        PBKDF2_Tests._testData = PBKDF2_Tests._testData[:3]
        scrypt_Tests.data = scrypt_Tests.data[:3]

    tests = []
    tests += list_test_cases(PBKDF1_Tests)
    tests += list_test_cases(PBKDF2_Tests)
    tests += list_test_cases(S2V_Tests)
    tests += list_test_cases(HKDF_Tests)
    tests += list_test_cases(scrypt_Tests)

    return tests
def get_tests(config={}):
    tests = []
    tests += list_test_cases(ChaCha20Test)
    tests += list_test_cases(XChaCha20Test)
    tests.append(ChaCha20_AGL_NIR())
    tests.append(ByteArrayTest())

    import sys
    if sys.version[:3] != "2.6":
        tests.append(MemoryviewTest())

    tests.append(TestOutput())

    return tests
def get_tests(config={}):
    tests = []

    tests += list_test_cases(Blake2bTest)
    tests.append(Blake2bOfficialTestVector())
    tests.append(Blake2bTestVector1())
    tests.append(Blake2bTestVector2())

    tests += list_test_cases(Blake2sTest)
    tests.append(Blake2sOfficialTestVector())
    tests.append(Blake2sTestVector1())
    tests.append(Blake2sTestVector2())

    return tests
def get_tests(config={}):
    from common import make_stream_tests

    tests = make_stream_tests(Salsa20, "Salsa20", test_data)
    tests.append(KeyLength())
    tests += list_test_cases(NonceTests)
    return tests
Beispiel #30
0
def get_tests(config={}):
    tests = []
    tests += list_test_cases(TestIntegerInt)

    try:
        from Crypto.Math import _Numbers_gmp as NumbersGMP

        class TestIntegerGMP(TestIntegerBase):
            def setUp(self):
                self.Numbers = NumbersGMP
                self.Integer = NumbersGMP.Integer
                TestIntegerBase.setUp(self)

        tests += list_test_cases(TestIntegerGMP)
    except (ImportError, OSError), e:
        import sys
        sys.stdout.write("Skipping GMP tests (%s)\n" % str(e) )
Beispiel #31
0
def get_tests(config={}):
    from .common import make_block_tests

    tests = []
    tests = make_block_tests(DES3, "DES3", test_data)
    tests.append(DegenerateToDESTest())
    tests += list_test_cases(CheckParity)
    return tests
Beispiel #32
0
def get_tests(config={}):
    skip_slow_tests = not config.get('slow_tests')
    wycheproof_warnings = config.get('wycheproof_warnings')

    tests = []
    tests += list_test_cases(PKCS1_15_Tests)
    tests += [TestVectorsWycheproof(wycheproof_warnings, skip_slow_tests)]
    return tests
Beispiel #33
0
def get_tests(config={}):
    tests = []
    tests += list_test_cases(TestIntegerInt)

    try:
        from Crypto.Math import _Numbers_gmp as NumbersGMP

        class TestIntegerGMP(TestIntegerBase):
            def setUp(self):
                self.Numbers = NumbersGMP
                self.Integer = NumbersGMP.Integer
                TestIntegerBase.setUp(self)

        tests += list_test_cases(TestIntegerGMP)
    except (ImportError, OSError), e:
        import sys
        sys.stdout.write("Skipping GMP tests (%s)\n" % str(e))
Beispiel #34
0
def get_tests(config={}):
    from .common import make_block_tests

    tests = []
    tests = make_block_tests(DES3, "DES3", test_data)
    tests.append(DegenerateToDESTest())
    tests += list_test_cases(CheckParity)
    return tests
Beispiel #35
0
def get_tests(config={}):
    tests = make_stream_tests(Salsa20, "Salsa20", test_data)
    tests.append(KeyLength())
    tests += list_test_cases(NonceTests)
    tests.append(ByteArrayTest())
    tests.append(MemoryviewTest())
    tests.append(TestOutput())

    return tests
Beispiel #36
0
def get_tests(config={}):
    tests = []
    tests += list_test_cases(DSATest)
    # try:
    #         from Crypto.PublicKey import _fastmath
    #         tests += list_test_cases(DSAFastMathTest)
    #     except ImportError:
    #         from distutils.sysconfig import get_config_var
    #         import inspect
    #         _fm_path = os.path.normpath(os.path.dirname(os.path.abspath(
    #             inspect.getfile(inspect.currentframe())))
    #             +"/../../PublicKey/_fastmath"+get_config_var("SO"))
    #         if os.path.exists(_fm_path):
    #             raise ImportError("While the _fastmath module exists, importing "+
    #                 "it failed. This may point to the gmp or mpir shared library "+
    #                 "not being in the path. _fastmath was found at "+_fm_path)
    tests += list_test_cases(DSASlowMathTest)
    return tests
Beispiel #37
0
def get_tests(config={}):
    from Crypto.SelfTest.st_common import list_test_cases
    listTests = []
    listTests += list_test_cases(DerObjectTests)
    listTests += list_test_cases(DerIntegerTests)
    listTests += list_test_cases(DerSequenceTests)
    listTests += list_test_cases(DerOctetStringTests)
    listTests += list_test_cases(DerNullTests)
    listTests += list_test_cases(DerObjectIdTests)
    listTests += list_test_cases(DerBitStringTests)
    listTests += list_test_cases(DerSetOfTests)
    return listTests
Beispiel #38
0
def get_tests(config={}):
    from Crypto.SelfTest.st_common import list_test_cases
    tests = list_test_cases(MiscTests)
    try:
        from Crypto.PublicKey import _fastmath
        tests += list_test_cases(FastmathTests)
    except ImportError:
        from distutils.sysconfig import get_config_var
        import inspect, os.path
        _fm_path = os.path.normpath(
            os.path.dirname(
                os.path.abspath(inspect.getfile(inspect.currentframe()))) +
            "/../../PublicKey/_fastmath" + get_config_var("SO"))
        if os.path.exists(_fm_path):
            raise ImportError(
                "While the _fastmath module exists, importing " +
                "it failed. This may point to the gmp or mpir shared library "
                + "not being in the path. _fastmath was found at " + _fm_path)
    return tests
Beispiel #39
0
def get_tests(config={}):
    from Crypto.SelfTest.st_common import list_test_cases
    listTests = []
    listTests += list_test_cases(DerObjectTests)
    listTests += list_test_cases(DerIntegerTests)
    listTests += list_test_cases(DerSequenceTests)
    listTests += list_test_cases(DerOctetStringTests)
    listTests += list_test_cases(DerNullTests)
    listTests += list_test_cases(DerObjectIdTests)
    listTests += list_test_cases(DerBitStringTests)
    listTests += list_test_cases(DerSetOfTests)
    return listTests
def get_tests(config={}):
    tests = make_stream_tests(Salsa20, "Salsa20", test_data)
    tests.append(KeyLength())
    tests += list_test_cases(NonceTests)
    tests.append(ByteArrayTest())

    import types
    if _memoryview != types.NoneType:
        tests.append(MemoryviewTest())

    return tests
Beispiel #41
0
def get_tests(config={}):
    tests = make_stream_tests(Salsa20, "Salsa20", test_data)
    tests.append(KeyLength())
    tests += list_test_cases(NonceTests)
    tests.append(ByteArrayTest())

    import types
    if _memoryview != type(None):
        tests.append(MemoryviewTest())

    return tests
def get_tests(config={}):
    from common import make_hash_tests

    tests = []

    test_data = load_tests("SHA3", "ShortMsgKAT_SHA3-512.txt")
    tests += make_hash_tests(SHA3, "SHA3_512", test_data,
                             digest_size=SHA3.digest_size,
                             oid="2.16.840.1.101.3.4.2.10")
    tests += list_test_cases(APITest)
    return tests
Beispiel #43
0
def get_tests(config={}):
    tests = []
    tests += list_test_cases(ChaCha20Test)
    tests.append(ChaCha20_AGL_NIR())
    tests.append(ByteArrayTest())

    import types
    if _memoryview != type(None):
        tests.append(MemoryviewTest())

    return tests
def get_tests(config={}):
    tests = []
    tests += list_test_cases(TestImport)
    tests += list_test_cases(TestImport_P256)
    tests += list_test_cases(TestImport_P384)
    tests += list_test_cases(TestImport_P521)
    tests += list_test_cases(TestExport_P256)
    tests += list_test_cases(TestExport_P384)
    tests += list_test_cases(TestExport_P521)
    return tests
def get_tests(config={}):
    tests = []
    tests += list_test_cases(TestImport)
    tests += list_test_cases(TestImport_P256)
    tests += list_test_cases(TestImport_P384)
    tests += list_test_cases(TestImport_P521)
    tests += list_test_cases(TestExport_P256)
    tests += list_test_cases(TestExport_P384)
    tests += list_test_cases(TestExport_P521)
    return tests
Beispiel #46
0
def get_tests(config={}):
    tests = make_stream_tests(Salsa20, "Salsa20", test_data)
    tests.append(KeyLength())
    tests += list_test_cases(NonceTests)
    tests.append(ByteArrayTest())

    import sys
    if sys.version[:3] != "2.6":
        tests.append(MemoryviewTest())

    tests.append(TestOutput())

    return tests
Beispiel #47
0
def get_tests(config={}):
    tests = []
    tests += list_test_cases(FIPS_PKCS1_Verify_Tests)
    tests += list_test_cases(FIPS_PKCS1_Sign_Tests)
    tests += list_test_cases(PKCS1_15_NoParams)
    tests += list_test_cases(PKCS1_Legacy_Module_Tests)
    tests += list_test_cases(PKCS1_All_Hashes_Tests)

    if config.get('slow_tests'):
        tests += list_test_cases(FIPS_PKCS1_Verify_Tests_KAT)
        tests += list_test_cases(FIPS_PKCS1_Sign_Tests_KAT)

    return tests
Beispiel #48
0
def get_tests(config={}):
    from Crypto.Util import _cpu_features

    wycheproof_warnings = config.get('wycheproof_warnings')

    tests = []
    tests += list_test_cases(GcmTests)
    tests += list_test_cases(GcmFSMTests)
    tests += [ TestVectors() ]
    tests += [ TestVectorsWycheproof(wycheproof_warnings) ]
    tests += list_test_cases(TestVectorsGueronKrasnov)
    tests += [ TestVariableLength() ]
    if config.get('slow_tests'):
        tests += list_test_cases(NISTTestVectorsGCM)

    if _cpu_features.have_clmul():
        tests += [ TestVectorsWycheproof(wycheproof_warnings, use_clmul=False) ]
        tests += [ TestVariableLength(use_clmul = False) ]
        if config.get('slow_tests'):
            tests += list_test_cases(NISTTestVectorsGCM_no_clmul)
    else:
        print("Skipping test of PCLMULDQD in AES GCM")

    return tests
def get_tests(config={}):
    from Crypto.Util import _cpu_features

    wycheproof_warnings = config.get('wycheproof_warnings')

    tests = []
    tests += list_test_cases(GcmTests)
    tests += list_test_cases(GcmFSMTests)
    tests += [TestVectors()]
    tests += [TestVectorsWycheproof(wycheproof_warnings)]
    tests += list_test_cases(TestVectorsGueronKrasnov)
    tests += [TestVariableLength()]
    if config.get('slow_tests'):
        tests += list_test_cases(NISTTestVectorsGCM)

    if _cpu_features.have_clmul():
        tests += [TestVectorsWycheproof(wycheproof_warnings, use_clmul=False)]
        tests += [TestVariableLength(use_clmul=False)]
        if config.get('slow_tests'):
            tests += list_test_cases(NISTTestVectorsGCM_no_clmul)
    else:
        print "Skipping test of PCLMULDQD in AES GCM"

    return tests
Beispiel #50
0
def get_tests(config={}):
    tests = []
    tests += list_test_cases(FIPS_DSA_Tests)
    tests += list_test_cases(FIPS_ECDSA_Tests)
    tests += list_test_cases(Det_DSA_Tests)
    tests += list_test_cases(Det_ECDSA_Tests)

    if config.get('slow_tests'):
        tests += list_test_cases(FIPS_DSA_Tests_KAT)
        tests += list_test_cases(FIPS_ECDSA_Tests_KAT)

    return tests
Beispiel #51
0
def get_tests(config={}):
    wycheproof_warnings = config.get('wycheproof_warnings')

    tests = []
    tests += list_test_cases(FIPS_PKCS1_Verify_Tests)
    tests += list_test_cases(FIPS_PKCS1_Sign_Tests)
    tests += list_test_cases(PKCS1_15_NoParams)
    tests += list_test_cases(PKCS1_Legacy_Module_Tests)
    tests += list_test_cases(PKCS1_All_Hashes_Tests)
    tests += [TestVectorsWycheproof(wycheproof_warnings)]

    if config.get('slow_tests'):
        tests += list_test_cases(FIPS_PKCS1_Verify_Tests_KAT)
        tests += list_test_cases(FIPS_PKCS1_Sign_Tests_KAT)

    return tests
Beispiel #52
0
def get_tests(config={}):
    wycheproof_warnings = config.get('wycheproof_warnings')

    tests = []
    tests += list_test_cases(FIPS_PKCS1_Verify_Tests)
    tests += list_test_cases(FIPS_PKCS1_Sign_Tests)
    tests += list_test_cases(PKCS1_15_NoParams)
    tests += list_test_cases(PKCS1_Legacy_Module_Tests)
    tests += list_test_cases(PKCS1_All_Hashes_Tests)
    tests += [ TestVectorsWycheproof(wycheproof_warnings) ]

    if config.get('slow_tests'):
        tests += list_test_cases(FIPS_PKCS1_Verify_Tests_KAT)
        tests += list_test_cases(FIPS_PKCS1_Sign_Tests_KAT)

    return tests
Beispiel #53
0
def get_tests(config={}):
    tests = []
    tests += list_test_cases(PaillierTest)
#     try:
#         from Crypto.PublicKey import _fastmath
#         tests += list_test_cases(PaillierFastMathTest)
#     except ImportError:
#         from distutils.sysconfig import get_config_var
#         import inspect
#         _fm_path = os.path.normpath(os.path.dirname(os.path.abspath(
#             inspect.getfile(inspect.currentframe())))
#             +"/../../PublicKey/_fastmath"+get_config_var("SO"))
#         if os.path.exists(_fm_path):
#             raise ImportError("While the _fastmath module exists, importing "+
#                 "it failed. This may point to the gmp or mpir shared library "+
#                 "not being in the path. _fastmath was found at "+_fm_path)
#     tests += list_test_cases(PaillierSlowMathTest)
    return tests
Beispiel #54
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(ByteArrayTests())
    tests.append(list_test_cases(TestCMAC))
    tests.append(MemoryViewTests())
    tests += [TestVectorsWycheproof(wycheproof_warnings)]
    return tests
def get_tests(config={}):
    from .common import make_hash_tests

    tests = []

    test_vectors = load_tests(("Crypto", "SelfTest", "Hash", "test_vectors", "SHA3"),
                                "ShortMsgKAT_SHA3-384.txt",
                                "KAT SHA-3 384",
                                { "len" : lambda x: int(x) } )

    test_data = []
    for tv in test_vectors:
        if tv.len == 0:
            tv.msg = b("")
        test_data.append((hexlify(tv.md), tv.msg, tv.desc))

    tests += make_hash_tests(SHA3, "SHA3_384", test_data,
                             digest_size=SHA3.digest_size,
                             oid="2.16.840.1.101.3.4.2.9")
    tests += list_test_cases(APITest)
    return tests
Beispiel #56
0
def get_tests(config={}):
    wycheproof_warnings = config.get('wycheproof_warnings')

    if not config.get('slow_tests'):
        PBKDF2_Tests._testData = PBKDF2_Tests._testData[:3]
        scrypt_Tests.data = scrypt_Tests.data[:3]

    tests = []
    tests += list_test_cases(PBKDF1_Tests)
    tests += list_test_cases(PBKDF2_Tests)
    tests += list_test_cases(S2V_Tests)
    tests += list_test_cases(HKDF_Tests)
    tests += [TestVectorsHKDFWycheproof(wycheproof_warnings)]
    tests += list_test_cases(scrypt_Tests)
    tests += list_test_cases(bcrypt_Tests)

    return tests
Beispiel #57
0
def get_tests(config={}):
    wycheproof_warnings = config.get('wycheproof_warnings')

    tests = []
    tests += list_test_cases(FIPS_DSA_Tests)
    tests += list_test_cases(FIPS_ECDSA_Tests)
    tests += list_test_cases(Det_DSA_Tests)
    tests += list_test_cases(Det_ECDSA_Tests)

    if config.get('slow_tests'):
        tests += list_test_cases(FIPS_DSA_Tests_KAT)
        tests += list_test_cases(FIPS_ECDSA_Tests_KAT)

    tests += [TestVectorsDSAWycheproof(wycheproof_warnings)]
    tests += [TestVectorsECDSAWycheproof(wycheproof_warnings)]

    return tests
Beispiel #58
0
def get_tests(config={}):
    tests = []
    tests += list_test_cases(PKCS1_PSS_Tests)
    return tests