コード例 #1
0
ファイル: test_bulk.c プロジェクト: Sp1l/heimdal
static void
test_bulk_provider_w32crypto(void)
{
    test_bulk_cipher("w32crypto_aes_256_cbc",	EVP_w32crypto_aes_256_cbc());
#if 0
    test_bulk_cipher("w32crypto_aes_256_cfb8",	EVP_w32crypto_aes_256_cfb8());
#endif
    test_bulk_cipher("w32crypto_rc4",		EVP_w32crypto_rc4());
    test_bulk_digest("w32crypto_md2",		EVP_w32crypto_md2());
    test_bulk_digest("w32crypto_md4",		EVP_w32crypto_md4());
    test_bulk_digest("w32crypto_md5",		EVP_w32crypto_md5());
    test_bulk_digest("w32crypto_sha1",		EVP_w32crypto_sha1());
    test_bulk_digest("w32crypto_sha256",	EVP_w32crypto_sha256());
    test_bulk_digest("w32crypto_sha384",	EVP_w32crypto_sha384());
    test_bulk_digest("w32crypto_sha512",	EVP_w32crypto_sha512());
}
コード例 #2
0
ファイル: test_cipher.c プロジェクト: DavidMulder/heimdal
int
main(int argc, char **argv)
{
    int ret = 0;
    int i, idx = 0;

    setprogname(argv[0]);

    if(getarg(args, sizeof(args) / sizeof(args[0]), argc, argv, &idx))
	usage(1);

    if (help_flag)
	usage(0);

    if(version_flag){
	print_version(NULL);
	exit(0);
    }

    argc -= idx;
    argv += idx;

    /* hcrypto */
    for (i = 0; i < sizeof(aes_tests)/sizeof(aes_tests[0]); i++)
	ret += test_cipher(i, EVP_hcrypto_aes_256_cbc(), &aes_tests[i]);
    for (i = 0; i < sizeof(aes_cfb_tests)/sizeof(aes_cfb_tests[0]); i++)
	ret += test_cipher(i, EVP_hcrypto_aes_128_cfb8(), &aes_cfb_tests[i]);
    for (i = 0; i < sizeof(rc2_tests)/sizeof(rc2_tests[0]); i++)
	ret += test_cipher(i, EVP_hcrypto_rc2_cbc(), &rc2_tests[i]);
    for (i = 0; i < sizeof(rc2_40_tests)/sizeof(rc2_40_tests[0]); i++)
	ret += test_cipher(i, EVP_hcrypto_rc2_40_cbc(), &rc2_40_tests[i]);
    for (i = 0; i < sizeof(des_ede3_tests)/sizeof(des_ede3_tests[0]); i++)
	ret += test_cipher(i, EVP_hcrypto_des_ede3_cbc(), &des_ede3_tests[i]);
    for (i = 0; i < sizeof(camellia128_tests)/sizeof(camellia128_tests[0]); i++)
	ret += test_cipher(i, EVP_hcrypto_camellia_128_cbc(),
			   &camellia128_tests[i]);
    for (i = 0; i < sizeof(rc4_tests)/sizeof(rc4_tests[0]); i++)
	ret += test_cipher(i, EVP_hcrypto_rc4(), &rc4_tests[i]);

    /* Common Crypto */
#ifdef __APPLE__
    for (i = 0; i < sizeof(aes_tests)/sizeof(aes_tests[0]); i++)
	ret += test_cipher(i, EVP_cc_aes_256_cbc(), &aes_tests[i]);
    for (i = 0; i < sizeof(aes_cfb_tests)/sizeof(aes_cfb_tests[0]); i++)
	ret += test_cipher(i, EVP_cc_aes_128_cfb8(), &aes_cfb_tests[i]);
    for (i = 0; i < sizeof(rc2_40_tests)/sizeof(rc2_40_tests[0]); i++)
	ret += test_cipher(i, EVP_cc_rc2_40_cbc(), &rc2_40_tests[i]);
    for (i = 0; i < sizeof(des_ede3_tests)/sizeof(des_ede3_tests[0]); i++)
	ret += test_cipher(i, EVP_cc_des_ede3_cbc(), &des_ede3_tests[i]);
    for (i = 0; i < sizeof(camellia128_tests)/sizeof(camellia128_tests[0]); i++)
	ret += test_cipher(i, EVP_cc_camellia_128_cbc(),
			   &camellia128_tests[i]);
    for (i = 0; i < sizeof(rc4_tests)/sizeof(rc4_tests[0]); i++)
	ret += test_cipher(i, EVP_cc_rc4(), &rc4_tests[i]);
#endif /* __APPLE__ */

    /* Windows CNG (if available) */
#ifdef WIN32
    for (i = 0; i < sizeof(aes_tests)/sizeof(aes_tests[0]); i++)
	ret += test_cipher(i, EVP_w32crypto_aes_256_cbc(), &aes_tests[i]);
    for (i = 0; i < sizeof(aes_cfb_tests)/sizeof(aes_cfb_tests[0]); i++)
	ret += test_cipher(i, EVP_w32crypto_aes_128_cfb8(), &aes_cfb_tests[i]);
    for (i = 0; i < sizeof(rc2_tests)/sizeof(rc2_tests[0]); i++)
	ret += test_cipher(i, EVP_w32crypto_rc2_cbc(), &rc2_tests[i]);
    for (i = 0; i < sizeof(rc2_40_tests)/sizeof(rc2_40_tests[0]); i++)
	ret += test_cipher(i, EVP_w32crypto_rc2_40_cbc(), &rc2_40_tests[i]);
    for (i = 0; i < sizeof(des_ede3_tests)/sizeof(des_ede3_tests[0]); i++)
	ret += test_cipher(i, EVP_w32crypto_des_ede3_cbc(), &des_ede3_tests[i]);
    for (i = 0; i < sizeof(rc4_tests)/sizeof(rc4_tests[0]); i++)
	ret += test_cipher(i, EVP_w32crypto_rc4(), &rc4_tests[i]);
#endif /* WIN32 */

    /* PKCS#11 */
#if __sun || defined(PKCS11_MODULE_PATH)
    for (i = 0; i < sizeof(aes_tests)/sizeof(aes_tests[0]); i++)
	ret += test_cipher(i, EVP_pkcs11_aes_256_cbc(), &aes_tests[i]);
    for (i = 0; i < sizeof(aes_cfb_tests)/sizeof(aes_cfb_tests[0]); i++)
	ret += test_cipher(i, EVP_pkcs11_aes_128_cfb8(), &aes_cfb_tests[i]);
    for (i = 0; i < sizeof(rc2_tests)/sizeof(rc2_tests[0]); i++)
	ret += test_cipher(i, EVP_pkcs11_rc2_cbc(), &rc2_tests[i]);
    for (i = 0; i < sizeof(rc2_40_tests)/sizeof(rc2_40_tests[0]); i++)
	ret += test_cipher(i, EVP_pkcs11_rc2_40_cbc(), &rc2_40_tests[i]);
    for (i = 0; i < sizeof(des_ede3_tests)/sizeof(des_ede3_tests[0]); i++)
	ret += test_cipher(i, EVP_pkcs11_des_ede3_cbc(), &des_ede3_tests[i]);
    for (i = 0; i < sizeof(rc4_tests)/sizeof(rc4_tests[0]); i++)
	ret += test_cipher(i, EVP_pkcs11_rc4(), &rc4_tests[i]);
#endif /* PKCS11_MODULE_PATH */

    /* OpenSSL */
#ifdef HAVE_HCRYPTO_W_OPENSSL
    for (i = 0; i < sizeof(aes_tests)/sizeof(aes_tests[0]); i++)
	ret += test_cipher(i, EVP_ossl_aes_256_cbc(), &aes_tests[i]);
    for (i = 0; i < sizeof(aes_cfb_tests)/sizeof(aes_cfb_tests[0]); i++)
	ret += test_cipher(i, EVP_ossl_aes_128_cfb8(), &aes_cfb_tests[i]);
    for (i = 0; i < sizeof(rc2_tests)/sizeof(rc2_tests[0]); i++)
	ret += test_cipher(i, EVP_ossl_rc2_cbc(), &rc2_tests[i]);
    for (i = 0; i < sizeof(rc2_40_tests)/sizeof(rc2_40_tests[0]); i++)
	ret += test_cipher(i, EVP_ossl_rc2_40_cbc(), &rc2_40_tests[i]);
    for (i = 0; i < sizeof(des_ede3_tests)/sizeof(des_ede3_tests[0]); i++)
	ret += test_cipher(i, EVP_ossl_des_ede3_cbc(), &des_ede3_tests[i]);
    for (i = 0; i < sizeof(rc4_tests)/sizeof(rc4_tests[0]); i++)
	ret += test_cipher(i, EVP_ossl_rc4(), &rc4_tests[i]);
#endif /* PKCS11_MODULE_PATH */

    return ret;
}