Skip to content

Commit c33035e

Browse files
add conditions to constant time mask functions
1 parent 838636c commit c33035e

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

wolfcrypt/src/misc.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,13 @@ WC_MISC_STATIC WC_INLINE int ConstantCompare(const byte* a, const byte* b,
633633
}
634634
#endif
635635

636-
#ifndef WOLFSSL_NO_CT_OPS
636+
637+
#if defined(WOLFSSL_NO_CT_OPS) && (!defined(NO_RSA) || !defined(WOLFCRYPT_ONLY))
638+
/* constant time operations with mask are required for RSA and TLS operations */
639+
#warning constant time operations required unless using NO_RSA & WOLFCRYPT_ONLY
640+
#endif
641+
642+
#if !defined(WOLFSSL_NO_CT_OPS) || !defined(NO_RSA) || !defined(WOLFCRYPT_ONLY)
637643
/* Constant time - mask set when a > b. */
638644
WC_MISC_STATIC WC_INLINE byte ctMaskGT(int a, int b)
639645
{

0 commit comments

Comments
 (0)