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

Side by Side Diff: third_party/WebKit/Source/platform/exported/WebCryptoKeyAlgorithm.cpp

Issue 2547053003: s/ passed(...) / WTF::passed(...) / to avoid future ambiguity w/ base::Passed. (Closed)
Patch Set: Rebasing... Created 4 years 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 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 WebCryptoKeyAlgorithm::WebCryptoKeyAlgorithm( 56 WebCryptoKeyAlgorithm::WebCryptoKeyAlgorithm(
57 WebCryptoAlgorithmId id, 57 WebCryptoAlgorithmId id,
58 std::unique_ptr<WebCryptoKeyAlgorithmParams> params) 58 std::unique_ptr<WebCryptoKeyAlgorithmParams> params)
59 : m_private( 59 : m_private(
60 adoptRef(new WebCryptoKeyAlgorithmPrivate(id, std::move(params)))) {} 60 adoptRef(new WebCryptoKeyAlgorithmPrivate(id, std::move(params)))) {}
61 61
62 WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::adoptParamsAndCreate( 62 WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::adoptParamsAndCreate(
63 WebCryptoAlgorithmId id, 63 WebCryptoAlgorithmId id,
64 WebCryptoKeyAlgorithmParams* params) { 64 WebCryptoKeyAlgorithmParams* params) {
65 return WebCryptoKeyAlgorithm(id, wrapUnique(params)); 65 return WebCryptoKeyAlgorithm(id, WTF::wrapUnique(params));
66 } 66 }
67 67
68 WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createAes( 68 WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createAes(
69 WebCryptoAlgorithmId id, 69 WebCryptoAlgorithmId id,
70 unsigned short keyLengthBits) { 70 unsigned short keyLengthBits) {
71 // FIXME: Verify that id is an AES algorithm. 71 // FIXME: Verify that id is an AES algorithm.
72 // FIXME: Move this somewhere more general. 72 // FIXME: Move this somewhere more general.
73 if (keyLengthBits != 128 && keyLengthBits != 192 && keyLengthBits != 256) 73 if (keyLengthBits != 128 && keyLengthBits != 192 && keyLengthBits != 256)
74 return WebCryptoKeyAlgorithm(); 74 return WebCryptoKeyAlgorithm();
75 return WebCryptoKeyAlgorithm( 75 return WebCryptoKeyAlgorithm(
76 id, makeUnique<WebCryptoAesKeyAlgorithmParams>(keyLengthBits)); 76 id, WTF::makeUnique<WebCryptoAesKeyAlgorithmParams>(keyLengthBits));
77 } 77 }
78 78
79 WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createHmac( 79 WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createHmac(
80 WebCryptoAlgorithmId hash, 80 WebCryptoAlgorithmId hash,
81 unsigned keyLengthBits) { 81 unsigned keyLengthBits) {
82 if (!WebCryptoAlgorithm::isHash(hash)) 82 if (!WebCryptoAlgorithm::isHash(hash))
83 return WebCryptoKeyAlgorithm(); 83 return WebCryptoKeyAlgorithm();
84 return WebCryptoKeyAlgorithm(WebCryptoAlgorithmIdHmac, 84 return WebCryptoKeyAlgorithm(
85 wrapUnique(new WebCryptoHmacKeyAlgorithmParams( 85 WebCryptoAlgorithmIdHmac,
86 createHash(hash), keyLengthBits))); 86 WTF::wrapUnique(new WebCryptoHmacKeyAlgorithmParams(createHash(hash),
87 keyLengthBits)));
87 } 88 }
88 89
89 WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createRsaHashed( 90 WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createRsaHashed(
90 WebCryptoAlgorithmId id, 91 WebCryptoAlgorithmId id,
91 unsigned modulusLengthBits, 92 unsigned modulusLengthBits,
92 const unsigned char* publicExponent, 93 const unsigned char* publicExponent,
93 unsigned publicExponentSize, 94 unsigned publicExponentSize,
94 WebCryptoAlgorithmId hash) { 95 WebCryptoAlgorithmId hash) {
95 // FIXME: Verify that id is an RSA algorithm which expects a hash 96 // FIXME: Verify that id is an RSA algorithm which expects a hash
96 if (!WebCryptoAlgorithm::isHash(hash)) 97 if (!WebCryptoAlgorithm::isHash(hash))
97 return WebCryptoKeyAlgorithm(); 98 return WebCryptoKeyAlgorithm();
98 return WebCryptoKeyAlgorithm( 99 return WebCryptoKeyAlgorithm(
99 id, wrapUnique(new WebCryptoRsaHashedKeyAlgorithmParams( 100 id, WTF::wrapUnique(new WebCryptoRsaHashedKeyAlgorithmParams(
100 modulusLengthBits, publicExponent, publicExponentSize, 101 modulusLengthBits, publicExponent, publicExponentSize,
101 createHash(hash)))); 102 createHash(hash))));
102 } 103 }
103 104
104 WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createEc( 105 WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createEc(
105 WebCryptoAlgorithmId id, 106 WebCryptoAlgorithmId id,
106 WebCryptoNamedCurve namedCurve) { 107 WebCryptoNamedCurve namedCurve) {
107 return WebCryptoKeyAlgorithm( 108 return WebCryptoKeyAlgorithm(
108 id, makeUnique<WebCryptoEcKeyAlgorithmParams>(namedCurve)); 109 id, WTF::makeUnique<WebCryptoEcKeyAlgorithmParams>(namedCurve));
109 } 110 }
110 111
111 WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createWithoutParams( 112 WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createWithoutParams(
112 WebCryptoAlgorithmId id) { 113 WebCryptoAlgorithmId id) {
113 if (!WebCryptoAlgorithm::isKdf(id)) 114 if (!WebCryptoAlgorithm::isKdf(id))
114 return WebCryptoKeyAlgorithm(); 115 return WebCryptoKeyAlgorithm();
115 return WebCryptoKeyAlgorithm(id, nullptr); 116 return WebCryptoKeyAlgorithm(id, nullptr);
116 } 117 }
117 118
118 bool WebCryptoKeyAlgorithm::isNull() const { 119 bool WebCryptoKeyAlgorithm::isNull() const {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 174
174 void WebCryptoKeyAlgorithm::assign(const WebCryptoKeyAlgorithm& other) { 175 void WebCryptoKeyAlgorithm::assign(const WebCryptoKeyAlgorithm& other) {
175 m_private = other.m_private; 176 m_private = other.m_private;
176 } 177 }
177 178
178 void WebCryptoKeyAlgorithm::reset() { 179 void WebCryptoKeyAlgorithm::reset() {
179 m_private.reset(); 180 m_private.reset();
180 } 181 }
181 182
182 } // namespace blink 183 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698