Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Side by Side Diff: components/webcrypto/algorithms/test_helpers.cc

Issue 1355873002: [refactor] More post-NSS WebCrypto cleanups (utility functions). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address David's comments Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/webcrypto/algorithms/test_helpers.h" 5 #include "components/webcrypto/algorithms/test_helpers.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 if (curve_str == "P-384") 638 if (curve_str == "P-384")
639 return blink::WebCryptoNamedCurveP384; 639 return blink::WebCryptoNamedCurveP384;
640 if (curve_str == "P-521") 640 if (curve_str == "P-521")
641 return blink::WebCryptoNamedCurveP521; 641 return blink::WebCryptoNamedCurveP521;
642 else 642 else
643 ADD_FAILURE() << "Unrecognized curve name: " << curve_str; 643 ADD_FAILURE() << "Unrecognized curve name: " << curve_str;
644 644
645 return blink::WebCryptoNamedCurveP384; 645 return blink::WebCryptoNamedCurveP384;
646 } 646 }
647 647
648 blink::WebCryptoAlgorithm CreateHmacImportAlgorithm(
649 blink::WebCryptoAlgorithmId hash_id,
650 unsigned int length_bits) {
651 DCHECK(blink::WebCryptoAlgorithm::isHash(hash_id));
652 return blink::WebCryptoAlgorithm::adoptParamsAndCreate(
653 blink::WebCryptoAlgorithmIdHmac,
654 new blink::WebCryptoHmacImportParams(CreateAlgorithm(hash_id), true,
655 length_bits));
656 }
657
658 blink::WebCryptoAlgorithm CreateHmacImportAlgorithmNoLength(
659 blink::WebCryptoAlgorithmId hash_id) {
660 DCHECK(blink::WebCryptoAlgorithm::isHash(hash_id));
661 return blink::WebCryptoAlgorithm::adoptParamsAndCreate(
662 blink::WebCryptoAlgorithmIdHmac,
663 new blink::WebCryptoHmacImportParams(CreateAlgorithm(hash_id), false, 0));
664 }
665
648 } // namespace webcrypto 666 } // namespace webcrypto
OLDNEW
« no previous file with comments | « components/webcrypto/algorithms/test_helpers.h ('k') | components/webcrypto/algorithms/util_openssl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698