load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")
load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest")

oncall("secure_pipes")

cpp_library(
    name = "mocks",
    headers = [
        "Mocks.h",
    ],
    exported_deps = [
        "//fizz/crypto:hasher",
        "//fizz/crypto:key_derivation",
        "//folly/portability:gmock",
    ],
)

cpp_library(
    name = "HmacTest",
    srcs = [
        "HmacTest.cpp",
    ],
    headers = [
        "HmacTest.h",
    ],
    deps = [
        "//fizz/crypto:crypto",
        "//folly:string",
        "//folly/io:iobuf",
        "//folly/portability:gtest",
    ],
    exported_deps = [
        "//fizz/crypto:hasher",
        "//fizz/protocol:types",
    ],
)

cpp_library(
    name = "hash_test",
    srcs = [
        "HashTest.cpp",
    ],
    headers = [
        "HashTest.h",
    ],
    deps = [
        "//fizz/crypto:crypto",
        "//folly:string",
        "//folly/io:iobuf",
        "//folly/portability:gtest",
    ],
    exported_deps = [
        "//fizz/crypto:hasher",
        "//fizz/protocol:types",
    ],
)

cpp_library(
    name = "TestKeys",
    srcs = [
        "TestKeys.cpp",
    ],
    headers = [
        "TestKeys.h",
    ],
    deps = [
    ],
    exported_deps = [
        "//fizz/crypto:crypto",
        "//folly:string",
    ],
)

cpp_library(
    name = "signature_test_data",
    srcs = [
        "SignatureTestData.cpp",
    ],
    headers = [
        "SignatureTestData.h",
    ],
    exported_deps = [
        "//fizz/record:record",
    ],
)

cpp_library(
    name = "TestUtil",
    srcs = [
        "TestUtil.cpp",
    ],
    headers = [
        "TestUtil.h",
    ],
    deps = [
        "//fizz:config",
        "//fizz/backend:libaegis",
        "//fizz/backend:openssl",
        "//folly/ssl:openssl_cert_utils",
    ],
    exported_deps = [
        ":TestKeys",
        "//fizz/crypto/aead:aead",
        "//fizz/protocol:types",
        "//folly:string",
        "//folly/io:iobuf",
        "//folly/ssl:openssl_ptr_types",
    ],
    external_deps = [
        ("libsodium", None, "sodium"),
    ],
)

cpp_unittest(
    name = "hkdf_tests",
    srcs = [
        "HkdfTest.cpp",
    ],
    supports_static_listing = False,
    deps = [
        ":TestUtil",
        "//fizz/backend:openssl",
        "//fizz/crypto:hkdf",
        "//folly/portability:gtest",
    ],
)

cpp_unittest(
    name = "key_derivation",
    srcs = [
        "KeyDerivationTest.cpp",
    ],
    supports_static_listing = False,
    deps = [
        "//fizz/backend:openssl",
        "//fizz/crypto:key_derivation",
        "//folly:string",
        "//folly/io:iobuf",
        "//folly/portability:gtest",
    ],
)

cpp_unittest(
    name = "random_generator_test",
    srcs = [
        "RandomGeneratorTest.cpp",
    ],
    deps = [
        ":TestUtil",
        "//fizz/crypto:random",
        "//folly/portability:gtest",
    ],
)

cpp_unittest(
    name = "utils_test",
    srcs = [
        "UtilsTest.cpp",
    ],
    deps = [
        "//fizz/crypto:utils",
        "//folly/portability:gtest",
    ],
)
