Skip to content

Commit

Permalink
Migrate Obj-C GetPrimitive calls to use crypto::tink::ConfigGlobalReg…
Browse files Browse the repository at this point in the history
…istry().

PiperOrigin-RevId: 584658056
Change-Id: I109a3261236b8a7c7851150df0bc6925c5073d76
  • Loading branch information
cindylindeed authored and copybara-github committed Nov 22, 2023
1 parent 6d43ef3 commit 16ed84d
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 8 deletions.
9 changes: 8 additions & 1 deletion Tink/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_static_framework", "ios_unit_test")
load("//:minimum_os.bzl", "IOS_MINIMUM_OS")
load("//:tink_version.bzl", "TINK_VERSION_LABEL")
load("//:template_rule.bzl", "template_rule")
load("//:tink_version.bzl", "TINK_VERSION_LABEL")

licenses(["notice"])

Expand Down Expand Up @@ -328,6 +328,7 @@ objc_library(
":keyset_handle",
"//Tink/util:errors",
"@tink_cc//tink:keyset_handle",
"@tink_cc//tink/config:global_registry",
"@tink_cc//tink/util:status",
],
)
Expand Down Expand Up @@ -394,6 +395,7 @@ objc_library(
":keyset_handle",
"//Tink/util:errors",
"@tink_cc//tink:keyset_handle",
"@tink_cc//tink/config:global_registry",
"@tink_cc//tink/util:status",
],
)
Expand Down Expand Up @@ -443,6 +445,7 @@ objc_library(
":keyset_handle",
"//Tink/util:errors",
"@tink_cc//tink:keyset_handle",
"@tink_cc//tink/config:global_registry",
"@tink_cc//tink/util:status",
],
)
Expand Down Expand Up @@ -471,6 +474,7 @@ objc_library(
":keyset_handle",
"//Tink/util:errors",
"@tink_cc//tink:keyset_handle",
"@tink_cc//tink/config:global_registry",
"@tink_cc//tink/util:status",
],
)
Expand Down Expand Up @@ -552,6 +556,7 @@ objc_library(
"//Tink:mac_internal",
"//Tink/util:errors",
"@tink_cc//tink:keyset_handle",
"@tink_cc//tink/config:global_registry",
"@tink_cc//tink/util:status",
],
)
Expand Down Expand Up @@ -667,6 +672,7 @@ objc_library(
":public_key_sign_internal",
"//Tink/util:errors",
"@tink_cc//tink:keyset_handle",
"@tink_cc//tink/config:global_registry",
"@tink_cc//tink/util:status",
],
)
Expand All @@ -682,6 +688,7 @@ objc_library(
":public_key_verify_internal",
"//Tink/util:errors",
"@tink_cc//tink:keyset_handle",
"@tink_cc//tink/config:global_registry",
"@tink_cc//tink/util:status",
],
)
Expand Down
3 changes: 2 additions & 1 deletion Tink/aead/TINKAeadFactory.mm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#import "Tink/core/TINKKeysetHandle_Internal.h"
#import "Tink/util/TINKErrors.h"

#include "tink/config/global_registry.h"
#include "tink/keyset_handle.h"
#include "tink/util/status.h"

