2 pakchois PKCS#11 interface -- error mapping
3 Copyright (C) 2008, Joe Orton <joe@manyfish.co.uk>
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with this library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 This code is directly derived from the scute.org PKCS#11 cryptoki
25 Copyright 2006, 2007 g10 Code GmbH
26 Copyright 2006 Andreas Jellinghaus
28 This file is free software; as a special exception the author gives
29 unlimited permission to copy and/or distribute it, with or without
30 modifications, as long as this notice is preserved.
32 This file is distributed in the hope that it will be useful, but
33 WITHOUT ANY WARRANTY, to the extent permitted by law; without even
34 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
44 #define _(x) dgettext(PACKAGE_NAME, x)
50 pakchois_error (ck_rv_t rv
)
52 if (rv
>= CKR_VENDOR_DEFINED
)
54 return _("Vendor defined error");
64 return _("Host memory");
65 case CKR_SLOT_ID_INVALID
:
66 return _("Slot id invalid");
67 case CKR_GENERAL_ERROR
:
68 return _("General error");
69 case CKR_FUNCTION_FAILED
:
70 return _("Function failed");
71 case CKR_ARGUMENTS_BAD
:
72 return _("Arguments bad");
75 case CKR_NEED_TO_CREATE_THREADS
:
76 return _("Need to create threads");
78 return _("Can't lock");
79 case CKR_ATTRIBUTE_READ_ONLY
:
80 return _("Attribute read only");
81 case CKR_ATTRIBUTE_SENSITIVE
:
82 return _("Attribute sensitive");
83 case CKR_ATTRIBUTE_TYPE_INVALID
:
84 return _("Attribute type invalid");
85 case CKR_ATTRIBUTE_VALUE_INVALID
:
86 return _("Attribute value invalid");
87 case CKR_DATA_INVALID
:
88 return _("Data invalid");
89 case CKR_DATA_LEN_RANGE
:
90 return _("Data len range");
91 case CKR_DEVICE_ERROR
:
92 return _("Device error");
93 case CKR_DEVICE_MEMORY
:
94 return _("Device memory");
95 case CKR_DEVICE_REMOVED
:
96 return _("Device removed");
97 case CKR_ENCRYPTED_DATA_INVALID
:
98 return _("Encrypted data invalid");
99 case CKR_ENCRYPTED_DATA_LEN_RANGE
:
100 return _("Encrypted data len range");
101 case CKR_FUNCTION_CANCELED
:
102 return _("Function canceled");
103 case CKR_FUNCTION_NOT_PARALLEL
:
104 return _("Function not parallel");
105 case CKR_FUNCTION_NOT_SUPPORTED
:
106 return _("Function not supported");
107 case CKR_KEY_HANDLE_INVALID
:
108 return _("Key handle invalid");
109 case CKR_KEY_SIZE_RANGE
:
110 return _("Key size range");
111 case CKR_KEY_TYPE_INCONSISTENT
:
112 return _("Key type inconsistent");
113 case CKR_KEY_NOT_NEEDED
:
114 return _("Key not needed");
115 case CKR_KEY_CHANGED
:
116 return _("Key changed");
118 return _("Key needed");
119 case CKR_KEY_INDIGESTIBLE
:
120 return _("Key indigestible");
121 case CKR_KEY_FUNCTION_NOT_PERMITTED
:
122 return _("Key function not permitted");
123 case CKR_KEY_NOT_WRAPPABLE
:
124 return _("Key not wrappable");
125 case CKR_KEY_UNEXTRACTABLE
:
126 return _("Key unextractable");
127 case CKR_MECHANISM_INVALID
:
128 return _("Mechanism invalid");
129 case CKR_MECHANISM_PARAM_INVALID
:
130 return _("Mechanism param invalid");
131 case CKR_OBJECT_HANDLE_INVALID
:
132 return _("Object handle invalid");
133 case CKR_OPERATION_ACTIVE
:
134 return _("Operation active");
135 case CKR_OPERATION_NOT_INITIALIZED
:
136 return _("Operation not initialized");
137 case CKR_PIN_INCORRECT
:
138 return _("PIN incorrect");
139 case CKR_PIN_INVALID
:
140 return _("PIN invalid");
141 case CKR_PIN_LEN_RANGE
:
142 return _("PIN len range");
143 case CKR_PIN_EXPIRED
:
144 return _("PIN expired");
146 return _("PIN locked");
147 case CKR_SESSION_CLOSED
:
148 return _("Session closed");
149 case CKR_SESSION_COUNT
:
150 return _("Session count");
151 case CKR_SESSION_HANDLE_INVALID
:
152 return _("Session handle invalid");
153 case CKR_SESSION_PARALLEL_NOT_SUPPORTED
:
154 return _("Session parallel not supported");
155 case CKR_SESSION_READ_ONLY
:
156 return _("Session read only");
157 case CKR_SESSION_EXISTS
:
158 return _("Session exists");
159 case CKR_SESSION_READ_ONLY_EXISTS
:
160 return _("Session read only exists");
161 case CKR_SESSION_READ_WRITE_SO_EXISTS
:
162 return _("Session read write so exists");
163 case CKR_SIGNATURE_INVALID
:
164 return _("Signature invalid");
165 case CKR_SIGNATURE_LEN_RANGE
:
166 return _("Signature length range");
167 case CKR_TEMPLATE_INCOMPLETE
:
168 return _("Template incomplete");
169 case CKR_TEMPLATE_INCONSISTENT
:
170 return _("Template inconsistent");
171 case CKR_TOKEN_NOT_PRESENT
:
172 return _("Token not present");
173 case CKR_TOKEN_NOT_RECOGNIZED
:
174 return _("Token not recognized");
175 case CKR_TOKEN_WRITE_PROTECTED
:
176 return _("Token write protected");
177 case CKR_UNWRAPPING_KEY_HANDLE_INVALID
:
178 return _("Unwrapping key handle invalid");
179 case CKR_UNWRAPPING_KEY_SIZE_RANGE
:
180 return _("Unwrapping key size range");
181 case CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT
:
182 return _("Unwrapping key type inconsistent");
183 case CKR_USER_ALREADY_LOGGED_IN
:
184 return _("User already logged in");
185 case CKR_USER_NOT_LOGGED_IN
:
186 return _("User not logged in");
187 case CKR_USER_PIN_NOT_INITIALIZED
:
188 return _("User PIN not initialized");
189 case CKR_USER_TYPE_INVALID
:
190 return _("User type invalid");
191 case CKR_USER_ANOTHER_ALREADY_LOGGED_IN
:
192 return _("Another user already logged in");
193 case CKR_USER_TOO_MANY_TYPES
:
194 return _("User too many types");
195 case CKR_WRAPPED_KEY_INVALID
:
196 return _("Wrapped key invalid");
197 case CKR_WRAPPED_KEY_LEN_RANGE
:
198 return _("Wrapped key length range");
199 case CKR_WRAPPING_KEY_HANDLE_INVALID
:
200 return _("Wrapping key handle invalid");
201 case CKR_WRAPPING_KEY_SIZE_RANGE
:
202 return _("Wrapping key size range");
203 case CKR_WRAPPING_KEY_TYPE_INCONSISTENT
:
204 return _("Wrapping key type inconsistent");
205 case CKR_RANDOM_SEED_NOT_SUPPORTED
:
206 return _("Random seed not supported");
207 case CKR_RANDOM_NO_RNG
:
208 return _("Random no rng");
209 case CKR_DOMAIN_PARAMS_INVALID
:
210 return _("Domain params invalid");
211 case CKR_BUFFER_TOO_SMALL
:
212 return _("Buffer too small");
213 case CKR_SAVED_STATE_INVALID
:
214 return _("Saved state invalid");
215 case CKR_INFORMATION_SENSITIVE
:
216 return _("Information sensitive");
217 case CKR_STATE_UNSAVEABLE
:
218 return _("State unsaveable");
219 case CKR_CRYPTOKI_NOT_INITIALIZED
:
220 return _("Cryptoki not initialized");
221 case CKR_CRYPTOKI_ALREADY_INITIALIZED
:
222 return _("Cryptoki already initialized");
224 return _("Mutex bad");
225 case CKR_MUTEX_NOT_LOCKED
:
226 return _("Mutex not locked");
227 case CKR_FUNCTION_REJECTED
:
228 return _("Function rejected");
233 return _("Unknown error");