Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include <dlfcn.h>
00029 #include <openssl/opensslv.h>
00030 #include <openssl/crypto.h>
00031
00032 #include <string.h>
00033 #include <descrip.h>
00034 #include <libclidef.h>
00035 #include <stsdef.h>
00036 #include <errno.h>
00037
00038 unsigned long LIB$SET_SYMBOL(
00039 const struct dsc$descriptor_s * symbol,
00040 const struct dsc$descriptor_s * value,
00041 const unsigned long * table_type);
00042
00043 int main(int argc, char ** argv) {
00044
00045
00046 void * libptr;
00047 const char * (*ssl_version)(int t);
00048 const char * version;
00049
00050 if (argc < 1) {
00051 puts("report_openssl_version filename");
00052 exit(1);
00053 }
00054
00055 libptr = dlopen(argv[1], 0);
00056
00057 ssl_version = (const char * (*)(int))dlsym(libptr, "SSLeay_version");
00058 if ((void *)ssl_version == NULL) {
00059 ssl_version = (const char * (*)(int))dlsym(libptr, "ssleay_version");
00060 if ((void *)ssl_version == NULL) {
00061 ssl_version = (const char * (*)(int))dlsym(libptr, "SSLEAY_VERSION");
00062 }
00063 }
00064
00065 dlclose(libptr);
00066
00067 if ((void *)ssl_version == NULL) {
00068 puts("Unable to lookup version of OpenSSL");
00069 exit(1);
00070 }
00071
00072 version = ssl_version(SSLEAY_VERSION);
00073
00074 puts(version);
00075
00076
00077 if (argc > 1) {
00078 int status;
00079 struct dsc$descriptor_s symbol_dsc;
00080 struct dsc$descriptor_s value_dsc;
00081 const unsigned long table_type = LIB$K_CLI_LOCAL_SYM;
00082
00083 symbol_dsc.dsc$a_pointer = argv[2];
00084 symbol_dsc.dsc$w_length = strlen(argv[2]);
00085 symbol_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
00086 symbol_dsc.dsc$b_class = DSC$K_CLASS_S;
00087
00088 value_dsc.dsc$a_pointer = (char *)version;
00089 value_dsc.dsc$w_length = strlen(version);
00090 value_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
00091 value_dsc.dsc$b_class = DSC$K_CLASS_S;
00092
00093 status = LIB$SET_SYMBOL(&symbol_dsc, &value_dsc, &table_type);
00094 if (!$VMS_STATUS_SUCCESS(status)) {
00095 exit(status);
00096 }
00097 }
00098
00099 exit(0);
00100 }