示例#1
0
static int
pass_data_cleanup_fn(const struct testcase_t *testcase, void *ptr)
{
  (void)ptr;
  (void)testcase;
  return 1;
}
static const struct testcase_setup_t pass_data = {
  pass_data_setup_fn, pass_data_cleanup_fn
};

#define CRYPTO_LEGACY(name)                                            \
  { #name, legacy_test_helper, 0, &legacy_setup, test_crypto_ ## name }

struct testcase_t crypto_tests[] = {
  CRYPTO_LEGACY(formats),
  CRYPTO_LEGACY(rng),
  { "aes_AES", test_crypto_aes, TT_FORK, &pass_data, (void*)"aes" },
  { "aes_EVP", test_crypto_aes, TT_FORK, &pass_data, (void*)"evp" },
  CRYPTO_LEGACY(sha),
  CRYPTO_LEGACY(pk),
  CRYPTO_LEGACY(dh),
  CRYPTO_LEGACY(s2k),
  { "aes_iv_AES", test_crypto_aes_iv, TT_FORK, &pass_data, (void*)"aes" },
  { "aes_iv_EVP", test_crypto_aes_iv, TT_FORK, &pass_data, (void*)"evp" },
  CRYPTO_LEGACY(base32_decode),
  { "kdf_TAP", test_crypto_kdf_TAP, 0, NULL, NULL },
  { "hkdf_sha256", test_crypto_hkdf_sha256, 0, NULL, NULL },
#ifdef CURVE25519_ENABLED
  { "curve25519_impl", test_crypto_curve25519_impl, 0, NULL, NULL },
  { "curve25519_impl_hibit", test_crypto_curve25519_impl, 0, NULL, (void*)"y"},
示例#2
0
                                                    boxed, len,
                                                    pw, strlen(pw)));

    tor_free(boxed);
  }

 done:
  tor_free(boxed);
  tor_free(decoded);
}

#define CRYPTO_LEGACY(name)                                            \
  { #name, test_crypto_ ## name , 0, NULL, NULL }

struct testcase_t slow_crypto_tests[] = {
  CRYPTO_LEGACY(s2k_rfc2440),
#ifdef HAVE_LIBSCRYPT_H
  { "s2k_scrypt", test_crypto_s2k_general, 0, &passthrough_setup,
    (void*)"scrypt" },
  { "s2k_scrypt_low", test_crypto_s2k_general, 0, &passthrough_setup,
    (void*)"scrypt-low" },
#ifdef HAVE_EVP_PBE_SCRYPT
  { "libscrypt_eq_openssl", test_libscrypt_eq_openssl, 0, NULL, NULL },
#endif
#endif
  { "s2k_pbkdf2", test_crypto_s2k_general, 0, &passthrough_setup,
    (void*)"pbkdf2" },
  { "s2k_rfc2440_general", test_crypto_s2k_general, 0, &passthrough_setup,
    (void*)"rfc2440" },
  { "s2k_rfc2440_legacy", test_crypto_s2k_general, 0, &passthrough_setup,
    (void*)"rfc2440-legacy" },