4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
29 #include <security/cryptoki.h>
30 #include "pkcs11Global.h"
31 #include "pkcs11Session.h"
32 #include "pkcs11Slot.h"
35 * C_DigestEncryptUpdate is a pure wrapper to the underlying provider.
36 * Policy enforcement was done earlier by the mandatory calls to
37 * C_DigestInit and C_EncryptInit.
39 * The only argument checked is whether or not hSession is valid.
42 C_DigestEncryptUpdate(CK_SESSION_HANDLE hSession
, CK_BYTE_PTR pPart
,
43 CK_ULONG ulPartLen
, CK_BYTE_PTR pEncryptedPart
,
44 CK_ULONG_PTR pulEncryptedPartLen
)
47 pkcs11_session_t
*sessp
;
49 /* Check for a fastpath */
50 if (purefastpath
|| policyfastpath
) {
51 return (fast_funcs
->C_DigestEncryptUpdate(hSession
, pPart
,
52 ulPartLen
, pEncryptedPart
, pulEncryptedPartLen
));
55 if (!pkcs11_initialized
) {
56 return (CKR_CRYPTOKI_NOT_INITIALIZED
);
59 /* Obtain the session pointer */
60 HANDLE2SESSION(hSession
, sessp
, rv
);
66 /* Pass data to the provider */
67 rv
= FUNCLIST(sessp
->se_slotid
)->
68 C_DigestEncryptUpdate(sessp
->se_handle
, pPart
, ulPartLen
,
69 pEncryptedPart
, pulEncryptedPartLen
);
71 /* Present consistent interface to the application */
72 if (rv
== CKR_FUNCTION_NOT_SUPPORTED
) {
73 return (CKR_FUNCTION_FAILED
);
81 * C_DecryptDigestUpdate is a pure wrapper to the underlying provider.
82 * Policy enforcement was done earlier by the mandatory calls to
83 * C_DigestInit and C_DecryptInit.
85 * The only argument checked is whether or not hSession is valid.
88 C_DecryptDigestUpdate(CK_SESSION_HANDLE hSession
, CK_BYTE_PTR pEncryptedPart
,
89 CK_ULONG ulEncryptedPartLen
, CK_BYTE_PTR pPart
, CK_ULONG_PTR pulPartLen
)
92 pkcs11_session_t
*sessp
;
94 /* Check for a fastpath */
95 if (purefastpath
|| policyfastpath
) {
96 return (fast_funcs
->C_DecryptDigestUpdate(hSession
,
97 pEncryptedPart
, ulEncryptedPartLen
, pPart
,
101 if (!pkcs11_initialized
) {
102 return (CKR_CRYPTOKI_NOT_INITIALIZED
);
105 /* Obtain the session pointer */
106 HANDLE2SESSION(hSession
, sessp
, rv
);
112 /* Pass data to the provider */
113 rv
= FUNCLIST(sessp
->se_slotid
)->
114 C_DecryptDigestUpdate(sessp
->se_handle
, pEncryptedPart
,
115 ulEncryptedPartLen
, pPart
, pulPartLen
);
117 /* Present consistent interface to the application */
118 if (rv
== CKR_FUNCTION_NOT_SUPPORTED
) {
119 return (CKR_FUNCTION_FAILED
);
126 * C_SignEncryptUpdate is a pure wrapper to the underlying provider.
127 * Policy enforcement was done earlier by the mandatory calls to
128 * C_SignInit and C_EncryptInit.
130 * The only argument checked is whether or not hSession is valid.
133 C_SignEncryptUpdate(CK_SESSION_HANDLE hSession
, CK_BYTE_PTR pPart
,
134 CK_ULONG ulPartLen
, CK_BYTE_PTR pEncryptedPart
,
135 CK_ULONG_PTR pulEncryptedPartLen
)
138 pkcs11_session_t
*sessp
;
140 /* Check for a fastpath */
141 if (purefastpath
|| policyfastpath
) {
142 return (fast_funcs
->C_SignEncryptUpdate(hSession
, pPart
,
143 ulPartLen
, pEncryptedPart
, pulEncryptedPartLen
));
146 if (!pkcs11_initialized
) {
147 return (CKR_CRYPTOKI_NOT_INITIALIZED
);
150 /* Obtain the session pointer */
151 HANDLE2SESSION(hSession
, sessp
, rv
);
157 /* Pass data to the provider */
158 rv
= FUNCLIST(sessp
->se_slotid
)->
159 C_SignEncryptUpdate(sessp
->se_handle
, pPart
, ulPartLen
,
160 pEncryptedPart
, pulEncryptedPartLen
);
162 /* Present consistent interface to the application */
163 if (rv
== CKR_FUNCTION_NOT_SUPPORTED
) {
164 return (CKR_FUNCTION_FAILED
);
171 * C_DecryptVerifyUpdate is a pure wrapper to the underlying provider.
172 * Policy enforcement was done earlier by the mandatory calls to
173 * C_SignInit and C_EncryptInit.
175 * The only argument checked is whether or not hSession is valid.
178 C_DecryptVerifyUpdate(CK_SESSION_HANDLE hSession
, CK_BYTE_PTR pEncryptedPart
,
179 CK_ULONG ulEncryptedPartLen
, CK_BYTE_PTR pPart
, CK_ULONG_PTR pulPartLen
)
182 pkcs11_session_t
*sessp
;
184 /* Check for a fastpath */
185 if (purefastpath
|| policyfastpath
) {
186 return (fast_funcs
->C_DecryptVerifyUpdate(hSession
,
187 pEncryptedPart
, ulEncryptedPartLen
, pPart
,
191 if (!pkcs11_initialized
) {
192 return (CKR_CRYPTOKI_NOT_INITIALIZED
);
195 /* Obtain the session pointer */
196 HANDLE2SESSION(hSession
, sessp
, rv
);
202 /* Pass data to the provider */
203 rv
= FUNCLIST(sessp
->se_slotid
)->
204 C_DecryptVerifyUpdate(sessp
->se_handle
, pEncryptedPart
,
205 ulEncryptedPartLen
, pPart
, pulPartLen
);
207 /* Present consistent interface to the application */
208 if (rv
== CKR_FUNCTION_NOT_SUPPORTED
) {
209 return (CKR_FUNCTION_FAILED
);