[PATCH v2 1/1] fix libssl version check
Christian Hesse
list at eworm.de
Thu Oct 16 16:39:47 CEST 2014
From: Christian Hesse <mail at eworm.de>
When doing bitwise AND leading zeros do not matter, trailing ones do.
Signed-off-by: Christian Hesse <mail at eworm.de>
---
src/main/version.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/main/version.c b/src/main/version.c
index 8b56ffa..dc5034c 100644
--- a/src/main/version.c
+++ b/src/main/version.c
@@ -54,6 +54,9 @@ int ssl_check_consistency(void)
ssl_linked = SSLeay();
/*
+ * OpenSSL version number is described in ssleay(3) and consists of:
+ * MMNNFFPPS: major minor fix patch status
+ *
* Status mismatch always triggers error.
*/
if ((ssl_linked & 0x00000000f) != (ssl_built & 0x00000000f)) {
@@ -70,14 +73,14 @@ int ssl_check_consistency(void)
* 1.0.0 and only allow moving backwards within a patch
* series.
*/
- if (ssl_built & 0xff) {
- if ((ssl_built & 0xffff) != (ssl_linked & 0xffff) ||
- (ssl_built & 0x0000ff) > (ssl_linked & 0x0000ff)) goto mismatch;
+ if (ssl_built & 0xff0000000 >= 0x010000000) {
+ if ((ssl_built & 0xffffff000) != (ssl_linked & 0xffffff000) ||
+ (ssl_built & 0x000000ff0) > (ssl_linked & 0x000000ff0)) goto mismatch;
/*
* Before 1.0.0 we require the same major minor and fix version
* and ignore the patch number.
*/
- } else if ((ssl_built & 0xffffff) != (ssl_linked & 0xffffff)) goto mismatch;
+ } else if ((ssl_built & 0xffffff000) != (ssl_linked & 0xffffff000)) goto mismatch;
return 0;
}
--
2.1.2
More information about the Freeradius-Devel
mailing list