Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 21
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 Crypto.SelfTest.st_common import handle_fastmath_import_error
        handle_fastmath_import_error()
    tests += list_test_cases(DSASlowMathTest)
    return tests
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 28
0
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
Ejemplo n.º 29
0
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
Ejemplo n.º 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) )
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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))
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 44
0
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
Ejemplo n.º 45
0
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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 49
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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 55
0
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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 58
0
def get_tests(config={}):
    tests = []
    tests += list_test_cases(PKCS1_PSS_Tests)
    return tests