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

oncall("secure_pipes")

cpp_library(
    name = "aead",
    headers = [
        "Aead.h",
    ],
    exported_deps = [
        "//folly:optional",
        "//folly/io:iobuf",
    ],
)

cpp_library(
    name = "iobuf",
    srcs = [
        "IOBufUtil.cpp",
    ],
    headers = [
        "IOBufUtil.h",
    ],
    exported_deps = [
        "//folly:range",
        "//folly/io:iobuf",
    ],
)

cpp_library(
    name = "cryptoutil",
    headers = [
        "CryptoUtil.h",
    ],
    exported_deps = [
        ":aead",
        ":iobuf",
        "//folly:conv",
        "//folly:memory",
        "//folly:range",
    ],
)

cpp_library(
    name = "aegiscipher",
    srcs = ["AEGISCipher.cpp"],
    headers = [
        "AEGISCipher.h",
    ],
    deps = [
        ":cryptoutil",
        "//fizz:config",
        "//folly/lang:checked_math",
    ] + select({
        "DEFAULT": [
            "fbsource//third-party/libaegis:aegis",
        ],
        # @fb-only: "ovr_config//toolchain/fb:arista": [], 
    }),
    exported_deps = [
        ":aead",
    ],
)
