English 中文(简体)
1. 确定“开放式”版本,代之以“失败”
原标题:Determining OpenSSL version with ifdef
  • 时间:2020-09-17 16:31:20
  •  标签:
  • c
  • openssl

I ve written code that under certain circumstances might load X509_STORE into SSL_CTX, and since I don t know if it happens I free the store at the end of the program.

我请X509_STORE_up_ref在将该仓库装入环境中以避免出现参考数字错误,因为SSL_C.2/63/_free 如果该仓库被装入特定环境,该仓库也将予以释放。

然而,我注意到,<代码>X509_STORE_up_ref是新的指挥系统,我的方案未能编纂旧系统。 我在此案中喜欢用开放式特别安全法版本的<代码>#ifdef来总结对这一职能的呼吁。

  1. What is the right way to check OpenSSL s version with an #ifdef?
  2. Am I right to even be in the position I m in, or am I using the store the wrong way?
最佳回答

您可以查阅<代码>,核对开放式特别安全局的号码。 OPENSSL_VERSION_NUMBER XI. The openslv.h file contained following comments on its Value:

/*-
 * Numeric release version identifier:
 * MNNFFPPS: major minor fix patch status
 * The status nibble has one of the values 0 for development, 1 to e for betas
 * 1 to 14, and f for release.  The patch level is exactly that.
 * For example:
 * 0.9.3-dev      0x00903000
 * 0.9.3-beta1    0x00903001
 * 0.9.3-beta2-dev 0x00903002
 * 0.9.3-beta2    0x00903002 (same as ...beta2-dev)
 * 0.9.3          0x0090300f
 * 0.9.3a         0x0090301f
 * 0.9.4          0x0090400f
 * 1.2.3z         0x102031af

因此,如果你具有某种特点,需要1.1.0或以上的开放式特别安全局,那么你会这样做:

#if OPENSSL_VERSION_NUMBER >= 0x10100000L
// code for version 1.1.0 or greater
#else
// code for 1.0.x or lower
#endif
问题回答

缩略语 只有在编辑时,才会告诉你你,你是否正在汇编你的法典,其文本是支持你想要发挥的职能的开放式社会文化基金会。 但是,它不会告诉你,开放式社会运动的双手实际上是否包含这一功能。 因此,你必须确保你实际上使用与你所汇编的SDK匹配的正确二字。 或者,其他情况下,在运行时间,如<代码>Getproc Address(>>上视窗、dlsym(> onlav等,对功能进行动态处理。





相关问题
Fastest method for running a binary search on a file in C?

For example, let s say I want to find a particular word or number in a file. The contents are in sorted order (obviously). Since I want to run a binary search on the file, it seems like a real waste ...

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

Tips for debugging a made-for-linux application on windows?

I m trying to find the source of a bug I have found in an open-source application. I have managed to get a build up and running on my Windows machine, but I m having trouble finding the spot in the ...

Trying to split by two delimiters and it doesn t work - C

I wrote below code to readin line by line from stdin ex. city=Boston;city=New York;city=Chicago and then split each line by ; delimiter and print each record. Then in yet another loop I try to ...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

Encoding, decoding an integer to a char array

Please note that this is not homework and i did search before starting this new thread. I got Store an int in a char array? I was looking for an answer but didn t get any satisfactory answer in the ...

热门标签