[webkit-changes] [WebKit/WebKit] 1fa83f: Add checks for the supported WebCrypto algorithms.

Javier Fernandez Garcia-Boente noreply at github.com
Mon Sep 18 03:29:57 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1fa83f2bc4ee72f8ebf13b4dae1348c2f4d1897a
      https://github.com/WebKit/WebKit/commit/1fa83f2bc4ee72f8ebf13b4dae1348c2f4d1897a
  Author: Javier Fernandez <jfernandez at igalia.com>
  Date:   2023-09-18 (Mon, 18 Sep 2023)

  Changed paths:
    M Source/WebCore/crypto/gcrypt/CryptoKeyOKPGCrypt.cpp
    M Source/WebCore/crypto/mac/CryptoKeyOKPCocoa.cpp

  Log Message:
  -----------
  Add checks for the supported WebCrypto algorithms.
https://bugs.webkit.org/show_bug.cgi?id=261550

Reviewed by Žan Doberšek.

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.

This PR adds some checks in different functions to early return in
case of unsupported algorithms.

* Source/WebCore/crypto/gcrypt/CryptoKeyOKPGCrypt.cpp:
(WebCore::CryptoKeyOKP::platformGeneratePair):
(WebCore::CryptoKeyOKP::platformCheckPairedKeys):
(WebCore::CryptoKeyOKP::importSpki):
(WebCore::algorithmId):
(WebCore::CryptoKeyOKP::exportSpki const):
(WebCore::CryptoKeyOKP::importPkcs8):
(WebCore::CryptoKeyOKP::exportPkcs8 const):
* Source/WebCore/crypto/mac/CryptoKeyOKPCocoa.cpp:
(WebCore::CryptoKeyOKP::platformGeneratePair):
(WebCore::CryptoKeyOKP::platformCheckPairedKeys):
(WebCore::CryptoKeyOKP::importSpki):
(WebCore::writeOID):
(WebCore::CryptoKeyOKP::importPkcs8):

Canonical link: https://commits.webkit.org/268079@main




More information about the webkit-changes mailing list