2 * Copyright (C) 2017 C-SKY Microsystems Co., Ltd. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 /******************************************************************************
19 * @brief Header File for TEE
22 ******************************************************************************/
32 /****** TEE AES mode *****/
34 TEE_AES_MODE_ECB = 0, ///< TEE AES ECB mode
35 TEE_AES_MODE_CBC = 1, ///< TEE AES CBC mode
36 TEE_AES_MODE_MAX, ///< invaild mode
41 \brief TEE AES encrypt
42 \note Length should be a multiple of the block size (16 bytes)
43 After calling this function, the content of iv is updated.
44 \param[in] in Pointer to plaintext buffer
45 \param[in] in_len Plaintext buffer length
46 \param[in] key Pointer to secret key
47 \param[in] key_len Secret key size,must be 16 bytes for AES128,24 bytes for AES192 or 32byes for AES256
48 \param[out] out Pointer to ciphertext buffer
49 \param[in] mode \ref tee_aes_mode_e
50 \return return 0 if successful,otherwise error code
52 int32_t csi_tee_aes_encrypt(const uint8_t *in, uint32_t in_len,
53 const uint8_t *key, uint32_t key_len,
59 \brief TEE AES decrypt
60 \note Length should be a multiple of the block size (16 bytes)
61 After calling this function, the content of iv is updated.
62 \param[in] in Pointer to ciphertext buffer
63 \param[in] in_len Ciphertext buffer length
64 \param[in] key Pointer to secret key
65 \param[in] key_len Secret key size,must be 16 bytes for AES128,24 bytes for AES192 or 32byes for AES256
66 \param[out] out Pointer to plaintext buffer
67 \param[in] mode \ref tee_aes_mode_e
68 \return return 0 if successful,otherwise error code
70 int32_t csi_tee_aes_decrypt(const uint8_t *in, uint32_t in_len,
71 const uint8_t *key, uint32_t key_len,
77 \brief TEE AES ECB encrypt
78 \note Length should be a multiple of the block size (16 bytes)
79 After calling this function, the content of iv is updated.
80 \param[in] in Pointer to plaintext buffer
81 \param[in] in_len Plaintext buffer length
82 \param[in] key Pointer to secret key
83 \param[in] key_len Secret key size,must be 16 bytes for AES128,24 bytes for AES192 or 32byes for AES256
84 \param[out] out Pointer to ciphertext buffer
85 \return return 0 if successful,otherwise error code
87 #define csi_tee_aes_encrypt_ecb(in, in_len, key, key_len, out) \
88 csi_tee_aes_encrypt(in, in_len, key, key_len, NULL, out, TEE_AES_MODE_ECB)
91 \brief TEE AES ECB decrypt
92 \note Length should be a multiple of the block size (16 bytes)
93 After calling this function, the content of iv is updated.
94 \param[in] in Pointer to ciphertext buffer
95 \param[in] in_len Ciphertext buffer length
96 \param[in] key Pointer to secret key
97 \param[in] key_len Secret key size,must be 16 bytes for AES128,24 bytes for AES192 or 32byes for AES256
98 \param[out] out Pointer to plaintext buffer
99 \return return 0 if successful,otherwise error code
101 #define csi_tee_aes_decrypt_ecb(in, in_len, key, key_len, out) \
102 csi_tee_aes_decrypt(in, in_len, key, key_len, NULL, out, TEE_AES_MODE_ECB)
105 \brief TEE AES CBC encrypt
106 \note Length should be a multiple of the block size (16 bytes)
107 After calling this function, the content of iv is updated.
108 \param[in] in Pointer to ciphertext buffer
109 \param[in] in_len Ciphertext buffer length
110 \param[in] key Pointer to secret key
111 \param[in] key_len Secret key size,must be 16 bytes for AES128,24 bytes for AES192 or 32byes for AES256
112 \param[out] out Pointer to plaintext buffer
113 \return return 0 if successful,otherwise error code
115 #define csi_tee_aes_encrypt_cbc(in, in_len, key, key_len, iv, out) \
116 csi_tee_aes_encrypt(in, in_len, key, key_len, iv, out, TEE_AES_MODE_CBC)
119 \brief TEE AES CBC decrypt
120 \note Length should be a multiple of the block size (16 bytes)
121 After calling this function, the content of iv is updated.
122 \param[in] in Pointer to ciphertext buffer
123 \param[in] in_len Ciphertext buffer length
124 \param[in] key Pointer to secret key
125 \param[in] key_len Secret key size,must be 16 bytes for AES128,24 bytes for AES192 or 32byes for AES256
126 \param[out] out Pointer to plaintext buffer
127 \return return 0 if successful,otherwise error code
129 #define csi_tee_aes_decrypt_cbc(in, in_len, key, key_len, iv, out) \
130 csi_tee_aes_decrypt(in, in_len, key, key_len, iv, out, TEE_AES_MODE_CBC)
133 \brief TEE BASE64 encode/decode
134 \param[in] in Pointer to input data buffer
135 \param[in] in_len input data buffer length
136 \param[out] out Pointer to output data buffer
137 \param[out] out_len output data buffer length
138 \param[in] is_encode 1 encode 0 decode
139 \param[in] wsafe base64 websafe feature,set 1, replace "+/" with "-_"
140 \return return 0 if successful,otherwise error code
142 int32_t csi_tee_base64(const uint8_t *in, uint32_t in_len,
143 uint8_t *out, uint32_t *out_len,
148 \brief TEE BASE64 encode
149 \param[in] in Pointer to input data buffer
150 \param[in] in_len input data buffer length
151 \param[out] out Pointer to output data buffer
152 \param[out] out_len output data buffer length
153 \return return 0 if successful,otherwise error code
155 #define csi_tee_base64_encode(in,in_len,out,out_len) \
156 csi_tee_base64(in,in_len,out,out_len,1,0)
159 \brief TEE BASE64 decode
160 \param[in] in Pointer to input data buffer
161 \param[in] in_len input data buffer length
162 \param[out] out Pointer to output data buffer
163 \param[out] out_len output data buffer length
164 \return return 0 if successful,otherwise error code
166 #define csi_tee_base64_decode(in,in_len,out,out_len) \
167 csi_tee_base64(in,in_len,out,out_len,0,0)
170 \brief TEE BASE64 web safe encode
171 \param[in] in Pointer to input data buffer
172 \param[in] in_len input data buffer length
173 \param[out] out Pointer to output data buffer
174 \param[out] out_len output data buffer length
175 \return return 0 if successful,otherwise error code
177 #define csi_tee_base64_websafe_encode(in,in_len,out,out_len) \
178 csi_tee_base64(in,in_len,out,out_len,1,1)
181 \brief TEE BASE64 web safe decode
182 \param[in] in Pointer to input data buffer
183 \param[in] in_len input data buffer length
184 \param[out] out Pointer to output data buffer
185 \param[out] out_len output data buffer length
186 \return return 0 if successful,otherwise error code
188 #define csi_tee_base64_websafe_decode(in,in_len,out,out_len) \
189 csi_tee_base64(in,in_len,out,out_len,0,1)
192 \brief TEE obtain CID from Key Provisioning
193 \param[out] out Pointer to cid buffer
194 \param[out] out_len cid buffer length,if cid obtain successfully,
195 out_len is updated to actual cid sizes
196 \return return 0 if successful,otherwise error code
198 int32_t csi_tee_get_cid(uint8_t *out, uint32_t *out_len);
200 /****** lpm mode *****/
202 TEE_LPM_MODE_WAIT = 0, ///< lpm wait
203 TEE_LPM_MODE_DOZE = 1, ///< lpm doze
204 TEE_LPM_MODE_STOP = 2, ///< lpm stop
205 TEE_LPM_MODE_STANDBY = 3, ///< lpm standby
210 \brief TEE set low power mode
211 \param[in] gate not use for now
212 \param[in] irqid not use for now
213 \param[in] mode \ref tee_lpm_mode_e
214 \return return 0 if successful,otherwise error code
216 int32_t csi_tee_enter_lpm(uint32_t gate, uint32_t irqid, tee_lpm_mode_e mode);
219 \brief TEE obtain manifest info from manifest table
220 \note call csi_tee_get_sys_img_info, csi_tee_get_sys_os_version or csi_tee_get_sys_partition is better
221 \param[out] out Pointer to info buffer
222 \param[out] out_len Info buffer length,if info obtain successfully,
223 out_len is updated to actual sizes
224 \param[in] name info name
225 \return return 0 if successful,otherwise error code
227 int32_t csi_tee_get_manifest_info(uint8_t *out, uint32_t *out_len, char *name);
230 \brief TEE obtain image buffer from manifest table
231 \param[out] out Pointer to image buffer
232 \param[out] out_len Image buffer length,if info obtain successfully,
233 out_len is updated to actual image buffer sizes
234 \param[in] img_name image name
235 \return return 0 if successful,otherwise error code
237 #define csi_tee_get_sys_img_info(out,out_len,img_name) \
238 csi_tee_get_manifest_info(out,out_len,img_name)
241 \brief TEE obtain os version from manifest table
242 \param[out] out Pointer to os version buffer
243 \param[out] out_len OS version buffer length,if info obtain successfully,
244 out_len is updated to actual os version buffer sizes
245 \return return 0 if successful,otherwise error code
247 #define csi_tee_get_sys_os_version(out,out_len) \
248 csi_tee_get_manifest_info(out,out_len,"os_v")
251 \brief TEE obtain partition buffer from manifest table
252 \param[out] out Pointer to partition buffer
253 \param[out] out_len Partition buffer length,if info obtain successfully,
254 out_len is updated to actual partition buffer sizes
255 \return return 0 if successful,otherwise error code
257 #define csi_tee_get_sys_partition(out,out_len) \
258 csi_tee_get_manifest_info(out,out_len,"sys_p")
261 \brief TEE set random seed
262 \param[in] Seed random sedd
263 \return return 0 if successful,otherwise error code
265 int32_t csi_tee_rand_seed(uint32_t seed);
268 \brief TEE ramdom date generation
269 \param[out] out Pointer to random data buffer
270 \param[in] out_len Data buffer length
271 \return return 0 if successful,otherwise error code
273 int32_t csi_tee_rand_generate(uint8_t *out, uint32_t out_len);
275 /****** TEE RSA sign type *****/
277 TEE_RSA_MD5 = 0, ///< MD5
278 TEE_RSA_SHA1 = 1, ///< SHA1
279 TEE_RSA_SHA256 = 3, ///< SHA256
280 TEE_RSA_SIGN_TYPE_MAX, ///< invailed type
281 } tee_rsa_sign_type_e;
284 \brief TEE RSA sign with private key
285 \param[in] in Pointer to digest buffer
286 \param[in] in_len Digest buffer length
287 \param[in] key Pointer to private key,key contains n, e, d
288 \param[in] key_len Private key size,must be 128*3 = 384 bytes for RSA1024, 256*3 = 768 bytes for RSA2048
289 \param[out] sign Pointer to sign buffer
290 \param[out] sign_len Sign buffer length
291 \param[in] type \ref tee_rsa_sign_type_e
292 \return return 0 if successful,otherwise error code
294 int32_t csi_tee_rsa_sign(const uint8_t *in, uint32_t in_len,
295 const uint8_t *key, uint32_t key_len,
296 uint8_t *sign, uint32_t *sign_len,
297 tee_rsa_sign_type_e type);
300 \brief TEE RSA verify with public key
301 \param[in] in Pointer to digest buffer
302 \param[in] in_len Digest buffer length
303 \param[in] key Pointer to public key,key contains n, e
304 \param[in] key_len Public key size,must be 128*2 = 256 bytes for RSA1024, 256*2 = 512 bytes for RSA2048
305 \param[in] sign Pointer to sign buffer
306 \param[in] sign_len Sign buffer length
307 \param[in] type \ref tee_rsa_sign_type_e
308 \return return 0 if verify successful,otherwise error code
310 int32_t csi_tee_rsa_verify(const uint8_t *in, uint32_t in_len,
311 const uint8_t *key, uint32_t key_len,
312 uint8_t *sign, uint32_t sign_len,
313 tee_rsa_sign_type_e type);
315 /****** TEE RSA padding mode *****/
317 TEE_RSA_PKCS1_PADDING = 0x01, ///< RSA PKCS padding mode
318 TEE_RSA_NO_PADDING = 0x02, ///< RSA no padding mode
319 } tee_rsa_padding_mode_e;
322 \brief TEE RSA encrypt with public key
323 \param[in] in Pointer to plaintext buffer
324 \param[in] in_len Plaintext buffer length
325 \param[in] key Pointer to public key,key contains n, e
326 \param[in] key_len Public key size, must be 128*2 = 256 bytes for RSA1024, 256*2 = 512 bytes for RSA2048
327 \param[in] out Pointer to ciphertext buffer
328 \param[in] out_len Ciphertext buffer length
329 \param[in] padding \ref tee_rsa_padding_mode_e
330 \return return 0 if successful,otherwise error code
332 int32_t csi_tee_rsa_encrypt(const uint8_t *in, uint32_t in_len,
333 const uint8_t *key, uint32_t key_len,
334 uint8_t *out, uint32_t *out_len,
335 tee_rsa_padding_mode_e padding);
337 \brief TEE RSA decrypt with private key
338 \param[in] in Pointer to ciphertext buffer
339 \param[in] in_len Ciphertext buffer length
340 \param[in] key Pointer to private key,key contains n, e, d
341 \param[in] key_len Private key size,must be 128*3 = 384 bytes for RSA1024, 256*3 = 768 bytes for RSA2048
342 \param[in] out Pointer to plaintext buffer
343 \param[in] out_len Plaintext buffer length
344 \param[in] padding \ref tee_rsa_padding_mode_e
345 \return return 0 if successful,otherwise error code
347 int32_t csi_tee_rsa_decrypt(const uint8_t *in, uint32_t in_len,
348 const uint8_t *key, uint32_t key_len,
349 uint8_t *out, uint32_t *out_len,
350 tee_rsa_padding_mode_e padding);
353 \brief TEE RSA sign with internal private key
354 \note Only use if key provisioning exist
355 \param[in] in Pointer to digest buffer
356 \param[in] in_len Digest buffer length
357 \param[out] sign Pointer to sign buffer
358 \param[out] sign_len Sign buffer length
359 \param[in] type \ref tee_rsa_sign_type_e
360 \return return 0 if successful,otherwise error code
362 #define csi_tee_cid_rsa_sign(in,in_len,sign,sign_len,type) \
363 csi_tee_rsa_sign(in,in_len,NULL,0,sign,sign_len,type)
366 \brief TEE RSA verify with internal public key
367 \note Only use if key provisioning exist
368 \param[in] in Pointer to digest buffer
369 \param[in] in_len Digest buffer length
370 \param[in] sign Pointer to sign buffer
371 \param[in] sign_len Sign buffer length
372 \param[in] type \ref tee_rsa_sign_type_e
373 \return return 0 if verify successful,otherwise error code
375 #define csi_tee_cid_rsa_verify(in,in_len,sign,sign_len,type) \
376 csi_tee_rsa_verify(in,in_len,NULL,0,sign,sign_len,type)
379 \brief TEE RSA encrypt with internal public key
380 \note Only use if key provisioning exist
381 \param[in] in Pointer to plaintext buffer
382 \param[in] in_len Plaintext buffer length
383 \param[in] out Pointer to ciphertext buffer
384 \param[in] out_len Ciphertext buffer length
385 \param[in] padding \ref tee_rsa_padding_mode_e
386 \return return 0 if successful,otherwise error code
388 #define csi_tee_cid_rsa_encrypt(in,in_len,out,out_len,padding) \
389 csi_tee_rsa_encrypt(in,in_len,NULL,0,out,out_len,padding)
392 \brief TEE RSA decrypt with internal private key
393 \note Only use if key provisioning exist
394 \param[in] in Pointer to ciphertext buffer
395 \param[in] in_len Ciphertext buffer length
396 \param[in] key Pointer to private key,key contains n, e, d
397 \param[in] key_len Private key size,must be 128*3 = 384 bytes for RSA1024, 256*3 = 768 bytes for RSA2048
398 \param[in] out Pointer to plaintext buffer
399 \param[in] out_len Plaintext buffer length
400 \param[in] padding \ref tee_rsa_padding_mode_e
401 \return return 0 if successful,otherwise error code
403 #define csi_tee_cid_rsa_decrypt(in,in_len,out,out_len,padding) \
404 csi_tee_rsa_decrypt(in,in_len,NULL,0,out,out_len,padding)
407 \brief verify boot image with boot public key
408 \note Only use if key provisioning exist
409 \param[in] in Pointer to digest buffer
410 \param[in] in_len Digest buffer length
411 \param[in] sign Pointer to sign buffer
412 \param[in] sign_len Sign buffer length
413 \param[in] type \ref tee_rsa_sign_type_e
414 \return return 0 if verify successful,otherwise error code
416 int32_t csi_tee_img_rsa_verify(const uint8_t *in, uint32_t in_len,
417 uint8_t *sign, uint32_t sign_len,
418 tee_rsa_sign_type_e type);
420 /****** TEE HASH operation mode *****/
422 TEE_HASH_OP_NONE = 0, ///< No operation
423 TEE_HASH_OP_START = 1, ///< HASH init
424 TEE_HASH_OP_UPDATA = 2, ///< HASH update
425 TEE_HASH_OP_FINISH = 3, ///< HASH finish
426 TEE_HASH_OP_MAX, ///< invailed operation
429 /****** TEE HMAC type *****/
431 TEE_HMAC_SHA1 = 1, ///< HMAC with SHA1
436 \note Call csi_tee_hmac_digest is better
437 out buffer size must be large enough according to type, eg. 20 bytes for TEE_HMAC_SHA1
438 \param[in] in Pointer to input data buffer
439 \param[in] in_len Input data buffer length
440 \param[in] key Pointer to key buffer
441 \param[in] key_len Key buffer size
442 \param[out] out Pointer to output date buffer
443 \param[in] type \ref tee_hmac_type_e
444 \param[in] hash_op \ref tee_hash_op_e
445 \param[in] ctx Pointer to context of hmac
446 \return return 0 if successful,otherwise error code
448 int32_t csi_tee_hmac(const uint8_t *in, uint32_t in_len,
449 const uint8_t *key, uint32_t key_len,
451 tee_hmac_type_e type,
452 tee_hash_op_e hash_op,
456 \brief TEE HAMC digest
457 \note out buffer size must be large enough according to type, eg. 20 bytes for TEE_HMAC_SHA1
458 \param[in] in Pointer to input data buffer
459 \param[in] in_len Input data buffer length
460 \param[in] key Pointer to key buffer
461 \param[in] key_len Key buffer size
462 \param[out] out Pointer to output date buffer
463 \param[in] type \ref tee_hmac_type_e
464 \return return 0 if successful,otherwise error code
466 #define csi_tee_hmac_digest(in,in_len,key,key_len,out,type) \
467 csi_tee_hmac(in,in_len,key,key_len,out,type,TEE_HASH_OP_NONE,NULL)
469 /****** TEE SHA type *****/
471 TEE_SHA1 = 0, ///< SHA1
472 TEE_SHA256 = 1, ///< SHA256
473 TEE_SHA224 = 2, ///< SHA224
474 TEE_SHA384 = 3, ///< SHA384
475 TEE_SHA512 = 4, ///< SHA512
476 TEE_SHA_MAX, ///< invaild sha type
481 \note Call csi_tee_sha_digest, csi_tee_sha_start, csi_tee_sha_update or csi_tee_sha_finish is better
482 out buffer size must be large enough according to type, eg. 20 bytes for TEE_SHA1, 32 bytes for TEE_SHA256
483 \param[in] in Pointer to input data buffer
484 \param[in] in_len Input data buffer length
485 \param[out] out Pointer to output date buffer
486 \param[in] type \ref tee_sha_type_t
487 \param[in] hash_op \ref tee_hash_op_e
488 \param[in] ctx Pointer to context of sha
489 \return return 0 if successful,otherwise error code
491 int32_t csi_tee_sha(const uint8_t *in, uint32_t in_len,
494 tee_hash_op_e hash_op,
498 \brief TEE SHA digest
499 \note out buffer size must be large enough according to type, eg. 20 bytes for TEE_SHA1, 32 bytes for TEE_SHA256
500 \param[in] in Pointer to input data buffer
501 \param[in] in_len Input data buffer length
502 \param[out] out Pointer to output date buffer
503 \param[in] type \ref tee_sha_type_t
504 \return return 0 if successful,otherwise error code
506 #define csi_tee_sha_digest(in,in_len,out,type) \
507 csi_tee_sha(in,in_len,out,type,TEE_HASH_OP_NONE,NULL);
510 \brief TEE SHA start, initial sha
511 \param[in] type \ref tee_sha_type_t
512 \param[in] ctx Pointer to context of sha
513 \return return 0 if successful,otherwise error code
515 #define csi_tee_sha_start(type,ctx) \
516 csi_tee_sha(NULL,0,NULL,type,TEE_HASH_OP_START,ctx);
519 \brief TEE SHA update, update data
520 \param[in] in Pointer to input data buffer
521 \param[in] in_len Input data buffer length
522 \param[in] ctx Pointer to context of sha
523 \return return 0 if successful,otherwise error code
525 #define csi_tee_sha_update(in,in_len,ctx) \
526 csi_tee_sha(in,in_len,NULL,0,TEE_HASH_OP_UPDATA,ctx);
529 \brief TEE SHA digest, get sha digest
530 \note out buffer size must be large enough according to type, eg. 20 bytes for TEE_SHA1, 32 bytes for TEE_SHA256
531 \param[out] out Pointer to output date buffer
532 \param[in] ctx Pointer to context of sha
533 \return return 0 if successful,otherwise error code
535 #define csi_tee_sha_finish(out,ctx) \
536 csi_tee_sha(NULL,0,out,0,TEE_HASH_OP_FINISH,ctx);
539 \brief TEE get device name and product key
540 \param[in] name_encrypted Pointer to device name ciphertext
541 \param[in] name_encrypted_len device name ciphertext length
542 \param[in] product_key_encrypted Pointer to device product key ciphertext
543 \param[in] product_key_encrypted_len Device product key ciphertext length
544 \param[out] name Pointer to device name
545 \param[out] name_len Device name length
546 \param[out] product_key Pointer to device product key
547 \param[out] product_key_len Device product key length
548 \return return 0 if successful,otherwise error code
550 int32_t csi_tee_dev_info_get(const uint8_t *name_encrypted, uint32_t name_encrypted_len,
551 const uint8_t *product_key_encrypted, uint32_t product_key_encrypted_len,
552 const uint8_t *name, uint32_t *name_len,
553 const uint8_t *product_key, uint32_t *product_key_len);
556 \brief TEE device info sign
557 \param[in] in Pointer to input date buffer
558 \param[in] in_len Input data buffer length
559 \param[in] device_secret Pointer to device secret ciphertext
560 \param[in] device_secret_len Device secret ciphertext length
561 \param[out] sign Pointer to signed buffer
562 \param[out] sign_len Signed buffer length
563 \return return 0 if successful,otherwise error code
565 int32_t csi_tee_dev_info_sign(const uint8_t *in, uint32_t in_len,
566 const uint8_t *device_secret, uint32_t device_secret_len,
567 const uint8_t *sign, uint32_t *sign_len);
570 \brief TEE device info encrypt/decrypt
571 \param[in] in Pointer to input date buffer
572 \param[in] in_len Input data buffer length
573 \param[in] out Pointer to output date buffer
574 \param[in] out_len Onput data buffer length
575 \param[in] is_enc 1 incrypt 0 decrypt
576 \return return 0 if successful,otherwise error code
578 int32_t csi_tee_dev_info_crypt(const uint8_t *in, uint32_t in_len,
579 uint8_t *out, uint32_t *out_len,
583 \brief TEE device info encrypt
584 \param[in] in Pointer to input date buffer
585 \param[in] in_len Input data buffer length
586 \param[in] out Pointer to output date buffer
587 \param[in] out_len Onput data buffer length
588 \return return 0 if successful,otherwise error code
590 #define csi_tee_dev_info_encrypt(in, in_len, out, out_len) \
591 csi_tee_dev_info_crypt(in, in_len, out, out_len, 1)
594 \brief TEE device info decrypt
595 \param[in] in Pointer to input date buffer
596 \param[in] in_len Input data buffer length
597 \param[in] out Pointer to output date buffer
598 \param[in] out_len Onput data buffer length
599 \return return 0 if successful,otherwise error code
601 #define csi_tee_dev_info_decrypt(in, in_len, out, out_len) \
602 csi_tee_dev_info_crypt(in, in_len, out, out_len, 0)
604 /****** system clock source type *****/
606 IHS_CLK = 0, ///< internel clock source
607 EHS_CLK = 1 ///< externel clock source
610 /****** system clock value scope *****/
612 OSR_8M_CLK_16M = 0x80204, ///< register value for clock 16M
613 OSR_8M_CLK_24M = 0x80206, ///< register value for clock 24M
614 OSR_8M_CLK_32M = 0x80208, ///< register value for clock 32M
615 OSR_8M_CLK_40M = 0x8020a, ///< register value for clock 40M
616 OSR_8M_CLK_48M = 0x8020c ///< register value for clock 48M
620 \brief Set system frequence
621 \param[in] clk_src indicate clock source type
622 \param[in] clk_val system freqence to be set
623 \return return 0 if successful,otherwise error code
625 int32_t csi_tee_set_sys_freq(uint32_t clk_src, uint32_t clk_val);
628 \brief Get system frequence
629 \param[in] clk_val value address to store system freqence
630 \return return 0 if successful,otherwise error code
632 int32_t csi_tee_get_sys_freq(uint32_t *clk_val);
635 int32_t csi_tee_xor(uint8_t *out, uint32_t *out_len);
640 #endif /* _CSI_AES_H_ */