Expand All @@ -34,7 +35,7 @@ @implementation TINKAeadFactory
+ (id<TINKAead>)primitiveWithKeysetHandle:(TINKKeysetHandle *)keysetHandle error:(NSError **)error {
crypto::tink::KeysetHandle *handle = [keysetHandle ccKeysetHandle];

auto st = handle->GetPrimitive<crypto::tink::Aead>();
auto st = handle->GetPrimitive<crypto::tink::Aead>(crypto::tink::ConfigGlobalRegistry());
if (!st.ok()) {
if (error) {
*error = TINKStatusToError(st.status());
Expand Down
4 changes: 3 additions & 1 deletion Tink/daead/TINKDeterministicAeadFactory.mm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#import "Tink/daead/TINKDeterministicAeadInternal.h"
#import "Tink/util/TINKErrors.h"

#include "tink/config/global_registry.h"
#include "tink/keyset_handle.h"
#include "tink/util/status.h"

Expand All @@ -34,7 +35,8 @@ @implementation TINKDeterministicAeadFactory
+ (id<TINKDeterministicAead>)primitiveWithKeysetHandle:(TINKKeysetHandle *)keysetHandle
error:(NSError **)error {
crypto::tink::KeysetHandle *handle = [keysetHandle ccKeysetHandle];
auto st = handle->GetPrimitive<crypto::tink::DeterministicAead>();
auto st =
handle->GetPrimitive<crypto::tink::DeterministicAead>(crypto::tink::ConfigGlobalRegistry());

if (!st.ok()) {
if (error) {
Expand Down
3 changes: 2 additions & 1 deletion Tink/hybrid/TINKHybridDecryptFactory.mm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#import "Tink/hybrid/TINKHybridDecryptInternal.h"
#import "Tink/util/TINKErrors.h"

#include "tink/config/global_registry.h"
#include "tink/keyset_handle.h"
#include "tink/util/status.h"

Expand All @@ -35,7 +36,7 @@ @implementation TINKHybridDecryptFactory
error:(NSError **)error {
crypto::tink::KeysetHandle *handle = [keysetHandle ccKeysetHandle];

auto st = handle->GetPrimitive<crypto::tink::HybridDecrypt>();
auto st = handle->GetPrimitive<crypto::tink::HybridDecrypt>(crypto::tink::ConfigGlobalRegistry());
if (!st.ok()) {
if (error) {
*error = TINKStatusToError(st.status());
Expand Down
3 changes: 2 additions & 1 deletion Tink/hybrid/TINKHybridEncryptFactory.mm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#import "Tink/hybrid/TINKHybridEncryptInternal.h"
#import "Tink/util/TINKErrors.h"

#include "tink/config/global_registry.h"
#include "tink/keyset_handle.h"
#include "tink/util/status.h"

Expand All @@ -35,7 +36,7 @@ @implementation TINKHybridEncryptFactory
error:(NSError **)error {
crypto::tink::KeysetHandle *handle = [keysetHandle ccKeysetHandle];

auto st = handle->GetPrimitive<crypto::tink::HybridEncrypt>();
auto st = handle->GetPrimitive<crypto::tink::HybridEncrypt>(crypto::tink::ConfigGlobalRegistry());
if (!st.ok()) {
if (error) {
*error = TINKStatusToError(st.status());
Expand Down
3 changes: 2 additions & 1 deletion Tink/mac/TINKMacFactory.mm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#import "Tink/mac/TINKMacInternal.h"
#import "Tink/util/TINKErrors.h"

#include "tink/config/global_registry.h"
#include "tink/keyset_handle.h"
#include "tink/util/status.h"

Expand All @@ -34,7 +35,7 @@ @implementation TINKMacFactory
+ (id<TINKMac>)primitiveWithKeysetHandle:(TINKKeysetHandle *)keysetHandle error:(NSError **)error {
crypto::tink::KeysetHandle *handle = [keysetHandle ccKeysetHandle];

auto st = handle->GetPrimitive<crypto::tink::Mac>();
auto st = handle->GetPrimitive<crypto::tink::Mac>(crypto::tink::ConfigGlobalRegistry());
if (!st.ok()) {
if (error) {
*error = TINKStatusToError(st.status());
Expand Down
3 changes: 2 additions & 1 deletion Tink/signature/TINKPublicKeySignFactory.mm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#import "Tink/signature/TINKPublicKeySignInternal.h"
#import "Tink/util/TINKErrors.h"

#include "tink/config/global_registry.h"
#include "tink/keyset_handle.h"
#include "tink/util/status.h"

Expand All @@ -35,7 +36,7 @@ @implementation TINKPublicKeySignFactory
error:(NSError **)error {
crypto::tink::KeysetHandle *handle = [keysetHandle ccKeysetHandle];

auto st = handle->GetPrimitive<crypto::tink::PublicKeySign>();
auto st = handle->GetPrimitive<crypto::tink::PublicKeySign>(crypto::tink::ConfigGlobalRegistry());
if (!st.ok()) {
if (error) {
*error = TINKStatusToError(st.status());
Expand Down
4 changes: 3 additions & 1 deletion Tink/signature/TINKPublicKeyVerifyFactory.mm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#import "Tink/signature/TINKPublicKeyVerifyInternal.h"
#import "Tink/util/TINKErrors.h"

#include "tink/config/global_registry.h"
#include "tink/keyset_handle.h"
#include "tink/util/status.h"

Expand All @@ -35,7 +36,8 @@ @implementation TINKPublicKeyVerifyFactory
error:(NSError **)error {
crypto::tink::KeysetHandle *handle = [keysetHandle ccKeysetHandle];

auto st = handle->GetPrimitive<crypto::tink::PublicKeyVerify>();
auto st =
handle->GetPrimitive<crypto::tink::PublicKeyVerify>(crypto::tink::ConfigGlobalRegistry());
if (!st.ok()) {
if (error) {
*error = TINKStatusToError(st.status());
Expand Down

0 comments on commit 16ed84d

Please sign in to comment.