| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a0691d6 commit d2f5004
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1246,7 +1246,8 @@ def get_openssl_version(o): | |||
| 1246 | 1246 | """Parse OpenSSL version from opensslv.h header file. | |
| 1247 | 1247 | ||
| 1248 | 1248 | Returns the version as a number matching OPENSSL_VERSION_NUMBER format: | |
| 1249 | - 0xMNN00PPSL where M=major, NN=minor, PP=patch, S=status(0xf=release,0x0=pre), L=0 | ||
| 1249 | + 0xMNN00PPSL where M=major, NN=minor, PP=patch, S=status(0xf=release,0x0=pre), | ||
| 1250 | + L denotes as a long type literal | ||
| 1250 | 1251 | """ | |
| 1251 | 1252 | ||
| 1252 | 1253 | try: | |
@@ -1289,6 +1290,14 @@ def get_openssl_version(o): | |||
| 1289 | 1290 | minor = int(macros.get('OPENSSL_VERSION_MINOR', '0')) | |
| 1290 | 1291 | patch = int(macros.get('OPENSSL_VERSION_PATCH', '0')) | |
| 1291 | 1292 | ||
| 1293 | + # If major, minor and patch are all 0, this is probably OpenSSL < 3. | ||
| 1294 | + if (major, minor, patch) == (0, 0, 0): | ||
| 1295 | + version_number = macros.get('OPENSSL_VERSION_NUMBER') | ||
| 1296 | + # Prior to OpenSSL 3 the value should be in the format 0xMNN00PPSL. | ||
| 1297 | + # If it is, we need to strip the `L` suffix prior to parsing. | ||
| 1298 | + if version_number[:2] == "0x" and version_number[-1] == "L": | ||
| 1299 | + return int(version_number[:-1], 16) | ||
| 1300 | + | ||
| 1292 | 1301 | # Check if it's a pre-release (has non-empty PRE_RELEASE string) | |
| 1293 | 1302 | pre_release = macros.get('OPENSSL_VERSION_PRE_RELEASE', '""').strip('"') | |
| 1294 | 1303 | status = 0x0 if pre_release else 0xf | |
| Back | FazBrowse Home | New Git URL |
0 commit comments