/openthread-latest/third_party/mbedtls/repo/3rdparty/everest/include/everest/kremlin/ |
D | c_endianness.h | 21 # define htole64(x) OSSwapHostToLittleInt64(x) argument 22 # define le64toh(x) OSSwapLittleToHostInt64(x) argument 23 # define htobe64(x) OSSwapHostToBigInt64(x) argument 24 # define be64toh(x) OSSwapBigToHostInt64(x) argument 26 # define htole16(x) OSSwapHostToLittleInt16(x) argument 27 # define le16toh(x) OSSwapLittleToHostInt16(x) argument 28 # define htobe16(x) OSSwapHostToBigInt16(x) argument 29 # define be16toh(x) OSSwapBigToHostInt16(x) argument 31 # define htole32(x) OSSwapHostToLittleInt32(x) argument 32 # define le32toh(x) OSSwapLittleToHostInt32(x) argument [all …]
|
/openthread-latest/third_party/mbedtls/repo/tests/suites/ |
D | test_suite_bignum.function | 15 static int sign_is_valid(const mbedtls_mpi *X) 18 if (X->s != 1 && X->s != -1) { 28 mbedtls_mpi_bitlen(X) == 0 && X->s != 1) { 53 if (random == NULL || random->data->x == NULL || buf == NULL) { 69 memcpy(buf + len - random->chunk_len, &random->data->x[random->pos], 102 mbedtls_mpi X, Y, Z; 104 mbedtls_mpi_init(&X); 108 TEST_ASSERT(mbedtls_mpi_get_bit(&X, 42) == 0); 109 TEST_ASSERT(mbedtls_mpi_lsb(&X) == 0); 110 TEST_ASSERT(mbedtls_mpi_bitlen(&X) == 0); [all …]
|
D | test_suite_bignum_mod_raw.function | 45 mbedtls_mpi_uint X[sizeof(buf) / sizeof(mbedtls_mpi_uint)]; 46 TEST_LE_U(nx, sizeof(X) / sizeof(X[0])); 55 mbedtls_mpi_uint init[sizeof(X) / sizeof(X[0])]; 64 ret = mbedtls_mpi_mod_raw_read(X, &m, input->x, input->len, endian); 72 ret = mbedtls_mpi_mod_raw_write(X, &m, buf, nb, endian); 80 TEST_ASSERT(memcmp(buf + nb - input->len, input->x, input->len) == 0); 85 TEST_ASSERT(memcmp(buf, input->x, input->len) == 0); 93 TEST_ASSERT(memcmp(input->x + input->len - nb, buf, nb) == 0); 95 TEST_EQUAL(input->x[i], 0); 98 TEST_ASSERT(memcmp(input->x, buf, nb) == 0); [all …]
|
D | test_suite_bignum_core.function | 12 * \param limbs Number of limbs in each MPI (\p A, \p B, \p S and \p X). 15 * \param[in,out] X Temporary storage to be used for results. 24 mbedtls_mpi_uint *X) 36 TEST_EQUAL(carry, mbedtls_mpi_core_add(X, A, B, limbs)); 37 TEST_MEMORY_COMPARE(X, bytes, S, bytes); 40 memcpy(X, A, bytes); 41 TEST_EQUAL(carry, mbedtls_mpi_core_add(X, X, B, limbs)); 42 TEST_MEMORY_COMPARE(X, bytes, S, bytes); 45 memcpy(X, B, bytes); 46 TEST_EQUAL(carry, mbedtls_mpi_core_add(X, A, X, limbs)); [all …]
|
D | test_suite_bignum_mod.function | 102 mbedtls_mpi_uint *X = NULL; 126 TEST_CALLOC(X, limbs); 128 TEST_EQUAL(mbedtls_mpi_mod_residue_setup(&rX, &m, X, limbs), 0); 133 /* alias X to A */ 138 /* alias X to B */ 148 /* X, A, B all aliased together */ 158 /* B * A: alias X to A */ 163 /* B + A: alias X to B */ 173 mbedtls_free(X); 187 mbedtls_mpi_uint *X = NULL; [all …]
|
D | test_suite_lmots.function | 42 key_id->x, leaf_id, seed->x, seed->len), 0); 45 msg->x, msg->len, sig, sizeof(sig), NULL), 0); 46 TEST_EQUAL(mbedtls_lmots_verify(&pub_ctx, msg->x, msg->len, sig, sizeof(sig)), 0); 65 key_id->x, leaf_id, seed->x, seed->len), 0); 87 TEST_EQUAL(mbedtls_lmots_import_public_key(&ctx, pub_key->x, pub_key->len), 0); 89 TEST_EQUAL(mbedtls_lmots_verify(&ctx, msg->x, msg->len, sig->x, sig->len), expected_rc); 95 msg->x[0] ^= 1; 96 TEST_EQUAL(mbedtls_lmots_verify(&ctx, msg->x, msg->len, sig->x, sig->len), 98 msg->x[0] ^= 1; 101 msg->x[msg->len - 1] ^= 1; [all …]
|
D | test_suite_ccm.function | 27 TEST_EQUAL(0, mbedtls_ccm_starts(ctx, mode, iv->x, iv->len)); 29 TEST_EQUAL(0, mbedtls_ccm_update_ad(ctx, add->x, n1_add)); 30 TEST_EQUAL(0, mbedtls_ccm_update_ad(ctx, add->x + n1_add, n2_add)); 37 TEST_EQUAL(0, mbedtls_ccm_update(ctx, input->x, n1, output, n1, &olen)); 39 TEST_MEMORY_COMPARE(output, olen, expected_output->x, n1); 45 TEST_EQUAL(0, mbedtls_ccm_update(ctx, input->x + n1, n2, output, n2, &olen)); 47 TEST_MEMORY_COMPARE(output, olen, expected_output->x + n1, n2); 53 TEST_MEMORY_COMPARE(output, tag->len, tag->x, tag->len); 198 const uint8_t *expected_tag = result->x + msg->len; 203 memcpy(io_msg_buf, msg->x, msg->len); [all …]
|
D | test_suite_lms.function | 27 seed->x, seed->len), 0); 32 msg->x, msg->len, sig, sizeof(sig), 35 TEST_EQUAL(mbedtls_lms_verify(&pub_ctx, msg->x, msg->len, sig, 60 seed->x, seed->len), 0); 87 TEST_EQUAL(mbedtls_lms_import_public_key(&ctx, pub_key->x, pub_key->len), 0); 89 TEST_EQUAL(mbedtls_lms_verify(&ctx, msg->x, msg->len, sig->x, sig->len), expected_rc); 95 msg->x[0] ^= 1; 96 TEST_EQUAL(mbedtls_lms_verify(&ctx, msg->x, msg->len, sig->x, sig->len), 98 msg->x[0] ^= 1; 101 msg->x[msg->len - 1] ^= 1; [all …]
|
D | test_suite_des.function | 13 TEST_ASSERT(mbedtls_des_key_check_weak(key->x) == ret); 27 TEST_ASSERT(mbedtls_des_setkey_enc(&ctx, key_str->x) == 0); 28 TEST_ASSERT(mbedtls_des_crypt_ecb(&ctx, src_str->x, output) == 0); 30 TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, 8, dst->len) == 0); 47 TEST_ASSERT(mbedtls_des_setkey_dec(&ctx, key_str->x) == 0); 48 TEST_ASSERT(mbedtls_des_crypt_ecb(&ctx, src_str->x, output) == 0); 50 TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, 8, dst->len) == 0); 68 TEST_ASSERT(mbedtls_des_setkey_enc(&ctx, key_str->x) == 0); 69 TEST_ASSERT(mbedtls_des_crypt_cbc(&ctx, MBEDTLS_DES_ENCRYPT, src_str->len, iv_str->x, 70 src_str->x, output) == cbc_result); [all …]
|
D | test_suite_bignum_core.misc.data | 161 mbedtls_mpi_core_lt_ct: x=y (1 limb) 164 mbedtls_mpi_core_lt_ct: x>y (1 limb) 167 mbedtls_mpi_core_lt_ct: x<y (1 limb) 170 mbedtls_mpi_core_lt_ct: x>y (63 bit x, y first byte greater) 173 mbedtls_mpi_core_lt_ct: x<y (63 bit y, x first byte greater) 176 mbedtls_mpi_core_lt_ct: x>y (64 bit x, y=x-1) 179 mbedtls_mpi_core_lt_ct: x<y (64 bit y, x=y-1) 182 mbedtls_mpi_core_lt_ct: x>y (64 bit x, y=1) 185 mbedtls_mpi_core_lt_ct: x<y (64 bit y, x=1) 188 mbedtls_mpi_core_lt_ct: x>y (64 bit x, y=0) [all …]
|
D | test_suite_aria.function | 74 TEST_ASSERT(mbedtls_aria_setkey_enc(&ctx, key_str->x, key_str->len * 8) 78 TEST_ASSERT(mbedtls_aria_crypt_ecb(&ctx, src_str->x + i, 83 expected_output->x, expected_output->len); 102 TEST_ASSERT(mbedtls_aria_setkey_dec(&ctx, key_str->x, key_str->len * 8) 106 TEST_ASSERT(mbedtls_aria_crypt_ecb(&ctx, src_str->x + i, 111 expected_output->x, expected_output->len); 130 mbedtls_aria_setkey_enc(&ctx, key_str->x, key_str->len * 8); 132 src_str->len, iv_str->x, src_str->x, 136 expected_output->x, expected_output->len); 155 mbedtls_aria_setkey_dec(&ctx, key_str->x, key_str->len * 8); [all …]
|
D | test_suite_alignment.function | 37 uint8_t *x = (uint8_t *) raw; 39 x[i] = (uint8_t) i; 47 r = mbedtls_get_unaligned_uint16(x + offset); 50 r = mbedtls_get_unaligned_uint32(x + offset); 53 r = mbedtls_get_unaligned_uint64(x + offset); 81 x[i + offset] = 0xff; 89 mbedtls_put_unaligned_uint16(x + offset, r); 92 mbedtls_put_unaligned_uint32(x + offset, r); 95 mbedtls_put_unaligned_uint64(x + offset, r); 98 for (size_t i = 0; i < sizeof(x); i++) { [all …]
|
D | test_suite_pkcs1_v21.function | 24 info.buf = rnd_buf->x; 36 TEST_ASSERT(mbedtls_mpi_read_binary(&N, input_N->x, input_N->len) == 0); 37 TEST_ASSERT(mbedtls_mpi_read_binary(&E, input_E->x, input_E->len) == 0); 43 message_str->x = NULL; 48 message_str->x, 51 TEST_MEMORY_COMPARE(output, ctx.len, result_str->x, result_str->len); 89 TEST_ASSERT(mbedtls_mpi_read_binary(&P, input_P->x, input_P->len) == 0); 90 TEST_ASSERT(mbedtls_mpi_read_binary(&Q, input_Q->x, input_Q->len) == 0); 91 TEST_ASSERT(mbedtls_mpi_read_binary(&N, input_N->x, input_N->len) == 0); 92 TEST_ASSERT(mbedtls_mpi_read_binary(&E, input_E->x, input_E->len) == 0); [all …]
|
/openthread-latest/third_party/mbedtls/repo/library/ |
D | constant_time_impl.h | 76 /* Ensure that the compiler cannot know the value of x (i.e., cannot optimise 90 * \param x The value to hide from the compiler. 93 * x = mbedtls_ct_compiler_opaque(1), x will be unknown). 100 static inline mbedtls_ct_uint_t mbedtls_ct_compiler_opaque(mbedtls_ct_uint_t x) in mbedtls_ct_compiler_opaque() argument 103 asm volatile ("" : [x] "+r" (x) :); in mbedtls_ct_compiler_opaque() 104 return x; in mbedtls_ct_compiler_opaque() 106 return x ^ mbedtls_ct_zero; in mbedtls_ct_compiler_opaque() 135 static inline mbedtls_ct_condition_t mbedtls_ct_bool(mbedtls_ct_uint_t x) in mbedtls_ct_bool() argument 147 asm volatile ("neg %x[s], %x[x] \n\t" in mbedtls_ct_bool() 148 "orr %x[x], %x[s], %x[x] \n\t" in mbedtls_ct_bool() [all …]
|
D | bignum.c | 56 int mbedtls_mpi_lt_mpi_ct(const mbedtls_mpi *X, in mbedtls_mpi_lt_mpi_ct() argument 62 if (X->n != Y->n) { in mbedtls_mpi_lt_mpi_ct() 70 X_is_negative = mbedtls_ct_bool((X->s & 2) >> 1); in mbedtls_mpi_lt_mpi_ct() 75 * That is if X is negative (X_is_negative == 1), then X < Y is true and it in mbedtls_mpi_lt_mpi_ct() 76 * is false if X is positive (X_is_negative == 0). in mbedtls_mpi_lt_mpi_ct() 82 * Assuming signs are the same, compare X and Y. We switch the comparison in mbedtls_mpi_lt_mpi_ct() 88 void * const p[2] = { X->p, Y->p }; in mbedtls_mpi_lt_mpi_ct() 90 mbedtls_ct_condition_t lt = mbedtls_mpi_core_lt_ct(p[i], p[i ^ 1], X->n); in mbedtls_mpi_lt_mpi_ct() 105 * Conditionally assign X = Y, without leaking information 107 * (Leaking information about the respective sizes of X and Y is ok however.) [all …]
|
D | bignum_mod_raw.c | 26 void mbedtls_mpi_mod_raw_cond_assign(mbedtls_mpi_uint *X, in mbedtls_mpi_mod_raw_cond_assign() argument 31 mbedtls_mpi_core_cond_assign(X, A, N->limbs, mbedtls_ct_bool(assign)); in mbedtls_mpi_mod_raw_cond_assign() 34 void mbedtls_mpi_mod_raw_cond_swap(mbedtls_mpi_uint *X, in mbedtls_mpi_mod_raw_cond_swap() argument 39 mbedtls_mpi_core_cond_swap(X, Y, N->limbs, mbedtls_ct_bool(swap)); in mbedtls_mpi_mod_raw_cond_swap() 42 int mbedtls_mpi_mod_raw_read(mbedtls_mpi_uint *X, in mbedtls_mpi_mod_raw_read() argument 52 ret = mbedtls_mpi_core_read_le(X, N->limbs, in mbedtls_mpi_mod_raw_read() 56 ret = mbedtls_mpi_core_read_be(X, N->limbs, in mbedtls_mpi_mod_raw_read() 67 if (!mbedtls_mpi_core_lt_ct(X, N->p, N->limbs)) { in mbedtls_mpi_mod_raw_read() 95 void mbedtls_mpi_mod_raw_sub(mbedtls_mpi_uint *X, in mbedtls_mpi_mod_raw_sub() argument 100 mbedtls_mpi_uint c = mbedtls_mpi_core_sub(X, A, B, N->limbs); in mbedtls_mpi_mod_raw_sub() [all …]
|
D | bignum_core.c | 168 void mbedtls_mpi_core_cond_assign(mbedtls_mpi_uint *X, in mbedtls_mpi_core_cond_assign() argument 173 if (X == A) { in mbedtls_mpi_core_cond_assign() 183 X[i] = mbedtls_ct_mpi_uint_if(assign, A[i], X[i]); in mbedtls_mpi_core_cond_assign() 187 void mbedtls_mpi_core_cond_swap(mbedtls_mpi_uint *X, in mbedtls_mpi_core_cond_swap() argument 192 if (X == Y) { in mbedtls_mpi_core_cond_swap() 197 mbedtls_mpi_uint tmp = X[i]; in mbedtls_mpi_core_cond_swap() 198 X[i] = mbedtls_ct_mpi_uint_if(swap, Y[i], X[i]); in mbedtls_mpi_core_cond_swap() 203 int mbedtls_mpi_core_read_le(mbedtls_mpi_uint *X, in mbedtls_mpi_core_read_le() argument 214 if (X != NULL) { in mbedtls_mpi_core_read_le() 215 memset(X, 0, X_limbs * ciL); in mbedtls_mpi_core_read_le() [all …]
|
D | ecp_invasive.h | 98 * \param[in,out] X The address of the MPI to be converted. 102 * in range `0 <= X < 2 * N` (where N is the modulus). 105 * \param[in] X_limbs The length of \p X in limbs. 112 int mbedtls_ecp_mod_p224_raw(mbedtls_mpi_uint *X, size_t X_limbs); 120 * \param[in,out] X The address of the MPI to be converted. 124 * in range `0 <= X < 2 * N` (where N is the modulus). 127 * \param[in] X_limbs The length of \p X in limbs. 134 int mbedtls_ecp_mod_p256_raw(mbedtls_mpi_uint *X, size_t X_limbs); 142 * \param[in,out] X The address of the MPI to be converted. 146 * in range `0 <= X < 2 * N` (where N is the modulus). [all …]
|
D | bignum_core.h | 29 * - Bignum parameters called \p X, \p Y are outputs or input-output. 90 #define GET_BYTE(X, i) \ argument 91 (((X)[(i) / ciL] >> (((i) % ciL) * 8)) & 0xff) 163 * \param[out] X The address of the destination MPI. 176 void mbedtls_mpi_core_cond_assign(mbedtls_mpi_uint *X, 185 * \param[in,out] X The address of the first MPI. 189 * \param limbs The number of limbs of \p X and \p Y. 196 void mbedtls_mpi_core_cond_swap(mbedtls_mpi_uint *X, 201 /** Import X from unsigned binary data, little-endian. 206 * \param[out] X The address of the MPI. [all …]
|
D | alignment.h | 68 * For gcc 4.x, this implementation will generate byte-by-byte loads even if unaligned access is 87 uint16_t x; member 90 uint32_t x; member 93 uint64_t x; member 123 r = p16->x; in mbedtls_get_unaligned_uint16() 135 * \param x data to write 142 static inline void mbedtls_put_unaligned_uint16(void *p, uint16_t x) in mbedtls_put_unaligned_uint16() argument 146 *p16 = x; in mbedtls_put_unaligned_uint16() 149 p16->x = x; in mbedtls_put_unaligned_uint16() 151 memcpy(p, &x, sizeof(x)); in mbedtls_put_unaligned_uint16() [all …]
|
/openthread-latest/third_party/mbedtls/repo/3rdparty/everest/include/everest/kremlin/internal/ |
D | debug.h | 24 #define KRML_FORMAT(X) _Generic((X), \ argument 25 uint8_t : "0x%08" PRIx8, \ 26 uint16_t: "0x%08" PRIx16, \ 27 uint32_t: "0x%08" PRIx32, \ 28 uint64_t: "0x%08" PRIx64, \ 29 int8_t : "0x%08" PRIx8, \ 30 int16_t : "0x%08" PRIx16, \ 31 int32_t : "0x%08" PRIx32, \ 32 int64_t : "0x%08" PRIx64, \ 35 #define KRML_FORMAT_ARG(X) _Generic((X), \ argument [all …]
|
/openthread-latest/third_party/mbedtls/repo/3rdparty/p256-m/p256-m/ |
D | p256-m.c | 59 * That is: x = x[0] + 2^32 x[1] + ... + 2^224 x[7] for 256-bit. 66 * in: x in [0, 2^32) 67 * out: z = x 69 static void u256_set32(uint32_t z[8], uint32_t x) in u256_set32() argument 71 z[0] = x; in u256_set32() 80 * in: x, y in [0, 2^256) 81 * out: z = (x + y) mod 2^256 82 * c = (x + y) div 2^256 83 * That is, z + c * 2^256 = x + y 85 * Note: as a memory area, z must be either equal to x or y, or not overlap. [all …]
|
/openthread-latest/tests/scripts/thread-cert/pktverify/ |
D | bytes.py | 58 return ''.join('%02x' % b for b in self) 64 return ':'.join('%02x' % b for b in self) 71 return ':'.join('%04x' % (self[i] * 256 + self[i + 1]) for i in range(0, len(self), 2)) 90 return bytearray(int(x, 16) for x in s.split(':')) 101 return bytearray(int(x[i:i + 2], 16) for x in s.split(':') for i in (0, 2)) 112 x = super().__getitem__(item) 113 if isinstance(x, bytearray): 114 return Bytes(x) 116 return x 134 x = Bytes(b"\x01\x02\x03\x04") variable [all …]
|
/openthread-latest/third_party/mbedtls/repo/include/mbedtls/ |
D | bignum.h | 247 * \param X The MPI context to initialize. This must not be \c NULL. 249 void mbedtls_mpi_init(mbedtls_mpi *X); 254 * \param X The MPI context to be cleared. This may be \c NULL, 258 void mbedtls_mpi_free(mbedtls_mpi *X); 266 * \param X The MPI to grow. It must be initialized. 273 int mbedtls_mpi_grow(mbedtls_mpi *X, size_t nblimbs); 279 * If \c X is smaller than \c nblimbs, it is resized up 282 * \param X The MPI to shrink. This must point to an initialized MPI. 290 int mbedtls_mpi_shrink(mbedtls_mpi *X, size_t nblimbs); 295 * \param X The destination MPI. This must point to an initialized MPI. [all …]
|
/openthread-latest/third_party/mbedtls/repo/3rdparty/everest/library/kremlib/ |
D | FStar_UInt64_FStar_UInt32_FStar_UInt16_FStar_UInt8.c | 15 uint64_t x = a ^ b; in FStar_UInt64_eq_mask() local 16 uint64_t minus_x = ~x + (uint64_t)1U; in FStar_UInt64_eq_mask() 17 uint64_t x_or_minus_x = x | minus_x; in FStar_UInt64_eq_mask() 24 uint64_t x = a; in FStar_UInt64_gte_mask() local 26 uint64_t x_xor_y = x ^ y; in FStar_UInt64_gte_mask() 27 uint64_t x_sub_y = x - y; in FStar_UInt64_gte_mask() 30 uint64_t x_xor_q = x ^ q; in FStar_UInt64_gte_mask() 37 uint32_t x = a ^ b; in FStar_UInt32_eq_mask() local 38 uint32_t minus_x = ~x + (uint32_t)1U; in FStar_UInt32_eq_mask() 39 uint32_t x_or_minus_x = x | minus_x; in FStar_UInt32_eq_mask() [all …]
|