File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed
Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,18 @@ task :debug_compiler do
3838end
3939
4040task :debug do
41- ruby "-I./lib -ropenssl -ve'puts OpenSSL::OPENSSL_VERSION, OpenSSL::OPENSSL_LIBRARY_VERSION'"
41+ ruby_code = <<~'EOF'
42+ openssl_version_number_str = OpenSSL::OPENSSL_VERSION_NUMBER.to_s(16)
43+ libressl_version_number_str = (defined? OpenSSL::LIBRESSL_VERSION_NUMBER) ?
44+ OpenSSL::LIBRESSL_VERSION_NUMBER.to_s(16) : "undefined"
45+ puts <<~MESSAGE
46+ OpenSSL::OPENSSL_VERSION: #{OpenSSL::OPENSSL_VERSION}
47+ OpenSSL::OPENSSL_LIBRARY_VERSION: #{OpenSSL::OPENSSL_LIBRARY_VERSION}
48+ OpenSSL::OPENSSL_VERSION_NUMBER: #{openssl_version_number_str}
49+ OpenSSL::LIBRESSL_VERSION_NUMBER: #{libressl_version_number_str}
50+ MESSAGE
51+ EOF
52+ ruby %Q(-I./lib -ropenssl -ve'#{ ruby_code } ')
4253end
4354
4455task :default => :test
Original file line number Diff line number Diff line change @@ -1149,10 +1149,27 @@ Init_openssl(void)
11491149
11501150 /*
11511151 * Version number of OpenSSL the ruby OpenSSL extension was built with
1152- * (base 16)
1152+ * (base 16). The formats are below.
1153+ *
1154+ * [OpenSSL 3] <tt>0xMNN00PP0 (major minor 00 patch 0)</tt>
1155+ * [OpenSSL before 3] <tt>0xMNNFFPPS (major minor fix patch status)</tt>
1156+ * [LibreSSL] <tt>0x20000000 (fixed value)</tt>
1157+ *
1158+ * See also the man page OPENSSL_VERSION_NUMBER(3).
11531159 */
11541160 rb_define_const (mOSSL , "OPENSSL_VERSION_NUMBER" , INT2NUM (OPENSSL_VERSION_NUMBER ));
11551161
1162+ #if defined(LIBRESSL_VERSION_NUMBER )
1163+ /*
1164+ * Version number of LibreSSL the ruby OpenSSL extension was built with
1165+ * (base 16). The format is <tt>0xMNNFFPPS (major minor fix patch
1166+ * status)</tt>. This constant is only defined in LibreSSL cases.
1167+ *
1168+ * See also the man page OPENSSL_VERSION_NUMBER(3).
1169+ */
1170+ rb_define_const (mOSSL , "LIBRESSL_VERSION_NUMBER" , INT2NUM (LIBRESSL_VERSION_NUMBER ));
1171+ #endif
1172+
11561173 /*
11571174 * Boolean indicating whether OpenSSL is FIPS-capable or not
11581175 */
You can’t perform that action at this time.
0 commit comments