mirror of
https://github.com/apple/swift-crypto
synced 2026-11-22 04:30:39 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f95b4d033 | ||
|
|
a53a7e8f85 | ||
|
|
8dafe0fdce | ||
|
|
e2dd5a547b | ||
|
|
46072478ca | ||
|
|
c370ad81a1 |
No files matched your search
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSPrivacyTracking</key>
|
||||
<false/>
|
||||
<key>NSPrivacyAccessedAPITypes</key>
|
||||
<array/>
|
||||
<key>NSPrivacyCollectedDataTypes</key>
|
||||
<array/>
|
||||
<key>NSPrivacyTrackingDomains</key>
|
||||
<array/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
+1
-2
@@ -127,7 +127,7 @@ let package = Package(
|
||||
resources: [
|
||||
.copy("PrivacyInfo.xcprivacy"),
|
||||
],
|
||||
swiftSettings: swiftSettings
|
||||
swiftSettings: swiftSettings + [.define("MODULE_IS_CRYPTO")]
|
||||
),
|
||||
.target(
|
||||
name: "_CryptoExtras",
|
||||
@@ -168,7 +168,6 @@ let package = Package(
|
||||
swiftSettings: swiftSettings
|
||||
),
|
||||
.testTarget(name: "_CryptoExtrasTests", dependencies: ["_CryptoExtras"]),
|
||||
.testTarget(name: "CryptoBoringWrapperTests", dependencies: ["CryptoBoringWrapper"]),
|
||||
],
|
||||
cxxLanguageStandard: .cxx11
|
||||
)
|
||||
@@ -1 +0,0 @@
|
||||
../../.PrivacyInfo.xcprivacy
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSPrivacyTracking</key>
|
||||
<false/>
|
||||
<key>NSPrivacyAccessedAPITypes</key>
|
||||
<array/>
|
||||
<key>NSPrivacyCollectedDataTypes</key>
|
||||
<array/>
|
||||
<key>NSPrivacyTrackingDomains</key>
|
||||
<array/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -2960,6 +2960,7 @@
|
||||
#define sk_TRUST_TOKEN_PRETOKEN_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_PRETOKEN_is_sorted)
|
||||
#define sk_TRUST_TOKEN_PRETOKEN_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_PRETOKEN_set_cmp_func)
|
||||
#define sk_TRUST_TOKEN_PRETOKEN_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_PRETOKEN_deep_copy)
|
||||
#define sk_TRUST_TOKEN_PRETOKEN_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_PRETOKEN_delete_if)
|
||||
#define sk_CRYPTO_EX_DATA_FUNCS_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CRYPTO_EX_DATA_FUNCS_call_free_func)
|
||||
#define sk_CRYPTO_EX_DATA_FUNCS_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CRYPTO_EX_DATA_FUNCS_call_copy_func)
|
||||
#define sk_CRYPTO_EX_DATA_FUNCS_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CRYPTO_EX_DATA_FUNCS_call_cmp_func)
|
||||
@@ -2983,6 +2984,7 @@
|
||||
#define sk_CRYPTO_EX_DATA_FUNCS_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CRYPTO_EX_DATA_FUNCS_is_sorted)
|
||||
#define sk_CRYPTO_EX_DATA_FUNCS_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CRYPTO_EX_DATA_FUNCS_set_cmp_func)
|
||||
#define sk_CRYPTO_EX_DATA_FUNCS_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CRYPTO_EX_DATA_FUNCS_deep_copy)
|
||||
#define sk_CRYPTO_EX_DATA_FUNCS_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CRYPTO_EX_DATA_FUNCS_delete_if)
|
||||
#define sk_BIGNUM_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_BIGNUM_call_free_func)
|
||||
#define sk_BIGNUM_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_BIGNUM_call_copy_func)
|
||||
#define sk_BIGNUM_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_BIGNUM_call_cmp_func)
|
||||
@@ -3006,6 +3008,7 @@
|
||||
#define sk_BIGNUM_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_BIGNUM_is_sorted)
|
||||
#define sk_BIGNUM_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_BIGNUM_set_cmp_func)
|
||||
#define sk_BIGNUM_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_BIGNUM_deep_copy)
|
||||
#define sk_BIGNUM_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_BIGNUM_delete_if)
|
||||
#define sk_X509V3_EXT_METHOD_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509V3_EXT_METHOD_call_free_func)
|
||||
#define sk_X509V3_EXT_METHOD_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509V3_EXT_METHOD_call_copy_func)
|
||||
#define sk_X509V3_EXT_METHOD_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509V3_EXT_METHOD_call_cmp_func)
|
||||
@@ -3029,6 +3032,7 @@
|
||||
#define sk_X509V3_EXT_METHOD_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509V3_EXT_METHOD_is_sorted)
|
||||
#define sk_X509V3_EXT_METHOD_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509V3_EXT_METHOD_set_cmp_func)
|
||||
#define sk_X509V3_EXT_METHOD_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509V3_EXT_METHOD_deep_copy)
|
||||
#define sk_X509V3_EXT_METHOD_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509V3_EXT_METHOD_delete_if)
|
||||
#define sk_X509_LOOKUP_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_LOOKUP_call_free_func)
|
||||
#define sk_X509_LOOKUP_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_LOOKUP_call_copy_func)
|
||||
#define sk_X509_LOOKUP_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_LOOKUP_call_cmp_func)
|
||||
@@ -3052,6 +3056,7 @@
|
||||
#define sk_X509_LOOKUP_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_LOOKUP_is_sorted)
|
||||
#define sk_X509_LOOKUP_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_LOOKUP_set_cmp_func)
|
||||
#define sk_X509_LOOKUP_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_LOOKUP_deep_copy)
|
||||
#define sk_X509_LOOKUP_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_LOOKUP_delete_if)
|
||||
#define sk_STACK_OF_X509_NAME_ENTRY_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_STACK_OF_X509_NAME_ENTRY_call_free_func)
|
||||
#define sk_STACK_OF_X509_NAME_ENTRY_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_STACK_OF_X509_NAME_ENTRY_call_copy_func)
|
||||
#define sk_STACK_OF_X509_NAME_ENTRY_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_STACK_OF_X509_NAME_ENTRY_call_cmp_func)
|
||||
@@ -3075,6 +3080,7 @@
|
||||
#define sk_STACK_OF_X509_NAME_ENTRY_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_STACK_OF_X509_NAME_ENTRY_is_sorted)
|
||||
#define sk_STACK_OF_X509_NAME_ENTRY_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_STACK_OF_X509_NAME_ENTRY_set_cmp_func)
|
||||
#define sk_STACK_OF_X509_NAME_ENTRY_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_STACK_OF_X509_NAME_ENTRY_deep_copy)
|
||||
#define sk_STACK_OF_X509_NAME_ENTRY_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_STACK_OF_X509_NAME_ENTRY_delete_if)
|
||||
#define sk_BY_DIR_HASH_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_BY_DIR_HASH_call_free_func)
|
||||
#define sk_BY_DIR_HASH_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_BY_DIR_HASH_call_copy_func)
|
||||
#define sk_BY_DIR_HASH_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_BY_DIR_HASH_call_cmp_func)
|
||||
@@ -3098,6 +3104,7 @@
|
||||
#define sk_BY_DIR_HASH_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_BY_DIR_HASH_is_sorted)
|
||||
#define sk_BY_DIR_HASH_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_BY_DIR_HASH_set_cmp_func)
|
||||
#define sk_BY_DIR_HASH_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_BY_DIR_HASH_deep_copy)
|
||||
#define sk_BY_DIR_HASH_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_BY_DIR_HASH_delete_if)
|
||||
#define sk_BY_DIR_ENTRY_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_BY_DIR_ENTRY_call_free_func)
|
||||
#define sk_BY_DIR_ENTRY_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_BY_DIR_ENTRY_call_copy_func)
|
||||
#define sk_BY_DIR_ENTRY_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_BY_DIR_ENTRY_call_cmp_func)
|
||||
@@ -3121,6 +3128,7 @@
|
||||
#define sk_BY_DIR_ENTRY_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_BY_DIR_ENTRY_is_sorted)
|
||||
#define sk_BY_DIR_ENTRY_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_BY_DIR_ENTRY_set_cmp_func)
|
||||
#define sk_BY_DIR_ENTRY_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_BY_DIR_ENTRY_deep_copy)
|
||||
#define sk_BY_DIR_ENTRY_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_BY_DIR_ENTRY_delete_if)
|
||||
#define sk_X509_POLICY_NODE_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_POLICY_NODE_call_free_func)
|
||||
#define sk_X509_POLICY_NODE_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_POLICY_NODE_call_copy_func)
|
||||
#define sk_X509_POLICY_NODE_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_POLICY_NODE_call_cmp_func)
|
||||
@@ -3144,6 +3152,7 @@
|
||||
#define sk_X509_POLICY_NODE_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_POLICY_NODE_is_sorted)
|
||||
#define sk_X509_POLICY_NODE_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_POLICY_NODE_set_cmp_func)
|
||||
#define sk_X509_POLICY_NODE_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_POLICY_NODE_deep_copy)
|
||||
#define sk_X509_POLICY_NODE_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_POLICY_NODE_delete_if)
|
||||
#define sk_X509_POLICY_LEVEL_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_POLICY_LEVEL_call_free_func)
|
||||
#define sk_X509_POLICY_LEVEL_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_POLICY_LEVEL_call_copy_func)
|
||||
#define sk_X509_POLICY_LEVEL_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_POLICY_LEVEL_call_cmp_func)
|
||||
@@ -3167,6 +3176,7 @@
|
||||
#define sk_X509_POLICY_LEVEL_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_POLICY_LEVEL_is_sorted)
|
||||
#define sk_X509_POLICY_LEVEL_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_POLICY_LEVEL_set_cmp_func)
|
||||
#define sk_X509_POLICY_LEVEL_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_POLICY_LEVEL_deep_copy)
|
||||
#define sk_X509_POLICY_LEVEL_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_POLICY_LEVEL_delete_if)
|
||||
#define sk_X509_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_call_free_func)
|
||||
#define sk_X509_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_call_copy_func)
|
||||
#define sk_X509_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_call_cmp_func)
|
||||
@@ -3190,6 +3200,7 @@
|
||||
#define sk_X509_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_is_sorted)
|
||||
#define sk_X509_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_set_cmp_func)
|
||||
#define sk_X509_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_deep_copy)
|
||||
#define sk_X509_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_delete_if)
|
||||
#define sk_GENERAL_NAME_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_GENERAL_NAME_call_free_func)
|
||||
#define sk_GENERAL_NAME_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_GENERAL_NAME_call_copy_func)
|
||||
#define sk_GENERAL_NAME_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_GENERAL_NAME_call_cmp_func)
|
||||
@@ -3213,6 +3224,7 @@
|
||||
#define sk_GENERAL_NAME_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_GENERAL_NAME_is_sorted)
|
||||
#define sk_GENERAL_NAME_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_GENERAL_NAME_set_cmp_func)
|
||||
#define sk_GENERAL_NAME_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_GENERAL_NAME_deep_copy)
|
||||
#define sk_GENERAL_NAME_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_GENERAL_NAME_delete_if)
|
||||
#define sk_X509_CRL_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_CRL_call_free_func)
|
||||
#define sk_X509_CRL_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_CRL_call_copy_func)
|
||||
#define sk_X509_CRL_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_CRL_call_cmp_func)
|
||||
@@ -3236,6 +3248,7 @@
|
||||
#define sk_X509_CRL_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_CRL_is_sorted)
|
||||
#define sk_X509_CRL_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_CRL_set_cmp_func)
|
||||
#define sk_X509_CRL_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_CRL_deep_copy)
|
||||
#define sk_X509_CRL_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_CRL_delete_if)
|
||||
#define sk_X509_REVOKED_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_REVOKED_call_free_func)
|
||||
#define sk_X509_REVOKED_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_REVOKED_call_copy_func)
|
||||
#define sk_X509_REVOKED_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_REVOKED_call_cmp_func)
|
||||
@@ -3259,6 +3272,7 @@
|
||||
#define sk_X509_REVOKED_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_REVOKED_is_sorted)
|
||||
#define sk_X509_REVOKED_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_REVOKED_set_cmp_func)
|
||||
#define sk_X509_REVOKED_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_REVOKED_deep_copy)
|
||||
#define sk_X509_REVOKED_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_REVOKED_delete_if)
|
||||
#define sk_X509_NAME_ENTRY_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_NAME_ENTRY_call_free_func)
|
||||
#define sk_X509_NAME_ENTRY_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_NAME_ENTRY_call_copy_func)
|
||||
#define sk_X509_NAME_ENTRY_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_NAME_ENTRY_call_cmp_func)
|
||||
@@ -3282,6 +3296,7 @@
|
||||
#define sk_X509_NAME_ENTRY_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_NAME_ENTRY_is_sorted)
|
||||
#define sk_X509_NAME_ENTRY_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_NAME_ENTRY_set_cmp_func)
|
||||
#define sk_X509_NAME_ENTRY_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_NAME_ENTRY_deep_copy)
|
||||
#define sk_X509_NAME_ENTRY_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_NAME_ENTRY_delete_if)
|
||||
#define sk_X509_NAME_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_NAME_call_free_func)
|
||||
#define sk_X509_NAME_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_NAME_call_copy_func)
|
||||
#define sk_X509_NAME_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_NAME_call_cmp_func)
|
||||
@@ -3305,6 +3320,7 @@
|
||||
#define sk_X509_NAME_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_NAME_is_sorted)
|
||||
#define sk_X509_NAME_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_NAME_set_cmp_func)
|
||||
#define sk_X509_NAME_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_NAME_deep_copy)
|
||||
#define sk_X509_NAME_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_NAME_delete_if)
|
||||
#define sk_X509_EXTENSION_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_EXTENSION_call_free_func)
|
||||
#define sk_X509_EXTENSION_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_EXTENSION_call_copy_func)
|
||||
#define sk_X509_EXTENSION_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_EXTENSION_call_cmp_func)
|
||||
@@ -3328,6 +3344,7 @@
|
||||
#define sk_X509_EXTENSION_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_EXTENSION_is_sorted)
|
||||
#define sk_X509_EXTENSION_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_EXTENSION_set_cmp_func)
|
||||
#define sk_X509_EXTENSION_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_EXTENSION_deep_copy)
|
||||
#define sk_X509_EXTENSION_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_EXTENSION_delete_if)
|
||||
#define sk_GENERAL_SUBTREE_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_GENERAL_SUBTREE_call_free_func)
|
||||
#define sk_GENERAL_SUBTREE_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_GENERAL_SUBTREE_call_copy_func)
|
||||
#define sk_GENERAL_SUBTREE_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_GENERAL_SUBTREE_call_cmp_func)
|
||||
@@ -3351,6 +3368,7 @@
|
||||
#define sk_GENERAL_SUBTREE_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_GENERAL_SUBTREE_is_sorted)
|
||||
#define sk_GENERAL_SUBTREE_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_GENERAL_SUBTREE_set_cmp_func)
|
||||
#define sk_GENERAL_SUBTREE_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_GENERAL_SUBTREE_deep_copy)
|
||||
#define sk_GENERAL_SUBTREE_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_GENERAL_SUBTREE_delete_if)
|
||||
#define sk_ACCESS_DESCRIPTION_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ACCESS_DESCRIPTION_call_free_func)
|
||||
#define sk_ACCESS_DESCRIPTION_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ACCESS_DESCRIPTION_call_copy_func)
|
||||
#define sk_ACCESS_DESCRIPTION_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ACCESS_DESCRIPTION_call_cmp_func)
|
||||
@@ -3374,6 +3392,7 @@
|
||||
#define sk_ACCESS_DESCRIPTION_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ACCESS_DESCRIPTION_is_sorted)
|
||||
#define sk_ACCESS_DESCRIPTION_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ACCESS_DESCRIPTION_set_cmp_func)
|
||||
#define sk_ACCESS_DESCRIPTION_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ACCESS_DESCRIPTION_deep_copy)
|
||||
#define sk_ACCESS_DESCRIPTION_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ACCESS_DESCRIPTION_delete_if)
|
||||
#define sk_DIST_POINT_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_DIST_POINT_call_free_func)
|
||||
#define sk_DIST_POINT_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_DIST_POINT_call_copy_func)
|
||||
#define sk_DIST_POINT_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_DIST_POINT_call_cmp_func)
|
||||
@@ -3397,6 +3416,7 @@
|
||||
#define sk_DIST_POINT_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_DIST_POINT_is_sorted)
|
||||
#define sk_DIST_POINT_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_DIST_POINT_set_cmp_func)
|
||||
#define sk_DIST_POINT_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_DIST_POINT_deep_copy)
|
||||
#define sk_DIST_POINT_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_DIST_POINT_delete_if)
|
||||
#define sk_POLICYQUALINFO_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_POLICYQUALINFO_call_free_func)
|
||||
#define sk_POLICYQUALINFO_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_POLICYQUALINFO_call_copy_func)
|
||||
#define sk_POLICYQUALINFO_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_POLICYQUALINFO_call_cmp_func)
|
||||
@@ -3420,6 +3440,7 @@
|
||||
#define sk_POLICYQUALINFO_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_POLICYQUALINFO_is_sorted)
|
||||
#define sk_POLICYQUALINFO_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_POLICYQUALINFO_set_cmp_func)
|
||||
#define sk_POLICYQUALINFO_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_POLICYQUALINFO_deep_copy)
|
||||
#define sk_POLICYQUALINFO_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_POLICYQUALINFO_delete_if)
|
||||
#define sk_POLICYINFO_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_POLICYINFO_call_free_func)
|
||||
#define sk_POLICYINFO_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_POLICYINFO_call_copy_func)
|
||||
#define sk_POLICYINFO_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_POLICYINFO_call_cmp_func)
|
||||
@@ -3443,6 +3464,7 @@
|
||||
#define sk_POLICYINFO_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_POLICYINFO_is_sorted)
|
||||
#define sk_POLICYINFO_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_POLICYINFO_set_cmp_func)
|
||||
#define sk_POLICYINFO_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_POLICYINFO_deep_copy)
|
||||
#define sk_POLICYINFO_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_POLICYINFO_delete_if)
|
||||
#define sk_POLICY_MAPPING_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_POLICY_MAPPING_call_free_func)
|
||||
#define sk_POLICY_MAPPING_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_POLICY_MAPPING_call_copy_func)
|
||||
#define sk_POLICY_MAPPING_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_POLICY_MAPPING_call_cmp_func)
|
||||
@@ -3466,6 +3488,7 @@
|
||||
#define sk_POLICY_MAPPING_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_POLICY_MAPPING_is_sorted)
|
||||
#define sk_POLICY_MAPPING_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_POLICY_MAPPING_set_cmp_func)
|
||||
#define sk_POLICY_MAPPING_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_POLICY_MAPPING_deep_copy)
|
||||
#define sk_POLICY_MAPPING_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_POLICY_MAPPING_delete_if)
|
||||
#define sk_X509_ALGOR_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_ALGOR_call_free_func)
|
||||
#define sk_X509_ALGOR_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_ALGOR_call_copy_func)
|
||||
#define sk_X509_ALGOR_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_ALGOR_call_cmp_func)
|
||||
@@ -3489,6 +3512,7 @@
|
||||
#define sk_X509_ALGOR_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_ALGOR_is_sorted)
|
||||
#define sk_X509_ALGOR_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_ALGOR_set_cmp_func)
|
||||
#define sk_X509_ALGOR_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_ALGOR_deep_copy)
|
||||
#define sk_X509_ALGOR_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_ALGOR_delete_if)
|
||||
#define sk_X509_ATTRIBUTE_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_ATTRIBUTE_call_free_func)
|
||||
#define sk_X509_ATTRIBUTE_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_ATTRIBUTE_call_copy_func)
|
||||
#define sk_X509_ATTRIBUTE_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_ATTRIBUTE_call_cmp_func)
|
||||
@@ -3512,6 +3536,7 @@
|
||||
#define sk_X509_ATTRIBUTE_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_ATTRIBUTE_is_sorted)
|
||||
#define sk_X509_ATTRIBUTE_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_ATTRIBUTE_set_cmp_func)
|
||||
#define sk_X509_ATTRIBUTE_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_ATTRIBUTE_deep_copy)
|
||||
#define sk_X509_ATTRIBUTE_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_ATTRIBUTE_delete_if)
|
||||
#define sk_X509_OBJECT_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_OBJECT_call_free_func)
|
||||
#define sk_X509_OBJECT_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_OBJECT_call_copy_func)
|
||||
#define sk_X509_OBJECT_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_OBJECT_call_cmp_func)
|
||||
@@ -3535,6 +3560,7 @@
|
||||
#define sk_X509_OBJECT_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_OBJECT_is_sorted)
|
||||
#define sk_X509_OBJECT_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_OBJECT_set_cmp_func)
|
||||
#define sk_X509_OBJECT_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_OBJECT_deep_copy)
|
||||
#define sk_X509_OBJECT_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_OBJECT_delete_if)
|
||||
#define sk_X509_INFO_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_INFO_call_free_func)
|
||||
#define sk_X509_INFO_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_INFO_call_copy_func)
|
||||
#define sk_X509_INFO_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_INFO_call_cmp_func)
|
||||
@@ -3558,6 +3584,7 @@
|
||||
#define sk_X509_INFO_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_INFO_is_sorted)
|
||||
#define sk_X509_INFO_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_INFO_set_cmp_func)
|
||||
#define sk_X509_INFO_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_INFO_deep_copy)
|
||||
#define sk_X509_INFO_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_X509_INFO_delete_if)
|
||||
#define sk_CRYPTO_BUFFER_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CRYPTO_BUFFER_call_free_func)
|
||||
#define sk_CRYPTO_BUFFER_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CRYPTO_BUFFER_call_copy_func)
|
||||
#define sk_CRYPTO_BUFFER_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CRYPTO_BUFFER_call_cmp_func)
|
||||
@@ -3581,6 +3608,7 @@
|
||||
#define sk_CRYPTO_BUFFER_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CRYPTO_BUFFER_is_sorted)
|
||||
#define sk_CRYPTO_BUFFER_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CRYPTO_BUFFER_set_cmp_func)
|
||||
#define sk_CRYPTO_BUFFER_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CRYPTO_BUFFER_deep_copy)
|
||||
#define sk_CRYPTO_BUFFER_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CRYPTO_BUFFER_delete_if)
|
||||
#define sk_ASN1_INTEGER_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_INTEGER_call_free_func)
|
||||
#define sk_ASN1_INTEGER_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_INTEGER_call_copy_func)
|
||||
#define sk_ASN1_INTEGER_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_INTEGER_call_cmp_func)
|
||||
@@ -3604,6 +3632,7 @@
|
||||
#define sk_ASN1_INTEGER_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_INTEGER_is_sorted)
|
||||
#define sk_ASN1_INTEGER_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_INTEGER_set_cmp_func)
|
||||
#define sk_ASN1_INTEGER_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_INTEGER_deep_copy)
|
||||
#define sk_ASN1_INTEGER_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_INTEGER_delete_if)
|
||||
#define sk_ASN1_OBJECT_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_OBJECT_call_free_func)
|
||||
#define sk_ASN1_OBJECT_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_OBJECT_call_copy_func)
|
||||
#define sk_ASN1_OBJECT_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_OBJECT_call_cmp_func)
|
||||
@@ -3627,6 +3656,7 @@
|
||||
#define sk_ASN1_OBJECT_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_OBJECT_is_sorted)
|
||||
#define sk_ASN1_OBJECT_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_OBJECT_set_cmp_func)
|
||||
#define sk_ASN1_OBJECT_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_OBJECT_deep_copy)
|
||||
#define sk_ASN1_OBJECT_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_OBJECT_delete_if)
|
||||
#define sk_ASN1_TYPE_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_TYPE_call_free_func)
|
||||
#define sk_ASN1_TYPE_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_TYPE_call_copy_func)
|
||||
#define sk_ASN1_TYPE_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_TYPE_call_cmp_func)
|
||||
@@ -3650,6 +3680,7 @@
|
||||
#define sk_ASN1_TYPE_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_TYPE_is_sorted)
|
||||
#define sk_ASN1_TYPE_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_TYPE_set_cmp_func)
|
||||
#define sk_ASN1_TYPE_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_TYPE_deep_copy)
|
||||
#define sk_ASN1_TYPE_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_TYPE_delete_if)
|
||||
#define sk_BIO_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_BIO_call_free_func)
|
||||
#define sk_BIO_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_BIO_call_copy_func)
|
||||
#define sk_BIO_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_BIO_call_cmp_func)
|
||||
@@ -3673,6 +3704,7 @@
|
||||
#define sk_BIO_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_BIO_is_sorted)
|
||||
#define sk_BIO_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_BIO_set_cmp_func)
|
||||
#define sk_BIO_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_BIO_deep_copy)
|
||||
#define sk_BIO_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_BIO_delete_if)
|
||||
#define sk_CONF_VALUE_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CONF_VALUE_call_free_func)
|
||||
#define sk_CONF_VALUE_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CONF_VALUE_call_copy_func)
|
||||
#define sk_CONF_VALUE_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CONF_VALUE_call_cmp_func)
|
||||
@@ -3696,6 +3728,7 @@
|
||||
#define sk_CONF_VALUE_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CONF_VALUE_is_sorted)
|
||||
#define sk_CONF_VALUE_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CONF_VALUE_set_cmp_func)
|
||||
#define sk_CONF_VALUE_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CONF_VALUE_deep_copy)
|
||||
#define sk_CONF_VALUE_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CONF_VALUE_delete_if)
|
||||
#define sk_void_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_void_call_free_func)
|
||||
#define sk_void_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_void_call_copy_func)
|
||||
#define sk_void_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_void_call_cmp_func)
|
||||
@@ -3719,6 +3752,7 @@
|
||||
#define sk_void_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_void_is_sorted)
|
||||
#define sk_void_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_void_set_cmp_func)
|
||||
#define sk_void_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_void_deep_copy)
|
||||
#define sk_void_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_void_delete_if)
|
||||
#define sk_OPENSSL_STRING_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_OPENSSL_STRING_call_free_func)
|
||||
#define sk_OPENSSL_STRING_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_OPENSSL_STRING_call_copy_func)
|
||||
#define sk_OPENSSL_STRING_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_OPENSSL_STRING_call_cmp_func)
|
||||
@@ -3742,6 +3776,7 @@
|
||||
#define sk_OPENSSL_STRING_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_OPENSSL_STRING_is_sorted)
|
||||
#define sk_OPENSSL_STRING_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_OPENSSL_STRING_set_cmp_func)
|
||||
#define sk_OPENSSL_STRING_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_OPENSSL_STRING_deep_copy)
|
||||
#define sk_OPENSSL_STRING_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_OPENSSL_STRING_delete_if)
|
||||
#define sk_TRUST_TOKEN_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_call_free_func)
|
||||
#define sk_TRUST_TOKEN_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_call_copy_func)
|
||||
#define sk_TRUST_TOKEN_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_call_cmp_func)
|
||||
@@ -3765,6 +3800,7 @@
|
||||
#define sk_TRUST_TOKEN_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_is_sorted)
|
||||
#define sk_TRUST_TOKEN_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_set_cmp_func)
|
||||
#define sk_TRUST_TOKEN_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_deep_copy)
|
||||
#define sk_TRUST_TOKEN_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_delete_if)
|
||||
#define sk_ASN1_VALUE_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_VALUE_call_free_func)
|
||||
#define sk_ASN1_VALUE_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_VALUE_call_copy_func)
|
||||
#define sk_ASN1_VALUE_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_VALUE_call_cmp_func)
|
||||
@@ -3788,6 +3824,7 @@
|
||||
#define sk_ASN1_VALUE_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_VALUE_is_sorted)
|
||||
#define sk_ASN1_VALUE_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_VALUE_set_cmp_func)
|
||||
#define sk_ASN1_VALUE_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_VALUE_deep_copy)
|
||||
#define sk_ASN1_VALUE_delete_if BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_VALUE_delete_if)
|
||||
#define lh_ASN1_STRING_TABLE_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, lh_ASN1_STRING_TABLE_call_cmp_func)
|
||||
#define lh_ASN1_STRING_TABLE_call_hash_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, lh_ASN1_STRING_TABLE_call_hash_func)
|
||||
#define lh_ASN1_STRING_TABLE_new BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, lh_ASN1_STRING_TABLE_new)
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../../.PrivacyInfo.xcprivacy
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSPrivacyTracking</key>
|
||||
<false/>
|
||||
<key>NSPrivacyAccessedAPITypes</key>
|
||||
<array/>
|
||||
<key>NSPrivacyCollectedDataTypes</key>
|
||||
<array/>
|
||||
<key>NSPrivacyTrackingDomains</key>
|
||||
<array/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
@_exported import CryptoKit
|
||||
#else
|
||||
import CCryptoBoringSSL
|
||||
import CryptoBoringWrapper
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
@_implementationOnly import CryptoBoringWrapper
|
||||
import Foundation
|
||||
|
||||
enum OpenSSLAESGCMImpl {
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
@_exported import CryptoKit
|
||||
#else
|
||||
import CCryptoBoringSSL
|
||||
import CCryptoBoringSSLShims
|
||||
import CryptoBoringWrapper
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
@_implementationOnly import CCryptoBoringSSLShims
|
||||
@_implementationOnly import CryptoBoringWrapper
|
||||
import Foundation
|
||||
|
||||
extension BoringSSLAEAD {
|
||||
|
||||
@@ -89,6 +89,8 @@ add_library(Crypto
|
||||
"Util/BoringSSL/CryptoKitErrors_boring.swift"
|
||||
"Util/BoringSSL/RNG_boring.swift"
|
||||
"Util/BoringSSL/SafeCompare_boring.swift"
|
||||
"Util/BoringSSL/Shared/ArbitraryPrecisionInteger_boring.swift"
|
||||
"Util/BoringSSL/Shared/FiniteFieldArithmeticContext_boring.swift"
|
||||
"Util/BoringSSL/Zeroization_boring.swift"
|
||||
"Util/PrettyBytes.swift"
|
||||
"Util/SafeCompare.swift"
|
||||
|
||||
@@ -14,49 +14,133 @@
|
||||
#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
@_exported import CryptoKit
|
||||
#else
|
||||
import CCryptoBoringSSL
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
|
||||
protocol HashFunctionImplementationDetails: HashFunction where Digest: DigestPrivate {}
|
||||
|
||||
protocol BoringSSLBackedHashFunction: HashFunctionImplementationDetails {
|
||||
static var digestType: DigestContext.DigestType { get }
|
||||
associatedtype Context
|
||||
static var digestSize: Int { get }
|
||||
static func initialize() -> Context?
|
||||
static func update(_ context: inout Context, data: UnsafeRawBufferPointer) -> Bool
|
||||
static func finalize(_ context: inout Context, digest: UnsafeMutableRawBufferPointer) -> Bool
|
||||
}
|
||||
|
||||
extension Insecure.MD5: BoringSSLBackedHashFunction {
|
||||
static var digestType: DigestContext.DigestType {
|
||||
.md5
|
||||
static var digestSize: Int {
|
||||
Int(MD5_DIGEST_LENGTH)
|
||||
}
|
||||
|
||||
static func initialize() -> MD5_CTX? {
|
||||
var context = MD5_CTX()
|
||||
guard CCryptoBoringSSL_MD5_Init(&context) == 1 else {
|
||||
return nil
|
||||
}
|
||||
return context
|
||||
}
|
||||
|
||||
static func update(_ context: inout MD5_CTX, data: UnsafeRawBufferPointer) -> Bool {
|
||||
CCryptoBoringSSL_MD5_Update(&context, data.baseAddress, data.count) == 1
|
||||
}
|
||||
|
||||
static func finalize(_ context: inout MD5_CTX, digest: UnsafeMutableRawBufferPointer) -> Bool {
|
||||
CCryptoBoringSSL_MD5_Final(digest.baseAddress, &context) == 1
|
||||
}
|
||||
}
|
||||
|
||||
extension Insecure.SHA1: BoringSSLBackedHashFunction {
|
||||
static var digestType: DigestContext.DigestType {
|
||||
.sha1
|
||||
static var digestSize: Int {
|
||||
Int(SHA_DIGEST_LENGTH)
|
||||
}
|
||||
|
||||
static func initialize() -> SHA_CTX? {
|
||||
var context = SHA_CTX()
|
||||
guard CCryptoBoringSSL_SHA1_Init(&context) == 1 else {
|
||||
return nil
|
||||
}
|
||||
return context
|
||||
}
|
||||
|
||||
static func update(_ context: inout SHA_CTX, data: UnsafeRawBufferPointer) -> Bool {
|
||||
CCryptoBoringSSL_SHA1_Update(&context, data.baseAddress, data.count) == 1
|
||||
}
|
||||
|
||||
static func finalize(_ context: inout SHA_CTX, digest: UnsafeMutableRawBufferPointer) -> Bool {
|
||||
CCryptoBoringSSL_SHA1_Final(digest.baseAddress, &context) == 1
|
||||
}
|
||||
}
|
||||
|
||||
extension SHA256: BoringSSLBackedHashFunction {
|
||||
static var digestType: DigestContext.DigestType {
|
||||
.sha256
|
||||
static var digestSize: Int {
|
||||
Int(SHA256_DIGEST_LENGTH)
|
||||
}
|
||||
|
||||
static func initialize() -> SHA256_CTX? {
|
||||
var context = SHA256_CTX()
|
||||
guard CCryptoBoringSSL_SHA256_Init(&context) == 1 else {
|
||||
return nil
|
||||
}
|
||||
return context
|
||||
}
|
||||
|
||||
static func update(_ context: inout SHA256_CTX, data: UnsafeRawBufferPointer) -> Bool {
|
||||
CCryptoBoringSSL_SHA256_Update(&context, data.baseAddress, data.count) == 1
|
||||
}
|
||||
|
||||
static func finalize(_ context: inout SHA256_CTX, digest: UnsafeMutableRawBufferPointer) -> Bool {
|
||||
CCryptoBoringSSL_SHA256_Final(digest.baseAddress, &context) == 1
|
||||
}
|
||||
}
|
||||
|
||||
extension SHA384: BoringSSLBackedHashFunction {
|
||||
static var digestType: DigestContext.DigestType {
|
||||
.sha384
|
||||
static var digestSize: Int {
|
||||
Int(SHA384_DIGEST_LENGTH)
|
||||
}
|
||||
|
||||
static func initialize() -> SHA512_CTX? {
|
||||
var context = SHA512_CTX()
|
||||
guard CCryptoBoringSSL_SHA384_Init(&context) == 1 else {
|
||||
return nil
|
||||
}
|
||||
return context
|
||||
}
|
||||
|
||||
static func update(_ context: inout SHA512_CTX, data: UnsafeRawBufferPointer) -> Bool {
|
||||
CCryptoBoringSSL_SHA384_Update(&context, data.baseAddress, data.count) == 1
|
||||
}
|
||||
|
||||
static func finalize(_ context: inout SHA512_CTX, digest: UnsafeMutableRawBufferPointer) -> Bool {
|
||||
CCryptoBoringSSL_SHA384_Final(digest.baseAddress, &context) == 1
|
||||
}
|
||||
}
|
||||
|
||||
extension SHA512: BoringSSLBackedHashFunction {
|
||||
static var digestType: DigestContext.DigestType {
|
||||
.sha512
|
||||
static var digestSize: Int {
|
||||
Int(SHA512_DIGEST_LENGTH)
|
||||
}
|
||||
|
||||
static func initialize() -> SHA512_CTX? {
|
||||
var context = SHA512_CTX()
|
||||
guard CCryptoBoringSSL_SHA512_Init(&context) == 1 else {
|
||||
return nil
|
||||
}
|
||||
return context
|
||||
}
|
||||
|
||||
static func update(_ context: inout SHA512_CTX, data: UnsafeRawBufferPointer) -> Bool {
|
||||
CCryptoBoringSSL_SHA512_Update(&context, data.baseAddress, data.count) == 1
|
||||
}
|
||||
|
||||
static func finalize(_ context: inout SHA512_CTX, digest: UnsafeMutableRawBufferPointer) -> Bool {
|
||||
CCryptoBoringSSL_SHA512_Final(digest.baseAddress, &context) == 1
|
||||
}
|
||||
}
|
||||
|
||||
struct OpenSSLDigestImpl<H: BoringSSLBackedHashFunction> {
|
||||
private var context: DigestContext
|
||||
private var context: DigestContext<H>
|
||||
|
||||
init() {
|
||||
self.context = DigestContext(digest: H.digestType)
|
||||
self.context = DigestContext()
|
||||
}
|
||||
|
||||
internal mutating func update(data: UnsafeRawBufferPointer) {
|
||||
@@ -67,81 +151,49 @@ struct OpenSSLDigestImpl<H: BoringSSLBackedHashFunction> {
|
||||
}
|
||||
|
||||
internal func finalize() -> H.Digest {
|
||||
// To have a non-destructive finalize operation we must allocate.
|
||||
let copyContext = DigestContext(copying: self.context)
|
||||
let digestBytes = copyContext.finalize()
|
||||
return digestBytes.withUnsafeBytes {
|
||||
// We force unwrap here because if the digest size is wrong it's an internal error.
|
||||
H.Digest(bufferPointer: $0)!
|
||||
}
|
||||
self.context.finalize()
|
||||
}
|
||||
}
|
||||
|
||||
class DigestContext {
|
||||
private var contextPointer: UnsafeMutablePointer<EVP_MD_CTX>
|
||||
fileprivate final class DigestContext<H: BoringSSLBackedHashFunction> {
|
||||
private var context: H.Context
|
||||
|
||||
init(digest: DigestType) {
|
||||
// We force unwrap because we cannot recover from allocation failure.
|
||||
self.contextPointer = CCryptoBoringSSL_EVP_MD_CTX_new()!
|
||||
guard CCryptoBoringSSL_EVP_DigestInit(self.contextPointer, digest.dispatchTable) != 0 else {
|
||||
// We can't do much but crash here.
|
||||
fatalError("Unable to initialize digest state: \(CCryptoBoringSSL_ERR_get_error())")
|
||||
init() {
|
||||
guard let contex = H.initialize() else {
|
||||
preconditionFailure("Unable to initialize digest state")
|
||||
}
|
||||
self.context = contex
|
||||
}
|
||||
|
||||
init(copying original: DigestContext) {
|
||||
// We force unwrap because we cannot recover from allocation failure.
|
||||
self.contextPointer = CCryptoBoringSSL_EVP_MD_CTX_new()!
|
||||
guard CCryptoBoringSSL_EVP_MD_CTX_copy(self.contextPointer, original.contextPointer) != 0 else {
|
||||
// We can't do much but crash here.
|
||||
fatalError("Unable to copy digest state: \(CCryptoBoringSSL_ERR_get_error())")
|
||||
}
|
||||
self.context = original.context
|
||||
}
|
||||
|
||||
func update(data: UnsafeRawBufferPointer) {
|
||||
guard let baseAddress = data.baseAddress else {
|
||||
return
|
||||
guard H.update(&self.context, data: data) else {
|
||||
preconditionFailure("Unable to update digest state")
|
||||
}
|
||||
|
||||
CCryptoBoringSSL_EVP_DigestUpdate(self.contextPointer, baseAddress, data.count)
|
||||
}
|
||||
|
||||
// This finalize function is _destructive_: do not call it if you want to reuse the object!
|
||||
func finalize() -> [UInt8] {
|
||||
let digestSize = CCryptoBoringSSL_EVP_MD_size(self.contextPointer.pointee.digest)
|
||||
var digestBytes = Array(repeating: UInt8(0), count: digestSize)
|
||||
var count = UInt32(digestSize)
|
||||
|
||||
digestBytes.withUnsafeMutableBufferPointer { digestPointer in
|
||||
assert(digestPointer.count == count)
|
||||
CCryptoBoringSSL_EVP_DigestFinal(self.contextPointer, digestPointer.baseAddress, &count)
|
||||
func finalize() -> H.Digest {
|
||||
var copyContext = self.context
|
||||
defer {
|
||||
withUnsafeMutablePointer(to: ©Context) { $0.zeroize() }
|
||||
}
|
||||
return withUnsafeTemporaryAllocation(byteCount: H.digestSize, alignment: 1) { digestPointer in
|
||||
defer {
|
||||
digestPointer.zeroize()
|
||||
}
|
||||
guard H.finalize(©Context, digest: digestPointer) else {
|
||||
preconditionFailure("Unable to finalize digest state")
|
||||
}
|
||||
// We force unwrap here because if the digest size is wrong it's an internal error.
|
||||
return H.Digest(bufferPointer: UnsafeRawBufferPointer(digestPointer))!
|
||||
}
|
||||
|
||||
return digestBytes
|
||||
}
|
||||
|
||||
deinit {
|
||||
CCryptoBoringSSL_EVP_MD_CTX_free(self.contextPointer)
|
||||
}
|
||||
}
|
||||
|
||||
extension DigestContext {
|
||||
struct DigestType {
|
||||
var dispatchTable: OpaquePointer
|
||||
|
||||
private init(_ dispatchTable: OpaquePointer) {
|
||||
self.dispatchTable = dispatchTable
|
||||
}
|
||||
|
||||
static let md5 = DigestType(CCryptoBoringSSL_EVP_md5())
|
||||
|
||||
static let sha1 = DigestType(CCryptoBoringSSL_EVP_sha1())
|
||||
|
||||
static let sha256 = DigestType(CCryptoBoringSSL_EVP_sha256())
|
||||
|
||||
static let sha384 = DigestType(CCryptoBoringSSL_EVP_sha384())
|
||||
|
||||
static let sha512 = DigestType(CCryptoBoringSSL_EVP_sha512())
|
||||
withUnsafeMutablePointer(to: &self.context) { $0.zeroize() }
|
||||
}
|
||||
}
|
||||
#endif // CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
@@ -14,7 +14,7 @@
|
||||
#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
@_exported import CryptoKit
|
||||
#else
|
||||
import CCryptoBoringSSL
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
|
||||
extension P256.KeyAgreement.PrivateKey {
|
||||
internal func openSSLSharedSecretFromKeyAgreement(with publicKeyShare: P256.KeyAgreement.PublicKey) throws -> SharedSecret {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
@_exported import CryptoKit
|
||||
#else
|
||||
import CCryptoBoringSSL
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
import Foundation
|
||||
|
||||
enum BoringSSLAESWRAPImpl {
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
@_exported import CryptoKit
|
||||
#else
|
||||
import CCryptoBoringSSL
|
||||
import CCryptoBoringSSLShims
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
@_implementationOnly import CCryptoBoringSSLShims
|
||||
import Foundation
|
||||
|
||||
// For signing and verifying, we use BoringSSL's Ed25519, not the X25519 stuff.
|
||||
|
||||
@@ -14,8 +14,7 @@
|
||||
#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
@_exported import CryptoKit
|
||||
#else
|
||||
import CCryptoBoringSSL
|
||||
import CryptoBoringWrapper
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
|
||||
/// A wrapper around BoringSSL's EC_POINT with some lifetime management.
|
||||
@usableFromInline
|
||||
|
||||
@@ -14,8 +14,7 @@
|
||||
#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
@_exported import CryptoKit
|
||||
#else
|
||||
import CCryptoBoringSSL
|
||||
import CryptoBoringWrapper
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
|
||||
/// A wrapper around BoringSSL's EC_GROUP object that handles reference counting and
|
||||
/// liveness.
|
||||
|
||||
@@ -14,9 +14,8 @@
|
||||
#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
@_exported import CryptoKit
|
||||
#else
|
||||
import CCryptoBoringSSL
|
||||
import CCryptoBoringSSLShims
|
||||
import CryptoBoringWrapper
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
@_implementationOnly import CCryptoBoringSSLShims
|
||||
import Foundation
|
||||
|
||||
@usableFromInline
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
@_exported import CryptoKit
|
||||
#else
|
||||
import CCryptoBoringSSL
|
||||
import CCryptoBoringSSLShims
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
@_implementationOnly import CCryptoBoringSSLShims
|
||||
import Foundation
|
||||
|
||||
extension Curve25519.KeyAgreement {
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../../.PrivacyInfo.xcprivacy
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSPrivacyTracking</key>
|
||||
<false/>
|
||||
<key>NSPrivacyAccessedAPITypes</key>
|
||||
<array/>
|
||||
<key>NSPrivacyCollectedDataTypes</key>
|
||||
<array/>
|
||||
<key>NSPrivacyTrackingDomains</key>
|
||||
<array/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -14,9 +14,8 @@
|
||||
#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
@_exported import CryptoKit
|
||||
#else
|
||||
import CCryptoBoringSSL
|
||||
import CCryptoBoringSSLShims
|
||||
import CryptoBoringWrapper
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
@_implementationOnly import CCryptoBoringSSLShims
|
||||
import Foundation
|
||||
|
||||
/// A wrapper around BoringSSL's ECDSA_SIG with some lifetime management.
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
@_exported import CryptoKit
|
||||
#else
|
||||
import CCryptoBoringSSL
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
import Foundation
|
||||
|
||||
extension Data {
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
@_exported import CryptoKit
|
||||
#else
|
||||
import CCryptoBoringSSL
|
||||
import CCryptoBoringSSLShims
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
@_implementationOnly import CCryptoBoringSSLShims
|
||||
import Foundation
|
||||
|
||||
extension Curve25519.Signing.PublicKey {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
@_exported import CryptoKit
|
||||
#else
|
||||
import CCryptoBoringSSL
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
|
||||
extension CryptoKitError {
|
||||
/// A helper function that packs the value of `ERR_get_error` into the internal error field.
|
||||
|
||||
+78
-82
@@ -11,32 +11,38 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
import CCryptoBoringSSL
|
||||
import CCryptoBoringSSLShims
|
||||
#if MODULE_IS_CRYPTO && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
@_exported import CryptoKit
|
||||
#else
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
@_implementationOnly import CCryptoBoringSSLShims
|
||||
import Foundation
|
||||
#if !MODULE_IS_CRYPTO
|
||||
import enum Crypto.CryptoKitError
|
||||
#endif
|
||||
|
||||
/// A wrapper around the OpenSSL BIGNUM object that is appropriately lifetime managed,
|
||||
/// and that provides better Swift types for this object.
|
||||
public struct ArbitraryPrecisionInteger {
|
||||
/* private but @usableFromInline */ @usableFromInline var _backing: BackingStorage
|
||||
@usableFromInline
|
||||
struct ArbitraryPrecisionInteger {
|
||||
private var _backing: BackingStorage
|
||||
|
||||
@inlinable
|
||||
public init() {
|
||||
@usableFromInline
|
||||
init() {
|
||||
self._backing = BackingStorage()
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public init(copying original: UnsafePointer<BIGNUM>) throws {
|
||||
init(copying original: UnsafePointer<BIGNUM>) throws {
|
||||
self._backing = try BackingStorage(copying: original)
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public init(_ original: ArbitraryPrecisionInteger) throws {
|
||||
@usableFromInline
|
||||
init(_ original: ArbitraryPrecisionInteger) throws {
|
||||
self._backing = try BackingStorage(copying: original._backing)
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public init(integerLiteral value: Int64) {
|
||||
@usableFromInline
|
||||
init(integerLiteral value: Int64) {
|
||||
self._backing = BackingStorage(value)
|
||||
}
|
||||
}
|
||||
@@ -44,36 +50,31 @@ public struct ArbitraryPrecisionInteger {
|
||||
// MARK: - BackingStorage
|
||||
|
||||
extension ArbitraryPrecisionInteger {
|
||||
@usableFromInline
|
||||
final class BackingStorage {
|
||||
/* private but @usableFromInline */ @usableFromInline var _backing: BIGNUM
|
||||
private var _backing: BIGNUM
|
||||
|
||||
@usableFromInline
|
||||
init() {
|
||||
self._backing = BIGNUM()
|
||||
CCryptoBoringSSL_BN_init(&self._backing)
|
||||
}
|
||||
|
||||
@usableFromInline
|
||||
init(copying original: UnsafePointer<BIGNUM>) throws {
|
||||
self._backing = BIGNUM()
|
||||
guard CCryptoBoringSSL_BN_copy(&self._backing, original) != nil else {
|
||||
throw CryptoBoringWrapperError.internalBoringSSLError()
|
||||
throw CryptoKitError.internalBoringSSLError()
|
||||
}
|
||||
}
|
||||
|
||||
@usableFromInline
|
||||
init(copying original: BackingStorage) throws {
|
||||
self._backing = BIGNUM()
|
||||
|
||||
try original.withUnsafeMutableBignumPointer { bnPtr in
|
||||
guard CCryptoBoringSSL_BN_copy(&self._backing, bnPtr) != nil else {
|
||||
throw CryptoBoringWrapperError.internalBoringSSLError()
|
||||
throw CryptoKitError.internalBoringSSLError()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@usableFromInline
|
||||
init(_ value: Int64) {
|
||||
self._backing = BIGNUM()
|
||||
let rc = CCryptoBoringSSL_BN_set_u64(&self._backing, value.magnitude)
|
||||
@@ -84,7 +85,6 @@ extension ArbitraryPrecisionInteger {
|
||||
}
|
||||
}
|
||||
|
||||
@inlinable
|
||||
deinit {
|
||||
CCryptoBoringSSL_BN_clear_free(&self._backing)
|
||||
}
|
||||
@@ -94,22 +94,21 @@ extension ArbitraryPrecisionInteger {
|
||||
// MARK: - Extra initializers
|
||||
|
||||
extension ArbitraryPrecisionInteger {
|
||||
@inlinable
|
||||
public init<Bytes: ContiguousBytes>(bytes: Bytes) throws {
|
||||
@usableFromInline
|
||||
init<Bytes: ContiguousBytes>(bytes: Bytes) throws {
|
||||
self._backing = try BackingStorage(bytes: bytes)
|
||||
}
|
||||
|
||||
/// Create an `ArbitraryPrecisionInteger` from a hex string.
|
||||
///
|
||||
/// - Parameter hexString: Hex byte string (big-endian, no `0x` prefix, may start with `-` for a negative number).
|
||||
@inlinable
|
||||
public init(hexString: String) throws {
|
||||
@usableFromInline
|
||||
init(hexString: String) throws {
|
||||
self._backing = try BackingStorage(hexString: hexString)
|
||||
}
|
||||
}
|
||||
|
||||
extension ArbitraryPrecisionInteger.BackingStorage {
|
||||
@inlinable
|
||||
convenience init<Bytes: ContiguousBytes>(bytes: Bytes) throws {
|
||||
self.init()
|
||||
|
||||
@@ -117,7 +116,7 @@ extension ArbitraryPrecisionInteger.BackingStorage {
|
||||
CCryptoBoringSSLShims_BN_bin2bn(bytesPointer.baseAddress, bytesPointer.count, &self._backing)
|
||||
}
|
||||
guard rc != nil else {
|
||||
throw CryptoBoringWrapperError.internalBoringSSLError()
|
||||
throw CryptoKitError.internalBoringSSLError()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +130,7 @@ extension ArbitraryPrecisionInteger.BackingStorage {
|
||||
try withUnsafeMutablePointer(to: &backingPtr) { backingPtrPtr in
|
||||
/// `BN_hex2bin` returns the number of bytes of `in` processed or zero on error.
|
||||
guard CCryptoBoringSSL_BN_hex2bn(backingPtrPtr, hexStringPtr) == hexString.count else {
|
||||
throw CryptoBoringWrapperError.incorrectParameterSize
|
||||
throw CryptoKitError.incorrectParameterSize
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -139,18 +138,14 @@ extension ArbitraryPrecisionInteger.BackingStorage {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// MARK: - Pointer helpers
|
||||
|
||||
extension ArbitraryPrecisionInteger {
|
||||
@inlinable
|
||||
public func withUnsafeBignumPointer<T>(_ body: (UnsafePointer<BIGNUM>) throws -> T) rethrows -> T {
|
||||
func withUnsafeBignumPointer<T>(_ body: (UnsafePointer<BIGNUM>) throws -> T) rethrows -> T {
|
||||
try self._backing.withUnsafeBignumPointer(body)
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public mutating func withUnsafeMutableBignumPointer<T>(_ body: (UnsafeMutablePointer<BIGNUM>) throws -> T) rethrows -> T {
|
||||
mutating func withUnsafeMutableBignumPointer<T>(_ body: (UnsafeMutablePointer<BIGNUM>) throws -> T) rethrows -> T {
|
||||
if !isKnownUniquelyReferenced(&self._backing) {
|
||||
// Failing to CoW is a fatal error here.
|
||||
self._backing = try! BackingStorage(copying: self._backing)
|
||||
@@ -161,12 +156,10 @@ extension ArbitraryPrecisionInteger {
|
||||
}
|
||||
|
||||
extension ArbitraryPrecisionInteger.BackingStorage {
|
||||
@usableFromInline
|
||||
func withUnsafeBignumPointer<T>(_ body: (UnsafePointer<BIGNUM>) throws -> T) rethrows -> T {
|
||||
try body(&self._backing)
|
||||
}
|
||||
|
||||
@usableFromInline
|
||||
func withUnsafeMutableBignumPointer<T>(_ body: (UnsafeMutablePointer<BIGNUM>) throws -> T) rethrows -> T {
|
||||
try body(&self._backing)
|
||||
}
|
||||
@@ -190,8 +183,8 @@ extension ArbitraryPrecisionInteger {
|
||||
}
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public func squared() -> ArbitraryPrecisionInteger {
|
||||
@usableFromInline
|
||||
func squared() -> ArbitraryPrecisionInteger {
|
||||
var result = ArbitraryPrecisionInteger()
|
||||
let rc = result.withUnsafeMutableBignumPointer { resultPtr in
|
||||
self.withUnsafeBignumPointer { selfPtr in
|
||||
@@ -204,8 +197,8 @@ extension ArbitraryPrecisionInteger {
|
||||
return result
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public func positiveSquareRoot() throws -> ArbitraryPrecisionInteger {
|
||||
@usableFromInline
|
||||
func positiveSquareRoot() throws -> ArbitraryPrecisionInteger {
|
||||
var result = ArbitraryPrecisionInteger()
|
||||
let rc = result.withUnsafeMutableBignumPointer { resultPtr in
|
||||
self.withUnsafeBignumPointer { selfPtr in
|
||||
@@ -216,20 +209,20 @@ extension ArbitraryPrecisionInteger {
|
||||
}
|
||||
|
||||
guard rc == 1 else {
|
||||
throw CryptoBoringWrapperError.internalBoringSSLError()
|
||||
throw CryptoKitError.internalBoringSSLError()
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public var byteCount: Int {
|
||||
@usableFromInline
|
||||
var byteCount: Int {
|
||||
self._backing.withUnsafeBignumPointer {
|
||||
Int(CCryptoBoringSSL_BN_num_bytes($0))
|
||||
}
|
||||
}
|
||||
|
||||
/// Some functions require a BN_CTX parameter: this obtains one with a scoped lifetime.
|
||||
/* private but @usableFromInline */ @usableFromInline static func withUnsafeBN_CTX<T>(_ body: (OpaquePointer) throws -> T) rethrows -> T {
|
||||
private static func withUnsafeBN_CTX<T>(_ body: (OpaquePointer) throws -> T) rethrows -> T {
|
||||
// We force unwrap here because this call can only fail if the allocator is broken, and if
|
||||
// the allocator fails we don't have long to live anyway.
|
||||
let bnCtx = CCryptoBoringSSL_BN_CTX_new()!
|
||||
@@ -245,7 +238,7 @@ extension ArbitraryPrecisionInteger {
|
||||
|
||||
extension ArbitraryPrecisionInteger: Equatable {
|
||||
@inlinable
|
||||
public static func == (lhs: ArbitraryPrecisionInteger, rhs: ArbitraryPrecisionInteger) -> Bool {
|
||||
static func == (lhs: ArbitraryPrecisionInteger, rhs: ArbitraryPrecisionInteger) -> Bool {
|
||||
self._compare(lhs: lhs, rhs: rhs) == 0
|
||||
}
|
||||
}
|
||||
@@ -254,22 +247,22 @@ extension ArbitraryPrecisionInteger: Equatable {
|
||||
|
||||
extension ArbitraryPrecisionInteger: Comparable {
|
||||
@inlinable
|
||||
public static func < (lhs: ArbitraryPrecisionInteger, rhs: ArbitraryPrecisionInteger) -> Bool {
|
||||
static func < (lhs: ArbitraryPrecisionInteger, rhs: ArbitraryPrecisionInteger) -> Bool {
|
||||
self._compare(lhs: lhs, rhs: rhs) < 0
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public static func <= (lhs: ArbitraryPrecisionInteger, rhs: ArbitraryPrecisionInteger) -> Bool {
|
||||
static func <= (lhs: ArbitraryPrecisionInteger, rhs: ArbitraryPrecisionInteger) -> Bool {
|
||||
self._compare(lhs: lhs, rhs: rhs) <= 0
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public static func > (lhs: ArbitraryPrecisionInteger, rhs: ArbitraryPrecisionInteger) -> Bool {
|
||||
static func > (lhs: ArbitraryPrecisionInteger, rhs: ArbitraryPrecisionInteger) -> Bool {
|
||||
self._compare(lhs: lhs, rhs: rhs) > 0
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public static func >= (lhs: ArbitraryPrecisionInteger, rhs: ArbitraryPrecisionInteger) -> Bool {
|
||||
static func >= (lhs: ArbitraryPrecisionInteger, rhs: ArbitraryPrecisionInteger) -> Bool {
|
||||
self._compare(lhs: lhs, rhs: rhs) >= 0
|
||||
}
|
||||
}
|
||||
@@ -282,12 +275,12 @@ extension ArbitraryPrecisionInteger: ExpressibleByIntegerLiteral {}
|
||||
|
||||
extension ArbitraryPrecisionInteger: AdditiveArithmetic {
|
||||
@inlinable
|
||||
public static var zero: ArbitraryPrecisionInteger {
|
||||
static var zero: ArbitraryPrecisionInteger {
|
||||
0
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public static func + (lhs: ArbitraryPrecisionInteger, rhs: ArbitraryPrecisionInteger) -> ArbitraryPrecisionInteger {
|
||||
@usableFromInline
|
||||
static func + (lhs: ArbitraryPrecisionInteger, rhs: ArbitraryPrecisionInteger) -> ArbitraryPrecisionInteger {
|
||||
var result = ArbitraryPrecisionInteger()
|
||||
|
||||
let rc = result.withUnsafeMutableBignumPointer { resultPtr in
|
||||
@@ -302,8 +295,8 @@ extension ArbitraryPrecisionInteger: AdditiveArithmetic {
|
||||
return result
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public static func += (lhs: inout ArbitraryPrecisionInteger, rhs: ArbitraryPrecisionInteger) {
|
||||
@usableFromInline
|
||||
static func += (lhs: inout ArbitraryPrecisionInteger, rhs: ArbitraryPrecisionInteger) {
|
||||
let rc = lhs.withUnsafeMutableBignumPointer { lhsPtr in
|
||||
rhs.withUnsafeBignumPointer { rhsPtr in
|
||||
CCryptoBoringSSL_BN_add(lhsPtr, lhsPtr, rhsPtr)
|
||||
@@ -312,8 +305,8 @@ extension ArbitraryPrecisionInteger: AdditiveArithmetic {
|
||||
precondition(rc == 1, "Unable to allocate memory for new ArbitraryPrecisionInteger")
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public static func - (lhs: ArbitraryPrecisionInteger, rhs: ArbitraryPrecisionInteger) -> ArbitraryPrecisionInteger {
|
||||
@usableFromInline
|
||||
static func - (lhs: ArbitraryPrecisionInteger, rhs: ArbitraryPrecisionInteger) -> ArbitraryPrecisionInteger {
|
||||
var result = ArbitraryPrecisionInteger()
|
||||
|
||||
let rc = result.withUnsafeMutableBignumPointer { resultPtr in
|
||||
@@ -328,8 +321,8 @@ extension ArbitraryPrecisionInteger: AdditiveArithmetic {
|
||||
return result
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public static func -= (lhs: inout ArbitraryPrecisionInteger, rhs: ArbitraryPrecisionInteger) {
|
||||
@usableFromInline
|
||||
static func -= (lhs: inout ArbitraryPrecisionInteger, rhs: ArbitraryPrecisionInteger) {
|
||||
let rc = lhs.withUnsafeMutableBignumPointer { lhsPtr in
|
||||
rhs.withUnsafeBignumPointer { rhsPtr in
|
||||
CCryptoBoringSSL_BN_sub(lhsPtr, lhsPtr, rhsPtr)
|
||||
@@ -342,10 +335,11 @@ extension ArbitraryPrecisionInteger: AdditiveArithmetic {
|
||||
// MARK: - Numeric
|
||||
|
||||
extension ArbitraryPrecisionInteger: Numeric {
|
||||
public typealias Magnitude = Self
|
||||
@usableFromInline
|
||||
typealias Magnitude = Self
|
||||
|
||||
@inlinable
|
||||
public var magnitude: Magnitude {
|
||||
@usableFromInline
|
||||
var magnitude: Magnitude {
|
||||
if self._positive {
|
||||
return self
|
||||
}
|
||||
@@ -359,8 +353,8 @@ extension ArbitraryPrecisionInteger: Numeric {
|
||||
return copy
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public static func * (lhs: ArbitraryPrecisionInteger, rhs: ArbitraryPrecisionInteger) -> ArbitraryPrecisionInteger {
|
||||
@usableFromInline
|
||||
static func * (lhs: ArbitraryPrecisionInteger, rhs: ArbitraryPrecisionInteger) -> ArbitraryPrecisionInteger {
|
||||
var result = ArbitraryPrecisionInteger()
|
||||
|
||||
let rc = result.withUnsafeMutableBignumPointer { resultPtr in
|
||||
@@ -377,8 +371,8 @@ extension ArbitraryPrecisionInteger: Numeric {
|
||||
return result
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public static func *= (lhs: inout ArbitraryPrecisionInteger, rhs: ArbitraryPrecisionInteger) {
|
||||
@usableFromInline
|
||||
static func *= (lhs: inout ArbitraryPrecisionInteger, rhs: ArbitraryPrecisionInteger) {
|
||||
let rc = lhs.withUnsafeMutableBignumPointer { lhsPtr in
|
||||
rhs.withUnsafeBignumPointer { rhsPtr in
|
||||
ArbitraryPrecisionInteger.withUnsafeBN_CTX { bnCtx in
|
||||
@@ -390,7 +384,7 @@ extension ArbitraryPrecisionInteger: Numeric {
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public init?<T: BinaryInteger>(exactly integer: T) {
|
||||
init?<T: BinaryInteger>(exactly integer: T) {
|
||||
fatalError("Not currently implemented")
|
||||
}
|
||||
}
|
||||
@@ -398,8 +392,8 @@ extension ArbitraryPrecisionInteger: Numeric {
|
||||
// MARK: - SignedNumeric
|
||||
|
||||
extension ArbitraryPrecisionInteger: SignedNumeric {
|
||||
@inlinable
|
||||
public mutating func negate() {
|
||||
@usableFromInline
|
||||
mutating func negate() {
|
||||
let signBit: CInt = self._positive ? 1 : 0
|
||||
|
||||
self.withUnsafeMutableBignumPointer {
|
||||
@@ -411,8 +405,8 @@ extension ArbitraryPrecisionInteger: SignedNumeric {
|
||||
// MARK: - Other arithmetic operations
|
||||
|
||||
extension ArbitraryPrecisionInteger {
|
||||
@inlinable
|
||||
public static func gcd(_ a: ArbitraryPrecisionInteger, _ b: ArbitraryPrecisionInteger) throws -> ArbitraryPrecisionInteger {
|
||||
@usableFromInline
|
||||
static func gcd(_ a: ArbitraryPrecisionInteger, _ b: ArbitraryPrecisionInteger) throws -> ArbitraryPrecisionInteger {
|
||||
var result = ArbitraryPrecisionInteger()
|
||||
|
||||
guard result.withUnsafeMutableBignumPointer({ resultPtr in
|
||||
@@ -424,19 +418,19 @@ extension ArbitraryPrecisionInteger {
|
||||
}
|
||||
}
|
||||
}) == 1 else {
|
||||
throw CryptoBoringWrapperError.internalBoringSSLError()
|
||||
throw CryptoKitError.internalBoringSSLError()
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public func isCoprime(with other: ArbitraryPrecisionInteger) throws -> Bool {
|
||||
@usableFromInline
|
||||
func isCoprime(with other: ArbitraryPrecisionInteger) throws -> Bool {
|
||||
try Self.gcd(self, other) == 1
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public static func random(inclusiveMin: UInt, exclusiveMax: ArbitraryPrecisionInteger) throws -> ArbitraryPrecisionInteger {
|
||||
@usableFromInline
|
||||
static func random(inclusiveMin: UInt, exclusiveMax: ArbitraryPrecisionInteger) throws -> ArbitraryPrecisionInteger {
|
||||
var result = ArbitraryPrecisionInteger()
|
||||
|
||||
guard result.withUnsafeMutableBignumPointer({ resultPtr in
|
||||
@@ -444,7 +438,7 @@ extension ArbitraryPrecisionInteger {
|
||||
CCryptoBoringSSL_BN_rand_range_ex(resultPtr, BN_ULONG(inclusiveMin), exclusiveMaxPtr)
|
||||
}
|
||||
}) == 1 else {
|
||||
throw CryptoBoringWrapperError.internalBoringSSLError()
|
||||
throw CryptoKitError.internalBoringSSLError()
|
||||
}
|
||||
|
||||
return result
|
||||
@@ -455,12 +449,12 @@ extension ArbitraryPrecisionInteger {
|
||||
|
||||
extension Data {
|
||||
/// Serializes an ArbitraryPrecisionInteger padded out to a certain minimum size.
|
||||
@inlinable
|
||||
public mutating func append(bytesOf integer: ArbitraryPrecisionInteger, paddedToSize paddingSize: Int) throws {
|
||||
@usableFromInline
|
||||
mutating func append(bytesOf integer: ArbitraryPrecisionInteger, paddedToSize paddingSize: Int) throws {
|
||||
let byteCount = integer.byteCount
|
||||
|
||||
guard paddingSize >= byteCount else {
|
||||
throw CryptoBoringWrapperError.incorrectParameterSize
|
||||
throw CryptoKitError.incorrectParameterSize
|
||||
}
|
||||
|
||||
// To extend the data we need to write some zeroes into it.
|
||||
@@ -479,8 +473,8 @@ extension Data {
|
||||
assert(written == byteCount)
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public init(bytesOf integer: ArbitraryPrecisionInteger, paddedToSize paddingSize: Int) throws {
|
||||
@usableFromInline
|
||||
init(bytesOf integer: ArbitraryPrecisionInteger, paddedToSize paddingSize: Int) throws {
|
||||
self.init(capacity: paddingSize)
|
||||
try self.append(bytesOf: integer, paddedToSize: paddingSize)
|
||||
}
|
||||
@@ -489,7 +483,8 @@ extension Data {
|
||||
// MARK: - Printing
|
||||
|
||||
extension ArbitraryPrecisionInteger: CustomDebugStringConvertible {
|
||||
public var debugDescription: String {
|
||||
@usableFromInline
|
||||
var debugDescription: String {
|
||||
guard let bio = CCryptoBoringSSL_BIO_new(CCryptoBoringSSL_BIO_s_mem()) else {
|
||||
return "ArbitraryPrecisionInteger: (error generating representation)"
|
||||
}
|
||||
@@ -524,3 +519,4 @@ extension ArbitraryPrecisionInteger: CustomDebugStringConvertible {
|
||||
return String(decoding: UnsafeBufferPointer(start: stringPointer, count: length), as: Unicode.UTF8.self)
|
||||
}
|
||||
}
|
||||
#endif // CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
+48
-41
@@ -11,7 +11,14 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
import CCryptoBoringSSL
|
||||
#if MODULE_IS_CRYPTO && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
@_exported import CryptoKit
|
||||
#else
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
import Foundation
|
||||
#if !MODULE_IS_CRYPTO
|
||||
import enum Crypto.CryptoKitError
|
||||
#endif
|
||||
|
||||
/// A context for performing mathematical operations on ArbitraryPrecisionIntegers over a finite field.
|
||||
///
|
||||
@@ -24,21 +31,21 @@ import CCryptoBoringSSL
|
||||
///
|
||||
/// Annoyingly, because of the way we have implemented ArbitraryPrecisionInteger, we can't actually use these temporary bignums
|
||||
/// ourselves.
|
||||
public final class FiniteFieldArithmeticContext {
|
||||
/* private but @usableFromInline */ @usableFromInline var fieldSize: ArbitraryPrecisionInteger
|
||||
/* private but @usableFromInline */ @usableFromInline var bnCtx: OpaquePointer
|
||||
@usableFromInline
|
||||
class FiniteFieldArithmeticContext {
|
||||
private var fieldSize: ArbitraryPrecisionInteger
|
||||
private var bnCtx: OpaquePointer
|
||||
|
||||
@inlinable
|
||||
public init(fieldSize: ArbitraryPrecisionInteger) throws {
|
||||
@usableFromInline
|
||||
init(fieldSize: ArbitraryPrecisionInteger) throws {
|
||||
self.fieldSize = fieldSize
|
||||
guard let bnCtx = CCryptoBoringSSL_BN_CTX_new() else {
|
||||
throw CryptoBoringWrapperError.internalBoringSSLError()
|
||||
throw CryptoKitError.internalBoringSSLError()
|
||||
}
|
||||
CCryptoBoringSSL_BN_CTX_start(bnCtx)
|
||||
self.bnCtx = bnCtx
|
||||
}
|
||||
|
||||
@inlinable
|
||||
deinit {
|
||||
CCryptoBoringSSL_BN_CTX_end(self.bnCtx)
|
||||
CCryptoBoringSSL_BN_CTX_free(self.bnCtx)
|
||||
@@ -48,8 +55,8 @@ public final class FiniteFieldArithmeticContext {
|
||||
// MARK: - Arithmetic operations
|
||||
|
||||
extension FiniteFieldArithmeticContext {
|
||||
@inlinable
|
||||
public func residue(_ x: ArbitraryPrecisionInteger) throws -> ArbitraryPrecisionInteger {
|
||||
@usableFromInline
|
||||
func residue(_ x: ArbitraryPrecisionInteger) throws -> ArbitraryPrecisionInteger {
|
||||
var result = ArbitraryPrecisionInteger()
|
||||
|
||||
guard x.withUnsafeBignumPointer({ xPtr in
|
||||
@@ -59,15 +66,14 @@ extension FiniteFieldArithmeticContext {
|
||||
}
|
||||
}
|
||||
}) == 1 else {
|
||||
throw CryptoBoringWrapperError.internalBoringSSLError()
|
||||
throw CryptoKitError.internalBoringSSLError()
|
||||
}
|
||||
|
||||
return result
|
||||
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public func square(_ input: ArbitraryPrecisionInteger) throws -> ArbitraryPrecisionInteger {
|
||||
@usableFromInline
|
||||
func square(_ input: ArbitraryPrecisionInteger) throws -> ArbitraryPrecisionInteger {
|
||||
var output = ArbitraryPrecisionInteger()
|
||||
|
||||
let rc = input.withUnsafeBignumPointer { inputPointer in
|
||||
@@ -79,14 +85,14 @@ extension FiniteFieldArithmeticContext {
|
||||
}
|
||||
|
||||
guard rc == 1 else {
|
||||
throw CryptoBoringWrapperError.internalBoringSSLError()
|
||||
throw CryptoKitError.internalBoringSSLError()
|
||||
}
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public func multiply(_ x: ArbitraryPrecisionInteger, _ y: ArbitraryPrecisionInteger) throws -> ArbitraryPrecisionInteger {
|
||||
@usableFromInline
|
||||
func multiply(_ x: ArbitraryPrecisionInteger, _ y: ArbitraryPrecisionInteger) throws -> ArbitraryPrecisionInteger {
|
||||
var output = ArbitraryPrecisionInteger()
|
||||
|
||||
let rc = x.withUnsafeBignumPointer { xPointer in
|
||||
@@ -100,14 +106,14 @@ extension FiniteFieldArithmeticContext {
|
||||
}
|
||||
|
||||
guard rc == 1 else {
|
||||
throw CryptoBoringWrapperError.internalBoringSSLError()
|
||||
throw CryptoKitError.internalBoringSSLError()
|
||||
}
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public func add(_ x: ArbitraryPrecisionInteger, _ y: ArbitraryPrecisionInteger) throws -> ArbitraryPrecisionInteger {
|
||||
@usableFromInline
|
||||
func add(_ x: ArbitraryPrecisionInteger, _ y: ArbitraryPrecisionInteger) throws -> ArbitraryPrecisionInteger {
|
||||
var output = ArbitraryPrecisionInteger()
|
||||
|
||||
let rc = x.withUnsafeBignumPointer { xPointer in
|
||||
@@ -121,14 +127,14 @@ extension FiniteFieldArithmeticContext {
|
||||
}
|
||||
|
||||
guard rc == 1 else {
|
||||
throw CryptoBoringWrapperError.internalBoringSSLError()
|
||||
throw CryptoKitError.internalBoringSSLError()
|
||||
}
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public func subtract(_ x: ArbitraryPrecisionInteger, from y: ArbitraryPrecisionInteger) throws -> ArbitraryPrecisionInteger {
|
||||
@usableFromInline
|
||||
func subtract(_ x: ArbitraryPrecisionInteger, from y: ArbitraryPrecisionInteger) throws -> ArbitraryPrecisionInteger {
|
||||
var output = ArbitraryPrecisionInteger()
|
||||
|
||||
let rc = x.withUnsafeBignumPointer { xPointer in
|
||||
@@ -143,14 +149,14 @@ extension FiniteFieldArithmeticContext {
|
||||
}
|
||||
|
||||
guard rc == 1 else {
|
||||
throw CryptoBoringWrapperError.internalBoringSSLError()
|
||||
throw CryptoKitError.internalBoringSSLError()
|
||||
}
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public func positiveSquareRoot(_ x: ArbitraryPrecisionInteger) throws -> ArbitraryPrecisionInteger {
|
||||
@usableFromInline
|
||||
func positiveSquareRoot(_ x: ArbitraryPrecisionInteger) throws -> ArbitraryPrecisionInteger {
|
||||
let outputPointer = x.withUnsafeBignumPointer { xPointer in
|
||||
self.fieldSize.withUnsafeBignumPointer { fieldSizePointer in
|
||||
// We can't pass a pointer in as BN_mod_sqrt may attempt to free it.
|
||||
@@ -159,7 +165,7 @@ extension FiniteFieldArithmeticContext {
|
||||
}
|
||||
|
||||
guard let actualOutputPointer = outputPointer else {
|
||||
throw CryptoBoringWrapperError.internalBoringSSLError()
|
||||
throw CryptoKitError.internalBoringSSLError()
|
||||
}
|
||||
|
||||
// Ok, we own this pointer now.
|
||||
@@ -170,14 +176,14 @@ extension FiniteFieldArithmeticContext {
|
||||
return try ArbitraryPrecisionInteger(copying: actualOutputPointer)
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public func inverse(_ x: ArbitraryPrecisionInteger) throws -> ArbitraryPrecisionInteger? {
|
||||
@usableFromInline
|
||||
func inverse(_ x: ArbitraryPrecisionInteger) throws -> ArbitraryPrecisionInteger? {
|
||||
var result = ArbitraryPrecisionInteger()
|
||||
|
||||
guard result.withUnsafeMutableBignumPointer({ resultPtr in
|
||||
x.withUnsafeBignumPointer { xPtr in
|
||||
self.fieldSize.withUnsafeBignumPointer { modPtr in
|
||||
CCryptoBoringSSL_BN_mod_inverse(resultPtr, xPtr , modPtr, self.bnCtx)
|
||||
CCryptoBoringSSL_BN_mod_inverse(resultPtr, xPtr, modPtr, self.bnCtx)
|
||||
}
|
||||
}
|
||||
}) != nil else { return nil }
|
||||
@@ -185,24 +191,24 @@ extension FiniteFieldArithmeticContext {
|
||||
return result
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public func pow(_ x: ArbitraryPrecisionInteger, _ p: ArbitraryPrecisionInteger) throws -> ArbitraryPrecisionInteger {
|
||||
@usableFromInline
|
||||
func pow(_ x: ArbitraryPrecisionInteger, _ p: ArbitraryPrecisionInteger) throws -> ArbitraryPrecisionInteger {
|
||||
try self.pow(x, p) { r, x, p, m, ctx, _ in CCryptoBoringSSL_BN_mod_exp(r, x, p, m, ctx) }
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public func pow(secret x: ArbitraryPrecisionInteger, _ p: ArbitraryPrecisionInteger) throws -> ArbitraryPrecisionInteger {
|
||||
guard x < self.fieldSize else { throw CryptoBoringWrapperError.incorrectParameterSize }
|
||||
@usableFromInline
|
||||
func pow(secret x: ArbitraryPrecisionInteger, _ p: ArbitraryPrecisionInteger) throws -> ArbitraryPrecisionInteger {
|
||||
guard x < self.fieldSize else { throw CryptoKitError.incorrectParameterSize }
|
||||
return try self.pow(x, p, using: CCryptoBoringSSL_BN_mod_exp_mont)
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public func pow(secret x: ArbitraryPrecisionInteger, secret p: ArbitraryPrecisionInteger) throws -> ArbitraryPrecisionInteger {
|
||||
guard x < self.fieldSize else { throw CryptoBoringWrapperError.incorrectParameterSize }
|
||||
@usableFromInline
|
||||
func pow(secret x: ArbitraryPrecisionInteger, secret p: ArbitraryPrecisionInteger) throws -> ArbitraryPrecisionInteger {
|
||||
guard x < self.fieldSize else { throw CryptoKitError.incorrectParameterSize }
|
||||
return try self.pow(x, p, using: CCryptoBoringSSL_BN_mod_exp_mont_consttime)
|
||||
}
|
||||
|
||||
/* private but @usableFromInline */ @usableFromInline func pow(
|
||||
fileprivate func pow(
|
||||
_ a: ArbitraryPrecisionInteger,
|
||||
_ b: ArbitraryPrecisionInteger,
|
||||
using method: (
|
||||
@@ -227,14 +233,14 @@ extension FiniteFieldArithmeticContext {
|
||||
}
|
||||
}
|
||||
}) == 1 else {
|
||||
throw CryptoBoringWrapperError.internalBoringSSLError()
|
||||
throw CryptoKitError.internalBoringSSLError()
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
/// Some functions require a `BN_MONT_CTX` parameter: this obtains one for the field modulus with a scoped lifetime.
|
||||
/* private but @usableFromInline */ @usableFromInline func withUnsafeBN_MONT_CTX<T>(_ body: (UnsafePointer<BN_MONT_CTX>) throws -> T) rethrows -> T {
|
||||
fileprivate func withUnsafeBN_MONT_CTX<T>(_ body: (UnsafePointer<BN_MONT_CTX>) throws -> T) rethrows -> T {
|
||||
try self.fieldSize.withUnsafeBignumPointer { modPtr in
|
||||
// We force unwrap here because this call can only fail if the allocator is broken, and if
|
||||
// the allocator fails we don't have long to live anyway.
|
||||
@@ -244,3 +250,4 @@ extension FiniteFieldArithmeticContext {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
@@ -12,7 +12,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
#if !canImport(Darwin)
|
||||
import CCryptoBoringSSL
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
|
||||
typealias errno_t = CInt
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import CCryptoBoringSSL
|
||||
import CCryptoBoringSSLShims
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
@_implementationOnly import CCryptoBoringSSLShims
|
||||
import Foundation
|
||||
|
||||
/// An abstraction over a BoringSSL AEAD
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
|
||||
add_library(CryptoBoringWrapper STATIC
|
||||
"AEAD/BoringSSLAEAD.swift"
|
||||
"ArbitraryPrecisionInteger.swift"
|
||||
"CryptoKitErrors_boring.swift"
|
||||
"FiniteFieldArithmeticContext.swift")
|
||||
"CryptoKitErrors_boring.swift")
|
||||
|
||||
target_include_directories(CryptoBoringWrapper PUBLIC
|
||||
$<TARGET_PROPERTY:CCryptoBoringSSL,INCLUDE_DIRECTORIES>
|
||||
|
||||
@@ -12,11 +12,10 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import CCryptoBoringSSL
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
|
||||
public enum CryptoBoringWrapperError: Error {
|
||||
case underlyingCoreCryptoError(error: Int32)
|
||||
case incorrectParameterSize
|
||||
}
|
||||
|
||||
extension CryptoBoringWrapperError {
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../../.PrivacyInfo.xcprivacy
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSPrivacyTracking</key>
|
||||
<false/>
|
||||
<key>NSPrivacyAccessedAPITypes</key>
|
||||
<array/>
|
||||
<key>NSPrivacyCollectedDataTypes</key>
|
||||
<array/>
|
||||
<key>NSPrivacyTrackingDomains</key>
|
||||
<array/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the SwiftCrypto open source project
|
||||
//
|
||||
// Copyright (c) 2024 Apple Inc. and the SwiftCrypto project authors
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import Crypto
|
||||
import Foundation
|
||||
|
||||
@usableFromInline
|
||||
typealias AESCFBImpl = OpenSSLAESCFBImpl
|
||||
|
||||
extension AES {
|
||||
public enum _CFB {
|
||||
@inlinable
|
||||
public static func encrypt<Plaintext: DataProtocol>(
|
||||
_ plaintext: Plaintext,
|
||||
using key: SymmetricKey,
|
||||
iv: AES._CFB.IV
|
||||
) throws -> Data {
|
||||
let bytes: ContiguousBytes = plaintext.regions.count == 1 ? plaintext.regions.first! : Array(plaintext)
|
||||
return try AESCFBImpl.encryptOrDecrypt(.encrypt, bytes, using: key, iv: iv)
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public static func decrypt<Ciphertext: DataProtocol>(
|
||||
_ ciphertext: Ciphertext,
|
||||
using key: SymmetricKey,
|
||||
iv: AES._CFB.IV
|
||||
) throws -> Data {
|
||||
let bytes: ContiguousBytes = ciphertext.regions.count == 1 ? ciphertext.regions.first! : Array(ciphertext)
|
||||
return try AESCFBImpl.encryptOrDecrypt(.decrypt, bytes, using: key, iv: iv)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension AES._CFB {
|
||||
public struct IV: Sendable {
|
||||
// AES CFB uses a 128-bit IV.
|
||||
private var ivBytes: (UInt64, UInt64)
|
||||
|
||||
public init() {
|
||||
var rng = SystemRandomNumberGenerator()
|
||||
self.ivBytes = (rng.next(), rng.next())
|
||||
}
|
||||
|
||||
public init<IVBytes: Collection>(ivBytes: IVBytes) throws where IVBytes.Element == UInt8 {
|
||||
guard ivBytes.count == 16 else {
|
||||
throw CryptoKitError.incorrectParameterSize
|
||||
}
|
||||
|
||||
self.ivBytes = (0, 0)
|
||||
|
||||
Swift.withUnsafeMutableBytes(of: &self.ivBytes) { bytesPtr in
|
||||
bytesPtr.copyBytes(from: ivBytes)
|
||||
}
|
||||
}
|
||||
|
||||
mutating func withUnsafeMutableBytes<ReturnType>(_ body: (UnsafeMutableRawBufferPointer) throws -> ReturnType) rethrows -> ReturnType {
|
||||
return try Swift.withUnsafeMutableBytes(of: &self.ivBytes, body)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,9 +13,9 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import Crypto
|
||||
import CCryptoBoringSSL
|
||||
import CCryptoBoringSSLShims
|
||||
import CryptoBoringWrapper
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
@_implementationOnly import CCryptoBoringSSLShims
|
||||
@_implementationOnly import CryptoBoringWrapper
|
||||
#if canImport(Darwin) || swift(>=5.9.1)
|
||||
import Foundation
|
||||
#else
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import Crypto
|
||||
import CCryptoBoringSSL
|
||||
import CCryptoBoringSSLShims
|
||||
import CryptoBoringWrapper
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
@_implementationOnly import CCryptoBoringSSLShims
|
||||
@_implementationOnly import CryptoBoringWrapper
|
||||
import Foundation
|
||||
|
||||
extension AES {
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the SwiftCrypto open source project
|
||||
//
|
||||
// Copyright (c) 2024 Apple Inc. and the SwiftCrypto project authors
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
import Crypto
|
||||
import Foundation
|
||||
|
||||
@usableFromInline
|
||||
enum OpenSSLAESCFBImpl {
|
||||
@usableFromInline
|
||||
enum Mode {
|
||||
case encrypt
|
||||
case decrypt
|
||||
|
||||
@usableFromInline
|
||||
var _boringSSLParameter: Int32 {
|
||||
switch self {
|
||||
case .encrypt: return AES_ENCRYPT
|
||||
case .decrypt: return AES_DECRYPT
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@inlinable
|
||||
static func encryptOrDecrypt<Plaintext: ContiguousBytes>(
|
||||
_ mode: Mode,
|
||||
_ plaintext: Plaintext,
|
||||
using key: SymmetricKey,
|
||||
iv: AES._CFB.IV
|
||||
) throws -> Data {
|
||||
guard [128, 192, 256].contains(key.bitCount) else {
|
||||
throw CryptoKitError.incorrectKeySize
|
||||
}
|
||||
return plaintext.withUnsafeBytes { plaintextBufferPtr in
|
||||
Self._encryptOrDecrypt(mode, plaintextBufferPtr, using: key, iv: iv)
|
||||
}
|
||||
}
|
||||
|
||||
@usableFromInline
|
||||
static func _encryptOrDecrypt(
|
||||
_ mode: Mode,
|
||||
_ plaintextBufferPtr: UnsafeRawBufferPointer,
|
||||
using key: SymmetricKey,
|
||||
iv: AES._CFB.IV
|
||||
) -> Data {
|
||||
var ciphertext = Data(repeating: 0, count: plaintextBufferPtr.count)
|
||||
ciphertext.withUnsafeMutableBytes { ciphertextBufferPtr in
|
||||
var iv = iv
|
||||
var num = UInt32.zero
|
||||
key.withUnsafeBytes { keyBufferPtr in
|
||||
iv.withUnsafeMutableBytes { ivBufferPtr in
|
||||
var key = AES_KEY()
|
||||
precondition(CCryptoBoringSSL_AES_set_encrypt_key(keyBufferPtr.baseAddress, UInt32(keyBufferPtr.count * 8), &key) == 0)
|
||||
CCryptoBoringSSL_AES_cfb128_encrypt(
|
||||
plaintextBufferPtr.baseAddress,
|
||||
ciphertextBufferPtr.baseAddress,
|
||||
plaintextBufferPtr.count,
|
||||
&key,
|
||||
ivBufferPtr.baseAddress,
|
||||
&num,
|
||||
mode._boringSSLParameter
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
return ciphertext
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import CCryptoBoringSSL
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
import Crypto
|
||||
import Foundation
|
||||
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
|
||||
// This is a copy ChaChaPoly_boring just with a different set aes algos
|
||||
|
||||
import CCryptoBoringSSL
|
||||
import CCryptoBoringSSLShims
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
@_implementationOnly import CCryptoBoringSSLShims
|
||||
import Crypto
|
||||
import CryptoBoringWrapper
|
||||
@_implementationOnly import CryptoBoringWrapper
|
||||
import Foundation
|
||||
|
||||
extension BoringSSLAEAD {
|
||||
|
||||
@@ -24,7 +24,9 @@ add_library(_CryptoExtras
|
||||
"Util/DigestType.swift"
|
||||
"Util/Error.swift"
|
||||
"Util/PEMDocument.swift"
|
||||
"Util/RandomBytes.swift")
|
||||
"Util/RandomBytes.swift"
|
||||
"Util/Shared/ArbitraryPrecisionInteger_boring.swift"
|
||||
"Util/Shared/FiniteFieldArithmeticContext_boring.swift")
|
||||
|
||||
target_include_directories(_CryptoExtras PRIVATE
|
||||
$<TARGET_PROPERTY:CCryptoBoringSSL,INCLUDE_DIRECTORIES>
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import CCryptoBoringSSL
|
||||
import CCryptoBoringSSLShims
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
@_implementationOnly import CCryptoBoringSSLShims
|
||||
import Crypto
|
||||
import CryptoBoringWrapper
|
||||
@_implementationOnly import CryptoBoringWrapper
|
||||
import Foundation
|
||||
|
||||
enum OpenSSLChaCha20CTRImpl {
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import CCryptoBoringSSL
|
||||
import CCryptoBoringSSLShims
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
@_implementationOnly import CCryptoBoringSSLShims
|
||||
import Crypto
|
||||
import CryptoBoringWrapper
|
||||
@_implementationOnly import CryptoBoringWrapper
|
||||
#if canImport(Darwin) || swift(>=5.9.1)
|
||||
import Foundation
|
||||
#else
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../../.PrivacyInfo.xcprivacy
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSPrivacyTracking</key>
|
||||
<false/>
|
||||
<key>NSPrivacyAccessedAPITypes</key>
|
||||
<array/>
|
||||
<key>NSPrivacyCollectedDataTypes</key>
|
||||
<array/>
|
||||
<key>NSPrivacyTrackingDomains</key>
|
||||
<array/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -83,6 +83,12 @@ extension _RSA.BlindSigning {
|
||||
}
|
||||
}
|
||||
|
||||
/// Construct a RSA public key with the specified parameters.
|
||||
public init(n: some ContiguousBytes, e: some ContiguousBytes, parameters: Parameters) throws {
|
||||
self.backing = try BackingPublicKey(n: n, e: e)
|
||||
self.parameters = parameters
|
||||
}
|
||||
|
||||
public var pkcs1DERRepresentation: Data {
|
||||
self.backing.pkcs1DERRepresentation
|
||||
}
|
||||
@@ -171,6 +177,12 @@ extension _RSA.BlindSigning {
|
||||
}
|
||||
}
|
||||
|
||||
/// Construct an RSA private key with the specified parameters.
|
||||
public init(n: some ContiguousBytes, e: some ContiguousBytes, d: some ContiguousBytes, p: some ContiguousBytes, q: some ContiguousBytes, parameters: Parameters) throws {
|
||||
self.backing = try BackingPrivateKey(n: n, e: e, d: d, p: p, q: q)
|
||||
self.parameters = parameters
|
||||
}
|
||||
|
||||
/// Randomly generate a new RSA private key of a given size.
|
||||
///
|
||||
/// This constructor will refuse to generate keys smaller than 2048 bits. Callers that want to enforce minimum
|
||||
|
||||
@@ -98,6 +98,17 @@ extension _RSA.Signing {
|
||||
}
|
||||
}
|
||||
|
||||
/// Construct an RSA public key with the specified parameters.
|
||||
///
|
||||
/// Only the BoringSSL backend provides APIs to create a key from its parameters so we first create a BoringSSL
|
||||
/// key, and then pass it to the platform-specific initializer that accepts a BoringSSL key.
|
||||
///
|
||||
/// On Darwin platforms, this will serialize it to PEM format, and then construct a platform-specific key from
|
||||
/// the PEM representation.
|
||||
public init(n: some ContiguousBytes, e: some ContiguousBytes) throws {
|
||||
self.backing = try BackingPublicKey(BoringSSLRSAPublicKey(n: n, e: e))
|
||||
}
|
||||
|
||||
public var pkcs1DERRepresentation: Data {
|
||||
self.backing.pkcs1DERRepresentation
|
||||
}
|
||||
@@ -178,6 +189,17 @@ extension _RSA.Signing {
|
||||
}
|
||||
}
|
||||
|
||||
/// Construct an RSA private key with the specified parameters.
|
||||
///
|
||||
/// Only the BoringSSL backend provides APIs to create a key from its parameters so we first create a BoringSSL
|
||||
/// key, and then pass it to the platform-specific initializer that accepts a BoringSSL key.
|
||||
///
|
||||
/// On Darwin platforms, this will serialize it to DER format, and then construct a platform-specific key from
|
||||
/// the DER representation.
|
||||
public init(n: some ContiguousBytes, e: some ContiguousBytes, d: some ContiguousBytes, p: some ContiguousBytes, q: some ContiguousBytes) throws {
|
||||
self.backing = try BackingPrivateKey(BoringSSLRSAPrivateKey(n: n, e: e, d: d, p: p, q: q))
|
||||
}
|
||||
|
||||
/// Randomly generate a new RSA private key of a given size.
|
||||
///
|
||||
/// This constructor will refuse to generate keys smaller than 2048 bits. Callers that want to enforce minimum
|
||||
@@ -444,6 +466,17 @@ extension _RSA.Encryption {
|
||||
guard self.keySizeInBits >= 1024, self.keySizeInBits % 8 == 0 else { throw CryptoKitError.incorrectParameterSize }
|
||||
}
|
||||
|
||||
/// Construct an RSA public key with the specified parameters.
|
||||
///
|
||||
/// Only the BoringSSL backend provides APIs to create a key from its parameters so we first create a BoringSSL
|
||||
/// key, and then pass it to the platform-specific initializer that accepts a BoringSSL key.
|
||||
///
|
||||
/// On Darwin platforms, this will serialize it to DER format, and then construct a platform-specific key from
|
||||
/// the DER representation.
|
||||
public init(n: some ContiguousBytes, e: some ContiguousBytes) throws {
|
||||
self.backing = try BackingPublicKey(BoringSSLRSAPublicKey(n: n, e: e))
|
||||
}
|
||||
|
||||
public var pkcs1DERRepresentation: Data { self.backing.pkcs1DERRepresentation }
|
||||
public var pkcs1PEMRepresentation: String { self.backing.pkcs1PEMRepresentation }
|
||||
public var derRepresentation: Data { self.backing.derRepresentation }
|
||||
@@ -494,6 +527,18 @@ extension _RSA.Encryption {
|
||||
guard self.keySizeInBits >= 1024, self.keySizeInBits % 8 == 0 else { throw CryptoKitError.incorrectParameterSize }
|
||||
}
|
||||
|
||||
|
||||
/// Construct an RSA private key with the specified parameters.
|
||||
///
|
||||
/// Only the BoringSSL backend provides APIs to create a key from its parameters so we first create a BoringSSL
|
||||
/// key, and then pass it to the platform-specific initializer that accepts a BoringSSL key.
|
||||
///
|
||||
/// On Darwin platforms, this will serialize it to PEM format, and then construct a platform-specific key from
|
||||
/// the PEM representation.
|
||||
public init(n: some ContiguousBytes, e: some ContiguousBytes, d: some ContiguousBytes, p: some ContiguousBytes, q: some ContiguousBytes) throws {
|
||||
self.backing = try BackingPrivateKey(BoringSSLRSAPrivateKey(n: n, e: e, d: d, p: p, q: q))
|
||||
}
|
||||
|
||||
/// Randomly generate a new RSA private key of a given size.
|
||||
///
|
||||
/// This constructor will refuse to generate keys smaller than 2048 bits. Callers that want to enforce minimum
|
||||
|
||||
@@ -15,9 +15,8 @@ import Foundation
|
||||
import Crypto
|
||||
|
||||
// NOTE: This file is unconditionally compiled because RSABSSA is implemented using BoringSSL on all platforms.
|
||||
import CCryptoBoringSSL
|
||||
import CCryptoBoringSSLShims
|
||||
import CryptoBoringWrapper
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
@_implementationOnly import CCryptoBoringSSLShims
|
||||
|
||||
internal struct BoringSSLRSAPublicKey: Sendable {
|
||||
private var backing: Backing
|
||||
@@ -30,6 +29,14 @@ internal struct BoringSSLRSAPublicKey: Sendable {
|
||||
self.backing = try Backing(derRepresentation: derRepresentation)
|
||||
}
|
||||
|
||||
init(n: some ContiguousBytes, e: some ContiguousBytes) throws {
|
||||
self.backing = try Backing(n: n, e: e)
|
||||
}
|
||||
|
||||
init(_ other: BoringSSLRSAPublicKey) throws {
|
||||
self = other
|
||||
}
|
||||
|
||||
var pkcs1DERRepresentation: Data {
|
||||
self.backing.pkcs1DERRepresentation
|
||||
}
|
||||
@@ -67,6 +74,14 @@ internal struct BoringSSLRSAPrivateKey: Sendable {
|
||||
self.backing = try Backing(derRepresentation: derRepresentation)
|
||||
}
|
||||
|
||||
init(n: some ContiguousBytes, e: some ContiguousBytes, d: some ContiguousBytes, p: some ContiguousBytes, q: some ContiguousBytes) throws {
|
||||
self.backing = try Backing(n: n, e: e, d: d, p: p, q: q)
|
||||
}
|
||||
|
||||
init(_ other: BoringSSLRSAPrivateKey) throws {
|
||||
self = other
|
||||
}
|
||||
|
||||
init(keySize: _RSA.Signing.KeySize) throws {
|
||||
self.backing = try Backing(keySize: keySize)
|
||||
}
|
||||
@@ -223,6 +238,20 @@ extension BoringSSLRSAPublicKey {
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate init(n: some ContiguousBytes, e: some ContiguousBytes) throws {
|
||||
self.pointer = CCryptoBoringSSL_EVP_PKEY_new()
|
||||
let n = try ArbitraryPrecisionInteger(bytes: n)
|
||||
let e = try ArbitraryPrecisionInteger(bytes: e)
|
||||
|
||||
// Create BoringSSL RSA key.
|
||||
guard let rsaPtr = n.withUnsafeBignumPointer({ n in
|
||||
e.withUnsafeBignumPointer { e in
|
||||
CCryptoBoringSSL_RSA_new_public_key(n, e)
|
||||
}
|
||||
}) else { throw CryptoKitError.internalBoringSSLError() }
|
||||
CCryptoBoringSSL_EVP_PKEY_assign_RSA(self.pointer, rsaPtr)
|
||||
}
|
||||
|
||||
fileprivate var pkcs1DERRepresentation: Data {
|
||||
return BIOHelper.withWritableMemoryBIO { bio in
|
||||
let rsaPublicKey = CCryptoBoringSSL_EVP_PKEY_get0_RSA(self.pointer)
|
||||
@@ -487,6 +516,43 @@ extension BoringSSLRSAPrivateKey {
|
||||
CCryptoBoringSSL_EVP_PKEY_assign_RSA(self.pointer, rsaPrivateKey)
|
||||
}
|
||||
|
||||
|
||||
fileprivate init(n: some ContiguousBytes, e: some ContiguousBytes, d: some ContiguousBytes, p: some ContiguousBytes, q: some ContiguousBytes) throws {
|
||||
self.pointer = CCryptoBoringSSL_EVP_PKEY_new()
|
||||
let n = try ArbitraryPrecisionInteger(bytes: n)
|
||||
let e = try ArbitraryPrecisionInteger(bytes: e)
|
||||
let d = try ArbitraryPrecisionInteger(bytes: d)
|
||||
let p = try ArbitraryPrecisionInteger(bytes: p)
|
||||
let q = try ArbitraryPrecisionInteger(bytes: q)
|
||||
|
||||
// Compute the CRT params.
|
||||
let dp = try FiniteFieldArithmeticContext(fieldSize: p - 1).residue(d)
|
||||
let dq = try FiniteFieldArithmeticContext(fieldSize: q - 1).residue(d)
|
||||
guard let qi = try FiniteFieldArithmeticContext(fieldSize: p).inverse(q) else {
|
||||
throw CryptoKitError.internalBoringSSLError()
|
||||
}
|
||||
|
||||
// Create BoringSSL RSA key.
|
||||
guard let rsaPtr = n.withUnsafeBignumPointer({ n in
|
||||
e.withUnsafeBignumPointer { e in
|
||||
d.withUnsafeBignumPointer { d in
|
||||
p.withUnsafeBignumPointer { p in
|
||||
q.withUnsafeBignumPointer { q in
|
||||
dp.withUnsafeBignumPointer { dp in
|
||||
dq.withUnsafeBignumPointer { dq in
|
||||
qi.withUnsafeBignumPointer { qi in
|
||||
CCryptoBoringSSL_RSA_new_private_key(n, e, d, p, q, dp, dq, qi)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}) else { throw CryptoKitError.internalBoringSSLError() }
|
||||
CCryptoBoringSSL_EVP_PKEY_assign_RSA(self.pointer, rsaPtr)
|
||||
}
|
||||
|
||||
private static func pkcs8DERPrivateKey<Bytes: ContiguousBytes>(_ derRepresentation: Bytes) -> OpaquePointer? {
|
||||
return derRepresentation.withUnsafeBytes { derPtr in
|
||||
return BIOHelper.withReadOnlyMemoryBIO(wrapping: derPtr) { bio in
|
||||
|
||||
@@ -43,6 +43,10 @@ internal struct SecurityRSAPublicKey: @unchecked Sendable {
|
||||
self.backing = unwrappedKey
|
||||
}
|
||||
|
||||
init(_ boringSSLKey: BoringSSLRSAPublicKey) throws {
|
||||
try self.init(derRepresentation: boringSSLKey.derRepresentation)
|
||||
}
|
||||
|
||||
var pkcs1DERRepresentation: Data {
|
||||
var error: Unmanaged<CFError>? = nil
|
||||
let representation = SecKeyCopyExternalRepresentation(self.backing, &error)
|
||||
@@ -135,6 +139,10 @@ internal struct SecurityRSAPrivateKey: @unchecked Sendable {
|
||||
self.backing = unwrappedKey
|
||||
}
|
||||
|
||||
init(_ boringSSLKey: BoringSSLRSAPrivateKey) throws {
|
||||
try self.init(derRepresentation: boringSSLKey.derRepresentation)
|
||||
}
|
||||
|
||||
var derRepresentation: Data {
|
||||
var error: Unmanaged<CFError>? = nil
|
||||
let representation = SecKeyCopyExternalRepresentation(self.backing, &error)
|
||||
|
||||
@@ -13,9 +13,8 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// NOTE: This file is unconditionally compiled because RSABSSA is implemented using BoringSSL on all platforms.
|
||||
import CCryptoBoringSSL
|
||||
import CCryptoBoringSSLShims
|
||||
import CryptoBoringWrapper
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
@_implementationOnly import CCryptoBoringSSLShims
|
||||
import Foundation
|
||||
import Crypto
|
||||
|
||||
@@ -93,86 +92,3 @@ extension FixedWidthInteger {
|
||||
return try block(&bn)
|
||||
}
|
||||
}
|
||||
|
||||
extension _RSA.BlindSigning.PublicKey {
|
||||
/// Construct a platform-specific RSA public key with the specified parameters.
|
||||
///
|
||||
/// This constructor is used in tests in cases where test vectors provide the key information this way.
|
||||
///
|
||||
/// Only the BoringSSL backend provides APIs to create the key from its parameters so we first create a BoringSSL
|
||||
/// key, serialize it to PEM format, and then construct a platform specific key from the PEM representation.
|
||||
internal init(nHexString: String, eHexString: String, parameters: Parameters) throws {
|
||||
let n = try ArbitraryPrecisionInteger(hexString: nHexString)
|
||||
let e = try ArbitraryPrecisionInteger(hexString: eHexString)
|
||||
|
||||
// Create BoringSSL RSA key.
|
||||
guard let rsaPtr = n.withUnsafeBignumPointer({ n in
|
||||
e.withUnsafeBignumPointer { e in
|
||||
CCryptoBoringSSL_RSA_new_public_key(n, e)
|
||||
}
|
||||
}) else { throw CryptoKitError.internalBoringSSLError() }
|
||||
defer { CCryptoBoringSSL_RSA_free(rsaPtr) }
|
||||
|
||||
// Get PEM representation for key.
|
||||
let pemRepresentation = BIOHelper.withWritableMemoryBIO { bio in
|
||||
precondition(CCryptoBoringSSL_PEM_write_bio_RSAPublicKey(bio, rsaPtr) == 1)
|
||||
return try! String(copyingUTF8MemoryBIO: bio)
|
||||
}
|
||||
|
||||
// Create a key (which might be backed by Security framework) from PEM representation.
|
||||
try self.init(pemRepresentation: pemRepresentation, parameters: parameters)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extension _RSA.BlindSigning.PrivateKey {
|
||||
/// Construct a platform-specific RSA private key with the specified parameters.
|
||||
///
|
||||
/// This constructor is used in tests in cases where test vectors provide the key information this way.
|
||||
///
|
||||
/// Only the BoringSSL backend provides APIs to create the key from its parameters so we first create a BoringSSL
|
||||
/// key, serialize it to PEM format, and then construct a platform specific key from the PEM representation.
|
||||
internal init(nHexString: String, eHexString: String, dHexString: String, pHexString: String, qHexString: String, parameters: Parameters) throws {
|
||||
let n = try ArbitraryPrecisionInteger(hexString: nHexString)
|
||||
let e = try ArbitraryPrecisionInteger(hexString: eHexString)
|
||||
let d = try ArbitraryPrecisionInteger(hexString: dHexString)
|
||||
let p = try ArbitraryPrecisionInteger(hexString: pHexString)
|
||||
let q = try ArbitraryPrecisionInteger(hexString: qHexString)
|
||||
|
||||
// Compute the CRT params.
|
||||
let dp = try FiniteFieldArithmeticContext(fieldSize: p - 1).residue(d)
|
||||
let dq = try FiniteFieldArithmeticContext(fieldSize: q - 1).residue(d)
|
||||
guard let qi = try FiniteFieldArithmeticContext(fieldSize: p).inverse(q) else {
|
||||
throw CryptoKitError.internalBoringSSLError()
|
||||
}
|
||||
|
||||
// Create BoringSSL RSA key.
|
||||
guard let rsaPtr = n.withUnsafeBignumPointer({ n in
|
||||
e.withUnsafeBignumPointer { e in
|
||||
d.withUnsafeBignumPointer { d in
|
||||
p.withUnsafeBignumPointer { p in
|
||||
q.withUnsafeBignumPointer { q in
|
||||
dp.withUnsafeBignumPointer { dp in
|
||||
dq.withUnsafeBignumPointer { dq in
|
||||
qi.withUnsafeBignumPointer { qi in
|
||||
CCryptoBoringSSL_RSA_new_private_key(n, e, d, p, q, dp, dq, qi)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}) else { throw CryptoKitError.internalBoringSSLError() }
|
||||
defer { CCryptoBoringSSL_RSA_free(rsaPtr) }
|
||||
|
||||
// Get PEM representation for key.
|
||||
let pemRepresentation = BIOHelper.withWritableMemoryBIO { bio in
|
||||
precondition(CCryptoBoringSSL_PEM_write_bio_RSAPrivateKey(bio, rsaPtr, nil, nil, 0, nil, nil) == 1)
|
||||
return try! String(copyingUTF8MemoryBIO: bio)
|
||||
}
|
||||
|
||||
// Create a key (which might be backed by Security framework) from PEM representation.
|
||||
try self.init(pemRepresentation: pemRepresentation, parameters: parameters)
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import CCryptoBoringSSL
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
import Crypto
|
||||
|
||||
extension CryptoKitError {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// NOTE: This file is unconditionally compiled because RSABSSA is implemented using BoringSSL on all platforms.
|
||||
import CCryptoBoringSSL
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
import Crypto
|
||||
|
||||
struct DigestType {
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
../../Crypto/Util/BoringSSL/Shared
|
||||
+7
-4
@@ -11,7 +11,9 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
@testable import CryptoBoringWrapper
|
||||
#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
#else
|
||||
@testable import Crypto
|
||||
import XCTest
|
||||
|
||||
final class ArbitraryPrecisionIntegerTests: XCTestCase {
|
||||
@@ -41,7 +43,7 @@ final class ArbitraryPrecisionIntegerTests: XCTestCase {
|
||||
func testPositiveSquareRoot() {
|
||||
XCTAssertNoThrow(XCTAssertEqual(try ArbitraryPrecisionInteger(144).positiveSquareRoot(), 12))
|
||||
XCTAssertThrowsError(try ArbitraryPrecisionInteger(101).positiveSquareRoot()) { error in
|
||||
guard case .some(.underlyingCoreCryptoError) = error as? CryptoBoringWrapperError else {
|
||||
guard case .some(.underlyingCoreCryptoError) = error as? CryptoKitError else {
|
||||
XCTFail("Unexpected error: \(error)")
|
||||
return
|
||||
}
|
||||
@@ -148,8 +150,8 @@ final class ArbitraryPrecisionIntegerTests: XCTestCase {
|
||||
XCTAssertEqual(try ArbitraryPrecisionInteger.random(inclusiveMin: 4, exclusiveMax: 5), 4)
|
||||
|
||||
var previousRandom = ArbitraryPrecisionInteger()
|
||||
for _ in 1...1_000 {
|
||||
let exclusiveMax = try ArbitraryPrecisionInteger(bytes: Data(repeating: UInt8.max, count: 2048/8))
|
||||
for _ in 1 ... 1000 {
|
||||
let exclusiveMax = try ArbitraryPrecisionInteger(bytes: Data(repeating: UInt8.max, count: 2048 / 8))
|
||||
let random = try ArbitraryPrecisionInteger.random(inclusiveMin: 42, exclusiveMax: exclusiveMax)
|
||||
XCTAssert(random >= ArbitraryPrecisionInteger(42))
|
||||
XCTAssert(random < exclusiveMax)
|
||||
@@ -166,3 +168,4 @@ final class ArbitraryPrecisionIntegerTests: XCTestCase {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
+9
-7
@@ -11,10 +11,11 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
@testable import CryptoBoringWrapper
|
||||
#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
#else
|
||||
@testable import Crypto
|
||||
import XCTest
|
||||
|
||||
|
||||
final class FiniteFieldArithmeticTests: XCTestCase {
|
||||
func testResidue() throws {
|
||||
let ff = try FiniteFieldArithmeticContext(fieldSize: 3)
|
||||
@@ -85,7 +86,7 @@ final class FiniteFieldArithmeticTests: XCTestCase {
|
||||
XCTAssertEqual(try ff.inverse(4), 1)
|
||||
XCTAssertEqual(try ff.inverse(5), 2)
|
||||
XCTAssertEqual(try ff.inverse(6), nil)
|
||||
for i: Int64 in 1...100 {
|
||||
for i: Int64 in 1 ... 100 {
|
||||
let integer = ArbitraryPrecisionInteger(integerLiteral: i)
|
||||
let inverse = try ff.inverse(integer)
|
||||
if i % 3 == 0 {
|
||||
@@ -104,8 +105,8 @@ final class FiniteFieldArithmeticTests: XCTestCase {
|
||||
(2, 0, 1), (2, 1, 2), (2, 2, 4), (2, 3, 1),
|
||||
(3, 0, 1), (3, 1, 3), (3, 2, 2), (3, 3, 6),
|
||||
(5, 0, 1), (5, 1, 5), (5, 2, 4), (5, 3, 6),
|
||||
(7, 0, 1), (7, 1, 0), (7, 2, 0), (7, 3, 0), // x = m
|
||||
(8, 0, 1), (8, 1, 1), (8, 2, 1), (8, 3, 1), // x > m
|
||||
(7, 0, 1), (7, 1, 0), (7, 2, 0), (7, 3, 0), // x = m
|
||||
(8, 0, 1), (8, 1, 1), (8, 2, 1), (8, 3, 1), // x > m
|
||||
] {
|
||||
let message = "\(x)^\(p) (mod \(m))"
|
||||
XCTAssertEqual(try ff.pow(x, p), expectedResult, message)
|
||||
@@ -114,8 +115,8 @@ final class FiniteFieldArithmeticTests: XCTestCase {
|
||||
XCTAssertEqual(try ff.pow(secret: x, secret: p), expectedResult, message)
|
||||
} else {
|
||||
XCTAssertThrowsError(try ff.pow(secret: x, p), message) { error in
|
||||
switch (error as? CryptoBoringWrapperError) {
|
||||
case .incorrectParameterSize: break // OK
|
||||
switch error as? CryptoKitError {
|
||||
case .incorrectParameterSize: break // OK
|
||||
default: XCTFail("Unexpected error: \(error)")
|
||||
}
|
||||
}
|
||||
@@ -123,3 +124,4 @@ final class FiniteFieldArithmeticTests: XCTestCase {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
@@ -20,7 +20,7 @@ import XCTest
|
||||
#if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
@testable import CryptoKit
|
||||
#else
|
||||
import CCryptoBoringSSL
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
@testable import Crypto
|
||||
#endif
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import XCTest
|
||||
#if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
@testable import CryptoKit
|
||||
#else
|
||||
import CCryptoBoringSSL
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
@testable import Crypto
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the SwiftCrypto open source project
|
||||
//
|
||||
// Copyright (c) 2024 Apple Inc. and the SwiftCrypto project authors
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import Crypto
|
||||
@testable import _CryptoExtras
|
||||
import XCTest
|
||||
|
||||
final class AES_CFBTests: XCTestCase {
|
||||
/// Test vectors from NIST, of the following form:
|
||||
/// ```
|
||||
/// COUNT = 0
|
||||
/// KEY = 00000000000000000000000000000000
|
||||
/// IV = f34481ec3cc627bacd5dc3fb08f273e6
|
||||
/// PLAINTEXT = 00000000000000000000000000000000
|
||||
/// CIPHERTEXT = 0336763e966d92595a567cc9ce537f5e
|
||||
/// ```
|
||||
/// —— source: https://csrc.nist.gov/projects/cryptographic-algorithm-validation-program/block-ciphers
|
||||
struct TestVector: Codable {
|
||||
var count: Int
|
||||
var key: [UInt8]
|
||||
var iv: [UInt8]
|
||||
var plaintext: [UInt8]
|
||||
var ciphertext: [UInt8]
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case count = "COUNT"
|
||||
case key = "KEY"
|
||||
case iv = "IV"
|
||||
case plaintext = "PLAINTEXT"
|
||||
case ciphertext = "CIPHERTEXT"
|
||||
}
|
||||
}
|
||||
|
||||
func testVector(_ vector: TestVector) throws {
|
||||
let (contiguousPlaintextData, discontiguousPlaintextData) = vector.plaintext.asDataProtocols()
|
||||
for plaintextData in [contiguousPlaintextData as DataProtocol, discontiguousPlaintextData as DataProtocol] {
|
||||
let key = SymmetricKey(data: Data(vector.key))
|
||||
let iv = try AES._CFB.IV(ivBytes: vector.iv)
|
||||
let ciphertext = try AES._CFB.encrypt(plaintextData, using: key, iv: iv)
|
||||
XCTAssertEqual(ciphertext, Data(vector.ciphertext))
|
||||
}
|
||||
}
|
||||
|
||||
func testVectorsFrom(fileName: String) throws {
|
||||
var decoder = try RFCVectorDecoder(bundleType: self, fileName: fileName)
|
||||
let vectors = try decoder.decode([TestVector].self)
|
||||
for vector in vectors {
|
||||
try self.testVector(vector)
|
||||
}
|
||||
}
|
||||
|
||||
func testVectors() throws {
|
||||
try self.testVectorsFrom(fileName: "AESCFB128GFSbox128")
|
||||
try self.testVectorsFrom(fileName: "AESCFB128GFSbox128")
|
||||
try self.testVectorsFrom(fileName: "AESCFB128GFSbox128")
|
||||
try self.testVectorsFrom(fileName: "AESCFB128GFSbox192")
|
||||
try self.testVectorsFrom(fileName: "AESCFB128GFSbox256")
|
||||
try self.testVectorsFrom(fileName: "AESCFB128KeySbox128")
|
||||
try self.testVectorsFrom(fileName: "AESCFB128KeySbox192")
|
||||
try self.testVectorsFrom(fileName: "AESCFB128KeySbox256")
|
||||
try self.testVectorsFrom(fileName: "AESCFB128VarKey128")
|
||||
try self.testVectorsFrom(fileName: "AESCFB128VarKey192")
|
||||
try self.testVectorsFrom(fileName: "AESCFB128VarKey256")
|
||||
try self.testVectorsFrom(fileName: "AESCFB128VarTxt128")
|
||||
try self.testVectorsFrom(fileName: "AESCFB128VarTxt192")
|
||||
try self.testVectorsFrom(fileName: "AESCFB128VarTxt256")
|
||||
}
|
||||
|
||||
func testRoundtrip() throws {
|
||||
let key = SymmetricKey(size: .bits128)
|
||||
let plaintext = Data(SystemRandomNumberGenerator.randomBytes(count: 1024))
|
||||
let iv = AES._CFB.IV()
|
||||
let ciphertext = try AES._CFB.encrypt(plaintext, using: key, iv: iv)
|
||||
XCTAssertEqual(try AES._CFB.decrypt(ciphertext, using: key, iv: iv), plaintext)
|
||||
}
|
||||
|
||||
func testRejectsInvalidIVSizes() throws {
|
||||
let someBytes = Array(repeating: UInt8(0), count: 24)
|
||||
|
||||
for count in 0..<someBytes.count {
|
||||
let ivBytes = someBytes.prefix(count)
|
||||
|
||||
if count != 16 {
|
||||
XCTAssertThrowsError(try AES._CFB.IV(ivBytes: ivBytes))
|
||||
} else {
|
||||
XCTAssertNoThrow(try AES._CFB.IV(ivBytes: ivBytes))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ import XCTest
|
||||
import Crypto
|
||||
@testable import _CryptoExtras
|
||||
|
||||
fileprivate struct TestVector: Codable {
|
||||
struct RFC9474TestVector: Codable {
|
||||
var name, p, q, n, e, d, msg, msg_prefix, prepared_msg, salt, inv, blinded_msg, blind_sig, sig: String
|
||||
|
||||
var parameters: _RSA.BlindSigning.Parameters<SHA384> {
|
||||
@@ -40,19 +40,33 @@ fileprivate struct TestVector: Codable {
|
||||
let decoder = JSONDecoder()
|
||||
return try decoder.decode([Self].self, from: json)
|
||||
}
|
||||
|
||||
static let allValues: [Self] = try! RFC9474TestVector.load(from: URL(
|
||||
fileURLWithPath: "../_CryptoExtrasVectors/rfc9474.json",
|
||||
relativeTo: URL(fileURLWithPath: #file)
|
||||
))
|
||||
}
|
||||
|
||||
final class TestRSABlindSigning: XCTestCase {
|
||||
func testAgainstRFC9474TestVectors() throws {
|
||||
let testVectors = try TestVector.load(from: URL(
|
||||
fileURLWithPath: "../_CryptoExtrasVectors/rfc9474.json",
|
||||
relativeTo: URL(fileURLWithPath: #file)
|
||||
))
|
||||
|
||||
for testVector in testVectors {
|
||||
for testVector in RFC9474TestVector.allValues {
|
||||
// Load key pair
|
||||
let privateKey = try _RSA.BlindSigning.PrivateKey(
|
||||
n: Data(hexString: testVector.n),
|
||||
e: Data(hexString: testVector.e),
|
||||
d: Data(hexString: testVector.d),
|
||||
p: Data(hexString: testVector.p),
|
||||
q: Data(hexString: testVector.q),
|
||||
parameters: testVector.parameters
|
||||
)
|
||||
let publicKey = try _RSA.BlindSigning.PublicKey(
|
||||
n: Data(hexString: testVector.n),
|
||||
e: Data(hexString: testVector.e),
|
||||
parameters: testVector.parameters
|
||||
)
|
||||
XCTAssertEqual(publicKey.derRepresentation, privateKey.publicKey.derRepresentation)
|
||||
// Prepare
|
||||
do {
|
||||
let publicKey = try _RSA.BlindSigning.PublicKey(nHexString: testVector.n, eHexString: testVector.e, parameters: testVector.parameters)
|
||||
let message = try Data(hexString: testVector.msg)
|
||||
let preparedMessage = publicKey.prepare(message)
|
||||
switch testVector.parameters.preparation {
|
||||
@@ -65,7 +79,6 @@ final class TestRSABlindSigning: XCTestCase {
|
||||
|
||||
// Blind
|
||||
do {
|
||||
let publicKey = try _RSA.BlindSigning.PublicKey(nHexString: testVector.n, eHexString: testVector.e, parameters: testVector.parameters)
|
||||
let preparedMessage = try _RSA.BlindSigning.PreparedMessage(rawRepresentation: Data(hexString: testVector.prepared_msg))
|
||||
let blindingResult = try publicKey.blind(preparedMessage)
|
||||
// NOTE: Sadly we can't validate the blinded message against the test vectors because BoringSSL doesn't
|
||||
@@ -76,14 +89,6 @@ final class TestRSABlindSigning: XCTestCase {
|
||||
|
||||
// BlindSign
|
||||
do {
|
||||
let privateKey = try _RSA.BlindSigning.PrivateKey(
|
||||
nHexString: testVector.n,
|
||||
eHexString: testVector.e,
|
||||
dHexString: testVector.d,
|
||||
pHexString: testVector.p,
|
||||
qHexString: testVector.q,
|
||||
parameters: testVector.parameters
|
||||
)
|
||||
let blindedMessage = try Data(hexString: testVector.blinded_msg)
|
||||
let blindSignature = try privateKey.blindSignature(for: blindedMessage)
|
||||
XCTAssertEqual(
|
||||
@@ -94,7 +99,6 @@ final class TestRSABlindSigning: XCTestCase {
|
||||
|
||||
// Finalize
|
||||
do {
|
||||
let publicKey = try _RSA.BlindSigning.PublicKey(nHexString: testVector.n, eHexString: testVector.e, parameters: testVector.parameters)
|
||||
let blindSignature = try _RSA.BlindSigning.BlindSignature(rawRepresentation: Data(hexString: testVector.blind_sig))
|
||||
let preparedMessage = try _RSA.BlindSigning.PreparedMessage(rawRepresentation: Data(hexString: testVector.prepared_msg))
|
||||
let blindingInverse = try _RSA.BlindSigning.BlindingInverse(rawRepresentation: Data(hexString: testVector.inv))
|
||||
@@ -107,7 +111,6 @@ final class TestRSABlindSigning: XCTestCase {
|
||||
|
||||
// Verification
|
||||
do {
|
||||
let publicKey = try _RSA.BlindSigning.PublicKey(nHexString: testVector.n, eHexString: testVector.e, parameters: testVector.parameters)
|
||||
let signature = try _RSA.Signing.RSASignature(rawRepresentation: Data(hexString: testVector.sig))
|
||||
let preparedMessage = try _RSA.BlindSigning.PreparedMessage(rawRepresentation: Data(hexString: testVector.prepared_msg))
|
||||
XCTAssert(publicKey.isValidSignature(signature, for: preparedMessage))
|
||||
@@ -164,4 +167,39 @@ final class TestRSABlindSigning: XCTestCase {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testConstructKeyFromRSANumbers() throws {
|
||||
/// Check we can successfully construct keys from known valid values from a test vector.
|
||||
for testVector in RFC9474TestVector.allValues {
|
||||
_ = try _RSA.BlindSigning.PrivateKey(
|
||||
n: Data(hexString: testVector.n),
|
||||
e: Data(hexString: testVector.e),
|
||||
d: Data(hexString: testVector.d),
|
||||
p: Data(hexString: testVector.p),
|
||||
q: Data(hexString: testVector.q),
|
||||
parameters: testVector.parameters
|
||||
)
|
||||
_ = try _RSA.BlindSigning.PublicKey(
|
||||
n: Data(hexString: testVector.n),
|
||||
e: Data(hexString: testVector.e),
|
||||
parameters: testVector.parameters
|
||||
)
|
||||
}
|
||||
/// Also check that we can provide each argument as a different `ContiguousBytes` type.
|
||||
/// NOTE: these calls use `try?` because they are guaranteed to fail; we're just checking these calls compile.
|
||||
let bytesValues: [any ContiguousBytes] = [Data(), [UInt8]()]
|
||||
_ = try? _RSA.BlindSigning.PrivateKey(
|
||||
n: bytesValues.randomElement()!,
|
||||
e: bytesValues.randomElement()!,
|
||||
d: bytesValues.randomElement()!,
|
||||
p: bytesValues.randomElement()!,
|
||||
q: bytesValues.randomElement()!,
|
||||
parameters: .RSABSSA_SHA384_PSS_Randomized
|
||||
)
|
||||
_ = try? _RSA.BlindSigning.PublicKey(
|
||||
n: bytesValues.randomElement()!,
|
||||
e: bytesValues.randomElement()!,
|
||||
parameters: .RSABSSA_SHA384_PSS_Randomized
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -77,6 +77,37 @@ final class TestRSAEncryption: XCTestCase {
|
||||
XCTAssertEqual(valid, test.expectedValidity, "test number \(test.tcId) failed, expected \(test.result) but got \(valid)")
|
||||
}
|
||||
}
|
||||
|
||||
func testConstructKeyFromRSANumbers() throws {
|
||||
/// Check we can successfully construct keys from known valid values from a test vector.
|
||||
for testVector in RFC9474TestVector.allValues {
|
||||
_ = try _RSA.Encryption.PrivateKey(
|
||||
n: Data(hexString: testVector.n),
|
||||
e: Data(hexString: testVector.e),
|
||||
d: Data(hexString: testVector.d),
|
||||
p: Data(hexString: testVector.p),
|
||||
q: Data(hexString: testVector.q)
|
||||
)
|
||||
_ = try _RSA.Encryption.PublicKey(
|
||||
n: Data(hexString: testVector.n),
|
||||
e: Data(hexString: testVector.e)
|
||||
)
|
||||
}
|
||||
/// Also check that we can provide each argument as a different `ContiguousBytes` type.
|
||||
/// NOTE: these calls use `try?` because they are guaranteed to fail; we're just checking these calls compile.
|
||||
let bytesValues: [any ContiguousBytes] = [Data(), [UInt8]()]
|
||||
_ = try? _RSA.Encryption.PrivateKey(
|
||||
n: bytesValues.randomElement()!,
|
||||
e: bytesValues.randomElement()!,
|
||||
d: bytesValues.randomElement()!,
|
||||
p: bytesValues.randomElement()!,
|
||||
q: bytesValues.randomElement()!
|
||||
)
|
||||
_ = try? _RSA.Encryption.PublicKey(
|
||||
n: bytesValues.randomElement()!,
|
||||
e: bytesValues.randomElement()!
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
struct RSAEncryptionOAEPTestGroup: Codable {
|
||||
|
||||
@@ -677,6 +677,37 @@ final class TestRSASigning: XCTestCase {
|
||||
XCTAssertEqual(pemKey, key.pkcs8PEMRepresentation)
|
||||
}
|
||||
|
||||
func testConstructKeyFromRSANumbers() throws {
|
||||
/// Check we can successfully construct keys from known valid values from a test vector.
|
||||
for testVector in RFC9474TestVector.allValues {
|
||||
_ = try _RSA.Signing.PrivateKey(
|
||||
n: Data(hexString: testVector.n),
|
||||
e: Data(hexString: testVector.e),
|
||||
d: Data(hexString: testVector.d),
|
||||
p: Data(hexString: testVector.p),
|
||||
q: Data(hexString: testVector.q)
|
||||
)
|
||||
_ = try _RSA.Signing.PublicKey(
|
||||
n: Data(hexString: testVector.n),
|
||||
e: Data(hexString: testVector.e)
|
||||
)
|
||||
}
|
||||
/// Also check that we can provide each argument as a different `ContiguousBytes` type.
|
||||
/// NOTE: these calls use `try?` because they are guaranteed to fail; we're just checking these calls compile.
|
||||
let bytesValues: [any ContiguousBytes] = [Data(), [UInt8]()]
|
||||
_ = try? _RSA.Signing.PrivateKey(
|
||||
n: bytesValues.randomElement()!,
|
||||
e: bytesValues.randomElement()!,
|
||||
d: bytesValues.randomElement()!,
|
||||
p: bytesValues.randomElement()!,
|
||||
q: bytesValues.randomElement()!
|
||||
)
|
||||
_ = try? _RSA.Signing.PublicKey(
|
||||
n: bytesValues.randomElement()!,
|
||||
e: bytesValues.randomElement()!
|
||||
)
|
||||
}
|
||||
|
||||
private func testPKCS1Group(_ group: RSAPKCS1TestGroup) throws {
|
||||
let derKey: _RSA.Signing.PublicKey
|
||||
let pemKey: _RSA.Signing.PublicKey
|
||||
|
||||
@@ -0,0 +1,289 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the SwiftCrypto open source project
|
||||
//
|
||||
// Copyright (c) 2019-2020 Apple Inc. and the SwiftCrypto project authors
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
import Foundation
|
||||
|
||||
/// This is a not-very-performant decoder of the RFC formatted test vectors.
|
||||
///
|
||||
/// It is not intended as a general-purpose example: it does exactly enough to be useful in our
|
||||
/// tests and nothing more.
|
||||
struct RFCVectorDecoder {
|
||||
private var rfcVectorData: String
|
||||
|
||||
private var decoded: [[String: String]]
|
||||
|
||||
private var index: Int?
|
||||
|
||||
init(bundleType: AnyObject, fileName: String) throws {
|
||||
let testsDirectory: String = URL(fileURLWithPath: "\(#file)").pathComponents.dropLast(3).joined(separator: "/")
|
||||
let fileURL: URL? = URL(fileURLWithPath: "\(testsDirectory)/_CryptoExtrasVectors/\(fileName).txt")
|
||||
|
||||
let rfcVectorData = try Data(contentsOf: fileURL!)
|
||||
self.rfcVectorData = String(decoding: rfcVectorData, as: Unicode.UTF8.self)
|
||||
self.decoded = RFCVectorDecoder.parse(data: self.rfcVectorData)
|
||||
}
|
||||
|
||||
init(copyOf decoder: RFCVectorDecoder, index: Int) {
|
||||
self.rfcVectorData = decoder.rfcVectorData
|
||||
self.decoded = decoder.decoded
|
||||
self.index = index
|
||||
}
|
||||
|
||||
mutating func decode<T: Decodable>(_ type: T.Type) throws -> T {
|
||||
return try T(from: self)
|
||||
}
|
||||
|
||||
private static func parse(data: String) -> [[String: String]] {
|
||||
// Split on lines.
|
||||
var lines = ArraySlice(data.split { $0.isNewline })
|
||||
|
||||
// Strip the leading elements.
|
||||
lines = lines.drop(while: { !$0.hasPrefix("COUNT") })
|
||||
|
||||
var decoded = [[String: String]]()
|
||||
|
||||
// Parse the elements
|
||||
while let element = lines.parseElement() {
|
||||
decoded.append(element)
|
||||
}
|
||||
assert(lines.count == 0)
|
||||
|
||||
return decoded
|
||||
}
|
||||
}
|
||||
|
||||
extension RFCVectorDecoder: Decoder {
|
||||
// We never allowed nested coding paths: they are always top-level, within an array.
|
||||
var codingPath: [CodingKey] {
|
||||
return []
|
||||
}
|
||||
|
||||
var userInfo: [CodingUserInfoKey: Any] { return [:] }
|
||||
|
||||
func container<Key>(keyedBy type: Key.Type) throws -> KeyedDecodingContainer<Key> where Key: CodingKey {
|
||||
guard let index = self.index else {
|
||||
throw Error.topLevelKeyedContainersNotSupported
|
||||
}
|
||||
|
||||
return KeyedDecodingContainer(_KeyedDecodingContainer(forElement: self.decoded[index], path: [], decoder: self))
|
||||
}
|
||||
|
||||
func unkeyedContainer() throws -> UnkeyedDecodingContainer {
|
||||
guard self.index == nil else {
|
||||
throw Error.nestedContainersNotSupported
|
||||
}
|
||||
return UnkeyedContainer(elements: self.decoded, decoder: self)
|
||||
}
|
||||
|
||||
func singleValueContainer() throws -> SingleValueDecodingContainer {
|
||||
guard self.index == nil else {
|
||||
throw Error.nestedContainersNotSupported
|
||||
}
|
||||
return SingleValueContainer()
|
||||
}
|
||||
}
|
||||
|
||||
extension RFCVectorDecoder {
|
||||
struct _KeyedDecodingContainer<Key: CodingKey>: KeyedDecodingContainerProtocol {
|
||||
private var element: [String: String]
|
||||
|
||||
private var decoder: RFCVectorDecoder
|
||||
|
||||
var codingPath: [CodingKey]
|
||||
|
||||
var allKeys: [Key] {
|
||||
self.element.keys.compactMap { Key(stringValue: $0) }
|
||||
}
|
||||
|
||||
init(forElement element: [String: String], path: [CodingKey], decoder: RFCVectorDecoder) {
|
||||
self.element = element
|
||||
self.codingPath = path
|
||||
self.decoder = decoder
|
||||
}
|
||||
|
||||
func contains(_ key: Key) -> Bool {
|
||||
return self.element.keys.contains(key.stringValue)
|
||||
}
|
||||
|
||||
func decode<T: Decodable>(_ type: T.Type, forKey key: Key) throws -> T {
|
||||
guard let stringResult = self.element[key.stringValue] else {
|
||||
throw Error.missingKey
|
||||
}
|
||||
|
||||
switch type {
|
||||
case is String.Type:
|
||||
return stringResult as! T
|
||||
case is [UInt8].Type:
|
||||
if stringResult.count == 0 {
|
||||
return [UInt8]() as! T
|
||||
} else {
|
||||
return try Array(hexString: stringResult) as! T
|
||||
}
|
||||
case is Int.Type:
|
||||
return Int(stringResult, radix: 10)! as! T
|
||||
default:
|
||||
throw Error.attemptToDecodeInvalidType
|
||||
}
|
||||
}
|
||||
|
||||
func decodeNil(forKey key: Key) throws -> Bool {
|
||||
return false // No support for nil today.
|
||||
}
|
||||
|
||||
func nestedContainer<NestedKey>(keyedBy type: NestedKey.Type, forKey key: Key) throws -> KeyedDecodingContainer<NestedKey> where NestedKey: CodingKey {
|
||||
throw Error.nestedContainersNotSupported
|
||||
}
|
||||
|
||||
func nestedUnkeyedContainer(forKey key: Key) throws -> UnkeyedDecodingContainer {
|
||||
throw Error.nestedContainersNotSupported
|
||||
}
|
||||
|
||||
func superDecoder() throws -> Decoder {
|
||||
return decoder
|
||||
}
|
||||
|
||||
func superDecoder(forKey key: Key) throws -> Decoder {
|
||||
return decoder
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension RFCVectorDecoder {
|
||||
struct UnkeyedContainer: UnkeyedDecodingContainer {
|
||||
private var elements: [[String: String]]
|
||||
|
||||
private var decoder: RFCVectorDecoder
|
||||
|
||||
var currentIndex: Int
|
||||
|
||||
var codingPath: [CodingKey] {
|
||||
// This is always at the root
|
||||
return []
|
||||
}
|
||||
|
||||
var count: Int? {
|
||||
return elements.count
|
||||
}
|
||||
|
||||
var isAtEnd: Bool {
|
||||
return self.currentIndex == self.elements.endIndex
|
||||
}
|
||||
|
||||
init(elements: [[String: String]], decoder: RFCVectorDecoder) {
|
||||
self.elements = elements
|
||||
self.decoder = decoder
|
||||
self.currentIndex = elements.startIndex
|
||||
}
|
||||
|
||||
mutating func decode<T>(_ type: T.Type) throws -> T where T: Decodable {
|
||||
let index = self.currentIndex
|
||||
self.elements.formIndex(after: &self.currentIndex)
|
||||
return try type.init(from: RFCVectorDecoder(copyOf: self.decoder, index: index))
|
||||
}
|
||||
|
||||
func decodeNil() throws -> Bool {
|
||||
return false // No support for nil today.
|
||||
}
|
||||
|
||||
mutating func nestedContainer<NestedKey>(keyedBy type: NestedKey.Type) throws -> KeyedDecodingContainer<NestedKey> where NestedKey: CodingKey {
|
||||
let index = self.currentIndex
|
||||
self.elements.formIndex(after: &self.currentIndex)
|
||||
return try RFCVectorDecoder(copyOf: self.decoder, index: index).container(keyedBy: type)
|
||||
}
|
||||
|
||||
func nestedUnkeyedContainer() throws -> UnkeyedDecodingContainer {
|
||||
throw Error.nestedContainersNotSupported
|
||||
}
|
||||
|
||||
func superDecoder() throws -> Decoder {
|
||||
return decoder
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension RFCVectorDecoder {
|
||||
// We don't support single values, but we need the type. It's unconstructable.
|
||||
struct SingleValueContainer: SingleValueDecodingContainer {
|
||||
var codingPath: [CodingKey] {
|
||||
// This is always at the root
|
||||
return []
|
||||
}
|
||||
|
||||
init() {
|
||||
fatalError("SingleValueContainer is unsupported")
|
||||
}
|
||||
|
||||
func decode<T>(_ type: T.Type) throws -> T where T: Decodable {
|
||||
fatalError("SingleValueContainer is unsupported")
|
||||
}
|
||||
|
||||
func decodeNil() -> Bool {
|
||||
fatalError("SingleValueContainer is unsupported")
|
||||
}
|
||||
|
||||
func nestedContainer<NestedKey>(keyedBy type: NestedKey.Type) throws -> KeyedDecodingContainer<NestedKey> where NestedKey: CodingKey {
|
||||
fatalError("SingleValueContainer is unsupported")
|
||||
}
|
||||
|
||||
func nestedUnkeyedContainer() throws -> UnkeyedDecodingContainer {
|
||||
fatalError("SingleValueContainer is unsupported")
|
||||
}
|
||||
|
||||
func superDecoder() throws -> Decoder {
|
||||
fatalError("SingleValueContainer is unsupported")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension RFCVectorDecoder {
|
||||
enum Error: Swift.Error {
|
||||
case attemptToDecodeInvalidType
|
||||
case missingKey
|
||||
case nestedContainersNotSupported
|
||||
case topLevelKeyedContainersNotSupported
|
||||
}
|
||||
}
|
||||
|
||||
extension ArraySlice where Element == Substring {
|
||||
/// Parses a single block. A block runs from a COUNT declaration to a COUNT declaration,
|
||||
/// includes the first and excludes the last.
|
||||
mutating func parseElement() -> [String: String]? {
|
||||
// We need to drop first here as the first index with COUNT is going to be startIndex.
|
||||
let nextCountIndex = self.dropFirst().firstIndex(where: { $0.hasPrefix("COUNT") }) ?? self.endIndex
|
||||
|
||||
// Grab the elements, removing any that are either empty strings, begin with # or [ characters,
|
||||
// or begin with whitespace (these are used in some cases and we don't want them). This is a brute
|
||||
// force comparison, but it's test code, don't worry about it.
|
||||
let elements: [(String, String)] = self[..<nextCountIndex].filter { string in
|
||||
return (string.trimmingCharacters(in: .whitespaces).count > 0 &&
|
||||
!string.hasPrefix("#") &&
|
||||
!string.hasPrefix("[") &&
|
||||
!string.first!.isWhitespace)
|
||||
}.map { string in
|
||||
let split = string.split(separator: "=", maxSplits: 1, omittingEmptySubsequences: false)
|
||||
assert(split.count == 2)
|
||||
return (String(split.first!.trimmingCharacters(in: .whitespaces)), String(split.last!).trimmingCharacters(in: .whitespaces))
|
||||
}
|
||||
|
||||
// Slice off the section we've parsed.
|
||||
self = self[nextCountIndex...]
|
||||
|
||||
// Now we split each element on = and turn them into a map, omitting the map when it's empty.
|
||||
let mappedElements = Dictionary(uniqueKeysWithValues: elements)
|
||||
if mappedElements.count > 0 {
|
||||
return mappedElements
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
# CAVS 11.1
|
||||
# Config info for aes_values
|
||||
# AESVS GFSbox test data for CFB128
|
||||
# State : Encrypt and Decrypt
|
||||
# Key Length : 128
|
||||
# Generated on Fri Apr 22 15:11:53 2011
|
||||
|
||||
[ENCRYPT]
|
||||
|
||||
COUNT = 0
|
||||
KEY = 00000000000000000000000000000000
|
||||
IV = f34481ec3cc627bacd5dc3fb08f273e6
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 0336763e966d92595a567cc9ce537f5e
|
||||
|
||||
COUNT = 1
|
||||
KEY = 00000000000000000000000000000000
|
||||
IV = 9798c4640bad75c7c3227db910174e72
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = a9a1631bf4996954ebc093957b234589
|
||||
|
||||
COUNT = 2
|
||||
KEY = 00000000000000000000000000000000
|
||||
IV = 96ab5c2ff612d9dfaae8c31f30c42168
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = ff4f8391a6a40ca5b25d23bedd44a597
|
||||
|
||||
COUNT = 3
|
||||
KEY = 00000000000000000000000000000000
|
||||
IV = 6a118a874519e64e9963798a503f1d35
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = dc43be40be0e53712f7e2bf5ca707209
|
||||
|
||||
COUNT = 4
|
||||
KEY = 00000000000000000000000000000000
|
||||
IV = cb9fceec81286ca3e989bd979b0cb284
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 92beedab1895a94faa69b632e5cc47ce
|
||||
|
||||
COUNT = 5
|
||||
KEY = 00000000000000000000000000000000
|
||||
IV = b26aeb1874e47ca8358ff22378f09144
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 459264f4798f6a78bacb89c15ed3d601
|
||||
|
||||
COUNT = 6
|
||||
KEY = 00000000000000000000000000000000
|
||||
IV = 58c8e00b2631686d54eab84b91f0aca1
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 08a4e2efec8a8e3312ca7460b9040bbf
|
||||
|
||||
[DECRYPT]
|
||||
|
||||
COUNT = 0
|
||||
KEY = 00000000000000000000000000000000
|
||||
IV = f34481ec3cc627bacd5dc3fb08f273e6
|
||||
CIPHERTEXT = 0336763e966d92595a567cc9ce537f5e
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 1
|
||||
KEY = 00000000000000000000000000000000
|
||||
IV = 9798c4640bad75c7c3227db910174e72
|
||||
CIPHERTEXT = a9a1631bf4996954ebc093957b234589
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 2
|
||||
KEY = 00000000000000000000000000000000
|
||||
IV = 96ab5c2ff612d9dfaae8c31f30c42168
|
||||
CIPHERTEXT = ff4f8391a6a40ca5b25d23bedd44a597
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 3
|
||||
KEY = 00000000000000000000000000000000
|
||||
IV = 6a118a874519e64e9963798a503f1d35
|
||||
CIPHERTEXT = dc43be40be0e53712f7e2bf5ca707209
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 4
|
||||
KEY = 00000000000000000000000000000000
|
||||
IV = cb9fceec81286ca3e989bd979b0cb284
|
||||
CIPHERTEXT = 92beedab1895a94faa69b632e5cc47ce
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 5
|
||||
KEY = 00000000000000000000000000000000
|
||||
IV = b26aeb1874e47ca8358ff22378f09144
|
||||
CIPHERTEXT = 459264f4798f6a78bacb89c15ed3d601
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 6
|
||||
KEY = 00000000000000000000000000000000
|
||||
IV = 58c8e00b2631686d54eab84b91f0aca1
|
||||
CIPHERTEXT = 08a4e2efec8a8e3312ca7460b9040bbf
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
# CAVS 11.1
|
||||
# Config info for aes_values
|
||||
# AESVS GFSbox test data for CFB128
|
||||
# State : Encrypt and Decrypt
|
||||
# Key Length : 192
|
||||
# Generated on Fri Apr 22 15:11:55 2011
|
||||
|
||||
[ENCRYPT]
|
||||
|
||||
COUNT = 0
|
||||
KEY = 000000000000000000000000000000000000000000000000
|
||||
IV = 1b077a6af4b7f98229de786d7516b639
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 275cfc0413d8ccb70513c3859b1d0f72
|
||||
|
||||
COUNT = 1
|
||||
KEY = 000000000000000000000000000000000000000000000000
|
||||
IV = 9c2d8842e5f48f57648205d39a239af1
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = c9b8135ff1b5adc413dfd053b21bd96d
|
||||
|
||||
COUNT = 2
|
||||
KEY = 000000000000000000000000000000000000000000000000
|
||||
IV = bff52510095f518ecca60af4205444bb
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 4a3650c3371ce2eb35e389a171427440
|
||||
|
||||
COUNT = 3
|
||||
KEY = 000000000000000000000000000000000000000000000000
|
||||
IV = 51719783d3185a535bd75adc65071ce1
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 4f354592ff7c8847d2d0870ca9481b7c
|
||||
|
||||
COUNT = 4
|
||||
KEY = 000000000000000000000000000000000000000000000000
|
||||
IV = 26aa49dcfe7629a8901a69a9914e6dfd
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = d5e08bf9a182e857cf40b3a36ee248cc
|
||||
|
||||
COUNT = 5
|
||||
KEY = 000000000000000000000000000000000000000000000000
|
||||
IV = 941a4773058224e1ef66d10e0a6ee782
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 067cd9d3749207791841562507fa9626
|
||||
|
||||
[DECRYPT]
|
||||
|
||||
COUNT = 0
|
||||
KEY = 000000000000000000000000000000000000000000000000
|
||||
IV = 1b077a6af4b7f98229de786d7516b639
|
||||
CIPHERTEXT = 275cfc0413d8ccb70513c3859b1d0f72
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 1
|
||||
KEY = 000000000000000000000000000000000000000000000000
|
||||
IV = 9c2d8842e5f48f57648205d39a239af1
|
||||
CIPHERTEXT = c9b8135ff1b5adc413dfd053b21bd96d
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 2
|
||||
KEY = 000000000000000000000000000000000000000000000000
|
||||
IV = bff52510095f518ecca60af4205444bb
|
||||
CIPHERTEXT = 4a3650c3371ce2eb35e389a171427440
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 3
|
||||
KEY = 000000000000000000000000000000000000000000000000
|
||||
IV = 51719783d3185a535bd75adc65071ce1
|
||||
CIPHERTEXT = 4f354592ff7c8847d2d0870ca9481b7c
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 4
|
||||
KEY = 000000000000000000000000000000000000000000000000
|
||||
IV = 26aa49dcfe7629a8901a69a9914e6dfd
|
||||
CIPHERTEXT = d5e08bf9a182e857cf40b3a36ee248cc
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 5
|
||||
KEY = 000000000000000000000000000000000000000000000000
|
||||
IV = 941a4773058224e1ef66d10e0a6ee782
|
||||
CIPHERTEXT = 067cd9d3749207791841562507fa9626
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
# CAVS 11.1
|
||||
# Config info for aes_values
|
||||
# AESVS GFSbox test data for CFB128
|
||||
# State : Encrypt and Decrypt
|
||||
# Key Length : 256
|
||||
# Generated on Fri Apr 22 15:11:57 2011
|
||||
|
||||
[ENCRYPT]
|
||||
|
||||
COUNT = 0
|
||||
KEY = 0000000000000000000000000000000000000000000000000000000000000000
|
||||
IV = 014730f80ac625fe84f026c60bfd547d
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 5c9d844ed46f9885085e5d6a4f94c7d7
|
||||
|
||||
COUNT = 1
|
||||
KEY = 0000000000000000000000000000000000000000000000000000000000000000
|
||||
IV = 0b24af36193ce4665f2825d7b4749c98
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = a9ff75bd7cf6613d3731c77c3b6d0c04
|
||||
|
||||
COUNT = 2
|
||||
KEY = 0000000000000000000000000000000000000000000000000000000000000000
|
||||
IV = 761c1fe41a18acf20d241650611d90f1
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 623a52fcea5d443e48d9181ab32c7421
|
||||
|
||||
COUNT = 3
|
||||
KEY = 0000000000000000000000000000000000000000000000000000000000000000
|
||||
IV = 8a560769d605868ad80d819bdba03771
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 38f2c7ae10612415d27ca190d27da8b4
|
||||
|
||||
COUNT = 4
|
||||
KEY = 0000000000000000000000000000000000000000000000000000000000000000
|
||||
IV = 91fbef2d15a97816060bee1feaa49afe
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 1bc704f1bce135ceb810341b216d7abe
|
||||
|
||||
[DECRYPT]
|
||||
|
||||
COUNT = 0
|
||||
KEY = 0000000000000000000000000000000000000000000000000000000000000000
|
||||
IV = 014730f80ac625fe84f026c60bfd547d
|
||||
CIPHERTEXT = 5c9d844ed46f9885085e5d6a4f94c7d7
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 1
|
||||
KEY = 0000000000000000000000000000000000000000000000000000000000000000
|
||||
IV = 0b24af36193ce4665f2825d7b4749c98
|
||||
CIPHERTEXT = a9ff75bd7cf6613d3731c77c3b6d0c04
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 2
|
||||
KEY = 0000000000000000000000000000000000000000000000000000000000000000
|
||||
IV = 761c1fe41a18acf20d241650611d90f1
|
||||
CIPHERTEXT = 623a52fcea5d443e48d9181ab32c7421
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 3
|
||||
KEY = 0000000000000000000000000000000000000000000000000000000000000000
|
||||
IV = 8a560769d605868ad80d819bdba03771
|
||||
CIPHERTEXT = 38f2c7ae10612415d27ca190d27da8b4
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 4
|
||||
KEY = 0000000000000000000000000000000000000000000000000000000000000000
|
||||
IV = 91fbef2d15a97816060bee1feaa49afe
|
||||
CIPHERTEXT = 1bc704f1bce135ceb810341b216d7abe
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
@@ -0,0 +1,263 @@
|
||||
# CAVS 11.1
|
||||
# Config info for aes_values
|
||||
# AESVS KeySbox test data for CFB128
|
||||
# State : Encrypt and Decrypt
|
||||
# Key Length : 128
|
||||
# Generated on Fri Apr 22 15:11:53 2011
|
||||
|
||||
[ENCRYPT]
|
||||
|
||||
COUNT = 0
|
||||
KEY = 10a58869d74be5a374cf867cfb473859
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 6d251e6944b051e04eaa6fb4dbf78465
|
||||
|
||||
COUNT = 1
|
||||
KEY = caea65cdbb75e9169ecd22ebe6e54675
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 6e29201190152df4ee058139def610bb
|
||||
|
||||
COUNT = 2
|
||||
KEY = a2e2fa9baf7d20822ca9f0542f764a41
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = c3b44b95d9d2f25670eee9a0de099fa3
|
||||
|
||||
COUNT = 3
|
||||
KEY = b6364ac4e1de1e285eaf144a2415f7a0
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 5d9b05578fc944b3cf1ccf0e746cd581
|
||||
|
||||
COUNT = 4
|
||||
KEY = 64cf9c7abc50b888af65f49d521944b2
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = f7efc89d5dba578104016ce5ad659c05
|
||||
|
||||
COUNT = 5
|
||||
KEY = 47d6742eefcc0465dc96355e851b64d9
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 0306194f666d183624aa230a8b264ae7
|
||||
|
||||
COUNT = 6
|
||||
KEY = 3eb39790678c56bee34bbcdeccf6cdb5
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 858075d536d79ccee571f7d7204b1f67
|
||||
|
||||
COUNT = 7
|
||||
KEY = 64110a924f0743d500ccadae72c13427
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 35870c6a57e9e92314bcb8087cde72ce
|
||||
|
||||
COUNT = 8
|
||||
KEY = 18d8126516f8a12ab1a36d9f04d68e51
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 6c68e9be5ec41e22c825b7c7affb4363
|
||||
|
||||
COUNT = 9
|
||||
KEY = f530357968578480b398a3c251cd1093
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = f5df39990fc688f1b07224cc03e86cea
|
||||
|
||||
COUNT = 10
|
||||
KEY = da84367f325d42d601b4326964802e8e
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = bba071bcb470f8f6586e5d3add18bc66
|
||||
|
||||
COUNT = 11
|
||||
KEY = e37b1c6aa2846f6fdb413f238b089f23
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 43c9f7e62f5d288bb27aa40ef8fe1ea8
|
||||
|
||||
COUNT = 12
|
||||
KEY = 6c002b682483e0cabcc731c253be5674
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 3580d19cff44f1014a7c966a69059de5
|
||||
|
||||
COUNT = 13
|
||||
KEY = 143ae8ed6555aba96110ab58893a8ae1
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 806da864dd29d48deafbe764f8202aef
|
||||
|
||||
COUNT = 14
|
||||
KEY = b69418a85332240dc82492353956ae0c
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = a303d940ded8f0baff6f75414cac5243
|
||||
|
||||
COUNT = 15
|
||||
KEY = 71b5c08a1993e1362e4d0ce9b22b78d5
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = c2dabd117f8a3ecabfbb11d12194d9d0
|
||||
|
||||
COUNT = 16
|
||||
KEY = e234cdca2606b81f29408d5f6da21206
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = fff60a4740086b3b9c56195b98d91a7b
|
||||
|
||||
COUNT = 17
|
||||
KEY = 13237c49074a3da078dc1d828bb78c6f
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 8146a08e2357f0caa30ca8c94d1a0544
|
||||
|
||||
COUNT = 18
|
||||
KEY = 3071a2a48fe6cbd04f1a129098e308f8
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 4b98e06d356deb07ebb824e5713f7be3
|
||||
|
||||
COUNT = 19
|
||||
KEY = 90f42ec0f68385f2ffc5dfc03a654dce
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 7a20a53d460fc9ce0423a7a0764c6cf2
|
||||
|
||||
COUNT = 20
|
||||
KEY = febd9a24d8b65c1c787d50a4ed3619a9
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = f4a70d8af877f9b02b4c40df57d45b17
|
||||
|
||||
[DECRYPT]
|
||||
|
||||
COUNT = 0
|
||||
KEY = 10a58869d74be5a374cf867cfb473859
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 6d251e6944b051e04eaa6fb4dbf78465
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 1
|
||||
KEY = caea65cdbb75e9169ecd22ebe6e54675
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 6e29201190152df4ee058139def610bb
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 2
|
||||
KEY = a2e2fa9baf7d20822ca9f0542f764a41
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = c3b44b95d9d2f25670eee9a0de099fa3
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 3
|
||||
KEY = b6364ac4e1de1e285eaf144a2415f7a0
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 5d9b05578fc944b3cf1ccf0e746cd581
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 4
|
||||
KEY = 64cf9c7abc50b888af65f49d521944b2
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = f7efc89d5dba578104016ce5ad659c05
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 5
|
||||
KEY = 47d6742eefcc0465dc96355e851b64d9
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 0306194f666d183624aa230a8b264ae7
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 6
|
||||
KEY = 3eb39790678c56bee34bbcdeccf6cdb5
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 858075d536d79ccee571f7d7204b1f67
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 7
|
||||
KEY = 64110a924f0743d500ccadae72c13427
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 35870c6a57e9e92314bcb8087cde72ce
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 8
|
||||
KEY = 18d8126516f8a12ab1a36d9f04d68e51
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 6c68e9be5ec41e22c825b7c7affb4363
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 9
|
||||
KEY = f530357968578480b398a3c251cd1093
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = f5df39990fc688f1b07224cc03e86cea
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 10
|
||||
KEY = da84367f325d42d601b4326964802e8e
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = bba071bcb470f8f6586e5d3add18bc66
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 11
|
||||
KEY = e37b1c6aa2846f6fdb413f238b089f23
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 43c9f7e62f5d288bb27aa40ef8fe1ea8
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 12
|
||||
KEY = 6c002b682483e0cabcc731c253be5674
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 3580d19cff44f1014a7c966a69059de5
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 13
|
||||
KEY = 143ae8ed6555aba96110ab58893a8ae1
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 806da864dd29d48deafbe764f8202aef
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 14
|
||||
KEY = b69418a85332240dc82492353956ae0c
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = a303d940ded8f0baff6f75414cac5243
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 15
|
||||
KEY = 71b5c08a1993e1362e4d0ce9b22b78d5
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = c2dabd117f8a3ecabfbb11d12194d9d0
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 16
|
||||
KEY = e234cdca2606b81f29408d5f6da21206
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = fff60a4740086b3b9c56195b98d91a7b
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 17
|
||||
KEY = 13237c49074a3da078dc1d828bb78c6f
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 8146a08e2357f0caa30ca8c94d1a0544
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 18
|
||||
KEY = 3071a2a48fe6cbd04f1a129098e308f8
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 4b98e06d356deb07ebb824e5713f7be3
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 19
|
||||
KEY = 90f42ec0f68385f2ffc5dfc03a654dce
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 7a20a53d460fc9ce0423a7a0764c6cf2
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 20
|
||||
KEY = febd9a24d8b65c1c787d50a4ed3619a9
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = f4a70d8af877f9b02b4c40df57d45b17
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
@@ -0,0 +1,299 @@
|
||||
# CAVS 11.1
|
||||
# Config info for aes_values
|
||||
# AESVS KeySbox test data for CFB128
|
||||
# State : Encrypt and Decrypt
|
||||
# Key Length : 192
|
||||
# Generated on Fri Apr 22 15:11:55 2011
|
||||
|
||||
[ENCRYPT]
|
||||
|
||||
COUNT = 0
|
||||
KEY = e9f065d7c13573587f7875357dfbb16c53489f6a4bd0f7cd
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 0956259c9cd5cfd0181cca53380cde06
|
||||
|
||||
COUNT = 1
|
||||
KEY = 15d20f6ebc7e649fd95b76b107e6daba967c8a9484797f29
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 8e4e18424e591a3d5b6f0876f16f8594
|
||||
|
||||
COUNT = 2
|
||||
KEY = a8a282ee31c03fae4f8e9b8930d5473c2ed695a347e88b7c
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 93f3270cfc877ef17e106ce938979cb0
|
||||
|
||||
COUNT = 3
|
||||
KEY = cd62376d5ebb414917f0c78f05266433dc9192a1ec943300
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 7f6c25ff41858561bb62f36492e93c29
|
||||
|
||||
COUNT = 4
|
||||
KEY = 502a6ab36984af268bf423c7f509205207fc1552af4a91e5
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 8e06556dcbb00b809a025047cff2a940
|
||||
|
||||
COUNT = 5
|
||||
KEY = 25a39dbfd8034f71a81f9ceb55026e4037f8f6aa30ab44ce
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 3608c344868e94555d23a120f8a5502d
|
||||
|
||||
COUNT = 6
|
||||
KEY = e08c15411774ec4a908b64eadc6ac4199c7cd453f3aaef53
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 77da2021935b840b7f5dcc39132da9e5
|
||||
|
||||
COUNT = 7
|
||||
KEY = 3b375a1ff7e8d44409696e6326ec9dec86138e2ae010b980
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 3b7c24f825e3bf9873c9f14d39a0e6f4
|
||||
|
||||
COUNT = 8
|
||||
KEY = 950bb9f22cc35be6fe79f52c320af93dec5bc9c0c2f9cd53
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 64ebf95686b353508c90ecd8b6134316
|
||||
|
||||
COUNT = 9
|
||||
KEY = 7001c487cc3e572cfc92f4d0e697d982e8856fdcc957da40
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = ff558c5d27210b7929b73fc708eb4cf1
|
||||
|
||||
COUNT = 10
|
||||
KEY = f029ce61d4e5a405b41ead0a883cc6a737da2cf50a6c92ae
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = a2c3b2a818075490a7b4c14380f02702
|
||||
|
||||
COUNT = 11
|
||||
KEY = 61257134a518a0d57d9d244d45f6498cbc32f2bafc522d79
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = cfe4d74002696ccf7d87b14a2f9cafc9
|
||||
|
||||
COUNT = 12
|
||||
KEY = b0ab0a6a818baef2d11fa33eac947284fb7d748cfb75e570
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = d2eafd86f63b109b91f5dbb3a3fb7e13
|
||||
|
||||
COUNT = 13
|
||||
KEY = ee053aa011c8b428cdcc3636313c54d6a03cac01c71579d6
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 9b9fdd1c5975655f539998b306a324af
|
||||
|
||||
COUNT = 14
|
||||
KEY = d2926527e0aa9f37b45e2ec2ade5853ef807576104c7ace3
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = dd619e1cf204446112e0af2b9afa8f8c
|
||||
|
||||
COUNT = 15
|
||||
KEY = 982215f4e173dfa0fcffe5d3da41c4812c7bcc8ed3540f93
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = d4f0aae13c8fe9339fbf9e69ed0ad74d
|
||||
|
||||
COUNT = 16
|
||||
KEY = 98c6b8e01e379fbd14e61af6af891596583565f2a27d59e9
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 19c80ec4a6deb7e5ed1033dda933498f
|
||||
|
||||
COUNT = 17
|
||||
KEY = b3ad5cea1dddc214ca969ac35f37dae1a9a9d1528f89bb35
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 3cf5e1d21a17956d1dffad6a7c41c659
|
||||
|
||||
COUNT = 18
|
||||
KEY = 45899367c3132849763073c435a9288a766c8b9ec2308516
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 69fd12e8505f8ded2fdcb197a121b362
|
||||
|
||||
COUNT = 19
|
||||
KEY = ec250e04c3903f602647b85a401a1ae7ca2f02f67fa4253e
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 8aa584e2cc4d17417a97cb9a28ba29c8
|
||||
|
||||
COUNT = 20
|
||||
KEY = d077a03bd8a38973928ccafe4a9d2f455130bd0af5ae46a9
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = abc786fb1edb504580c4d882ef29a0c7
|
||||
|
||||
COUNT = 21
|
||||
KEY = d184c36cf0dddfec39e654195006022237871a47c33d3198
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 2e19fb60a3e1de0166f483c97824a978
|
||||
|
||||
COUNT = 22
|
||||
KEY = 4c6994ffa9dcdc805b60c2c0095334c42d95a8fc0ca5b080
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 7656709538dd5fec41e0ce6a0f8e207d
|
||||
|
||||
COUNT = 23
|
||||
KEY = c88f5b00a4ef9a6840e2acaf33f00a3bdc4e25895303fa72
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = a67cf333b314d411d3c0ae6e1cfcd8f5
|
||||
|
||||
[DECRYPT]
|
||||
|
||||
COUNT = 0
|
||||
KEY = e9f065d7c13573587f7875357dfbb16c53489f6a4bd0f7cd
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 0956259c9cd5cfd0181cca53380cde06
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 1
|
||||
KEY = 15d20f6ebc7e649fd95b76b107e6daba967c8a9484797f29
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 8e4e18424e591a3d5b6f0876f16f8594
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 2
|
||||
KEY = a8a282ee31c03fae4f8e9b8930d5473c2ed695a347e88b7c
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 93f3270cfc877ef17e106ce938979cb0
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 3
|
||||
KEY = cd62376d5ebb414917f0c78f05266433dc9192a1ec943300
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 7f6c25ff41858561bb62f36492e93c29
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 4
|
||||
KEY = 502a6ab36984af268bf423c7f509205207fc1552af4a91e5
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 8e06556dcbb00b809a025047cff2a940
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 5
|
||||
KEY = 25a39dbfd8034f71a81f9ceb55026e4037f8f6aa30ab44ce
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 3608c344868e94555d23a120f8a5502d
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 6
|
||||
KEY = e08c15411774ec4a908b64eadc6ac4199c7cd453f3aaef53
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 77da2021935b840b7f5dcc39132da9e5
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 7
|
||||
KEY = 3b375a1ff7e8d44409696e6326ec9dec86138e2ae010b980
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 3b7c24f825e3bf9873c9f14d39a0e6f4
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 8
|
||||
KEY = 950bb9f22cc35be6fe79f52c320af93dec5bc9c0c2f9cd53
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 64ebf95686b353508c90ecd8b6134316
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 9
|
||||
KEY = 7001c487cc3e572cfc92f4d0e697d982e8856fdcc957da40
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = ff558c5d27210b7929b73fc708eb4cf1
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 10
|
||||
KEY = f029ce61d4e5a405b41ead0a883cc6a737da2cf50a6c92ae
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = a2c3b2a818075490a7b4c14380f02702
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 11
|
||||
KEY = 61257134a518a0d57d9d244d45f6498cbc32f2bafc522d79
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = cfe4d74002696ccf7d87b14a2f9cafc9
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 12
|
||||
KEY = b0ab0a6a818baef2d11fa33eac947284fb7d748cfb75e570
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = d2eafd86f63b109b91f5dbb3a3fb7e13
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 13
|
||||
KEY = ee053aa011c8b428cdcc3636313c54d6a03cac01c71579d6
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 9b9fdd1c5975655f539998b306a324af
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 14
|
||||
KEY = d2926527e0aa9f37b45e2ec2ade5853ef807576104c7ace3
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = dd619e1cf204446112e0af2b9afa8f8c
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 15
|
||||
KEY = 982215f4e173dfa0fcffe5d3da41c4812c7bcc8ed3540f93
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = d4f0aae13c8fe9339fbf9e69ed0ad74d
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 16
|
||||
KEY = 98c6b8e01e379fbd14e61af6af891596583565f2a27d59e9
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 19c80ec4a6deb7e5ed1033dda933498f
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 17
|
||||
KEY = b3ad5cea1dddc214ca969ac35f37dae1a9a9d1528f89bb35
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 3cf5e1d21a17956d1dffad6a7c41c659
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 18
|
||||
KEY = 45899367c3132849763073c435a9288a766c8b9ec2308516
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 69fd12e8505f8ded2fdcb197a121b362
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 19
|
||||
KEY = ec250e04c3903f602647b85a401a1ae7ca2f02f67fa4253e
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 8aa584e2cc4d17417a97cb9a28ba29c8
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 20
|
||||
KEY = d077a03bd8a38973928ccafe4a9d2f455130bd0af5ae46a9
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = abc786fb1edb504580c4d882ef29a0c7
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 21
|
||||
KEY = d184c36cf0dddfec39e654195006022237871a47c33d3198
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 2e19fb60a3e1de0166f483c97824a978
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 22
|
||||
KEY = 4c6994ffa9dcdc805b60c2c0095334c42d95a8fc0ca5b080
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 7656709538dd5fec41e0ce6a0f8e207d
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 23
|
||||
KEY = c88f5b00a4ef9a6840e2acaf33f00a3bdc4e25895303fa72
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = a67cf333b314d411d3c0ae6e1cfcd8f5
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
@@ -0,0 +1,203 @@
|
||||
# CAVS 11.1
|
||||
# Config info for aes_values
|
||||
# AESVS KeySbox test data for CFB128
|
||||
# State : Encrypt and Decrypt
|
||||
# Key Length : 256
|
||||
# Generated on Fri Apr 22 15:11:57 2011
|
||||
|
||||
[ENCRYPT]
|
||||
|
||||
COUNT = 0
|
||||
KEY = c47b0294dbbbee0fec4757f22ffeee3587ca4730c3d33b691df38bab076bc558
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 46f2fb342d6f0ab477476fc501242c5f
|
||||
|
||||
COUNT = 1
|
||||
KEY = 28d46cffa158533194214a91e712fc2b45b518076675affd910edeca5f41ac64
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 4bf3b0a69aeb6657794f2901b1440ad4
|
||||
|
||||
COUNT = 2
|
||||
KEY = c1cc358b449909a19436cfbb3f852ef8bcb5ed12ac7058325f56e6099aab1a1c
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 352065272169abf9856843927d0674fd
|
||||
|
||||
COUNT = 3
|
||||
KEY = 984ca75f4ee8d706f46c2d98c0bf4a45f5b00d791c2dfeb191b5ed8e420fd627
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 4307456a9e67813b452e15fa8fffe398
|
||||
|
||||
COUNT = 4
|
||||
KEY = b43d08a447ac8609baadae4ff12918b9f68fc1653f1269222f123981ded7a92f
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 4663446607354989477a5c6f0f007ef4
|
||||
|
||||
COUNT = 5
|
||||
KEY = 1d85a181b54cde51f0e098095b2962fdc93b51fe9b88602b3f54130bf76a5bd9
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 531c2c38344578b84d50b3c917bbb6e1
|
||||
|
||||
COUNT = 6
|
||||
KEY = dc0eba1f2232a7879ded34ed8428eeb8769b056bbaf8ad77cb65c3541430b4cf
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = fc6aec906323480005c58e7e1ab004ad
|
||||
|
||||
COUNT = 7
|
||||
KEY = f8be9ba615c5a952cabbca24f68f8593039624d524c816acda2c9183bd917cb9
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = a3944b95ca0b52043584ef02151926a8
|
||||
|
||||
COUNT = 8
|
||||
KEY = 797f8b3d176dac5b7e34a2d539c4ef367a16f8635f6264737591c5c07bf57a3e
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = a74289fe73a4c123ca189ea1e1b49ad5
|
||||
|
||||
COUNT = 9
|
||||
KEY = 6838d40caf927749c13f0329d331f448e202c73ef52c5f73a37ca635d4c47707
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = b91d4ea4488644b56cf0812fa7fcf5fc
|
||||
|
||||
COUNT = 10
|
||||
KEY = ccd1bc3c659cd3c59bc437484e3c5c724441da8d6e90ce556cd57d0752663bbc
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 304f81ab61a80c2e743b94d5002a126b
|
||||
|
||||
COUNT = 11
|
||||
KEY = 13428b5e4c005e0636dd338405d173ab135dec2a25c22c5df0722d69dcc43887
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 649a71545378c783e368c9ade7114f6c
|
||||
|
||||
COUNT = 12
|
||||
KEY = 07eb03a08d291d1b07408bf3512ab40c91097ac77461aad4bb859647f74f00ee
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 47cb030da2ab051dfc6c4bf6910d12bb
|
||||
|
||||
COUNT = 13
|
||||
KEY = 90143ae20cd78c5d8ebdd6cb9dc1762427a96c78c639bccc41a61424564eafe1
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 798c7c005dee432b2c8ea5dfa381ecc3
|
||||
|
||||
COUNT = 14
|
||||
KEY = b7a5794d52737475d53d5a377200849be0260a67a2b22ced8bbef12882270d07
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 637c31dc2591a07636f646b72daabbe7
|
||||
|
||||
COUNT = 15
|
||||
KEY = fca02f3d5011cfc5c1e23165d413a049d4526a991827424d896fe3435e0bf68e
|
||||
IV = 00000000000000000000000000000000
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 179a49c712154bbffbe6e7a84a18e220
|
||||
|
||||
[DECRYPT]
|
||||
|
||||
COUNT = 0
|
||||
KEY = c47b0294dbbbee0fec4757f22ffeee3587ca4730c3d33b691df38bab076bc558
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 46f2fb342d6f0ab477476fc501242c5f
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 1
|
||||
KEY = 28d46cffa158533194214a91e712fc2b45b518076675affd910edeca5f41ac64
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 4bf3b0a69aeb6657794f2901b1440ad4
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 2
|
||||
KEY = c1cc358b449909a19436cfbb3f852ef8bcb5ed12ac7058325f56e6099aab1a1c
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 352065272169abf9856843927d0674fd
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 3
|
||||
KEY = 984ca75f4ee8d706f46c2d98c0bf4a45f5b00d791c2dfeb191b5ed8e420fd627
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 4307456a9e67813b452e15fa8fffe398
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 4
|
||||
KEY = b43d08a447ac8609baadae4ff12918b9f68fc1653f1269222f123981ded7a92f
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 4663446607354989477a5c6f0f007ef4
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 5
|
||||
KEY = 1d85a181b54cde51f0e098095b2962fdc93b51fe9b88602b3f54130bf76a5bd9
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 531c2c38344578b84d50b3c917bbb6e1
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 6
|
||||
KEY = dc0eba1f2232a7879ded34ed8428eeb8769b056bbaf8ad77cb65c3541430b4cf
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = fc6aec906323480005c58e7e1ab004ad
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 7
|
||||
KEY = f8be9ba615c5a952cabbca24f68f8593039624d524c816acda2c9183bd917cb9
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = a3944b95ca0b52043584ef02151926a8
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 8
|
||||
KEY = 797f8b3d176dac5b7e34a2d539c4ef367a16f8635f6264737591c5c07bf57a3e
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = a74289fe73a4c123ca189ea1e1b49ad5
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 9
|
||||
KEY = 6838d40caf927749c13f0329d331f448e202c73ef52c5f73a37ca635d4c47707
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = b91d4ea4488644b56cf0812fa7fcf5fc
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 10
|
||||
KEY = ccd1bc3c659cd3c59bc437484e3c5c724441da8d6e90ce556cd57d0752663bbc
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 304f81ab61a80c2e743b94d5002a126b
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 11
|
||||
KEY = 13428b5e4c005e0636dd338405d173ab135dec2a25c22c5df0722d69dcc43887
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 649a71545378c783e368c9ade7114f6c
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 12
|
||||
KEY = 07eb03a08d291d1b07408bf3512ab40c91097ac77461aad4bb859647f74f00ee
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 47cb030da2ab051dfc6c4bf6910d12bb
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 13
|
||||
KEY = 90143ae20cd78c5d8ebdd6cb9dc1762427a96c78c639bccc41a61424564eafe1
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 798c7c005dee432b2c8ea5dfa381ecc3
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 14
|
||||
KEY = b7a5794d52737475d53d5a377200849be0260a67a2b22ced8bbef12882270d07
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 637c31dc2591a07636f646b72daabbe7
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
COUNT = 15
|
||||
KEY = fca02f3d5011cfc5c1e23165d413a049d4526a991827424d896fe3435e0bf68e
|
||||
IV = 00000000000000000000000000000000
|
||||
CIPHERTEXT = 179a49c712154bbffbe6e7a84a18e220
|
||||
PLAINTEXT = 00000000000000000000000000000000
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -55,7 +55,7 @@ function update_cmakelists_source() {
|
||||
fi
|
||||
|
||||
# Wrap quotes around each filename since it might contain spaces
|
||||
srcs=$($find "${src_root}" -type f \( "${exts_arg[@]}" \) -printf ' "%P"\n' | LC_ALL=POSIX sort)
|
||||
srcs=$($find -L "${src_root}" -type f \( "${exts_arg[@]}" \) -printf ' "%P"\n' | LC_ALL=POSIX sort)
|
||||
echo "$srcs"
|
||||
|
||||
# Update list of source files in CMakeLists.txt
|
||||
|
||||
@@ -50,7 +50,7 @@ SRCROOT="${TMPDIR}/src/boringssl.googlesource.com/boringssl"
|
||||
function namespace_inlines {
|
||||
# Pull out all STACK_OF functions.
|
||||
STACKS=$(grep --no-filename -rE -e "DEFINE_(SPECIAL_)?STACK_OF\([A-Z_0-9a-z]+\)" -e "DEFINE_NAMED_STACK_OF\([A-Z_0-9a-z]+, +[A-Z_0-9a-z:]+\)" "$1/"* | grep -v '//' | grep -v '#' | gsed -e 's/DEFINE_\(SPECIAL_\)\?STACK_OF(\(.*\))/\2/' -e 's/DEFINE_NAMED_STACK_OF(\(.*\), .*)/\1/')
|
||||
STACK_FUNCTIONS=("call_free_func" "call_copy_func" "call_cmp_func" "new" "new_null" "num" "zero" "value" "set" "free" "pop_free" "insert" "delete" "delete_ptr" "find" "shift" "push" "pop" "dup" "sort" "is_sorted" "set_cmp_func" "deep_copy")
|
||||
STACK_FUNCTIONS=("call_free_func" "call_copy_func" "call_cmp_func" "new" "new_null" "num" "zero" "value" "set" "free" "pop_free" "insert" "delete" "delete_ptr" "find" "shift" "push" "pop" "dup" "sort" "is_sorted" "set_cmp_func" "deep_copy" "delete_if")
|
||||
|
||||
for s in $STACKS; do
|
||||
for f in "${STACK_FUNCTIONS[@]}"; do
|
||||
|
||||
Reference in new issue
Block a user