Commit 3abe0e4
committed
https://bugs.webkit.org/show_bug.cgi?id=246145
rdar://problem/100401588
Reviewed by Chris Dumez.
Introduce CryptoKeyOKP to support secure safe curves.
Add support for generating, importing and exporting Ed25519 keys.
Add a runtime flag to control exposing the support.
This patch reuses work done in #5026 by Angela Izquierdo Garcia.
* LayoutTests/http/wpt/crypto/serialize-cryptokey-okp-expected.txt: Added.
* LayoutTests/http/wpt/crypto/serialize-cryptokey-okp.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/import_export/okp_importKey.https.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/import_export/okp_importKey.https.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/import_export/okp_importKey_failures_Ed25519.https.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/import_export/okp_importKey_failures_Ed25519.https.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/sign_verify/eddsa.https.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/sign_verify/eddsa.https.any.worker-expected.txt:
* LayoutTests/platform/glib/TestExpectations:
* Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj:
* Source/WebCore/PAL/pal/spi/cocoa/CoreCryptoSPI.h: Added.
(cccurve25519_make_priv):
(cccurve25519_make_pub):
(cccurve25519_make_key_pair):
* Source/WebCore/Sources.txt:
* Source/WebCore/SourcesCocoa.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::write):
(WebCore::CloneDeserializer::read):
(WebCore::CloneDeserializer::readOKPKey):
(WebCore::CloneDeserializer::readCryptoKey):
* Source/WebCore/crypto/CryptoAlgorithmIdentifier.h:
* Source/WebCore/crypto/CryptoKey.h:
* Source/WebCore/crypto/SubtleCrypto.cpp:
(WebCore::normalizeCryptoAlgorithmParameters):
(WebCore::isSupportedExportKey):
* Source/WebCore/crypto/algorithms/CryptoAlgorithmEd25519.cpp: Added.
(WebCore::CryptoAlgorithmEd25519::platformSign):
(WebCore::CryptoAlgorithmEd25519::platformVerify):
(WebCore::CryptoAlgorithmEd25519::create):
(WebCore::CryptoAlgorithmEd25519::identifier const):
(WebCore::CryptoAlgorithmEd25519::generateKey):
(WebCore::CryptoAlgorithmEd25519::sign):
(WebCore::CryptoAlgorithmEd25519::verify):
(WebCore::CryptoAlgorithmEd25519::importKey):
(WebCore::CryptoAlgorithmEd25519::exportKey):
* Source/WebCore/crypto/algorithms/CryptoAlgorithmEd25519.h: Added.
* Source/WebCore/crypto/keys/CryptoKeyOKP.cpp: Added.
(WebCore::keySizeInBytesFromNamedCurve):
(WebCore::CryptoKeyOKP::create):
(WebCore::CryptoKeyOKP::CryptoKeyOKP):
(WebCore::CryptoKeyOKP::generatePair):
(WebCore::CryptoKeyOKP::importRaw):
(WebCore::CryptoKeyOKP::importJwk):
(WebCore::CryptoKeyOKP::exportRaw const):
(WebCore::CryptoKeyOKP::exportJwk const):
(WebCore::CryptoKeyOKP::namedCurveString const):
(WebCore::CryptoKeyOKP::isValidOKPAlgorithm):
(WebCore::CryptoKeyOKP::algorithm const):
(WebCore::CryptoKeyOKP::platformSupportedCurve):
(WebCore::CryptoKeyOKP::platformGeneratePair):
(WebCore::CryptoKeyOKP::importSpki):
(WebCore::CryptoKeyOKP::exportSpki const):
(WebCore::CryptoKeyOKP::importPkcs8):
(WebCore::CryptoKeyOKP::exportPkcs8 const):
(WebCore::CryptoKeyOKP::computePublicKeyFromPrivateKey const):
* Source/WebCore/crypto/keys/CryptoKeyOKP.h: Added.
* Source/WebCore/crypto/mac/CryptoAlgorithmEd25519Cocoa.cpp: Added.
(WebCore::signEd25519):
(WebCore::verifyEd25519):
(WebCore::CryptoAlgorithmEd25519::platformSign):
(WebCore::CryptoAlgorithmEd25519::platformVerify):
* Source/WebCore/crypto/mac/CryptoAlgorithmHKDFMac.cpp:
* Source/WebCore/crypto/mac/CryptoAlgorithmRegistryMac.cpp:
(WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
* Source/WebCore/crypto/mac/CryptoKeyOKPCocoa.cpp: Added.
(WebCore::CryptoKeyOKP::platformSupportedCurve):
(WebCore::CryptoKeyOKP::computePublicKeyFromPrivateKey const):
(WebCore::CryptoKeyOKP::platformGeneratePair):
(WebCore::CryptoKeyOKP::importSpki):
(WebCore::CryptoKeyOKP::exportSpki const):
(WebCore::CryptoKeyOKP::importPkcs8):
(WebCore::CryptoKeyOKP::exportPkcs8 const):
* Source/WebCore/platform/Logging.h:
Canonical link: https://commits.webkit.org/259277@main
1 parent 48aa7e7 commit 3abe0e4
File tree
32 files changed
+1849
-528
lines changed- LayoutTests
- http/wpt/crypto
- imported/w3c/web-platform-tests/WebCryptoAPI
- generateKey
- import_export
- sign_verify
- platform/glib
- Source
- WTF/Scripts/Preferences
- WebCore
- PAL
- PAL.xcodeproj
- pal/spi/cocoa
- WebCore.xcodeproj
- bindings/js
- crypto
- algorithms
- keys
- mac
- platform
32 files changed
+1849
-528
lines changedLines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
Lines changed: 26 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
352 | 352 | | |
Lines changed: 26 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
352 | 352 | | |
0 commit comments