Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions drivers/builtin/src/ecp_curves.c
Original file line number Diff line number Diff line change
Expand Up @@ -3871,13 +3871,13 @@ int mbedtls_ecp_group_load(mbedtls_ecp_group *grp, mbedtls_ecp_group_id id)

#if defined(MBEDTLS_HAVE_INT32) /* 32 bit */

#define MAX32 N->n
#define MAX32 (N->n)
#define A(j) N->p[j]
#define STORE32 N->p[i] = cur;

#else /* 64-bit */

#define MAX32 N->n * 2
#define MAX32 (N->n * 2)
#define A(j) (j) % 2 ? (uint32_t) (N->p[(j)/2] >> 32) : \
(uint32_t) (N->p[(j)/2])
#define STORE32 \
Expand Down
4 changes: 2 additions & 2 deletions drivers/builtin/src/ecp_curves_new.c
Original file line number Diff line number Diff line change
Expand Up @@ -3906,14 +3906,14 @@ int mbedtls_ecp_group_load(mbedtls_ecp_group *grp, mbedtls_ecp_group_id id)

#if defined(MBEDTLS_HAVE_INT32) /* 32 bit */

#define MAX32 X_limbs
#define MAX32 (X_limbs)
#define A(j) X[j]
#define STORE32 X[i] = (mbedtls_mpi_uint) cur;
#define STORE0 X[i] = 0;

#else /* 64 bit */

#define MAX32 X_limbs * 2
#define MAX32 (X_limbs * 2)
#define A(j) \
(j) % 2 ? \
(uint32_t) (X[(j) / 2] >> 32) : \
Expand Down
2 changes: 1 addition & 1 deletion drivers/builtin/src/sha3.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
* YMMV.
*/
/* Helper macro to set the values of the higher bits in unused low positions */
#define H(b63, b31, b15) (b63 << 6 | b31 << 5 | b15 << 4)
#define H(b63, b31, b15) (((b63) << 6) | ((b31) << 5) | ((b15) << 4))
static const uint8_t iota_r_packed[24] = {
H(0, 0, 0) | 0x01, H(0, 0, 1) | 0x82, H(1, 0, 1) | 0x8a, H(1, 1, 1) | 0x00,
H(0, 0, 1) | 0x8b, H(0, 1, 0) | 0x01, H(1, 1, 1) | 0x81, H(1, 0, 1) | 0x09,
Expand Down
2 changes: 1 addition & 1 deletion extras/pk_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ static inline mbedtls_ecp_group_id mbedtls_pk_get_ec_group_id(const mbedtls_pk_c
#endif /* PSA_WANT_ECC_MONTGOMERY_255 || PSA_WANT_ECC_MONTGOMERY_448 */

#define MBEDTLS_PK_IS_RFC8410_GROUP_ID(id) \
((id == MBEDTLS_ECP_DP_CURVE25519) || (id == MBEDTLS_ECP_DP_CURVE448))
(((id) == MBEDTLS_ECP_DP_CURVE25519) || ((id) == MBEDTLS_ECP_DP_CURVE448))

static inline int mbedtls_pk_is_rfc8410(const mbedtls_pk_context *pk)
{
Expand Down
20 changes: 10 additions & 10 deletions include/psa/crypto_extra.h
Original file line number Diff line number Diff line change
Expand Up @@ -893,12 +893,12 @@ typedef uint32_t psa_pake_primitive_t;
* return 0.
*/
#define PSA_PAKE_OUTPUT_SIZE(alg, primitive, output_step) \
(PSA_ALG_IS_JPAKE(alg) && \
primitive == PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC, \
PSA_ECC_FAMILY_SECP_R1, 256) ? \
(PSA_ALG_IS_JPAKE(alg) && \
(primitive) == PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC, \
PSA_ECC_FAMILY_SECP_R1, 256) ? \
( \
output_step == PSA_PAKE_STEP_KEY_SHARE ? 65 : \
output_step == PSA_PAKE_STEP_ZK_PUBLIC ? 65 : \
(output_step) == PSA_PAKE_STEP_KEY_SHARE ? 65 : \
(output_step) == PSA_PAKE_STEP_ZK_PUBLIC ? 65 : \
32 \
) : \
0)
Expand All @@ -923,12 +923,12 @@ typedef uint32_t psa_pake_primitive_t;
* the parameters are incompatible, return 0.
*/
#define PSA_PAKE_INPUT_SIZE(alg, primitive, input_step) \
(PSA_ALG_IS_JPAKE(alg) && \
primitive == PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC, \
PSA_ECC_FAMILY_SECP_R1, 256) ? \
(PSA_ALG_IS_JPAKE(alg) && \
(primitive) == PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC, \
PSA_ECC_FAMILY_SECP_R1, 256) ? \
( \
input_step == PSA_PAKE_STEP_KEY_SHARE ? 65 : \
input_step == PSA_PAKE_STEP_ZK_PUBLIC ? 65 : \
(input_step) == PSA_PAKE_STEP_KEY_SHARE ? 65 : \
(input_step) == PSA_PAKE_STEP_ZK_PUBLIC ? 65 : \
32 \
) : \
0)
Expand Down
2 changes: 1 addition & 1 deletion include/psa/crypto_values.h
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@
0))

/** Check if the curve of given family is Weierstrass elliptic curve. */
#define PSA_ECC_FAMILY_IS_WEIERSTRASS(family) ((family & 0xc0) == 0)
#define PSA_ECC_FAMILY_IS_WEIERSTRASS(family) (((family) & 0xc0) == 0)

/** SEC Koblitz curves over prime fields.
*
Expand Down