0
Files
src/crypto
Elly 5a157ba810 components/cup: migrate to new crypto APIs
This change migrates //components/client_update_protocol from:
* crypto/sha2 to crypto/hash
* crypto/signature_verifier to crypto/sign and crypto/keypair

Specifically:
* Uses of the obsolete SHA-256 APIs are replaced with uses of the new
  crypto::hash API, generally resulting in less copying and intermediate
  variables
* Use of SignatureVerifier is replaced with a single call to
  crypto::sign::Verify

That causes a design change. Previously, the Ecdsa class relied on
SignatureCreator, and creation of SignatureCreator could fail, so
Ecdsa also had to have a constructor that could fail (its ::Create
static method). Since construction of PublicKey *can't* fail unless the
public key is malformed, and we know the public key in advance (it is
hardcoded), Ecdsa no longer needs a fallible ::Create method. It is now
possible to directly construct an Ecdsa instance and hold it inline.
This change bubbles outwards to clients of Ecdsa, which now hold Ecdsa
instances as class members directly rather than as unique_ptrs, and
allows removing a bunch of conditions / failure paths from those client
classes.

Apart from that design change (which accounts for the bulk of the LOC in
this CL), this CL:
* Migrates some raw arrays to std::arrays, fixing unsafe bounds
  warnings;
* Promotes some DCHECKs that indicate programmer errors to CHECKs in
  line with current guidance;
* Removes some logic that decoded static public keys from hardcoded
  base64 strings at runtime in favor of hardcoding the raw key bytes
  instead, and removes some failure paths as a result;
* Removes the MISSING_PUBLIC_KEY error code, since this is now
  impossible in RequestSender (the public key is hardcoded, and no
  longer needs fallible base64 decoding);
* Adds assignment operators to crypto::keypair, which I forgot to do
  when originally adding them but which are needed for Ecdsa to allow
  replacing its internal keys for testing

Bug: 372283556

Change-Id: I1431aeebd83722eb45bab32330487a88bf73aaac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6427233
Reviewed-by: Carlos IL <carlosil@chromium.org>
Reviewed-by: Joshua Pawlicki <waffles@chromium.org>
Commit-Queue: Elly FJ <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1444203}
2025-04-08 10:05:56 -07:00
..
2025-04-03 17:15:35 -07:00
2024-10-23 17:28:03 +00:00
2024-10-23 17:28:03 +00:00
2024-10-23 17:28:03 +00:00
2024-11-27 16:17:21 +00:00
2024-11-27 16:17:21 +00:00
2025-04-04 07:28:51 -07:00
2024-10-23 21:50:38 +00:00
2025-02-20 20:47:25 -08:00
2025-03-27 08:23:05 -07:00
2025-03-27 08:23:05 -07:00
2024-10-10 20:51:36 +00:00
2024-10-10 20:51:36 +00:00
2025-03-27 08:23:05 -07:00
2024-10-18 03:18:26 +00:00
2025-04-02 13:12:55 -07:00
2025-04-02 13:12:55 -07:00
2024-10-10 20:51:36 +00:00