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

Side by Side Diff: nss/lib/ckfw/crypto.c

Issue 2078763002: Delete bundled copy of NSS and replace with README. (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/nss@master
Patch Set: Delete bundled copy of NSS and replace with README. Created 4 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 unified diff | Download patch
« no previous file with comments | « nss/lib/ckfw/ckt.h ('k') | nss/lib/ckfw/find.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 /*
6 * crypto.c
7 *
8 * This file implements the NSSCKFWCryptoOperation type and methods.
9 */
10
11 #ifndef CK_T
12 #include "ck.h"
13 #endif /* CK_T */
14
15 /*
16 * NSSCKFWCryptoOperation
17 *
18 * -- create/destroy --
19 * nssCKFWCrytoOperation_Create
20 * nssCKFWCryptoOperation_Destroy
21 *
22 * -- implement public accessors --
23 * nssCKFWCryptoOperation_GetMDCryptoOperation
24 * nssCKFWCryptoOperation_GetType
25 *
26 * -- private accessors --
27 *
28 * -- module fronts --
29 * nssCKFWCryptoOperation_GetFinalLength
30 * nssCKFWCryptoOperation_GetOperationLength
31 * nssCKFWCryptoOperation_Final
32 * nssCKFWCryptoOperation_Update
33 * nssCKFWCryptoOperation_DigestUpdate
34 * nssCKFWCryptoOperation_UpdateFinal
35 */
36
37 struct NSSCKFWCryptoOperationStr {
38 /* NSSArena *arena; */
39 NSSCKMDCryptoOperation *mdOperation;
40 NSSCKMDSession *mdSession;
41 NSSCKFWSession *fwSession;
42 NSSCKMDToken *mdToken;
43 NSSCKFWToken *fwToken;
44 NSSCKMDInstance *mdInstance;
45 NSSCKFWInstance *fwInstance;
46 NSSCKFWCryptoOperationType type;
47 };
48
49 /*
50 * nssCKFWCrytoOperation_Create
51 */
52 NSS_EXTERN NSSCKFWCryptoOperation *
53 nssCKFWCryptoOperation_Create(
54 NSSCKMDCryptoOperation *mdOperation,
55 NSSCKMDSession *mdSession,
56 NSSCKFWSession *fwSession,
57 NSSCKMDToken *mdToken,
58 NSSCKFWToken *fwToken,
59 NSSCKMDInstance *mdInstance,
60 NSSCKFWInstance *fwInstance,
61 NSSCKFWCryptoOperationType type,
62 CK_RV *pError)
63 {
64 NSSCKFWCryptoOperation *fwOperation;
65 fwOperation = nss_ZNEW(NULL, NSSCKFWCryptoOperation);
66 if (!fwOperation) {
67 *pError = CKR_HOST_MEMORY;
68 return (NSSCKFWCryptoOperation *)NULL;
69 }
70 fwOperation->mdOperation = mdOperation;
71 fwOperation->mdSession = mdSession;
72 fwOperation->fwSession = fwSession;
73 fwOperation->mdToken = mdToken;
74 fwOperation->fwToken = fwToken;
75 fwOperation->mdInstance = mdInstance;
76 fwOperation->fwInstance = fwInstance;
77 fwOperation->type = type;
78 return fwOperation;
79 }
80
81 /*
82 * nssCKFWCryptoOperation_Destroy
83 */
84 NSS_EXTERN void
85 nssCKFWCryptoOperation_Destroy(
86 NSSCKFWCryptoOperation *fwOperation)
87 {
88 if ((NSSCKMDCryptoOperation *)NULL != fwOperation->mdOperation) {
89 if (fwOperation->mdOperation->Destroy) {
90 fwOperation->mdOperation->Destroy(
91 fwOperation->mdOperation,
92 fwOperation,
93 fwOperation->mdInstance,
94 fwOperation->fwInstance);
95 }
96 }
97 nss_ZFreeIf(fwOperation);
98 }
99
100 /*
101 * nssCKFWCryptoOperation_GetMDCryptoOperation
102 */
103 NSS_EXTERN NSSCKMDCryptoOperation *
104 nssCKFWCryptoOperation_GetMDCryptoOperation(
105 NSSCKFWCryptoOperation *fwOperation)
106 {
107 return fwOperation->mdOperation;
108 }
109
110 /*
111 * nssCKFWCryptoOperation_GetType
112 */
113 NSS_EXTERN NSSCKFWCryptoOperationType
114 nssCKFWCryptoOperation_GetType(
115 NSSCKFWCryptoOperation *fwOperation)
116 {
117 return fwOperation->type;
118 }
119
120 /*
121 * nssCKFWCryptoOperation_GetFinalLength
122 */
123 NSS_EXTERN CK_ULONG
124 nssCKFWCryptoOperation_GetFinalLength(
125 NSSCKFWCryptoOperation *fwOperation,
126 CK_RV *pError)
127 {
128 if (!fwOperation->mdOperation->GetFinalLength) {
129 *pError = CKR_FUNCTION_FAILED;
130 return 0;
131 }
132 return fwOperation->mdOperation->GetFinalLength(
133 fwOperation->mdOperation,
134 fwOperation,
135 fwOperation->mdSession,
136 fwOperation->fwSession,
137 fwOperation->mdToken,
138 fwOperation->fwToken,
139 fwOperation->mdInstance,
140 fwOperation->fwInstance,
141 pError);
142 }
143
144 /*
145 * nssCKFWCryptoOperation_GetOperationLength
146 */
147 NSS_EXTERN CK_ULONG
148 nssCKFWCryptoOperation_GetOperationLength(
149 NSSCKFWCryptoOperation *fwOperation,
150 NSSItem *inputBuffer,
151 CK_RV *pError)
152 {
153 if (!fwOperation->mdOperation->GetOperationLength) {
154 *pError = CKR_FUNCTION_FAILED;
155 return 0;
156 }
157 return fwOperation->mdOperation->GetOperationLength(
158 fwOperation->mdOperation,
159 fwOperation,
160 fwOperation->mdSession,
161 fwOperation->fwSession,
162 fwOperation->mdToken,
163 fwOperation->fwToken,
164 fwOperation->mdInstance,
165 fwOperation->fwInstance,
166 inputBuffer,
167 pError);
168 }
169
170 /*
171 * nssCKFWCryptoOperation_Final
172 */
173 NSS_EXTERN CK_RV
174 nssCKFWCryptoOperation_Final(
175 NSSCKFWCryptoOperation *fwOperation,
176 NSSItem *outputBuffer)
177 {
178 if (!fwOperation->mdOperation->Final) {
179 return CKR_FUNCTION_FAILED;
180 }
181 return fwOperation->mdOperation->Final(
182 fwOperation->mdOperation,
183 fwOperation,
184 fwOperation->mdSession,
185 fwOperation->fwSession,
186 fwOperation->mdToken,
187 fwOperation->fwToken,
188 fwOperation->mdInstance,
189 fwOperation->fwInstance,
190 outputBuffer);
191 }
192
193 /*
194 * nssCKFWCryptoOperation_Update
195 */
196 NSS_EXTERN CK_RV
197 nssCKFWCryptoOperation_Update(
198 NSSCKFWCryptoOperation *fwOperation,
199 NSSItem *inputBuffer,
200 NSSItem *outputBuffer)
201 {
202 if (!fwOperation->mdOperation->Update) {
203 return CKR_FUNCTION_FAILED;
204 }
205 return fwOperation->mdOperation->Update(
206 fwOperation->mdOperation,
207 fwOperation,
208 fwOperation->mdSession,
209 fwOperation->fwSession,
210 fwOperation->mdToken,
211 fwOperation->fwToken,
212 fwOperation->mdInstance,
213 fwOperation->fwInstance,
214 inputBuffer,
215 outputBuffer);
216 }
217
218 /*
219 * nssCKFWCryptoOperation_DigestUpdate
220 */
221 NSS_EXTERN CK_RV
222 nssCKFWCryptoOperation_DigestUpdate(
223 NSSCKFWCryptoOperation *fwOperation,
224 NSSItem *inputBuffer)
225 {
226 if (!fwOperation->mdOperation->DigestUpdate) {
227 return CKR_FUNCTION_FAILED;
228 }
229 return fwOperation->mdOperation->DigestUpdate(
230 fwOperation->mdOperation,
231 fwOperation,
232 fwOperation->mdSession,
233 fwOperation->fwSession,
234 fwOperation->mdToken,
235 fwOperation->fwToken,
236 fwOperation->mdInstance,
237 fwOperation->fwInstance,
238 inputBuffer);
239 }
240
241 /*
242 * nssCKFWCryptoOperation_DigestKey
243 */
244 NSS_EXTERN CK_RV
245 nssCKFWCryptoOperation_DigestKey(
246 NSSCKFWCryptoOperation *fwOperation,
247 NSSCKFWObject *fwObject /* Key */
248 )
249 {
250 NSSCKMDObject *mdObject;
251
252 if (!fwOperation->mdOperation->DigestKey) {
253 return CKR_FUNCTION_FAILED;
254 }
255 mdObject = nssCKFWObject_GetMDObject(fwObject);
256 return fwOperation->mdOperation->DigestKey(
257 fwOperation->mdOperation,
258 fwOperation,
259 fwOperation->mdToken,
260 fwOperation->fwToken,
261 fwOperation->mdInstance,
262 fwOperation->fwInstance,
263 mdObject,
264 fwObject);
265 }
266
267 /*
268 * nssCKFWCryptoOperation_UpdateFinal
269 */
270 NSS_EXTERN CK_RV
271 nssCKFWCryptoOperation_UpdateFinal(
272 NSSCKFWCryptoOperation *fwOperation,
273 NSSItem *inputBuffer,
274 NSSItem *outputBuffer)
275 {
276 if (!fwOperation->mdOperation->UpdateFinal) {
277 return CKR_FUNCTION_FAILED;
278 }
279 return fwOperation->mdOperation->UpdateFinal(
280 fwOperation->mdOperation,
281 fwOperation,
282 fwOperation->mdSession,
283 fwOperation->fwSession,
284 fwOperation->mdToken,
285 fwOperation->fwToken,
286 fwOperation->mdInstance,
287 fwOperation->fwInstance,
288 inputBuffer,
289 outputBuffer);
290 }
291
292 /*
293 * nssCKFWCryptoOperation_UpdateCombo
294 */
295 NSS_EXTERN CK_RV
296 nssCKFWCryptoOperation_UpdateCombo(
297 NSSCKFWCryptoOperation *fwOperation,
298 NSSCKFWCryptoOperation *fwPeerOperation,
299 NSSItem *inputBuffer,
300 NSSItem *outputBuffer)
301 {
302 if (!fwOperation->mdOperation->UpdateCombo) {
303 return CKR_FUNCTION_FAILED;
304 }
305 return fwOperation->mdOperation->UpdateCombo(
306 fwOperation->mdOperation,
307 fwOperation,
308 fwPeerOperation->mdOperation,
309 fwPeerOperation,
310 fwOperation->mdSession,
311 fwOperation->fwSession,
312 fwOperation->mdToken,
313 fwOperation->fwToken,
314 fwOperation->mdInstance,
315 fwOperation->fwInstance,
316 inputBuffer,
317 outputBuffer);
318 }
OLDNEW
« no previous file with comments | « nss/lib/ckfw/ckt.h ('k') | nss/lib/ckfw/find.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698