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

Side by Side Diff: public/platform/WebCrypto.h

Issue 255453002: [refactor] Use a lookup table rather than binary search for algorithm normalization. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 // "verifySignature". 186 // "verifySignature".
187 // 187 //
188 // ----------------------- 188 // -----------------------
189 // Guarantees on input validity 189 // Guarantees on input validity
190 // ----------------------- 190 // -----------------------
191 // 191 //
192 // Implementations MUST carefully sanitize algorithm inputs before using 192 // Implementations MUST carefully sanitize algorithm inputs before using
193 // them, as they come directly from the user. Few checks have been done on 193 // them, as they come directly from the user. Few checks have been done on
194 // algorithm parameters prior to passing to the embedder. 194 // algorithm parameters prior to passing to the embedder.
195 // 195 //
196 // Only the following checks can be assumed as having alread passed: 196 // Only the following checks can be assumed as having already passed:
197 // 197 //
198 // * The key is extractable when calling into exportKey/wrapKey. 198 // * The key is extractable when calling into exportKey/wrapKey.
199 // * The key usages permit the operation being requested. 199 // * The key usages permit the operation being requested.
200 // * The key's algorithm matches that of the requested operation. 200 // * The key's algorithm matches that of the requested operation.
201 // * When creating a key, the key usages are appropriate for the algorithm.
201 // 202 //
202 virtual void encrypt(const WebCryptoAlgorithm&, const WebCryptoKey&, const u nsigned char* data, unsigned dataSize, WebCryptoResult result) { result.complete WithError(WebCryptoErrorTypeNotSupported, ""); } 203 virtual void encrypt(const WebCryptoAlgorithm&, const WebCryptoKey&, const u nsigned char* data, unsigned dataSize, WebCryptoResult result) { result.complete WithError(WebCryptoErrorTypeNotSupported, ""); }
203 virtual void decrypt(const WebCryptoAlgorithm&, const WebCryptoKey&, const u nsigned char* data, unsigned dataSize, WebCryptoResult result) { result.complete WithError(WebCryptoErrorTypeNotSupported, ""); } 204 virtual void decrypt(const WebCryptoAlgorithm&, const WebCryptoKey&, const u nsigned char* data, unsigned dataSize, WebCryptoResult result) { result.complete WithError(WebCryptoErrorTypeNotSupported, ""); }
204 virtual void sign(const WebCryptoAlgorithm&, const WebCryptoKey&, const unsi gned char* data, unsigned dataSize, WebCryptoResult result) { result.completeWit hError(WebCryptoErrorTypeNotSupported, ""); } 205 virtual void sign(const WebCryptoAlgorithm&, const WebCryptoKey&, const unsi gned char* data, unsigned dataSize, WebCryptoResult result) { result.completeWit hError(WebCryptoErrorTypeNotSupported, ""); }
205 virtual void verifySignature(const WebCryptoAlgorithm&, const WebCryptoKey&, const unsigned char* signature, unsigned signatureSize, const unsigned char* da ta, unsigned dataSize, WebCryptoResult result) { result.completeWithError(WebCry ptoErrorTypeNotSupported, ""); } 206 virtual void verifySignature(const WebCryptoAlgorithm&, const WebCryptoKey&, const unsigned char* signature, unsigned signatureSize, const unsigned char* da ta, unsigned dataSize, WebCryptoResult result) { result.completeWithError(WebCry ptoErrorTypeNotSupported, ""); }
206 virtual void digest(const WebCryptoAlgorithm&, const unsigned char* data, un signed dataSize, WebCryptoResult result) { result.completeWithError(WebCryptoErr orTypeNotSupported, ""); } 207 virtual void digest(const WebCryptoAlgorithm&, const unsigned char* data, un signed dataSize, WebCryptoResult result) { result.completeWithError(WebCryptoErr orTypeNotSupported, ""); }
207 virtual void generateKey(const WebCryptoAlgorithm&, bool extractable, WebCry ptoKeyUsageMask, WebCryptoResult result) { result.completeWithError(WebCryptoErr orTypeNotSupported, ""); } 208 virtual void generateKey(const WebCryptoAlgorithm&, bool extractable, WebCry ptoKeyUsageMask, WebCryptoResult result) { result.completeWithError(WebCryptoErr orTypeNotSupported, ""); }
208 virtual void importKey(WebCryptoKeyFormat, const unsigned char* keyData, uns igned keyDataSize, const WebCryptoAlgorithm&, bool extractable, WebCryptoKeyUsag eMask, WebCryptoResult result) { result.completeWithError(WebCryptoErrorTypeNotS upported, ""); } 209 virtual void importKey(WebCryptoKeyFormat, const unsigned char* keyData, uns igned keyDataSize, const WebCryptoAlgorithm&, bool extractable, WebCryptoKeyUsag eMask, WebCryptoResult result) { result.completeWithError(WebCryptoErrorTypeNotS upported, ""); }
209 virtual void exportKey(WebCryptoKeyFormat, const WebCryptoKey&, WebCryptoRes ult result) { result.completeWithError(WebCryptoErrorTypeNotSupported, ""); } 210 virtual void exportKey(WebCryptoKeyFormat, const WebCryptoKey&, WebCryptoRes ult result) { result.completeWithError(WebCryptoErrorTypeNotSupported, ""); }
210 virtual void wrapKey(WebCryptoKeyFormat, const WebCryptoKey& key, const WebC ryptoKey& wrappingKey, const WebCryptoAlgorithm&, WebCryptoResult result) { resu lt.completeWithError(WebCryptoErrorTypeNotSupported, ""); } 211 virtual void wrapKey(WebCryptoKeyFormat, const WebCryptoKey& key, const WebC ryptoKey& wrappingKey, const WebCryptoAlgorithm&, WebCryptoResult result) { resu lt.completeWithError(WebCryptoErrorTypeNotSupported, ""); }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 // Returns true on success. 268 // Returns true on success.
268 virtual bool serializeKeyForClone(const WebCryptoKey&, WebVector<unsigned ch ar>&) { return false; } 269 virtual bool serializeKeyForClone(const WebCryptoKey&, WebVector<unsigned ch ar>&) { return false; }
269 270
270 protected: 271 protected:
271 virtual ~WebCrypto() { } 272 virtual ~WebCrypto() { }
272 }; 273 };
273 274
274 } // namespace blink 275 } // namespace blink
275 276
276 #endif 277 #endif
OLDNEW
« Source/modules/crypto/NormalizeAlgorithm.cpp ('K') | « Source/modules/crypto/SubtleCrypto.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698