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

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

Issue 789733009: Implement HKDF for WebCrypto (blink-side) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: move ASSERT(), add break Created 5 years, 11 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 /* 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 WebCryptoAlgorithmIdSha256, 63 WebCryptoAlgorithmIdSha256,
64 WebCryptoAlgorithmIdSha384, 64 WebCryptoAlgorithmIdSha384,
65 WebCryptoAlgorithmIdSha512, 65 WebCryptoAlgorithmIdSha512,
66 WebCryptoAlgorithmIdAesGcm, 66 WebCryptoAlgorithmIdAesGcm,
67 WebCryptoAlgorithmIdRsaOaep, 67 WebCryptoAlgorithmIdRsaOaep,
68 WebCryptoAlgorithmIdAesCtr, 68 WebCryptoAlgorithmIdAesCtr,
69 WebCryptoAlgorithmIdAesKw, 69 WebCryptoAlgorithmIdAesKw,
70 WebCryptoAlgorithmIdRsaPss, 70 WebCryptoAlgorithmIdRsaPss,
71 WebCryptoAlgorithmIdEcdsa, 71 WebCryptoAlgorithmIdEcdsa,
72 WebCryptoAlgorithmIdEcdh, 72 WebCryptoAlgorithmIdEcdh,
73 WebCryptoAlgorithmIdHkdf,
73 #if INSIDE_BLINK 74 #if INSIDE_BLINK
74 WebCryptoAlgorithmIdLast = WebCryptoAlgorithmIdEcdh, 75 WebCryptoAlgorithmIdLast = WebCryptoAlgorithmIdHkdf,
75 #endif 76 #endif
76 }; 77 };
77 78
78 enum WebCryptoNamedCurve { 79 enum WebCryptoNamedCurve {
79 WebCryptoNamedCurveP256, 80 WebCryptoNamedCurveP256,
80 WebCryptoNamedCurveP384, 81 WebCryptoNamedCurveP384,
81 WebCryptoNamedCurveP521, 82 WebCryptoNamedCurveP521,
82 #if INSIDE_BLINK 83 #if INSIDE_BLINK
83 WebCryptoNamedCurveLast = WebCryptoNamedCurveP521, 84 WebCryptoNamedCurveLast = WebCryptoNamedCurveP521,
84 #endif 85 #endif
85 }; 86 };
86 87
87 enum WebCryptoAlgorithmParamsType { 88 enum WebCryptoAlgorithmParamsType {
88 WebCryptoAlgorithmParamsTypeNone, 89 WebCryptoAlgorithmParamsTypeNone,
89 WebCryptoAlgorithmParamsTypeAesCbcParams, 90 WebCryptoAlgorithmParamsTypeAesCbcParams,
90 WebCryptoAlgorithmParamsTypeAesKeyGenParams, 91 WebCryptoAlgorithmParamsTypeAesKeyGenParams,
91 WebCryptoAlgorithmParamsTypeHmacImportParams, 92 WebCryptoAlgorithmParamsTypeHmacImportParams,
92 WebCryptoAlgorithmParamsTypeHmacKeyGenParams, 93 WebCryptoAlgorithmParamsTypeHmacKeyGenParams,
93 WebCryptoAlgorithmParamsTypeRsaHashedKeyGenParams, 94 WebCryptoAlgorithmParamsTypeRsaHashedKeyGenParams,
94 WebCryptoAlgorithmParamsTypeRsaHashedImportParams, 95 WebCryptoAlgorithmParamsTypeRsaHashedImportParams,
95 WebCryptoAlgorithmParamsTypeAesGcmParams, 96 WebCryptoAlgorithmParamsTypeAesGcmParams,
96 WebCryptoAlgorithmParamsTypeRsaOaepParams, 97 WebCryptoAlgorithmParamsTypeRsaOaepParams,
97 WebCryptoAlgorithmParamsTypeAesCtrParams, 98 WebCryptoAlgorithmParamsTypeAesCtrParams,
98 WebCryptoAlgorithmParamsTypeRsaPssParams, 99 WebCryptoAlgorithmParamsTypeRsaPssParams,
99 WebCryptoAlgorithmParamsTypeEcdsaParams, 100 WebCryptoAlgorithmParamsTypeEcdsaParams,
100 WebCryptoAlgorithmParamsTypeEcKeyGenParams, 101 WebCryptoAlgorithmParamsTypeEcKeyGenParams,
101 WebCryptoAlgorithmParamsTypeEcKeyImportParams, 102 WebCryptoAlgorithmParamsTypeEcKeyImportParams,
102 WebCryptoAlgorithmParamsTypeEcdhKeyDeriveParams, 103 WebCryptoAlgorithmParamsTypeEcdhKeyDeriveParams,
103 WebCryptoAlgorithmParamsTypeAesDerivedKeyParams, 104 WebCryptoAlgorithmParamsTypeAesDerivedKeyParams,
105 WebCryptoAlgorithmParamsTypeHkdfParams,
104 }; 106 };
105 107
106 struct WebCryptoAlgorithmInfo { 108 struct WebCryptoAlgorithmInfo {
107 typedef char ParamsTypeOrUndefined; 109 typedef char ParamsTypeOrUndefined;
108 static const ParamsTypeOrUndefined Undefined = -1; 110 static const ParamsTypeOrUndefined Undefined = -1;
109 111
110 // The canonical (case-sensitive) name for the algorithm as a 112 // The canonical (case-sensitive) name for the algorithm as a
111 // null-terminated C-string literal. 113 // null-terminated C-string literal.
112 const char* name; 114 const char* name;
113 115
(...skipping 11 matching lines...) Expand all
125 class WebCryptoRsaOaepParams; 127 class WebCryptoRsaOaepParams;
126 class WebCryptoAesCtrParams; 128 class WebCryptoAesCtrParams;
127 class WebCryptoRsaHashedKeyGenParams; 129 class WebCryptoRsaHashedKeyGenParams;
128 class WebCryptoRsaHashedImportParams; 130 class WebCryptoRsaHashedImportParams;
129 class WebCryptoRsaPssParams; 131 class WebCryptoRsaPssParams;
130 class WebCryptoEcdsaParams; 132 class WebCryptoEcdsaParams;
131 class WebCryptoEcKeyGenParams; 133 class WebCryptoEcKeyGenParams;
132 class WebCryptoEcKeyImportParams; 134 class WebCryptoEcKeyImportParams;
133 class WebCryptoEcdhKeyDeriveParams; 135 class WebCryptoEcdhKeyDeriveParams;
134 class WebCryptoAesDerivedKeyParams; 136 class WebCryptoAesDerivedKeyParams;
137 class WebCryptoHkdfParams;
135 138
136 class WebCryptoAlgorithmParams; 139 class WebCryptoAlgorithmParams;
137 class WebCryptoAlgorithmPrivate; 140 class WebCryptoAlgorithmPrivate;
138 141
139 // The WebCryptoAlgorithm represents a normalized algorithm and its parameters. 142 // The WebCryptoAlgorithm represents a normalized algorithm and its parameters.
140 // * Immutable 143 // * Immutable
141 // * Threadsafe 144 // * Threadsafe
142 // * Copiable (cheaply) 145 // * Copiable (cheaply)
143 // 146 //
144 // If WebCryptoAlgorithm "isNull()" then it is invalid to call any of the other 147 // If WebCryptoAlgorithm "isNull()" then it is invalid to call any of the other
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 BLINK_PLATFORM_EXPORT const WebCryptoRsaOaepParams* rsaOaepParams() const; 186 BLINK_PLATFORM_EXPORT const WebCryptoRsaOaepParams* rsaOaepParams() const;
184 BLINK_PLATFORM_EXPORT const WebCryptoAesCtrParams* aesCtrParams() const; 187 BLINK_PLATFORM_EXPORT const WebCryptoAesCtrParams* aesCtrParams() const;
185 BLINK_PLATFORM_EXPORT const WebCryptoRsaHashedImportParams* rsaHashedImportP arams() const; 188 BLINK_PLATFORM_EXPORT const WebCryptoRsaHashedImportParams* rsaHashedImportP arams() const;
186 BLINK_PLATFORM_EXPORT const WebCryptoRsaHashedKeyGenParams* rsaHashedKeyGenP arams() const; 189 BLINK_PLATFORM_EXPORT const WebCryptoRsaHashedKeyGenParams* rsaHashedKeyGenP arams() const;
187 BLINK_PLATFORM_EXPORT const WebCryptoRsaPssParams* rsaPssParams() const; 190 BLINK_PLATFORM_EXPORT const WebCryptoRsaPssParams* rsaPssParams() const;
188 BLINK_PLATFORM_EXPORT const WebCryptoEcdsaParams* ecdsaParams() const; 191 BLINK_PLATFORM_EXPORT const WebCryptoEcdsaParams* ecdsaParams() const;
189 BLINK_PLATFORM_EXPORT const WebCryptoEcKeyGenParams* ecKeyGenParams() const; 192 BLINK_PLATFORM_EXPORT const WebCryptoEcKeyGenParams* ecKeyGenParams() const;
190 BLINK_PLATFORM_EXPORT const WebCryptoEcKeyImportParams* ecKeyImportParams() const; 193 BLINK_PLATFORM_EXPORT const WebCryptoEcKeyImportParams* ecKeyImportParams() const;
191 BLINK_PLATFORM_EXPORT const WebCryptoEcdhKeyDeriveParams* ecdhKeyDeriveParam s() const; 194 BLINK_PLATFORM_EXPORT const WebCryptoEcdhKeyDeriveParams* ecdhKeyDeriveParam s() const;
192 BLINK_PLATFORM_EXPORT const WebCryptoAesDerivedKeyParams* aesDerivedKeyParam s() const; 195 BLINK_PLATFORM_EXPORT const WebCryptoAesDerivedKeyParams* aesDerivedKeyParam s() const;
196 BLINK_PLATFORM_EXPORT const WebCryptoHkdfParams* hkdfParams() const;
193 197
194 // Returns true if the provided algorithm ID is for a hash (in other words, SHA-*) 198 // Returns true if the provided algorithm ID is for a hash (in other words, SHA-*)
195 BLINK_PLATFORM_EXPORT static bool isHash(WebCryptoAlgorithmId); 199 BLINK_PLATFORM_EXPORT static bool isHash(WebCryptoAlgorithmId);
200 // Returns true if the provided algorithm ID is for a key derivation functio n
201 BLINK_PLATFORM_EXPORT static bool isKdf(WebCryptoAlgorithmId);
196 202
197 private: 203 private:
198 BLINK_PLATFORM_EXPORT void assign(const WebCryptoAlgorithm& other); 204 BLINK_PLATFORM_EXPORT void assign(const WebCryptoAlgorithm& other);
199 BLINK_PLATFORM_EXPORT void reset(); 205 BLINK_PLATFORM_EXPORT void reset();
200 206
201 WebPrivatePtr<WebCryptoAlgorithmPrivate> m_private; 207 WebPrivatePtr<WebCryptoAlgorithmPrivate> m_private;
202 }; 208 };
203 209
204 } // namespace blink 210 } // namespace blink
205 211
206 #endif 212 #endif
OLDNEW
« no previous file with comments | « Source/platform/exported/WebCryptoKeyAlgorithm.cpp ('k') | public/platform/WebCryptoAlgorithmParams.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698