Skip to content

Instantly share code, notes, and snippets.

@hjc4869
Last active August 18, 2017 17:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hjc4869/e7cf201e90b960c7c4f2af6902da3fc8 to your computer and use it in GitHub Desktop.
Save hjc4869/e7cf201e90b960c7c4f2af6902da3fc8 to your computer and use it in GitHub Desktop.
sslver.cs
using System;
using System.Runtime.InteropServices;
namespace sslver
{
class Program
{
// Use OpenSSL_version_num on OpenSSL 1.1 or later.
[DllImport("libcrypto", CallingConvention = CallingConvention.Cdecl)]
public extern static uint SSLeay();
static void Main(string[] args)
{
var ver = SSLeay();
var major = (ver & 0xf0000000) >> 28;
var minor = (ver & 0x0ff00000) >> 20;
var fix = (ver & 0x000ff000) >> 12;
var patchNum = (ver & 0x00000ff0) >> 4;
char? patch = patchNum == 0 ? (char?)null : (char)('a' + patchNum - 1);
Console.WriteLine($"libcrypto {major}.{minor}.{fix}{patch}");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment