My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
otz_tee_crypto_api.h
Go to the documentation of this file.
1 /*
2  * OpenVirtualization:
3  * For additional details and support contact developer@sierraware.com.
4  * Additional documentation can be found at www.openvirtualization.org
5  *
6  * Copyright (C) 2010-2014 SierraWare
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21  *
22  */
23 /*
24  * Header file for global platform TEE crypto API
25  */
26 
27 #ifndef OTZ_TEE_CRYPTO_API_H
28 #define OTZ_TEE_CRYPTO_API_H
29 
30 
31 #include "otz_api.h"
32 #include "otz_tee_api.h"
33 
34 
38 #define SW_RSA_KEYLEN 1024
39 
40 #define ALGORITHM_NAME_LENGTH 128
41 
45 #define SW_DSA_KEYLEN 1024
46 
50 #define SW_CRYPTO_TRUE 1
51 #define SW_CRYPTO_FALSE 0
52 
53 /*
54  * @brief Definitions for using public or private key encryption for RSA
55  */
56 #define SW_RSA_USE_PUBLIC 1
57 #define SW_RSA_USE_PRIVATE 2
58 
59 /*
60  * @brief defines for maximum key length values of various algorithms
61  */
62 #define AES_128_CBC_MAX_KEY_LEN 16
63 
74 };
75 
77 
90 };
91 
93 
105 } ;
106 
108 
109 /*
110  * @brief A structure that gives information regarding the
111  * cryptographic operation
112  */
122  void *keyValue;
123 } ;
124 
126 
141  void *keyValue;
142  void *crypto_ctxt;
143  void *IV;
147 };
148 
151 
153 
154 
155 /*
156  * @brief An opaque structure that provides information regarding the current
157  * cryptographic operation
158  */
159 /*typedef struct {
160  uint32_t algorithm;
161 } __TEE_OperationHandle;
162 
163 __TEE_OperationHandle* TEEOperationHandle;
164 */
165 
166 /*typedef struct {
167  uint32_t algorithm;
168 } __TEE_OperationHandle* TEE_OperationHandle;*/
169 
170 
171 /* The value 0x60210230 is being used by all these algorithm types.
172  * Hence we introduce an #define for these so that we can use them in
173  * programs
174  */
175 #define TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA224 TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA1
176 #define TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA256 TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA1
177 #define TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA384 TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA1
178 #define TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA512 TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA1
179 
180 /*
181  * @brief All possible ID's for algorithm values.
182  */
183 #define TEE_ALG_AES_ECB_NOPAD 0x10000010
184 #define TEE_ALG_AES_CBC_NOPAD 0x10000110
185 #define TEE_ALG_AES_CTR 0x10000210
186 #define TEE_ALG_AES_CTS 0x10000310
187 #define TEE_ALG_AES_XTS 0x10000410
188 #define TEE_ALG_AES_CBC_MAC_NOPAD 0x30000110
189 #define TEE_ALG_AES_CBC_MAC_PKCS5 0x30000510
190 #define TEE_ALG_AES_CMAC 0x30000610
191 #define TEE_ALG_AES_CCM 0x40000710
192 #define TEE_ALG_AES_GCM 0x40000810
193 #define TEE_ALG_DES_ECB_NOPAD 0x10000011
194 #define TEE_ALG_DES_CBC_NOPAD 0x10000111
195 #define TEE_ALG_DES_CBC_MAC_NOPAD 0x30000111
196 #define TEE_ALG_DES_CBC_MAC_PKCS5 0x30000511
197 #define TEE_ALG_DES3_ECB_NOPAD 0x10000013
198 #define TEE_ALG_DES3_CBC_NOPAD 0x10000113
199 #define TEE_ALG_DES3_CBC_MAC_NOPAD 0x30000113
200 #define TEE_ALG_DES3_CBC_MAC_PKCS5 0x30000513
201 #define TEE_ALG_RSASSA_PKCS1_V1_5_MD5 0x70001830
202 #define TEE_ALG_RSASSA_PKCS1_V1_5_SHA1 0x70002830
203 #define TEE_ALG_RSASSA_PKCS1_V1_5_SHA224 0x70003830
204 #define TEE_ALG_RSASSA_PKCS1_V1_5_SHA256 0x70004830
205 #define TEE_ALG_RSASSA_PKCS1_V1_5_SHA384 0x70005830
206 #define TEE_ALG_RSASSA_PKCS1_V1_5_SHA512 0x70006830
207 #define TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA1 0x70212930
208 #define TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA224 0x70313930
209 #define TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA256 0x70414930
210 #define TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA384 0x70515930
211 #define TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA512 0x70616930
212 #define TEE_ALG_RSAES_PKCS1_V1_5 0x60000130
213 #define TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA1 0x60210230
214 #define TEE_ALG_RSA_NOPAD 0x60000030
215 #define TEE_ALG_DSA_SHA1 0x70002131
216 #define TEE_ALG_DH_DERIVE_SHARED_SECRET 0x80000032
217 #define TEE_ALG_MD5 0x50000001
218 #define TEE_ALG_SHA1 0x50000002
219 #define TEE_ALG_SHA224 0x50000003
220 #define TEE_ALG_SHA256 0x50000004
221 #define TEE_ALG_SHA384 0x50000005
222 #define TEE_ALG_SHA512 0x50000006
223 #define TEE_ALG_HMAC_MD5 0x30000001
224 #define TEE_ALG_HMAC_SHA1 0x30000002
225 #define TEE_ALG_HMAC_SHA224 0x30000003
226 #define TEE_ALG_HMAC_SHA256 0x30000004
227 #define TEE_ALG_HMAC_SHA384 0x30000005
228 #define TEE_ALG_HMAC_SHA512 0x30000006
229 
230 
231 
232 /*
233  * @brief This function allocates a handle for a new cryptographic operation
234  *
235  * @param TEE_OperationHandle - which has the details about the current
236  * cryptographic operation
237  * @param algorithm - an integer that represents the algorithm, defined
238  *
239  * @param mode - The mode for the current operation, as specified by the
240  * enumeration TEE_OperationMode
241  * @param maxKeySize - The maximum keysize that is in use by the algorithm.
242  *
243  * @return TEEC_Result which signifies the errors, if any, associated with
244  * this operation
245  */
246 TEEC_Result TEE_AllocateOperation(TEE_OperationHandle *operation,
247  uint32_t algorithm, uint32_t mode,uint32_t maxKeySize);
248 
249 /*
250  * @brief This function frees the resources associated with the handle.
251  *
252  * @param A pointer to the sturcture operation handle.
253  */
254 void TEE_FreeOperation(TEE_OperationHandle operation);
255 
256 /*
257  * @brief This function fills in the operationinfo structure associated with
258  * an operation.
259  *
260  * @param operation - A variable of type operationhandle.
261  *
262  * @param operationInfo - A pointer to a variable of type operationinfo, into
263  * which the data is filled and returned back.
264  */
265 void TEE_GetOperationInfo(TEE_OperationHandle operation,
266  TEE_OperationInfo* operationInfo);
267 
268 /*
269  * @brief This function resets the operation state, and is meaningful only
270  * multi-stage crypto operations like symmetric ciphers.
271  *
272  * @param operation - A variable of type operation handle.
273  *
274  */
275 void TEE_ResetOperation(TEE_OperationHandle operation);
276 
277 
278 /*
279  * @brief This function associates an operation with a specific key
280  *
281  * @param operation - A variable for type operation handle
282  * @param key - A variable of type object handle
283  *
284  * @return TEEC_Result - A variable that must return TEEC_SUCCESS for now.
285  * Future versions may return a different variable.
286  */
287 
288 TEEC_Result TEE_SetOperationKey(TEE_OperationHandle operation,
289  TEE_ObjectHandle* key);
290 
291 /*
292  *@brief This function associates an operation with a specific key, and is used
293  * only with the algorithm TEE_ALG_AES_XTS.
294  *
295  * @param operation - A variable for type operation handle
296  * @param key - A variable of type object handle
297  *
298  * @return TEEC_Result - A variable that must return TEEC_SUCCESS for now.
299  * Future versions may return a different variable.
300  */
301 TEEC_Result TEE_SetOperationKey2(TEE_OperationHandle operation,
302  TEE_ObjectHandle* key1,TEE_ObjectHandle* key2);
303 
304 
305 /*
306  * @brief This function copies the operation handle details from one variable
307  * to another.
308  *
309  * @param dstOperation - A variable of type operation handle, into which the
310  * source variable needs to be copied.
311  *
312  * @param srcOperation - A variable of type operation handle, from which the
313  * data is copied into the destination variable.
314  */
315 void TEE_CopyOperation( TEE_OperationHandle dstOperation,
316  TEE_OperationHandle srcOperation);
317 
318 /*
319  * @brief This function accumulates message data for hashing into the operation
320  * handle variable.
321  *
322  * @param operation - A variable of type operation handle into which the message
323  * data that needs to hashed, is stored.
324  * @param chunk - The buffer that contains the data
325  * @param chunkSize - The size of the incoming buffer.
326  */
327 void TEE_DigestUpdate(TEE_OperationHandle operation,
328  void* chunk, size_t chunkSize);
329 
330 
331 /* @brief This function finalizes the message digest operation and produces
332  * the hash of the message. The digest cannot be updated after invoking
333  * this function.
334  *
335  * @param operation - A variable of type operation handle
336  * @param chunk - The final buffer that needs to be used for producing the hash
337  * @param chunkLen - The size of the final buffer.
338  * @param hash - The output buffer into which the hash is stored.
339  * @param hashlen - The size of the output buffer.
340  * @return TEEC_SUCCESS is the operation succeeded, or TEEC_ERROR_SHORT_BUFFER
341  * if the hash cannot be stored into the buffer provided
342  */
343 TEEC_Result TEE_DigestDoFinal(TEE_OperationHandle operation,
344  void* chunk, size_t chunkLen,void* hash, size_t *hashLen);
345 
346 /*
347  * @brief This function initializes a symmetric cipher operation
348  *
349  * @param operation - A variable of type operation handle
350  * @param IV - The initialization vector
351  * @param IVLen - The length of the initialization vector.
352  */
353 void TEE_CipherInit(TEE_OperationHandle operation,void* IV, size_t IVLen);
354 
355 /*
356  * @brief This function encrypts or decrypts the input data.
357  *
358  * @param operation - A variable of type operation handle, which stores
359  * details of the current running cipher operation.
360  * @param srcData - The input buffer that is to be encrypted.
361  * @param srcLen - The length of the input buffer that needs to be encrypted.
362  * @param destData - The output buffer into which the data needs to be stored.
363  * @param destLen - The length of the output buffer
364  * @return TEEC_SUCCESS is the operation succeeded, or TEEC_ERROR_SHORT_BUFFER
365  * if the data cannot be stored into the buffer provided
366  */
367 TEEC_Result TEE_CipherUpdate(TEE_OperationHandle operation,
368  void* srcData, size_t srcLen,void* destData, size_t *destLen);
369 
370 /*
371  * @brief This function finalizes the cipher operation and encrypts/decrypts
372  * any remaining data, and the data that is supplied in the source
373  * buffer
374  *
375  * @param operation - A variable of type operation handle, which stores
376  * details of the current running cipher operation.
377  * @param srcData - The input buffer that is to be encrypted.
378  * @param srcLen - The length of the input buffer that needs to be encrypted.
379  * @param destData - The output buffer into which the data needs to be stored.
380  * @param destLen - The length of the output buffer
381  * @return TEEC_SUCCESS is the operation succeeded, or TEEC_ERROR_SHORT_BUFFER
382  * if the data cannot be stored into the buffer provided
383  */
384 TEEC_Result TEE_CipherDoFinal(TEE_OperationHandle operation,
385  void* srcData, size_t srcLen,void* destData, size_t *destLen);
386 
387 /*
388  * @brief This function initializes a MAC(Message Authentication code) operation
389  *
390  * @param operation - A variable of type operation handle
391  * @param IV - Initialization vector
392  * @param IVLen - The length of the initialization vector
393  *
394  */
395 void TEE_MACInit(TEE_OperationHandle operation,void* IV, size_t IVLen);
396 
397 /*
398  * @brief This function accumulates data for a MAC calculation
399  *
400  * @param operation - A variable of type operation handle
401  * @param chunk -input message on which MAC calculation needs to be done
402  * @param chunkSize - length of the input message
403  */
404 void TEE_MACUpdate(TEE_OperationHandle operation,void* chunk, size_t chunkSize);
405 
406 
407 /*
408  * @brief This function finalizes the computation of MAC. It used any previous
409  * existing buffers supplied, and the current input buffer.
410  *
411  * @param operation - A variable of type operation handle.
412  * @param message - The input buffer on which the mac needs to be computed
413  * @param messageLen - The length of the input buffer
414  * @param mac - The output buffer into which the mac needs to be stored.
415  * @param macLen - The length of the output buffer
416  * @return TEEC_SUCCESS is the operation succeeded, or TEEC_ERROR_SHORT_BUFFER
417  * if the data cannot be stored into the buffer provided
418  */
419 TEEC_Result TEE_MACComputeFinal(TEE_OperationHandle operation,
420  void* message, size_t messageLen,void* mac, size_t *macLen);
421 
422 /*
423  * @brief This function finalizes the computation of the MAC operation and
424  * compares it with the buffer that has been provided.
425  *
426  * @param operation - A variable of type operation handle.
427  * @param message - The input buffer on which the mac needs to be computed
428  * @param messageLen - The length of the input buffer
429  * @param mac - The input buffer against which the mac needs to be checked
430  * @param macLen - The length of the input buffer that has the mac value
431  * @return TEEC_SUCCESS is the operation succeeded, or TEEC_ERROR_MAC_INVALID
432  * if the mac computed is different from the value provided.
433  */
434 TEEC_Result TEE_MACCompareFinal(TEE_OperationHandle operation,
435  void* message, size_t messageLen,void* mac, size_t *macLen);
436 
437 /*
438  * @brief This function initializes an Authentication Encryption operation
439  *
440  * @param operation - A variable of type operation handle.
441  * @param nonce - The initialization vector.
442  * @param nonceLen - The length of the initialization vector.
443  * @param tagLen - The size (in bits) of the tag.
444  * @param AADLen - The length of AAD (in bytes)
445  * @param payloadLen - Length of the payload (in bytes)
446  * @return TEEC_SUCCESS is the operation succeeded, or TEEC_ERROR_NOT_SUPPORTED
447  * if the tag length is not supported by the algorithm
448  */
449 TEEC_Result TEE_AEInit(TEE_OperationHandle operation,
450  void* nonce, size_t nonceLen, uint32_t tagLen,
451  uint32_t AADLen, uint32_t payloadLen);
452 
453 /*
454  * @brief This function adds a new chunk of Additional Authentication Data (AAD)
455  * to the Authentication Encryption operation.
456  *
457  * @param operation - A variable of type operation handle.
458  * @param AAD - The input buffer that contains the AAD
459  * @param AADdataLen - The length of the input buffer.
460  */
461 void TEE_AEUpdateAAD(TEE_OperationHandle operation,
462  void* AADdata, size_t AADdataLen);
463 
464 /*
465  * @brief This function accumulates data for AE operation
466  *
467  * @param srcData - The input buffer on which the AE operation needs to be
468  * performed
469  * @param srcLen - The length of the input buffer
470  * @param destData - The output buffer into which the result of the
471  * AE operation needs to be stored.
472  * @param destLen - The length of the output buffer
473  * @return TEEC_SUCCESS is the operation succeeded, or TEEC_ERROR_SHORT_BUFFER
474  * if the data cannot be stored into the buffer provided
475  */
476 TEEC_Result TEE_AEUpdate(TEE_OperationHandle operation,void* srcData,
477  size_t srcLen,void* destData, size_t *destLen);
478 
479 
480 /*
481  * @brief This function finalizes the computation of the AE encryption
482  *
483  * @param operation - A variable of type operation handle.
484  * @param srcData - The input buffer on which the AE encryption needs to be
485  * performed
486  * @param srcLen - The length of the input buffer
487  * @param destData - The output buffer against which the the result of the
488  * operation needs to be stored.
489  * @param destLen - The length of the output buffer
490  * @param tag - The buffer into which the computed tag needs to be stored.
491  * @param tagLen - The length of the buffer.
492  * @return TEEC_SUCCESS is the operation succeeded, or TEEC_ERROR_SHORT_BUFFER
493  * if the mac computed is different from the value provided.
494  */
495 TEEC_Result TEE_AEEncryptFinal(TEE_OperationHandle operation,
496  void* srcData, size_t srcLen,void* destData, size_t* destLen,
497  void* tag,size_t* tagLen);
498 
499 /*
500  * @brief This function finalizes the computation of the AE encryption and
501  * compares the tag that has been computed, with the one provided in
502  * the parameter.
503  *
504  * @param operation - A variable of type operation handle.
505  * @param srcData - The input buffer on which the AE encryption needs to be
506  * performed
507  * @param srcLen - The length of the input buffer
508  * @param destData - The output buffer against which the the result of the
509  * operation needs to be stored.
510  * @param destLen - The length of the output buffer
511  * @param tag - The buffer against which the computed tag needs to be compared.
512  * @param tagLen - The length of the buffer.
513  * @return TEEC_SUCCESS is the operation succeeded, or TEEC_ERROR_SHORT_BUFFER
514  * if the buffer cannot hold the data computed, or TEE_ERROR_MAC_INVALID
515  * if the mac computed is different from the value provided.
516  */
517 TEEC_Result TEE_AEDecryptFinal(TEE_OperationHandle operation, void* srcData,
518  size_t srcLen, void* destData, size_t *destLen,
519  void* tag, size_t tagLen);
520 
521 /*
522  * @brief This functions performs an encryption on a message within an
523  * asymmetric operation. Note that this operation is valid only
524  * on a specific subset of algorithms.
525  *
526  * @param operation - A variable of type operation handle.
527  * @param params - A variable of type attribute
528  * @param paramCount - The number of such attributes that have been provided.
529  * @param srcData - Input buffer that has data to be encrypted.
530  * @param srcLen - Length of the input buffer
531  * @param destData - Output buffer into which the data needs to be stored.
532  * @param destLen - Length of the output buffer.
533  * @return TEEC_SUCCESS if the operation succeeded, or TEEC_ERROR_SHORT_BUFFER
534  * if output buffer is not large enough to hold the result.
535  */
536 TEEC_Result TEE_AsymmetricEncrypt(TEE_OperationHandle operation,
537  TEE_Attribute* params, uint32_t paramCount, void* srcData,
538  size_t srcLen, void* destData, size_t *destLen);
539 
540 /*
541  * @brief This functions performs a decryption on a message within an
542  * asymmetric operation. Note that this operation is valid only
543  * on a specific subset of algorithms.
544  *
545  * @param operation - A variable of type operation handle.
546  * @param params - A variable of type attribute
547  * @param paramCount - The number of such attributes that have been provided.
548  * @param srcData - Input buffer that has data to be encrypted.
549  * @param srcLen - Length of the input buffer
550  * @param destData - Output buffer into which the data needs to be stored.
551  * @param destLen - Length of the output buffer.
552  * @return TEEC_SUCCESS if the operation succeeded, or TEEC_ERROR_SHORT_BUFFER
553  * if output buffer is not large enough to hold the result.
554  */
555 TEEC_Result TEE_AsymmetricDecrypt(TEE_OperationHandle operation,
556  TEE_Attribute* params, uint32_t paramCount, void* srcData,
557  size_t srcLen, void* destData, size_t *destLen);
558 
559 /*
560  * @brief This functions signs a message digest within an asymmetric operation.
561  * Note that this operation is valid only on a specific subset of algorithms.
562  *
563  *
564  * @param operation - A variable of type operation handle.
565  * @param params - A variable of type attribute
566  * @param paramCount - The number of such attributes that have been provided.
567  * @param diget - Input buffer containing the input digest
568  * @param digestLen - Length of the input digest
569  * @param signature - Output buffer that has the signature of the digest
570  * @param signatureLen - Length of the output buffer provided.
571  * @return TEEC_SUCCESS if the operation succeeded, or TEEC_ERROR_SHORT_BUFFER
572  * if output buffer is not large enough to hold the result.
573  */
574 TEEC_Result TEE_AsymmetricSignDigest(TEE_OperationHandle operation,
575  TEE_Attribute* params, uint32_t paramCount, void* digest,
576  size_t digestLen, void* signature, size_t *signatureLen);
577 
578 /*
579  * @brief This functions signs and verifies message digest within an
580  * asymmetric operation. Note that this operation is valid
581  * only on a specific subset of algorithms.
582  *
583  *
584  * @param operation - A variable of type operation handle.
585  * @param params - A variable of type attribute
586  * @param paramCount - The number of such attributes that have been provided.
587  * @param diget - Input buffer containing the input digest
588  * @param digestLen - Length of the input digest
589  * @param signature - Buffer that has the signature against which the
590  * verification needs to be done.
591  * @param signatureLen - Length of the signature buffer provided.
592  * @return TEEC_SUCCESS if the operation succeeded, or TEE_ERROR_SIGNATURE_INVALID
593  * if the signature verification failed.
594  */
595 TEEC_Result TEE_AsymmetricVerifyDigest(TEE_OperationHandle operation,
596  TEE_Attribute* params, uint32_t paramCount, void* digest,
597  size_t digestLen, void* signature, size_t signatureLen);
598 
599 /*
600  * @brief This functions derives a key and stores it in the object handle. This
601  * function can be used only with the algorithm
602  * TEE_ALG_DH_DERIVE_SHARED_SECRET.
603  *
604  * @param operation - A variable of type operation handle.
605  * @param params - A variable of type attribute
606  * @param paramCount - The number of such attributes that have been provided.
607  */
608 void TEE_DeriveKey(TEE_OperationHandle operation, TEE_Attribute* params,
609  uint32_t paramCount, TEE_ObjectHandle* derivedKey);
610 
611 /*
612  * @brief This function generated random data
613  *
614  * @param randomBuffer - The input buffer to be used for generation for
615  * random data
616  * @param randomBufferLen - The length of the input buffer
617  */
618 void TEE_GenerateRandom(void* randomBuffer, size_t randomBufferLen);
619 
620 /*
621  * @brief This is a panic function, which indicates that an un-recoverable
622  * error has occurred. This function may not return control to the
623  * caller function.
624  *
625  * @param panicCode A variable that may be used to indicate error status.
626  */
627 void TEE_Panic(TEE_Result panicCode);
628 
629 #endif
630 
Definition: otz_tee_crypto_api.h:86
void TEE_CopyOperation(TEE_OperationHandle dstOperation, TEE_OperationHandle srcOperation)
copies an operation state from dstOperation to srcOperation
Definition: otz_tee_crypto_api.c:886
Definition: otz_tee_crypto_api.h:67
enum __TEE_Valid_Tag_Lengths TEE_Valid_Tag_Lengths
Definition: otz_tee_crypto_api.h:92
Definition: otz_tee_crypto_api.h:68
uint32_t aadLen
Definition: otz_tee_crypto_api.h:146
Definition: otz_tee_crypto_api.h:101
Definition: otz_tee_crypto_api.h:113
uint32_t digestLength
Definition: otz_tee_crypto_api.h:117
void TEE_DigestUpdate(TEE_OperationHandle operation, void *chunk, size_t chunkSize)
This function is called to accumulate message data for hashing.
Definition: otz_tee_crypto_api.c:925
TEEC_Result TEE_CipherUpdate(TEE_OperationHandle operation, void *srcData, size_t srcLen, void *destData, size_t *destLen)
This function is used to encrypt or decrypt the input data.
Definition: otz_tee_crypto_api.c:1145
void * IV
Definition: otz_tee_crypto_api.h:143
uint32_t mode
Definition: otz_tee_crypto_api.h:116
Definition: otz_tee_crypto_api.h:99
void * crypto_cipher
Definition: otz_tee_crypto_api.h:144
Definition: otz_tee_crypto_api.h:98
Definition: otz_tee_crypto_api.h:73
opaque structure definition for an object handle. TODO - Fill it with something appropriate ...
Definition: otz_api.h:299
TEEC_Result TEE_DigestDoFinal(TEE_OperationHandle operation, void *chunk, size_t chunkLen, void *hash, size_t *hashLen)
Finalizes the message digest operation and produces the message hash.
Definition: otz_tee_crypto_api.c:990
Definition: otz_tee_crypto_api.h:69
uint32_t handleState
Definition: otz_tee_crypto_api.h:140
void TEE_AEUpdateAAD(TEE_OperationHandle operation, void *AADdata, size_t AADdataLen)
Feeds a new chunk of Additional Authentication Data (AAD) to the AE operation.
Definition: otz_tee_crypto_api.c:1534
unsigned int uint32_t
Definition: otz_api.h:35
TEEC_Result TEE_AsymmetricEncrypt(TEE_OperationHandle operation, TEE_Attribute *params, uint32_t paramCount, void *srcData, size_t srcLen, void *destData, size_t *destLen)
Encrypts a message with an asymmetric operation.
Definition: otz_tee_crypto_api.c:1695
TEEC_Result TEE_AsymmetricDecrypt(TEE_OperationHandle operation, TEE_Attribute *params, uint32_t paramCount, void *srcData, size_t srcLen, void *destData, size_t *destLen)
Decrypts a message with an assymetric operation.
Definition: otz_tee_crypto_api.c:1759
enum __TEE_Operation_Constants TEE_Operation_Constants
Definition: otz_tee_crypto_api.h:76
TEEC_Result TEE_AEUpdate(TEE_OperationHandle operation, void *srcData, size_t srcLen, void *destData, size_t *destLen)
Accumulates data for an Authentication Encryption Operation.
Definition: otz_tee_crypto_api.c:1568
void TEE_Panic(TEE_Result panicCode)
Definition: otz_tee_crypto_api.c:46
TEEC_Result TEE_MACCompareFinal(TEE_OperationHandle operation, void *message, size_t messageLen, void *mac, size_t *macLen)
Finalizes the MAC operation and compares the MAC with the buffer passed to the function.
Definition: otz_tee_crypto_api.c:1420
uint32_t requiredKeyUsage
Definition: otz_tee_crypto_api.h:139
__TEE_Operation_Constants
Typedefs for various crypto operation constants.
Definition: otz_tee_crypto_api.h:66
void * keyValue
Definition: otz_tee_crypto_api.h:122
void TEE_MACUpdate(TEE_OperationHandle operation, void *chunk, size_t chunkSize)
Accumulates data for a MAC calculation.
Definition: otz_tee_crypto_api.c:1333
TEEC_Result TEE_CipherDoFinal(TEE_OperationHandle operation, void *srcData, size_t srcLen, void *destData, size_t *destLen)
Finalizes the cipher operation, processing data that has not been processed by previous calls to TEE_...
Definition: otz_tee_crypto_api.c:1205
TEE_Result TEEC_Result
Definition: otz_tee_api.h:88
TEEC_Result TEE_AsymmetricSignDigest(TEE_OperationHandle operation, TEE_Attribute *params, uint32_t paramCount, void *digest, size_t digestLen, void *signature, size_t *signatureLen)
Signs a message digest signature with an asymmetric operation.
Definition: otz_tee_crypto_api.c:1823
uint32_t IVLen
Definition: otz_tee_crypto_api.h:145
void TEE_GetOperationInfo(TEE_OperationHandle operation, TEE_OperationInfo *operationInfo)
Returns information about operation handle.
Definition: otz_tee_crypto_api.c:662
Definition: otz_tee_crypto_api.h:72
uint32_t digestLength
Definition: otz_tee_crypto_api.h:136
Definition: otz_tee_crypto_api.h:88
TEEC_Result TEE_SetOperationKey(TEE_OperationHandle operation, TEE_ObjectHandle *key)
Programs the key of an operation Associates an operation with a key.
Definition: otz_tee_crypto_api.c:783
TEEC_Result TEE_AllocateOperation(TEE_OperationHandle *operation, uint32_t algorithm, uint32_t mode, uint32_t maxKeySize)
Definition: otz_tee_crypto_api.c:433
uint32_t keySize
Definition: otz_tee_crypto_api.h:138
Definition: otz_tee_crypto_api.h:89
Definition: otz_tee_crypto_api.h:87
void TEE_MACInit(TEE_OperationHandle operation, void *IV, size_t IVLen)
Initializes a MAC operation.
Definition: otz_tee_crypto_api.c:1275
Definition: otz_tee_crypto_api.h:70
Definition: otz_tee_crypto_api.h:82
void * keyValue
Definition: otz_tee_crypto_api.h:141
uint32_t mode
Definition: otz_tee_crypto_api.h:135
uint32_t maxKeySize
Definition: otz_tee_crypto_api.h:137
TEEC_Result TEE_AEInit(TEE_OperationHandle operation, void *nonce, size_t nonceLen, uint32_t tagLen, uint32_t AADLen, uint32_t payloadLen)
Initializes an authentication encryption operation.
Definition: otz_tee_crypto_api.c:1476
TEEC_Result TEE_MACComputeFinal(TEE_OperationHandle operation, void *message, size_t messageLen, void *mac, size_t *macLen)
Finalizes the MAC operation with a last chunk of message and computes the MAC.
Definition: otz_tee_crypto_api.c:1372
Definition: otz_tee_crypto_api.h:71
opaque structure definition for an operation handle. It contains almost all the elements of operation...
Definition: otz_tee_crypto_api.h:132
uint32_t algorithm
Definition: otz_tee_crypto_api.h:114
void TEE_GenerateRandom(void *randomBuffer, size_t randomBufferLen)
Generates random data.
Definition: otz_tee_crypto_api.c:1960
uint32_t handleState
Definition: otz_tee_crypto_api.h:121
uint32_t requiredKeyUsage
Definition: otz_tee_crypto_api.h:120
__TEE_OperationMode
Typedefs for various crypto operation modes.
Definition: otz_tee_crypto_api.h:97
Definition: otz_tee_crypto_api.h:83
uint32_t operationClass
Definition: otz_tee_crypto_api.h:115
uint32_t keySize
Definition: otz_tee_crypto_api.h:119
TEEC_Result TEE_AsymmetricVerifyDigest(TEE_OperationHandle operation, TEE_Attribute *params, uint32_t paramCount, void *digest, size_t digestLen, void *signature, size_t signatureLen)
Verifies a message digest signature with an asymmetric operation.
Definition: otz_tee_crypto_api.c:1884
Definition: otz_api.h:280
TEEC_Result TEE_AEEncryptFinal(TEE_OperationHandle operation, void *srcData, size_t srcLen, void *destData, size_t *destLen, void *tag, size_t *tagLen)
Processes data that has not been processed by previous calls to TEE_AEUpdate as well as data supplied...
Definition: otz_tee_crypto_api.c:1614
void TEE_CipherInit(TEE_OperationHandle operation, void *IV, size_t IVLen)
This function is used to start the symmetric cipher operation.
Definition: otz_tee_crypto_api.c:1085
void TEE_FreeOperation(TEE_OperationHandle operation)
Deallocates all resources associated with an operation handle. After this function is called...
Definition: otz_tee_crypto_api.c:611
struct __TEE_OperationHandle * TEE_OperationHandle
Definition: otz_tee_crypto_api.h:149
Definition: otz_tee_crypto_api.h:102
enum __TEE_OperationMode TEE_OperationMode
Definition: otz_tee_crypto_api.h:107
uint32_t TEE_Result
Definition: otz_tee_api.h:87
Definition: otz_tee_crypto_api.h:104
Definition: otz_tee_crypto_api.h:103
void TEE_DeriveKey(TEE_OperationHandle operation, TEE_Attribute *params, uint32_t paramCount, TEE_ObjectHandle *derivedKey)
Can only be used with the algorithm TEE_ALG_DH_DERIVE_SHARED_SECRET.
Definition: otz_tee_crypto_api.c:1939
Definition: otz_tee_crypto_api.h:85
uint32_t operationClass
Definition: otz_tee_crypto_api.h:134
uint32_t algorithm
Definition: otz_tee_crypto_api.h:133
TEEC_Result TEE_SetOperationKey2(TEE_OperationHandle operation, TEE_ObjectHandle *key1, TEE_ObjectHandle *key2)
Initializes an existing operation with two keys. This is used only for the algorithm TEE_ALG_AES_XTS...
Definition: otz_tee_crypto_api.c:858
Definition: otz_tee_crypto_api.h:100
Definition: otz_tee_crypto_api.h:84
void * crypto_ctxt
Definition: otz_tee_crypto_api.h:142
__TEE_Valid_Tag_Lengths
Valid tag lengths for Asymmetric cipher encryption.
Definition: otz_tee_crypto_api.h:81
TEEC_Result TEE_AEDecryptFinal(TEE_OperationHandle operation, void *srcData, size_t srcLen, void *destData, size_t *destLen, void *tag, size_t tagLen)
Processes data that has not been processed by previous calls to TEE_AEUpdate as well as data supplied...
Definition: otz_tee_crypto_api.c:1655
void TEE_ResetOperation(TEE_OperationHandle operation)
Resets the operation state before initialization But after the key has been set.
Definition: otz_tee_crypto_api.c:706
uint32_t maxKeySize
Definition: otz_tee_crypto_api.h:118