Bug 261550

Summary: [WebCrypto] Refactoring: Add checks for supported algorithms
Product: WebKit Reporter: Javier Fernandez <jfernandez>
Component: WebCore Misc.Assignee: Diego Pino <dpino>
Status: RESOLVED FIXED    
Severity: Normal CC: dpino, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Description Javier Fernandez 2023-09-14 00:54:30 PDT
We have several functions using if/then/else clauses and ternary operators to reuse the logic structure between several algorithms that use the OKP keys (eg, Curve25519 and Curve488). 

While it's not a big deal for Curve25519, since we are talking just about 2 algorithms, it may become a problem if we want to add support for Curve488 in the future.
Comment 1 Javier Fernandez 2023-09-14 01:12:08 PDT
Pull request: https://github.com/WebKit/WebKit/pull/17768
Comment 2 EWS 2023-09-18 03:29:48 PDT
Committed 268079@main (1fa83f2bc4ee): <https://commits.webkit.org/268079@main>

Reviewed commits have been landed. Closing PR #17768 and removing active labels.
Comment 3 Radar WebKit Bug Importer 2023-09-18 03:30:16 PDT
<rdar://problem/115649943>
Comment 4 Diego Pino 2023-09-19 08:20:42 PDT
Debian Stable and Ubuntu 20.04 build bots are failing after this patch with the following error:

https://build.webkit.org/#/builders/595/builds/13369

```
In file included from /home/buildbot/worker/GTK-Linux-64-bit-Release-Ubuntu-2004-Build/build/WebKitBuild/Release/WebCore/DerivedSources/unified-sources/UnifiedSource-44a97133-6.cpp:4:
/home/buildbot/worker/GTK-Linux-64-bit-Release-Ubuntu-2004-Build/build/Source/WebCore/crypto/gcrypt/CryptoKeyOKPGCrypt.cpp: In function ‘const std::array<unsigned char, 12> WebCore::algorithmId(WebCore::CryptoKeyOKP::NamedCurve)’:
/home/buildbot/worker/GTK-Linux-64-bit-Release-Ubuntu-2004-Build/build/Source/WebCore/crypto/gcrypt/CryptoKeyOKPGCrypt.cpp:260:25: error: could not convert ‘{{""}}’ from ‘<brace-enclosed initializer list>’ to ‘const std::array<unsigned char, 12>’
  260 |         return { { "" } };
      |                         ^
      |                         |
      |                         <brace-enclosed initializer list>
ninja: build stopped: subcommand failed.
```
Comment 5 Diego Pino 2023-09-19 08:21:22 PDT
Re-opening for pull request https://github.com/webkit/webkit/pull/17917
Comment 6 EWS 2023-09-19 08:29:30 PDT
Committed 268126@main (0d052d134bf0): <https://commits.webkit.org/268126@main>

Reviewed commits have been landed. Closing PR #17917 and removing active labels.