Bug 1539578 - Add telemetry for DH use in WebCrypto API r=keeler

Our WebCrypto implementation supports using DH as an algorithm in generateKey,
which is not one of the recognized algorithms in the published specification [0].

We should seek to remove it from Firefox, but before we do, it'd be good to
gather some telemetry on whether it's used at all, even in its' non-standard
form.

[0] https://www.w3.org/TR/WebCryptoAPI/#algorithm-overview

Differential Revision: https://phabricator.services.mozilla.com/D25291
This commit is contained in:
J.C. Jones
2019-03-29 15:55:54 +00:00
parent 857bd64fea
commit 830023da24
5 changed files with 88 additions and 0 deletions

View File

@@ -85,6 +85,7 @@ enum TelemetryAlgorithm {
TA_PBKDF2 = 21,
TA_ECDSA = 22,
TA_HKDF = 23,
TA_DH = 24,
};
// Convenience functions for extracting / converting information
@@ -2883,6 +2884,7 @@ class DeriveDhBitsTask : public ReturnArrayBufferViewTask {
}
void Init(JSContext* aCx, const ObjectOrString& aAlgorithm, CryptoKey& aKey) {
Telemetry::Accumulate(Telemetry::WEBCRYPTO_ALG, TA_DH);
CHECK_KEY_ALGORITHM(aKey.Algorithm(), WEBCRYPTO_ALG_DH);
// Check that we have a private key.