| /optee_os/lib/libmbedtls/core/ |
| H A D | bignum.c | 73 mbedtls_mpi *bn = NULL; in crypto_bignum_allocate() local 78 bn = calloc(1, sizeof(mbedtls_mpi)); in crypto_bignum_allocate() 79 if (!bn) in crypto_bignum_allocate() 81 mbedtls_mpi_init(bn); in crypto_bignum_allocate() 82 if (mbedtls_mpi_grow(bn, BITS_TO_LIMBS(size_bits)) != 0) { in crypto_bignum_allocate() 83 free(bn); in crypto_bignum_allocate() 87 return (struct bignum *)bn; in crypto_bignum_allocate() 101 mbedtls_mpi *bn = (mbedtls_mpi *)s; in crypto_bignum_clear() local 103 memset(bn->p, 0, mbedtls_mpi_size((const mbedtls_mpi *)bn)); in crypto_bignum_clear()
|
| /optee_os/core/lib/libtomcrypt/ |
| H A D | mpi_desc.c | 65 mbedtls_mpi *bn = mempool_alloc(mbedtls_mpi_mempool, sizeof(*bn)); in init() local 67 if (!bn) in init() 70 mbedtls_mpi_init_mempool(bn); in init() 71 *a = bn; in init() 118 mbedtls_mpi bn = { .s = 1, .n = 1, .p = &p }; in set_int() local 120 if (mbedtls_mpi_copy(a, &bn)) in set_int() 127 mbedtls_mpi *bn = a; in get_int() local 129 if (!bn->n) in get_int() 132 return bn->p[bn->n - 1]; in get_int() 137 mbedtls_mpi *bn = a; in get_digit() local [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/ecc/ |
| H A D | ecc_set_curve_internal.c | 17 void *bn; in s_ecc_oid_lookup() local 21 if (mp_init(&bn) != CRYPT_OK) return; in s_ecc_oid_lookup() 23 if (s_ecc_cmp_hex_bn(curve->prime, key->dp.prime, bn) != 1) continue; in s_ecc_oid_lookup() 24 if (s_ecc_cmp_hex_bn(curve->order, key->dp.order, bn) != 1) continue; in s_ecc_oid_lookup() 25 if (s_ecc_cmp_hex_bn(curve->A, key->dp.A, bn) != 1) continue; in s_ecc_oid_lookup() 26 if (s_ecc_cmp_hex_bn(curve->B, key->dp.B, bn) != 1) continue; in s_ecc_oid_lookup() 27 if (s_ecc_cmp_hex_bn(curve->Gx, key->dp.base.x, bn) != 1) continue; in s_ecc_oid_lookup() 28 if (s_ecc_cmp_hex_bn(curve->Gy, key->dp.base.y, bn) != 1) continue; in s_ecc_oid_lookup() 32 mp_clear(bn); in s_ecc_oid_lookup()
|
| /optee_os/lib/libutils/isoc/ |
| H A D | bget.c | 973 struct bfhead *b, *bn; local 1015 bn = NULL; 1075 bn = BFH(((char *) b) + b->bh.bsize); 1076 if (bn->bh.bsize > 0) { 1081 assert(BH((char *) bn + bn->bh.bsize)->prevfree == bn->bh.bsize); 1082 assert(bn->ql.blink->ql.flink == bn); 1083 assert(bn->ql.flink->ql.blink == bn); 1084 bn->ql.blink->ql.flink = bn->ql.flink; 1085 bn->ql.flink->ql.blink = bn->ql.blink; 1087 rem_sz2 = bn->bh.bsize; [all …]
|
| /optee_os/core/pta/tests/ |
| H A D | fs_htree.c | 180 static uint32_t val_from_bn_n_salt(size_t bn, size_t n, uint8_t salt) in val_from_bn_n_salt() argument 182 assert(bn < UINT16_MAX); in val_from_bn_n_salt() 184 return SHIFT_U32(n, 16) | SHIFT_U32(bn, 8) | salt; in val_from_bn_n_salt() 187 static TEE_Result write_block(struct tee_fs_htree **ht, size_t bn, uint8_t salt) in write_block() argument 193 b[n] = val_from_bn_n_salt(bn, n, salt); in write_block() 195 return tee_fs_htree_write_block(ht, bn, b); in write_block() 198 static TEE_Result read_block(struct tee_fs_htree **ht, size_t bn, uint8_t salt) in read_block() argument 204 res = tee_fs_htree_read_block(ht, bn, b); in read_block() 209 if (b[n] != val_from_bn_n_salt(bn, n, salt)) { in read_block() 212 n, b[n], val_from_bn_n_salt(bn, n, salt)); in read_block() [all …]
|
| /optee_os/core/pta/ |
| H A D | attestation.c | 87 static size_t serialize_bignum(uint8_t *buf, size_t buf_sz, struct bignum *bn) in serialize_bignum() argument 90 size_t sz = crypto_bignum_num_bytes(bn); in serialize_bignum() 100 crypto_bignum_bn2bin(bn, p); in serialize_bignum() 157 static size_t deserialize_bignum(uint8_t *buf, size_t max_sz, struct bignum *bn) in deserialize_bignum() argument 174 res = crypto_bignum_bin2bn(p, sz, bn); in deserialize_bignum()
|
| /optee_os/core/tee/ |
| H A D | tee_svc_cryp.c | 827 struct bignum **bn = attr; in op_attr_bignum_from_user() local 834 res = crypto_bignum_bin2bn(bbuf, size, *bn); in op_attr_bignum_from_user() 846 struct bignum **bn = attr; in op_attr_bignum_to_user() local 855 req_size = crypto_bignum_num_bytes(*bn); in op_attr_bignum_to_user() 872 crypto_bignum_bn2bin(*bn, bbuf); in op_attr_bignum_to_user() 883 struct bignum **bn = attr; in op_attr_bignum_to_binary() local 884 uint32_t n = crypto_bignum_num_bytes(*bn); in op_attr_bignum_to_binary() 895 crypto_bignum_bn2bin(*bn, (uint8_t *)data + *offs); in op_attr_bignum_to_binary() 904 struct bignum **bn = attr; in op_attr_bignum_from_binary() local 912 if (crypto_bignum_bin2bn((const uint8_t *)data + *offs, n, *bn)) in op_attr_bignum_from_binary() [all …]
|