[openssl/openssl] cfbec3: bn_nist: replace pointer bit-fiddling with ternary
Alois Klink
noreply at github.com
Mon Apr 17 22:08:03 UTC 2023
Branch: refs/heads/openssl-3.1
Home: https://github.com/openssl/openssl
Commit: cfbec3543f7d1475739e49599945e649ef9bb531
https://github.com/openssl/openssl/commit/cfbec3543f7d1475739e49599945e649ef9bb531
Author: Alois Klink <alois at aloisklink.com>
Date: 2023-04-18 (Tue, 18 Apr 2023)
Changed paths:
M crypto/bn/bn_nist.c
Log Message:
-----------
bn_nist: replace pointer bit-fiddling with ternary
Bit-fiddling pointers is technically implementation defined behavior
in the C specification so the following code is not supported in all
platforms:
PTR_SIZE_INT mask;
void * a, b, c;
int boolean_flag;
mask = 0 - boolean_flag;
/* Not guaranteed to be a valid ptr to a or b on all platforms */
a = (void *)
((((PTR_SIZE_INT) b & ~mask) | (((PTR_SIZE_INT)) c & mask)));
Using a ternary conditional operator is supported on all platforms
(i.e. `a = boolean_flag ? b : c;`).
On most modern compilers/CPUs, this will be faster, since it will
get converted to a CMOV instruction.
Reviewed-by: Richard Levitte <levitte at openssl.org>
Reviewed-by: Paul Dale <pauli at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20748)
(cherry picked from commit 326af4ad171b849ba1e76fd425d8f337718c4108)
Commit: 3eca58faf5a4a3734755c26d1878ca2362ae2dc1
https://github.com/openssl/openssl/commit/3eca58faf5a4a3734755c26d1878ca2362ae2dc1
Author: Alois Klink <alois at aloisklink.com>
Date: 2023-04-18 (Tue, 18 Apr 2023)
Changed paths:
M crypto/bn/bn_nist.c
Log Message:
-----------
bn_nist: remove unused type-punning union `u`
We no longer need to cast function pointers to PTR_SIZE_INT.
Reviewed-by: Richard Levitte <levitte at openssl.org>
Reviewed-by: Paul Dale <pauli at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20748)
(cherry picked from commit f659f7a1c70709caa1727bb0b7f836d170d35bb5)
Commit: bf64571916ca294a4a52fa8de303c6bea462341d
https://github.com/openssl/openssl/commit/bf64571916ca294a4a52fa8de303c6bea462341d
Author: Alois Klink <alois at aloisklink.com>
Date: 2023-04-18 (Tue, 18 Apr 2023)
Changed paths:
M crypto/bn/bn_local.h
Log Message:
-----------
bn_local: remove unused `PTR_SIZE_INT` definition
Reviewed-by: Richard Levitte <levitte at openssl.org>
Reviewed-by: Paul Dale <pauli at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20748)
(cherry picked from commit dcfeb617477dd957f69e713cbc61fd4dca0f2db4)
Compare: https://github.com/openssl/openssl/compare/c299be277f24...bf64571916ca
More information about the openssl-commits
mailing list