/optee_os/lib/libmbedtls/mbedtls/library/ |
A D | x509write_crt.c | 140 unsigned char *c = buf + sizeof(buf); in mbedtls_x509write_crt_set_basic_constraints() 143 memset( buf, 0, sizeof(buf) ); in mbedtls_x509write_crt_set_basic_constraints() 174 unsigned char *c = buf + sizeof(buf); in mbedtls_x509write_crt_set_subject_key_identifier() 177 memset( buf, 0, sizeof(buf) ); in mbedtls_x509write_crt_set_subject_key_identifier() 182 buf + sizeof( buf ) - 20 ); in mbedtls_x509write_crt_set_subject_key_identifier() 185 c = buf + sizeof( buf ) - 20; in mbedtls_x509write_crt_set_subject_key_identifier() 195 0, buf + sizeof(buf) - len, len ); in mbedtls_x509write_crt_set_subject_key_identifier() 202 unsigned char *c = buf + sizeof( buf ); in mbedtls_x509write_crt_set_authority_key_identifier() 205 memset( buf, 0, sizeof(buf) ); in mbedtls_x509write_crt_set_authority_key_identifier() 213 c = buf + sizeof( buf ) - 20; in mbedtls_x509write_crt_set_authority_key_identifier() [all …]
|
A D | x509write_csr.c | 98 c = buf + 4; in mbedtls_x509write_csr_set_key_usage() 120 c = buf + 4; in mbedtls_x509write_csr_set_ns_cert_type() 157 c = buf + size; in x509write_csr_der_internal() 167 &c, buf, in x509write_csr_der_internal() 173 &c, buf, in x509write_csr_der_internal() 184 &c, buf, in x509write_csr_der_internal() 191 &c, buf, in x509write_csr_der_internal() 213 &c, buf, in x509write_csr_der_internal() 267 c2 = buf + size; in x509write_csr_der_internal() 284 &c2, buf, in x509write_csr_der_internal() [all …]
|
A D | pkwrite.c | 116 unsigned char buf[MBEDTLS_ECP_MAX_PT_LEN]; in pk_write_ec_pubkey() local 120 &len, buf, sizeof( buf ) ) ) != 0 ) in pk_write_ec_pubkey() 129 memcpy( *p, buf, len ); in pk_write_ec_pubkey() 236 PK_VALIDATE_RET( buf != NULL ); in mbedtls_pk_write_pubkey_der() 238 c = buf + size; in mbedtls_pk_write_pubkey_der() 242 if( c - buf < 1 ) in mbedtls_pk_write_pubkey_der() 322 PK_VALIDATE_RET( buf != NULL ); in mbedtls_pk_write_key_der() 324 c = buf + size; in mbedtls_pk_write_key_der() 425 if( c - buf < 1 ) in mbedtls_pk_write_key_der() 563 PK_VALIDATE_RET( buf != NULL || size == 0 ); in mbedtls_pk_write_pubkey_pem() [all …]
|
A D | entropy.c | 301 mbedtls_platform_zeroize( buf, sizeof( buf ) ); in entropy_gather_internal() 435 memcpy( output, buf, len ); in mbedtls_entropy_func() 440 mbedtls_platform_zeroize( buf, sizeof( buf ) ); in mbedtls_entropy_func() 499 mbedtls_platform_zeroize( buf, sizeof( buf ) ); in mbedtls_entropy_write_seed_file() 524 if( fread( buf, 1, n, f ) != n ) in mbedtls_entropy_update_seed_file() 531 mbedtls_platform_zeroize( buf, sizeof( buf ) ); in mbedtls_entropy_update_seed_file() 594 set &= buf[i]; in mbedtls_entropy_source_self_test_check_bits() 595 unset |= buf[i]; in mbedtls_entropy_source_self_test_check_bits() 685 if( ( ret = mbedtls_entropy_update_manual( &ctx, buf, sizeof buf ) ) != 0 ) in mbedtls_entropy_self_test() 698 if( ( ret = mbedtls_entropy_func( &ctx, buf, sizeof( buf ) ) ) != 0 ) in mbedtls_entropy_self_test() [all …]
|
A D | pem.c | 154 des_iv, buf, buf ); in pem_des_decrypt() 182 des3_iv, buf, buf ); in pem_des3_decrypt() 212 aes_iv, buf, buf ); in pem_aes_decrypt() 231 unsigned char *buf; in mbedtls_pem_read_buffer() local 354 mbedtls_free( buf ); in mbedtls_pem_read_buffer() 365 mbedtls_free( buf ); in mbedtls_pem_read_buffer() 399 if( len <= 2 || buf[0] != 0x30 || buf[1] > 0x83 ) in mbedtls_pem_read_buffer() 407 mbedtls_free( buf ); in mbedtls_pem_read_buffer() 413 ctx->buf = buf; in mbedtls_pem_read_buffer() 421 if ( ctx->buf != NULL ) in mbedtls_pem_free() [all …]
|
A D | ecdh.c | 336 buf += grp_len; in ecdh_make_params_internal() 362 ECDH_VALIDATE_RET( buf != NULL ); in mbedtls_ecdh_make_params() 415 ECDH_VALIDATE_RET( buf != NULL ); in mbedtls_ecdh_read_params() 416 ECDH_VALIDATE_RET( *buf != NULL ); in mbedtls_ecdh_read_params() 419 if( ( ret = mbedtls_ecp_tls_read_group_id( &grp_id, buf, end - *buf ) ) in mbedtls_ecdh_read_params() 554 buf, blen ); in ecdh_make_public_internal() 568 ECDH_VALIDATE_RET( buf != NULL ); in mbedtls_ecdh_make_public() 601 const unsigned char *p = buf; in ecdh_read_public_internal() 607 if( (size_t)( p - buf ) != blen ) in ecdh_read_public_internal() 620 ECDH_VALIDATE_RET( buf != NULL ); in mbedtls_ecdh_read_public() [all …]
|
A D | ssl_srv.c | 332 list_size = ( ( buf[0] << 8 ) | ( buf[1] ) ); in ssl_parse_supported_elliptic_curves() 719 list_len = ( buf[0] << 8 ) | buf[1]; in ssl_parse_alpn_ext() 826 profile_length = ( buf[0] << 8 ) | buf[1]; in ssl_parse_use_srtp_ext() 1179 buf[3], buf[4] ) ); in ssl_parse_client_hello_v2() 1198 n = ( ( buf[0] << 8 ) | buf[1] ) & 0x7FFF; in ssl_parse_client_hello_v2() 1246 ciph_len = ( buf[0] << 8 ) | buf[1]; in ssl_parse_client_hello_v2() 1247 sess_len = ( buf[2] << 8 ) | buf[3]; in ssl_parse_client_hello_v2() 1248 chal_len = ( buf[4] << 8 ) | buf[5]; in ssl_parse_client_hello_v2() 1496 buf[1], buf[2] ) ); in ssl_parse_client_hello() 1605 ( buf[1] << 16 ) | ( buf[2] << 8 ) | buf[3] ) ); in ssl_parse_client_hello() [all …]
|
/optee_os/lib/libutils/ext/ |
A D | trace.c | 122 res = snprintk(buf, sizeof(buf), "%c/", in trace_vprintf() 129 res = snprintk(buf + boffs, sizeof(buf) - boffs, "%s:", in trace_vprintf() 137 res = print_core_id(buf + boffs, sizeof(buf) - boffs); in trace_vprintf() 143 res = print_thread_id(buf + boffs, sizeof(buf) - boffs); in trace_vprintf() 149 res = snprintk(buf + boffs, sizeof(buf) - boffs, "%s:%d ", in trace_vprintf() 160 buf[boffs] = 0; in trace_vprintf() 163 res = vsnprintk(buf + boffs, sizeof(buf) - boffs, fmt, ap); in trace_vprintf() 170 buf[boffs] = '\n'; in trace_vprintf() 218 left = sizeof(sbuf->buf) - (sbuf->ptr - sbuf->buf); in append() 260 sbuf.buf); in dhex_dump() [all …]
|
/optee_os/core/lib/libtomcrypt/src/hashes/ |
A D | sha3_test.c | 41 XMEMSET(buf, c1, sizeof(buf)); in sha3_224_test() 53 sha3_process(&c, buf + sizeof(buf) / 2, sizeof(buf) / 2); in sha3_224_test() 97 XMEMSET(buf, c1, sizeof(buf)); in sha3_256_test() 108 sha3_process(&c, buf, sizeof(buf)); in sha3_256_test() 117 sha3_process(&c, buf + sizeof(buf) / 2, sizeof(buf) / 2); in sha3_256_test() 187 XMEMSET(buf, c1, sizeof(buf)); in sha3_384_test() 200 sha3_process(&c, buf + sizeof(buf) / 2, sizeof(buf) / 2); in sha3_384_test() 242 XMEMSET(buf, c1, sizeof(buf)); in sha3_512_test() 255 sha3_process(&c, buf + sizeof(buf) / 2, sizeof(buf) / 2); in sha3_512_test() 312 XMEMSET(buf, c1, sizeof(buf)); in sha3_shake_test() [all …]
|
/optee_os/core/drivers/crypto/caam/utils/ |
A D | utils_mem.c | 98 if (!buf->data) in mem_alloc_buf() 101 buf->paddr = virt_to_phys(buf->data); in mem_alloc_buf() 102 if (!buf->paddr) { in mem_alloc_buf() 107 buf->length = size; in mem_alloc_buf() 108 buf->nocache = 0; in mem_alloc_buf() 166 if (buf) { in caam_free_buf() 167 if (buf->data) { in caam_free_buf() 169 buf->data = NULL; in caam_free_buf() 172 buf->length = 0; in caam_free_buf() 173 buf->paddr = 0; in caam_free_buf() [all …]
|
A D | utils_sgt.c | 31 op_size = MIN(rem_length, insgt->buf[idx].length); in caam_sgt_cache_op() 32 if (!insgt->buf[idx].nocache) in caam_sgt_cache_op() 47 sgt->buf[idx].length); in caam_sgt_fill_table() 52 sgt->buf[idx].length); in caam_sgt_fill_table() 75 off -= from->buf[idx].length; in caam_sgt_derive() 82 rlength -= MIN(rlength, from->buf[idx].length); in caam_sgt_derive() 95 memcpy(sgt->buf, &from->buf[st_idx], sgt->number * sizeof(*sgt->buf)); in caam_sgt_derive() 113 sgt->paddr = sgt->buf->paddr + off; in caam_sgt_derive() 126 caam_free(data->buf); in caam_sgtbuf_free() 129 data->buf = NULL; in caam_sgtbuf_free() [all …]
|
/optee_os/core/lib/libtomcrypt/src/misc/pkcs5/ |
A D | pkcs_5_2.c | 38 unsigned char *buf[2]; in pkcs_5_alg2() local 51 buf[0] = XMALLOC(MAXBLOCKSIZE * 2); in pkcs_5_alg2() 57 if (buf[0] != NULL) { in pkcs_5_alg2() 58 XFREE(buf[0]); in pkcs_5_alg2() 63 buf[1] = buf[0] + MAXBLOCKSIZE; in pkcs_5_alg2() 73 STORE32H(blkno, buf[1]); in pkcs_5_alg2() 92 XMEMCPY(buf[1], buf[0], x); in pkcs_5_alg2() 98 buf[1][y] ^= buf[0][y]; in pkcs_5_alg2() 104 out[stored++] = buf[1][y]; in pkcs_5_alg2() 113 zeromem(buf[0], MAXBLOCKSIZE*2); in pkcs_5_alg2() [all …]
|
/optee_os/core/lib/zlib/ |
A D | adler32.c | 17 #define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;} argument 18 #define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); argument 19 #define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); argument 20 #define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); argument 21 #define DO16(buf) DO8(buf,0); DO8(buf,8); argument 66 const Bytef *buf; 88 if (buf == Z_NULL) 109 buf += 16; 119 DO16(buf); 120 buf += 16; [all …]
|
/optee_os/core/lib/libtomcrypt/src/pk/asn1/der/generalizedtime/ |
A D | der_decode_generalizedtime.c | 38 y = _char_to_int(buf[x])*10 + _char_to_int(buf[x+1]); \ 44 …y = _char_to_int(buf[x])*1000 + _char_to_int(buf[x+1])*100 + _char_to_int(buf[x+2])*10 + _char_to… 59 unsigned char buf[32]; in der_decode_generalizedtime() local 83 buf[x] = y; in der_decode_generalizedtime() 114 if (buf[x] == 'Z') { in der_decode_generalizedtime() 117 if (buf[x] == '.') { in der_decode_generalizedtime() 119 while (buf[x] >= '0' && buf[x] <= '9') { in der_decode_generalizedtime() 123 out->fs += _char_to_int(buf[x]); in der_decode_generalizedtime() 130 if (buf[x] == 'Z') { in der_decode_generalizedtime() 133 if (buf[x] == '+' || buf[x] == '-') { in der_decode_generalizedtime() [all …]
|
/optee_os/core/lib/libtomcrypt/src/pk/ecc/ |
A D | ltc_ecc_export_point.c | 18 unsigned char buf[ECC_BUF_SIZE]; in ltc_ecc_export_point() local 21 if (size > sizeof(buf)) return CRYPT_BUFFER_OVERFLOW; in ltc_ecc_export_point() 33 zeromem(buf, sizeof(buf)); in ltc_ecc_export_point() 34 if ((err = mp_to_unsigned_bin(x, buf + (size - xsize))) != CRYPT_OK) return err; in ltc_ecc_export_point() 35 XMEMCPY(out+1, buf, size); in ltc_ecc_export_point() 47 zeromem(buf, sizeof(buf)); in ltc_ecc_export_point() 48 if ((err = mp_to_unsigned_bin(x, buf + (size - xsize))) != CRYPT_OK) return err; in ltc_ecc_export_point() 49 XMEMCPY(out+1, buf, size); in ltc_ecc_export_point() 51 zeromem(buf, sizeof(buf)); in ltc_ecc_export_point() 52 if ((err = mp_to_unsigned_bin(y, buf + (size - ysize))) != CRYPT_OK) return err; in ltc_ecc_export_point() [all …]
|
/optee_os/lib/libutee/ |
A D | tee_api_panic.c | 43 if (!buf) in check_access() 47 return TEE_CheckMemoryAccessRights(flags, buf, len); in check_access() 52 void __utee_check_outbuf_annotation(void *buf, uint32_t *len) in __utee_check_outbuf_annotation() argument 57 check_access(ACCESS_W_ANY, buf, *len)); in __utee_check_outbuf_annotation() 60 void __utee_check_instring_annotation(const char *buf) in __utee_check_instring_annotation() argument 63 check_access(ACCESS_R, (char *)buf, strlen(buf) + 1)); in __utee_check_instring_annotation() 71 check_access(ACCESS_W_ANY, buf, *len)); in __utee_check_outstring_annotation() 74 void __utee_check_out_annotation(void *buf, const size_t len) in __utee_check_out_annotation() argument 77 check_access(ACCESS_W, buf, len)); in __utee_check_out_annotation() 86 void __utee_check_inout_annotation(void *buf, const size_t len) in __utee_check_inout_annotation() argument [all …]
|
/optee_os/core/lib/libtomcrypt/src/math/ |
A D | rand_prime.c | 24 unsigned char *buf; in rand_prime() local 47 buf = XCALLOC(1, len); in rand_prime() 48 if (buf == NULL) { in rand_prime() 55 XFREE(buf); in rand_prime() 60 buf[0] |= 0x80 | 0x40; in rand_prime() 61 buf[len-1] |= 0x01 | ((type & USE_BBS) ? 0x02 : 0x00); in rand_prime() 64 if ((err = mp_read_unsigned_bin(N, buf, len)) != CRYPT_OK) { in rand_prime() 65 XFREE(buf); in rand_prime() 71 XFREE(buf); in rand_prime() 77 zeromem(buf, len); in rand_prime() [all …]
|
/optee_os/core/lib/libtomcrypt/ |
A D | sm2-kep.c | 60 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_Z() 65 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_Z() 70 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_Z() 75 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_Z() 80 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_Z() 85 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_Z() 128 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_S() 140 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_S() 147 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_S() 154 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_S() [all …]
|
/optee_os/lib/libmbedtls/core/ |
A D | sm2-kep.c | 70 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_Z() 79 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_Z() 88 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_Z() 97 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_Z() 106 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_Z() 115 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_Z() 164 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_S() 180 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_S() 191 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_S() 202 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_S() [all …]
|
/optee_os/core/lib/libtomcrypt/src/encauth/eax/ |
A D | eax_init.c | 36 unsigned char *buf; in eax_init() local 55 buf = XMALLOC(MAXBLOCKSIZE); in eax_init() 59 if (buf != NULL) { in eax_init() 60 XFREE(buf); in eax_init() 69 zeromem(buf, MAXBLOCKSIZE); in eax_init() 89 zeromem(buf, MAXBLOCKSIZE); in eax_init() 90 buf[blklen - 1] = 1; in eax_init() 120 zeromem(buf, MAXBLOCKSIZE); in eax_init() 121 buf[blklen-1] = 2; in eax_init() 129 zeromem(buf, MAXBLOCKSIZE); in eax_init() [all …]
|
/optee_os/core/lib/libtomcrypt/src/pk/asn1/der/utctime/ |
A D | der_decode_utctime.c | 37 y = _char_to_int(buf[x])*10 + _char_to_int(buf[x+1]); \ 51 unsigned char buf[32] = { 0 }; /* initialize as all zeroes */ in der_decode_utctime() local 60 if (*inlen < 2UL || (in[1] >= sizeof(buf)) || ((in[1] + 2UL) > *inlen)) { in der_decode_utctime() 70 buf[x] = y; in der_decode_utctime() 97 if (buf[x] == 'Z') { in der_decode_utctime() 100 if (buf[x] == '+' || buf[x] == '-') { in der_decode_utctime() 101 out->off_dir = (buf[x++] == '+') ? 0 : 1; in der_decode_utctime() 111 if (buf[x] == 'Z') { in der_decode_utctime() 114 if (buf[x] == '+' || buf[x] == '-') { in der_decode_utctime() 115 out->off_dir = (buf[x++] == '+') ? 0 : 1; in der_decode_utctime()
|
/optee_os/core/lib/libtomcrypt/src/prngs/ |
A D | rc4.c | 45 XMEMSET(&prng->u.rc4.s.buf, 0, sizeof(prng->u.rc4.s.buf)); in rc4_start() 59 unsigned char buf[256]; in rc4_add_entropy() local 70 … if ((err = rc4_stream_keystream(&prng->u.rc4.s, buf, sizeof(buf))) != CRYPT_OK) goto LBL_UNLOCK; in rc4_add_entropy() 71 for(i = 0; i < inlen; i++) buf[i % sizeof(buf)] ^= in[i]; in rc4_add_entropy() 73 if ((err = rc4_stream_setup(&prng->u.rc4.s, buf, sizeof(buf))) != CRYPT_OK) goto LBL_UNLOCK; in rc4_add_entropy() 75 for (i = 0; i < 12; i++) rc4_stream_keystream(&prng->u.rc4.s, buf, sizeof(buf)); in rc4_add_entropy() 76 zeromem(buf, sizeof(buf)); in rc4_add_entropy() 80 while (inlen--) prng->u.rc4.s.buf[prng->u.rc4.s.x++ % sizeof(prng->u.rc4.s.buf)] ^= *in++; in rc4_add_entropy() 95 unsigned char buf[256] = { 0 }; in rc4_ready() local 103 XMEMCPY(buf, prng->u.rc4.s.buf, sizeof(buf)); in rc4_ready() [all …]
|
/optee_os/core/drivers/crypto/crypto_api/acipher/ |
A D | rsassa.c | 66 buf = EM->data; in emsa_pkcs1_v1_5_encode() 69 *buf++ = 0x00; in emsa_pkcs1_v1_5_encode() 72 *buf++ = 0x01; in emsa_pkcs1_v1_5_encode() 76 buf += ps_size; in emsa_pkcs1_v1_5_encode() 79 *buf++ = 0x00; in emsa_pkcs1_v1_5_encode() 104 *buf++ = 0x00; in emsa_pkcs1_v1_5_encode() 153 *buf++ = 0x00; in emsa_pkcs1_v1_5_encode_noasn1() 156 *buf++ = 0x01; in emsa_pkcs1_v1_5_encode_noasn1() 163 *buf++ = 0x00; in emsa_pkcs1_v1_5_encode_noasn1() 380 buf += 8; in emsa_pss_encode() [all …]
|
/optee_os/core/lib/libtomcrypt/src/pk/pkcs1/ |
A D | pkcs_1_mgf1.c | 36 unsigned char *buf; in pkcs_1_mgf1() local 51 buf = XMALLOC(hLen); in pkcs_1_mgf1() 52 if (md == NULL || buf == NULL) { in pkcs_1_mgf1() 56 if (buf != NULL) { in pkcs_1_mgf1() 57 XFREE(buf); in pkcs_1_mgf1() 67 STORE32H(counter, buf); in pkcs_1_mgf1() 77 if ((err = hash_descriptor[hash_idx]->process(md, buf, 4)) != CRYPT_OK) { in pkcs_1_mgf1() 80 if ((err = hash_descriptor[hash_idx]->done(md, buf)) != CRYPT_OK) { in pkcs_1_mgf1() 86 *mask++ = buf[x]; in pkcs_1_mgf1() 93 zeromem(buf, hLen); in pkcs_1_mgf1() [all …]
|
/optee_os/core/drivers/crypto/caam/blob/ |
A D | caam_blob.c | 27 struct caambuf buf = { }; in caam_blob_mkvb_init() local 32 res = caam_calloc_align_buf(&buf, MKVB_SIZE); in caam_blob_mkvb_init() 45 caam_desc_add_ptr(desc, buf.paddr); in caam_blob_mkvb_init() 49 cache_operation(TEE_CACHEFLUSH, buf.data, buf.length); in caam_blob_mkvb_init() 58 cache_operation(TEE_CACHEINVALIDATE, buf.data, MKVB_SIZE); in caam_blob_mkvb_init() 59 BLOB_DUMPBUF("MKVB", buf.data, buf.length); in caam_blob_mkvb_init() 60 memcpy(&stored_key, buf.data, buf.length); in caam_blob_mkvb_init() 66 caam_free_buf(&buf); in caam_blob_mkvb_init()
|