Changeset 242963 in webkit
- Timestamp:
- Mar 14, 2019, 1:56:18 PM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
- 1 copied
-
ChangeLog (modified) (1 diff)
-
PAL/ChangeLog (modified) (1 diff)
-
PAL/PAL.xcodeproj/project.pbxproj (modified) (4 diffs)
-
PAL/pal/spi/cocoa/CommonCryptoSPI.h (copied) (copied from trunk/Source/WebCore/crypto/CommonCryptoUtilities.h ) (4 diffs)
-
crypto/CommonCryptoUtilities.h (modified) (2 diffs)
-
crypto/mac/CryptoAlgorithmHKDFMac.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r242960 r242963 1 2019-03-14 Brent Fulgham <bfulgham@apple.com> 2 3 Move CommonCrypto SPI declarations to an appropriate PAL/spi header 4 https://bugs.webkit.org/show_bug.cgi?id=195754 5 <rdar://problem/48591957> 6 7 Reviewed by Jiewen Tan. 8 9 Move the forward declarations of various CommonCrypto SPI to an appropriate PAL/spi header. 10 Update the const correctness of one function call to match new SDK declaration. 11 12 No tests because there are no changes in behavior. 13 14 * crypto/CommonCryptoUtilities.h: 15 * crypto/mac/CryptoAlgorithmHKDFMac.cpp: 16 (WebCore::CryptoAlgorithmHKDF::platformDeriveBits): 17 1 18 2019-03-14 Chris Dumez <cdumez@apple.com> 2 19 -
trunk/Source/WebCore/PAL/ChangeLog
r242918 r242963 1 2019-03-14 Brent Fulgham <bfulgham@apple.com> 2 3 Move CommonCrypto SPI declarations to an appropriate PAL/spi header 4 https://bugs.webkit.org/show_bug.cgi?id=195754 5 <rdar://problem/48591957> 6 7 Reviewed by Jiewen Tan. 8 9 Move the forward declarations of various CommonCrypto SPI to an appropriate PAL/spi header. 10 Update the const correctness of one function call to match new SDK declaration. 11 12 No tests because there are no changes in behavior. 13 14 * PAL.xcodeproj/project.pbxproj: 15 * pal/spi/cocoa/CommonCryptoSPI.h: Copied from Source/WebCore/crypto/CommonCryptoUtilities.h. 16 1 17 2019-03-13 Keith Rollin <krollin@apple.com> 2 18 -
trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
r242325 r242963 99 99 0C7785A11F45130F00F4EBB6 /* TelephonyUtilitiesSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 0C7785881F45130F00F4EBB6 /* TelephonyUtilitiesSPI.h */; }; 100 100 0CF99CA41F736375007EE793 /* MediaTimeAVFoundation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0C00CFD11F68CE4600AAC26D /* MediaTimeAVFoundation.cpp */; }; 101 7A36D0F9223AD9AB00B0522E /* CommonCryptoSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A36D0F8223AD9AB00B0522E /* CommonCryptoSPI.h */; }; 101 102 0CF99CA81F738437007EE793 /* CoreMediaSoftLink.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0CF99CA61F738436007EE793 /* CoreMediaSoftLink.cpp */; }; 102 103 0CF99CA91F738437007EE793 /* CoreMediaSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 0CF99CA71F738437007EE793 /* CoreMediaSoftLink.h */; }; … … 182 183 0C2DA0691F33CA8400DBC317 /* CFNetworkSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFNetworkSPI.h; sourceTree = "<group>"; }; 183 184 0C2DA06A1F33CA8400DBC317 /* CFUtilitiesSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFUtilitiesSPI.h; sourceTree = "<group>"; }; 185 7A36D0F8223AD9AB00B0522E /* CommonCryptoSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonCryptoSPI.h; sourceTree = "<group>"; }; 184 186 0C2DA06B1F33CA8400DBC317 /* CoreAudioSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreAudioSPI.h; sourceTree = "<group>"; }; 185 187 0C2DA06C1F33CA8400DBC317 /* CoreMediaSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreMediaSPI.h; sourceTree = "<group>"; }; … … 387 389 0C2DA1221F3BEB4900DBC317 /* AVKitSPI.h */, 388 390 0C2DA1231F3BEB4900DBC317 /* CFNSURLConnectionSPI.h */, 391 7A36D0F8223AD9AB00B0522E /* CommonCryptoSPI.h */, 389 392 0C2DA1241F3BEB4900DBC317 /* CoreTextSPI.h */, 390 393 0C2DA1251F3BEB4900DBC317 /* DataDetectorsCoreSPI.h */, … … 680 683 0C5FFF0C1F78D990009EFF1A /* Clock.h in Headers */, 681 684 0C5FFF101F78D9DA009EFF1A /* ClockCM.h in Headers */, 685 7A36D0F9223AD9AB00B0522E /* CommonCryptoSPI.h in Headers */, 682 686 1C09D0581E31C57E00725F18 /* config.h in Headers */, 683 687 0C2DA0711F33CA8400DBC317 /* CoreAudioSPI.h in Headers */, -
trunk/Source/WebCore/PAL/pal/spi/cocoa/CommonCryptoSPI.h
r242962 r242963 1 1 /* 2 * Copyright (C) 2013-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2013-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 30 30 #endif 31 31 32 #if ENABLE(WEB_CRYPTO)33 34 #include "CryptoAlgorithmIdentifier.h"35 #include <CommonCrypto/CommonCryptor.h>36 #include <CommonCrypto/CommonRandom.h>37 #include <wtf/Vector.h>38 39 32 #if USE(APPLE_INTERNAL_SDK) 40 33 #include <CommonCrypto/CommonCryptorSPI.h> 41 34 #include <CommonCrypto/CommonECCryptor.h> 42 // FIXME: <rdar://problem/31508959> 43 // #include <CommonCrypto/CommonKeyDerivationSPI.h> 35 #include <CommonCrypto/CommonKeyDerivationSPI.h> 44 36 #include <CommonCrypto/CommonRSACryptor.h> 37 38 #if HAVE(CCRSAGetCRTComponents) 39 #include <CommonCrypto/CommonRSACryptorSPI.h> 45 40 #endif 46 41 47 #if USE(APPLE_INTERNAL_SDK) && HAVE(CCRSAGetCRTComponents) 48 #include <CommonCrypto/CommonRSACryptorSPI.h> 49 #endif 42 #else 50 43 51 44 #ifndef _CC_RSACRYPTOR_H_ … … 110 103 extern "C" CCCryptorStatus CCECCryptorGeneratePair(size_t keysize, CCECCryptorRef *publicKey, CCECCryptorRef *privateKey); 111 104 extern "C" void CCECCryptorRelease(CCECCryptorRef key); 105 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000) 106 extern "C" CCCryptorStatus CCECCryptorImportKey(CCECKeyExternalFormat format, const void *keyPackage, size_t keyPackageLen, CCECKeyType keyType, CCECCryptorRef *key); 107 #else 112 108 extern "C" CCCryptorStatus CCECCryptorImportKey(CCECKeyExternalFormat format, void *keyPackage, size_t keyPackageLen, CCECKeyType keyType, CCECCryptorRef *key); 109 #endif 113 110 extern "C" CCCryptorStatus CCECCryptorExportKey(CCECKeyExternalFormat format, void *keyPackage, size_t *keyPackageLen, CCECKeyType keyType, CCECCryptorRef key); 114 111 extern "C" int CCECGetKeySize(CCECCryptorRef key); … … 128 125 extern "C" CCStatus CCKeyDerivationHMac(CCKDFAlgorithm algorithm, CCDigestAlgorithm digest, unsigned rounds, const void *keyDerivationKey, size_t keyDerivationKeyLen, const void *label, size_t labelLen, const void *context, size_t contextLen, const void *iv, size_t ivLen, const void *salt, size_t saltLen, void *derivedKey, size_t derivedKeyLen); 129 126 130 #if !USE(APPLE_INTERNAL_SDK)131 127 extern "C" CCCryptorStatus CCCryptorGCM(CCOperation op, CCAlgorithm alg, const void* key, size_t keyLength, const void* iv, size_t ivLen, const void* aData, size_t aDataLen, const void* dataIn, size_t dataInLength, void* dataOut, void* tag, size_t* tagLength); 132 128 extern "C" CCCryptorStatus CCRSACryptorCreateFromData(CCRSAKeyType keyType, const uint8_t *modulus, size_t modulusLength, const uint8_t *exponent, size_t exponentLength, const uint8_t *p, size_t pLength, const uint8_t *q, size_t qLength, CCRSACryptorRef *ref); 133 #endif134 129 135 namespace WebCore { 136 137 #if !HAVE(CCRSAGetCRTComponents) 138 139 // Only need CCBigNum for the code used when we don't have CCRSAGetCRTComponents. 140 class CCBigNum { 141 public: 142 CCBigNum(const uint8_t*, size_t); 143 ~CCBigNum(); 144 145 CCBigNum(const CCBigNum&); 146 CCBigNum(CCBigNum&&); 147 CCBigNum& operator=(const CCBigNum&); 148 CCBigNum& operator=(CCBigNum&&); 149 150 Vector<uint8_t> data() const; 151 152 CCBigNum operator-(uint32_t) const; 153 CCBigNum operator%(const CCBigNum&) const; 154 CCBigNum inverse(const CCBigNum& modulus) const; 155 156 private: 157 CCBigNum(CCBigNumRef); 158 159 CCBigNumRef m_number; 160 }; 161 162 #endif 163 164 bool getCommonCryptoDigestAlgorithm(CryptoAlgorithmIdentifier, CCDigestAlgorithm&); 165 166 } // namespace WebCore 167 168 #endif // ENABLE(WEB_CRYPTO) 130 #endif // !USE(APPLE_INTERNAL_SDK) -
trunk/Source/WebCore/crypto/CommonCryptoUtilities.h
r238754 r242963 26 26 #pragma once 27 27 28 #if (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300)29 #define HAVE_CCRSAGetCRTComponents 130 #endif31 32 28 #if ENABLE(WEB_CRYPTO) 33 29 … … 35 31 #include <CommonCrypto/CommonCryptor.h> 36 32 #include <CommonCrypto/CommonRandom.h> 33 #include <pal/spi/cocoa/CommonCryptoSPI.h> 37 34 #include <wtf/Vector.h> 38 39 #if USE(APPLE_INTERNAL_SDK)40 #include <CommonCrypto/CommonCryptorSPI.h>41 #include <CommonCrypto/CommonECCryptor.h>42 // FIXME: <rdar://problem/31508959>43 // #include <CommonCrypto/CommonKeyDerivationSPI.h>44 #include <CommonCrypto/CommonRSACryptor.h>45 #endif46 47 #if USE(APPLE_INTERNAL_SDK) && HAVE(CCRSAGetCRTComponents)48 #include <CommonCrypto/CommonRSACryptorSPI.h>49 #endif50 51 #ifndef _CC_RSACRYPTOR_H_52 enum {53 kCCDigestNone = 0,54 kCCDigestSHA1 = 8,55 kCCDigestSHA224 = 9,56 kCCDigestSHA256 = 10,57 kCCDigestSHA384 = 11,58 kCCDigestSHA512 = 12,59 };60 typedef uint32_t CCDigestAlgorithm;61 62 enum {63 ccRSAKeyPublic = 0,64 ccRSAKeyPrivate = 165 };66 typedef uint32_t CCRSAKeyType;67 68 enum {69 ccPKCS1Padding = 1001,70 ccOAEPPadding = 1002,71 ccRSAPSSPadding = 100572 };73 typedef uint32_t CCAsymmetricPadding;74 #endif75 76 typedef struct _CCBigNumRef *CCBigNumRef;77 78 typedef struct _CCRSACryptor *CCRSACryptorRef;79 extern "C" CCCryptorStatus CCRSACryptorEncrypt(CCRSACryptorRef publicKey, CCAsymmetricPadding padding, const void *plainText, size_t plainTextLen, void *cipherText, size_t *cipherTextLen, const void *tagData, size_t tagDataLen, CCDigestAlgorithm digestType);80 extern "C" CCCryptorStatus CCRSACryptorDecrypt(CCRSACryptorRef privateKey, CCAsymmetricPadding padding, const void *cipherText, size_t cipherTextLen, void *plainText, size_t *plainTextLen, const void *tagData, size_t tagDataLen, CCDigestAlgorithm digestType);81 extern "C" CCCryptorStatus CCRSACryptorSign(CCRSACryptorRef privateKey, CCAsymmetricPadding padding, const void *hashToSign, size_t hashSignLen, CCDigestAlgorithm digestType, size_t saltLen, void *signedData, size_t *signedDataLen);82 extern "C" CCCryptorStatus CCRSACryptorVerify(CCRSACryptorRef publicKey, CCAsymmetricPadding padding, const void *hash, size_t hashLen, CCDigestAlgorithm digestType, size_t saltLen, const void *signedData, size_t signedDataLen);83 extern "C" CCCryptorStatus CCRSACryptorGeneratePair(size_t keysize, uint32_t e, CCRSACryptorRef *publicKey, CCRSACryptorRef *privateKey);84 extern "C" CCRSACryptorRef CCRSACryptorGetPublicKeyFromPrivateKey(CCRSACryptorRef privkey);85 extern "C" void CCRSACryptorRelease(CCRSACryptorRef key);86 extern "C" CCCryptorStatus CCRSAGetKeyComponents(CCRSACryptorRef rsaKey, uint8_t *modulus, size_t *modulusLength, uint8_t *exponent, size_t *exponentLength, uint8_t *p, size_t *pLength, uint8_t *q, size_t *qLength);87 extern "C" CCRSAKeyType CCRSAGetKeyType(CCRSACryptorRef key);88 extern "C" CCCryptorStatus CCRSACryptorImport(const void *keyPackage, size_t keyPackageLen, CCRSACryptorRef *key);89 extern "C" CCCryptorStatus CCRSACryptorExport(CCRSACryptorRef key, void *out, size_t *outLen);90 91 #if HAVE(CCRSAGetCRTComponents)92 extern "C" CCCryptorStatus CCRSAGetCRTComponentsSizes(CCRSACryptorRef rsaKey, size_t *dpSize, size_t *dqSize, size_t *qinvSize);93 extern "C" CCCryptorStatus CCRSAGetCRTComponents(CCRSACryptorRef rsaKey, void *dp, size_t dpSize, void *dq, size_t dqSize, void *qinv, size_t qinvSize);94 #endif95 96 #ifndef _CC_ECCRYPTOR_H_97 enum {98 ccECKeyPublic = 0,99 ccECKeyPrivate = 1,100 };101 typedef uint32_t CCECKeyType;102 103 enum {104 kCCImportKeyBinary = 0,105 };106 typedef uint32_t CCECKeyExternalFormat;107 #endif108 109 typedef struct _CCECCryptor *CCECCryptorRef;110 extern "C" CCCryptorStatus CCECCryptorGeneratePair(size_t keysize, CCECCryptorRef *publicKey, CCECCryptorRef *privateKey);111 extern "C" void CCECCryptorRelease(CCECCryptorRef key);112 extern "C" CCCryptorStatus CCECCryptorImportKey(CCECKeyExternalFormat format, void *keyPackage, size_t keyPackageLen, CCECKeyType keyType, CCECCryptorRef *key);113 extern "C" CCCryptorStatus CCECCryptorExportKey(CCECKeyExternalFormat format, void *keyPackage, size_t *keyPackageLen, CCECKeyType keyType, CCECCryptorRef key);114 extern "C" int CCECGetKeySize(CCECCryptorRef key);115 extern "C" CCCryptorStatus CCECCryptorCreateFromData(size_t keySize, uint8_t *qX, size_t qXLength, uint8_t *qY, size_t qYLength, CCECCryptorRef *ref);116 extern "C" CCCryptorStatus CCECCryptorGetKeyComponents(CCECCryptorRef ecKey, size_t *keySize, uint8_t *qX, size_t *qXLength, uint8_t *qY, size_t *qYLength, uint8_t *d, size_t *dLength);117 extern "C" CCCryptorStatus CCECCryptorComputeSharedSecret(CCECCryptorRef privateKey, CCECCryptorRef publicKey, void *out, size_t *outLen);118 extern "C" CCCryptorStatus CCECCryptorSignHash(CCECCryptorRef privateKey, const void *hashToSign, size_t hashSignLen, void *signedData, size_t *signedDataLen);119 extern "C" CCCryptorStatus CCECCryptorVerifyHash(CCECCryptorRef publicKey, const void *hash, size_t hashLen, const void *signedData, size_t signedDataLen, uint32_t *valid);120 121 #ifndef CommonCrypto_CommonNistKeyDerivation_h122 enum {123 kCCKDFAlgorithmHKDF = 6124 };125 typedef uint32_t CCKDFAlgorithm;126 #endif127 128 extern "C" CCStatus CCKeyDerivationHMac(CCKDFAlgorithm algorithm, CCDigestAlgorithm digest, unsigned rounds, const void *keyDerivationKey, size_t keyDerivationKeyLen, const void *label, size_t labelLen, const void *context, size_t contextLen, const void *iv, size_t ivLen, const void *salt, size_t saltLen, void *derivedKey, size_t derivedKeyLen);129 130 #if !USE(APPLE_INTERNAL_SDK)131 extern "C" CCCryptorStatus CCCryptorGCM(CCOperation op, CCAlgorithm alg, const void* key, size_t keyLength, const void* iv, size_t ivLen, const void* aData, size_t aDataLen, const void* dataIn, size_t dataInLength, void* dataOut, void* tag, size_t* tagLength);132 extern "C" CCCryptorStatus CCRSACryptorCreateFromData(CCRSAKeyType keyType, const uint8_t *modulus, size_t modulusLength, const uint8_t *exponent, size_t exponentLength, const uint8_t *p, size_t pLength, const uint8_t *q, size_t qLength, CCRSACryptorRef *ref);133 #endif134 35 135 36 namespace WebCore { -
trunk/Source/WebCore/crypto/mac/CryptoAlgorithmHKDFMac.cpp
r238754 r242963 41 41 getCommonCryptoDigestAlgorithm(parameters.hashIdentifier, digestAlgorithm); 42 42 43 #pragma clang diagnostic push 44 #pragma clang diagnostic ignored "-Wdeprecated-declarations" 43 45 // <rdar://problem/32439455> Currently, when key data is empty, CCKeyDerivationHMac will bail out. 44 46 if (CCKeyDerivationHMac(kCCKDFAlgorithmHKDF, digestAlgorithm, 0, key.key().data(), key.key().size(), 0, 0, parameters.infoVector().data(), parameters.infoVector().size(), 0, 0, parameters.saltVector().data(), parameters.saltVector().size(), result.data(), result.size())) 45 47 return Exception { OperationError }; 48 #pragma clang diagnostic pop 46 49 return WTFMove(result); 47 50 }
Note:
See TracChangeset
for help on using the changeset viewer.