Replace MOD_EXP_CTIME_ALIGN with align_pointer.

Change-Id: Iea1cf557acc85e9bab7ddd50a15376ce77b1c65d
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/55226
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
diff --git a/crypto/fipsmodule/bn/exponentiation.c b/crypto/fipsmodule/bn/exponentiation.c
index e03785c..a76d7cb 100644
--- a/crypto/fipsmodule/bn/exponentiation.c
+++ b/crypto/fipsmodule/bn/exponentiation.c
@@ -860,9 +860,6 @@
   return 1;
 }
 
-#define MOD_EXP_CTIME_MIN_CACHE_LINE_MASK \
-  (MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH - 1)
-
 // Window sizes optimized for fixed window size modular exponentiation
 // algorithm (BN_mod_exp_mont_consttime).
 //
@@ -888,13 +885,6 @@
 
 #endif
 
-// Given a pointer value, compute the next address that is a cache line
-// multiple.
-#define MOD_EXP_CTIME_ALIGN(x_)          \
-  ((unsigned char *)(x_) +               \
-   (MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH - \
-    (((size_t)(x_)) & (MOD_EXP_CTIME_MIN_CACHE_LINE_MASK))))
-
 // This variant of |BN_mod_exp_mont| uses fixed windows and fixed memory access
 // patterns to protect secret exponents (cf. the hyper-threading timing attacks
 // pointed out by Colin Percival,
@@ -1006,7 +996,7 @@
     if (powerbufFree == NULL) {
       goto err;
     }
-    powerbuf = (BN_ULONG *)MOD_EXP_CTIME_ALIGN(powerbufFree);
+    powerbuf = align_pointer(powerbufFree, MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH);
   }
   OPENSSL_memset(powerbuf, 0, powerbufLen);