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

Unified Diff: public/platform/WebCryptoAlgorithmParams.h

Issue 18475002: WebCrypto: Add framework for AlgorithmIdentifier normalization. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rename verify --> verifySignature (because "verify" is a macro on Mac) Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « public/platform/WebCryptoAlgorithm.h ('k') | public/platform/WebVector.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: public/platform/WebCryptoAlgorithmParams.h
diff --git a/public/platform/WebDeviceMotionData.h b/public/platform/WebCryptoAlgorithmParams.h
similarity index 54%
copy from public/platform/WebDeviceMotionData.h
copy to public/platform/WebCryptoAlgorithmParams.h
index 140d8f21ff8c1bb94251428551452a6de463fa02..eea3ab7eb18059e4cf4d589db5fbf28515eb3b9c 100644
--- a/public/platform/WebDeviceMotionData.h
+++ b/public/platform/WebCryptoAlgorithmParams.h
@@ -28,55 +28,65 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebDeviceMotionData_h
-#define WebDeviceMotionData_h
+#ifndef WebCryptoAlgorithmParams_h
+#define WebCryptoAlgorithmParams_h
#include "WebCommon.h"
+#include "WebCryptoAlgorithm.h"
+#include "WebVector.h"
namespace WebKit {
-#pragma pack(push, 1)
+// NOTE: For documentation on the meaning of each of the parameters see the
+// Web crypto spec:
+//
+// http://www.w3.org/TR/WebCryptoAPI
+//
+// The parameters in the spec have the same name, minus the "WebCrypto" prefix.
-class WebDeviceMotionData {
+class WebCryptoAlgorithmParams {
public:
- WEBKIT_EXPORT WebDeviceMotionData();
- ~WebDeviceMotionData() { }
+ WebCryptoAlgorithmParams(WebCryptoAlgorithmParamsType type)
+ : m_type(type)
+ {
+ }
- double accelerationX;
- double accelerationY;
- double accelerationZ;
+ virtual ~WebCryptoAlgorithmParams() { }
- double accelerationIncludingGravityX;
- double accelerationIncludingGravityY;
- double accelerationIncludingGravityZ;
+ WebCryptoAlgorithmParamsType type() const { return m_type; }
- double rotationRateAlpha;
- double rotationRateBeta;
- double rotationRateGamma;
-
- double interval;
-
- bool hasAccelerationX : 1;
- bool hasAccelerationY : 1;
- bool hasAccelerationZ : 1;
+private:
+ WebCryptoAlgorithmParamsType m_type;
+};
- bool hasAccelerationIncludingGravityX : 1;
- bool hasAccelerationIncludingGravityY : 1;
- bool hasAccelerationIncludingGravityZ : 1;
+class WebCryptoAesCbcParams : public WebCryptoAlgorithmParams {
+public:
+ WebCryptoAesCbcParams(unsigned char* iv, size_t ivSize)
+ : WebCryptoAlgorithmParams(WebCryptoAlgorithmParamsTypeAesCbcParams)
+ , m_iv(iv, ivSize)
+ {
+ }
- bool hasRotationRateAlpha : 1;
- bool hasRotationRateBeta : 1;
- bool hasRotationRateGamma : 1;
+ const WebVector<unsigned char>& iv() const { return m_iv; }
- bool allAvailableSensorsAreActive : 1;
+private:
+ const WebVector<unsigned char> m_iv;
};
-#if WEBKIT_IMPLEMENTATION
-COMPILE_ASSERT(sizeof(WebDeviceMotionData) == (10 * sizeof(double) + 2 * sizeof(char)), WebDeviceMotionData_has_wrong_size);
-#endif
+class WebCryptoAesKeyGenParams : public WebCryptoAlgorithmParams {
+public:
+ WebCryptoAesKeyGenParams(unsigned short length)
+ : WebCryptoAlgorithmParams(WebCryptoAlgorithmParamsTypeAesKeyGenParams)
+ , m_length(length)
+ {
+ }
+
+ unsigned short length() const { return m_length; }
-#pragma pack(pop)
+private:
+ const unsigned short m_length;
+};
} // namespace WebKit
-#endif // WebDeviceMotionData_h
+#endif
« no previous file with comments | « public/platform/WebCryptoAlgorithm.h ('k') | public/platform/WebVector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698