blob: e314d4243e5d7f9a7abe39fdcce55749aa71d7d3 [file] [log] [blame]
licenses(["notice"])
package(default_visibility = ["//tools/build_defs:internal_pkg"])
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_static_framework", "ios_unit_test")
load("//:tink_version.bzl", "TINK_VERSION_LABEL")
load("//tools:common.bzl", "template_rule")
# public libraries
PUBLIC_APIS = [
"TINKAead.h",
"TINKAeadConfig.h",
"TINKAeadFactory.h",
"TINKAeadKeyTemplate.h",
"TINKAllConfig.h",
"TINKBinaryKeysetReader.h",
"TINKConfig.h",
"TINKDeterministicAead.h",
"TINKDeterministicAeadConfig.h",
"TINKDeterministicAeadFactory.h",
"TINKDeterministicAeadKeyTemplate.h",
"TINKHybridConfig.h",
"TINKHybridDecrypt.h",
"TINKHybridDecryptFactory.h",
"TINKHybridEncrypt.h",
"TINKHybridEncryptFactory.h",
"TINKHybridKeyTemplate.h",
"TINKJSONKeysetReader.h",
"TINKKeyTemplate.h",
"TINKKeysetHandle.h",
"TINKKeysetReader.h",
"TINKMac.h",
"TINKMacConfig.h",
"TINKMacFactory.h",
"TINKMacKeyTemplate.h",
"TINKPublicKeySign.h",
"TINKPublicKeySignFactory.h",
"TINKPublicKeyVerify.h",
"TINKPublicKeyVerifyFactory.h",
"TINKRegistryConfig.h",
"TINKSignatureConfig.h",
"TINKSignatureKeyTemplate.h",
"TINKVersion.h",
]
PUBLIC_API_DEPS = [
":aead",
":aead_config",
":aead_factory",
":aead_key_template",
":all_config",
":binary_keyset_reader",
":config",
":deterministic_aead",
":deterministic_aead_config",
":deterministic_aead_factory",
":deterministic_aead_key_template",
":hybrid_config",
":hybrid_decrypt",
":hybrid_decrypt_factory",
":hybrid_encrypt",
":hybrid_encrypt_factory",
":hybrid_key_template",
":json_keyset_reader",
":key_template",
":keyset_handle",
":keyset_reader",
":mac",
":mac_config",
":mac_factory",
":mac_key_template",
":public_key_sign",
":public_key_sign_factory",
":public_key_verify",
":public_key_verify_factory",
":registry_config",
":signature_config",
":signature_key_template",
":version",
"//objc/util:errors",
"//objc/util:strings",
]
objc_library(
name = "objc",
hdrs = PUBLIC_APIS,
visibility = ["//visibility:public"],
deps = PUBLIC_API_DEPS,
)
objc_library(
name = "testonly",
testonly = 1,
hdrs = PUBLIC_APIS + [
"TINKKeysetHandle+Cleartext.h",
],
visibility = ["//visibility:public"],
deps = PUBLIC_API_DEPS + [
":cleartext_keyset_handle",
],
)
ios_static_framework(
name = "Tink_framework",
hdrs = PUBLIC_APIS + [
"TINKKeysetHandle+Cleartext.h",
],
bundle_name = "Tink",
minimum_os_version = "9.0",
deps = [
":cleartext_keyset_handle",
":objc",
],
)
############################
# Core #
############################
objc_library(
name = "all_config",
srcs = ["core/TINKAllConfig.mm"],
hdrs = [
"TINKAllConfig.h",
],
visibility = ["//visibility:public"],
deps = [
":registry_config",
"//cc/config:tink_config",
"//cc/util:errors",
"//objc/util:errors",
],
)
objc_library(
name = "binary_keyset_reader",
srcs = ["core/TINKBinaryKeysetReader.mm"],
hdrs = [
"TINKBinaryKeysetReader.h",
],
visibility = ["//visibility:public"],
deps = [
":keyset_reader",
":tink_cc_pb",
"//cc:binary_keyset_reader",
"//objc/util:errors",
"//objc/util:strings",
"@com_google_absl//absl/strings",
],
)
objc_library(
name = "cleartext_keyset_handle",
srcs = ["core/TINKKeysetHandle+Cleartext.mm"],
hdrs = [
"TINKKeysetHandle+Cleartext.h",
],
deps = [
":keyset_handle",
":keyset_reader",
"//cc:cleartext_keyset_handle",
"//objc/util:errors",
],
)
objc_library(
name = "config",
srcs = ["core/TINKConfig.mm"],
hdrs = [
"TINKConfig.h",
],
visibility = ["//visibility:public"],
deps = [
":registry_config",
"//cc:config",
"//objc/util:errors",
],
)
objc_library(
name = "json_keyset_reader",
srcs = ["core/TINKJSONKeysetReader.mm"],
hdrs = [
"TINKJSONKeysetReader.h",
],
visibility = ["//visibility:public"],
deps = [
":keyset_reader",
":tink_cc_pb",
"//cc:json_keyset_reader",
"//objc/util:errors",
"//objc/util:strings",
"@com_google_absl//absl/strings",
],
)
objc_library(
name = "key_template",
srcs = ["core/TINKKeyTemplate.mm"],
hdrs = [
"TINKKeyTemplate.h",
"core/TINKKeyTemplate_Internal.h",
],
visibility = ["//visibility:public"],
deps = [
":tink_cc_pb",
"//cc/util:status",
"//objc/util:errors",
],
)
objc_library(
name = "keyset_handle",
srcs = ["core/TINKKeysetHandle.mm"],
hdrs = [
"TINKKeysetHandle.h",
"core/TINKKeysetHandle_Internal.h",
],
sdk_frameworks = [
"Security",
],
visibility = ["//visibility:public"],
deps = [
":aead",
":aead_internal",
":key_template",
":keyset_reader",
"//cc:binary_keyset_reader",
"//cc:cleartext_keyset_handle",
"//cc:keyset_handle",
"//cc/util:status",
"//objc/util:errors",
"//objc/util:strings",
"@com_google_absl//absl/strings",
],
)
objc_library(
name = "keyset_reader",
srcs = ["core/TINKKeysetReader.mm"],
hdrs = [
"TINKKeysetReader.h",
"core/TINKKeysetReader_Internal.h",
],
visibility = ["//visibility:public"],
deps = [
"//cc:keyset_reader",
],
)
objc_library(
name = "registry_config",
srcs = ["core/TINKRegistryConfig.mm"],
hdrs = [
"TINKRegistryConfig.h",
"core/TINKRegistryConfig_Internal.h",
],
visibility = ["//visibility:public"],
deps = [
":config_cc_pb",
],
)
template_rule(
name = "version_m",
src = "core/TINKVersion.m.templ",
out = "core/TINKVersion.m",
substitutions = {
"TINK_VERSION_LABEL": "%s" % TINK_VERSION_LABEL,
},
)
objc_library(
name = "version",
srcs = [":version_m"],
hdrs = ["TINKVersion.h"],
visibility = ["//visibility:public"],
)
############################
# Aead #
############################
objc_library(
name = "aead",
hdrs = ["TINKAead.h"],
visibility = ["//visibility:public"],
)
objc_library(
name = "aead_internal",
srcs = ["aead/TINKAeadInternal.mm"],
hdrs = ["aead/TINKAeadInternal.h"],
deps = [
":aead",
"//cc:aead",
"//objc/util:errors",
"//objc/util:strings",
"@com_google_absl//absl/strings",
],
)
objc_library(
name = "aead_config",
srcs = ["aead/TINKAeadConfig.mm"],
hdrs = ["TINKAeadConfig.h"],
visibility = ["//visibility:public"],
deps = [
":registry_config",
"//cc/aead:aead_config",
"//cc/util:errors",
"//objc/util:errors",
"//objc/util:strings",
],
)
objc_library(
name = "aead_factory",
srcs = ["aead/TINKAeadFactory.mm"],
hdrs = ["TINKAeadFactory.h"],
visibility = ["//visibility:public"],
deps = [
":aead",
":aead_internal",
":keyset_handle",
"//cc:keyset_handle",
"//cc/aead:aead_factory",
"//cc/util:status",
"//objc/util:errors",
],
)
objc_library(
name = "aead_key_template",
srcs = ["aead/TINKAeadKeyTemplate.mm"],
hdrs = ["TINKAeadKeyTemplate.h"],
visibility = ["//visibility:public"],
deps = [
":key_template",
":tink_cc_pb",
"//cc/aead:aead_key_templates",
"//cc/util:status",
"//objc/util:errors",
],
)
############################
# Deterministic Aead #
############################
objc_library(
name = "deterministic_aead",
hdrs = ["TINKDeterministicAead.h"],
visibility = ["//visibility:public"],
)
objc_library(
name = "deterministic_aead_internal",
srcs = ["daead/TINKDeterministicAeadInternal.mm"],
hdrs = ["daead/TINKDeterministicAeadInternal.h"],
deps = [
":deterministic_aead",
":keyset_handle",
"//cc:deterministic_aead",
"//objc/util:errors",
"//objc/util:strings",
"@com_google_absl//absl/strings",
],
)
objc_library(
name = "deterministic_aead_config",
srcs = ["daead/TINKDeterministicAeadConfig.mm"],
hdrs = ["TINKDeterministicAeadConfig.h"],
visibility = ["//visibility:public"],
deps = [
":registry_config",
"//cc/daead:deterministic_aead_config",
"//cc/util:errors",
"//objc/util:errors",
"//objc/util:strings",
],
)
objc_library(
name = "deterministic_aead_factory",
srcs = ["daead/TINKDeterministicAeadFactory.mm"],
hdrs = ["TINKDeterministicAeadFactory.h"],
visibility = ["//visibility:public"],
deps = [
":deterministic_aead",
":deterministic_aead_internal",
":keyset_handle",
"//cc:keyset_handle",
"//cc/daead:deterministic_aead_factory",
"//cc/util:status",
"//objc/util:errors",
],
)
objc_library(
name = "deterministic_aead_key_template",
srcs = ["daead/TINKDeterministicAeadKeyTemplate.mm"],
hdrs = ["TINKDeterministicAeadKeyTemplate.h"],
visibility = ["//visibility:public"],
deps = [
":key_template",
":tink_cc_pb",
"//cc/daead:deterministic_aead_key_templates",
"//cc/util:status",
"//objc/util:errors",
],
)
############################
# Hybrid #
############################
objc_library(
name = "hybrid_decrypt",
hdrs = [
"TINKHybridDecrypt.h",
],
visibility = ["//visibility:public"],
)
objc_library(
name = "hybrid_encrypt",
hdrs = [
"TINKHybridEncrypt.h",
],
visibility = ["//visibility:public"],
)
objc_library(
name = "hybrid_decrypt_factory",
srcs = ["hybrid/TINKHybridDecryptFactory.mm"],
hdrs = ["TINKHybridDecryptFactory.h"],
visibility = ["//visibility:public"],
deps = [
":hybrid_decrypt",
":hybrid_decrypt_internal",
":keyset_handle",
"//cc:keyset_handle",
"//cc/hybrid:hybrid_decrypt_factory",
"//cc/util:status",
"//objc/util:errors",
],
)
objc_library(
name = "hybrid_decrypt_internal",
srcs = ["hybrid/TINKHybridDecryptInternal.mm"],
hdrs = ["hybrid/TINKHybridDecryptInternal.h"],
deps = [
":hybrid_decrypt",
"//cc:hybrid_decrypt",
"//objc/util:errors",
"//objc/util:strings",
"@com_google_absl//absl/strings",
],
)
objc_library(
name = "hybrid_encrypt_factory",
srcs = ["hybrid/TINKHybridEncryptFactory.mm"],
hdrs = ["TINKHybridEncryptFactory.h"],
visibility = ["//visibility:public"],
deps = [
":hybrid_encrypt",
":hybrid_encrypt_internal",
":keyset_handle",
"//cc:keyset_handle",
"//cc/hybrid:hybrid_encrypt_factory",
"//cc/util:status",
"//objc/util:errors",
],
)
objc_library(
name = "hybrid_encrypt_internal",
srcs = ["hybrid/TINKHybridEncryptInternal.mm"],
hdrs = ["hybrid/TINKHybridEncryptInternal.h"],
deps = [
":hybrid_encrypt",
"//cc:hybrid_encrypt",
"//objc/util:errors",
"//objc/util:strings",
"@com_google_absl//absl/strings",
],
)
objc_library(
name = "hybrid_config",
srcs = ["hybrid/TINKHybridConfig.mm"],
hdrs = ["TINKHybridConfig.h"],
visibility = ["//visibility:public"],
deps = [
":registry_config",
"//cc/hybrid:hybrid_config",
"//cc/util:errors",
"//objc/util:errors",
"//objc/util:strings",
],
)
objc_library(
name = "hybrid_key_template",
srcs = ["hybrid/TINKHybridKeyTemplate.mm"],
hdrs = ["TINKHybridKeyTemplate.h"],
visibility = ["//visibility:public"],
deps = [
":key_template",
":tink_cc_pb",
"//cc/hybrid:hybrid_key_templates",
"//cc/util:status",
"//objc/util:errors",
],
)
############################
# Mac #
############################
objc_library(
name = "mac",
hdrs = [
"TINKMac.h",
],
visibility = ["//visibility:public"],
)
objc_library(
name = "mac_config",
srcs = ["mac/TINKMacConfig.mm"],
hdrs = ["TINKMacConfig.h"],
visibility = ["//visibility:public"],
deps = [
":registry_config",
"//cc/mac:mac_config",
"//cc/util:errors",
"//objc/util:errors",
"//objc/util:strings",
],
)
objc_library(
name = "mac_factory",
srcs = ["mac/TINKMacFactory.mm"],
hdrs = ["TINKMacFactory.h"],
visibility = ["//visibility:public"],
deps = [
":keyset_handle",
":mac",
":mac_internal",
"//cc:keyset_handle",
"//cc/mac:mac_factory",
"//cc/util:status",
"//objc/util:errors",
],
)
objc_library(
name = "mac_internal",
srcs = ["mac/TINKMacInternal.mm"],
hdrs = ["mac/TINKMacInternal.h"],
deps = [
":mac",
"//cc:mac",
"//objc/util:errors",
"//objc/util:strings",
"@com_google_absl//absl/strings",
],
)
objc_library(
name = "mac_key_template",
srcs = ["mac/TINKMacKeyTemplate.mm"],
hdrs = ["TINKMacKeyTemplate.h"],
visibility = ["//visibility:public"],
deps = [
":key_template",
":tink_cc_pb",
"//cc/mac:mac_key_templates",
"//cc/util:status",
"//objc/util:errors",
],
)
# C++ protocol buffers.
# We need to convert them to cc_library so we can add them as a dependency of objc_library targets.
cc_library(
name = "config_cc_pb",
deps = [
"//proto:config_cc_proto",
],
)
cc_library(
name = "tink_cc_pb",
deps = [
"//proto:tink_cc_proto",
],
)
############################
# Signature #
############################
objc_library(
name = "public_key_sign",
hdrs = [
"TINKPublicKeySign.h",
],
visibility = ["//visibility:public"],
)
objc_library(
name = "public_key_verify",
hdrs = [
"TINKPublicKeyVerify.h",
],
visibility = ["//visibility:public"],
)
objc_library(
name = "signature_config",
srcs = ["signature/TINKSignatureConfig.mm"],
hdrs = ["TINKSignatureConfig.h"],
visibility = ["//visibility:public"],
deps = [
":registry_config",
"//cc/signature:signature_config",
"//cc/util:errors",
"//objc/util:errors",
],
)
objc_library(
name = "signature_key_template",
srcs = ["signature/TINKSignatureKeyTemplate.mm"],
hdrs = ["TINKSignatureKeyTemplate.h"],
visibility = ["//visibility:public"],
deps = [
":key_template",
":tink_cc_pb",
"//cc/signature:signature_key_templates",
"//cc/util:status",
"//objc/util:errors",
],
)
objc_library(
name = "public_key_sign_internal",
srcs = ["signature/TINKPublicKeySignInternal.mm"],
hdrs = ["signature/TINKPublicKeySignInternal.h"],
deps = [
":public_key_sign",
"//cc:public_key_sign",
"//objc/util:errors",
"//objc/util:strings",
"@com_google_absl//absl/strings",
],
)
objc_library(
name = "public_key_verify_internal",
srcs = ["signature/TINKPublicKeyVerifyInternal.mm"],
hdrs = ["signature/TINKPublicKeyVerifyInternal.h"],
deps = [
":public_key_verify",
"//cc:public_key_verify",
"//objc/util:errors",
"//objc/util:strings",
"@com_google_absl//absl/strings",
],
)
objc_library(
name = "public_key_sign_factory",
srcs = ["signature/TINKPublicKeySignFactory.mm"],
hdrs = ["TINKPublicKeySignFactory.h"],
visibility = ["//visibility:public"],
deps = [
":keyset_handle",
":public_key_sign",
":public_key_sign_internal",
"//cc:keyset_handle",
"//cc/signature:public_key_sign_factory",
"//cc/util:status",
"//objc/util:errors",
],
)
objc_library(
name = "public_key_verify_factory",
srcs = ["signature/TINKPublicKeyVerifyFactory.mm"],
hdrs = ["TINKPublicKeyVerifyFactory.h"],
visibility = ["//visibility:public"],
deps = [
":keyset_handle",
":public_key_verify",
":public_key_verify_internal",
"//cc:keyset_handle",
"//cc/signature:public_key_verify_factory",
"//cc/util:status",
"//objc/util:errors",
],
)
############################
# Tests #
############################
ios_unit_test(
name = "TinkTests",
minimum_os_version = "9.0",
deps = [
":UnitTestLib",
],
)
objc_library(
name = "UnitTestLib",
testonly = 1,
srcs = glob(
[
"Tests/UnitTests/**/*.m",
"Tests/UnitTests/**/*.mm",
],
exclude = [
"Tests/UnitTests/core/TINKJSONKeysetReaderTest.mm",
"Tests/UnitTests/core/TINKKeysetHandleTest.mm",
],
),
deps = [
":aead_internal",
":testonly",
"//cc:aead",
"//cc:crypto_format",
"//cc:keyset_handle",
"//cc/aead:aead_config",
"//cc/aead:aead_factory",
"//cc/util:status",
"//cc/util:test_keyset_handle",
"//cc/util:test_util",
"//objc/util:proto_helpers",
"//objc/util:test_helpers",
"//proto:all_objc_proto",
"@com_google_absl//absl/memory",
"@com_google_protobuf//:protobuf_lite",
],
)