FAQ 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703
  1. OpenSSL - Frequently Asked Questions
  2. --------------------------------------
  3. [MISC] Miscellaneous questions
  4. * Which is the current version of OpenSSL?
  5. * Where is the documentation?
  6. * How can I contact the OpenSSL developers?
  7. * Where can I get a compiled version of OpenSSL?
  8. * Why aren't tools like 'autoconf' and 'libtool' used?
  9. * What is an 'engine' version?
  10. * How do I check the authenticity of the OpenSSL distribution?
  11. [LEGAL] Legal questions
  12. * Do I need patent licenses to use OpenSSL?
  13. * Can I use OpenSSL with GPL software?
  14. [USER] Questions on using the OpenSSL applications
  15. * Why do I get a "PRNG not seeded" error message?
  16. * Why do I get an "unable to write 'random state'" error message?
  17. * How do I create certificates or certificate requests?
  18. * Why can't I create certificate requests?
  19. * Why does <SSL program> fail with a certificate verify error?
  20. * Why can I only use weak ciphers when I connect to a server using OpenSSL?
  21. * How can I create DSA certificates?
  22. * Why can't I make an SSL connection using a DSA certificate?
  23. * How can I remove the passphrase on a private key?
  24. * Why can't I use OpenSSL certificates with SSL client authentication?
  25. * Why does my browser give a warning about a mismatched hostname?
  26. * How do I install a CA certificate into a browser?
  27. [BUILD] Questions about building and testing OpenSSL
  28. * Why does the linker complain about undefined symbols?
  29. * Why does the OpenSSL test fail with "bc: command not found"?
  30. * Why does the OpenSSL test fail with "bc: 1 no implemented"?
  31. * Why does the OpenSSL test fail with "bc: stack empty"?
  32. * Why does the OpenSSL compilation fail on Alpha Tru64 Unix?
  33. * Why does the OpenSSL compilation fail with "ar: command not found"?
  34. * Why does the OpenSSL compilation fail on Win32 with VC++?
  35. * What is special about OpenSSL on Redhat?
  36. * Why does the OpenSSL test suite fail on MacOS X?
  37. [PROG] Questions about programming with OpenSSL
  38. * Is OpenSSL thread-safe?
  39. * I've compiled a program under Windows and it crashes: why?
  40. * How do I read or write a DER encoded buffer using the ASN1 functions?
  41. * I've tried using <M_some_evil_pkcs12_macro> and I get errors why?
  42. * I've called <some function> and it fails, why?
  43. * I just get a load of numbers for the error output, what do they mean?
  44. * Why do I get errors about unknown algorithms?
  45. * Why can't the OpenSSH configure script detect OpenSSL?
  46. * Can I use OpenSSL's SSL library with non-blocking I/O?
  47. * Why doesn't my server application receive a client certificate?
  48. ===============================================================================
  49. [MISC] ========================================================================
  50. * Which is the current version of OpenSSL?
  51. The current version is available from <URL: http://www.openssl.org>.
  52. OpenSSL 0.9.7d was released on March 17, 2004.
  53. In addition to the current stable release, you can also access daily
  54. snapshots of the OpenSSL development version at <URL:
  55. ftp://ftp.openssl.org/snapshot/>, or get it by anonymous CVS access.
  56. * Where is the documentation?
  57. OpenSSL is a library that provides cryptographic functionality to
  58. applications such as secure web servers. Be sure to read the
  59. documentation of the application you want to use. The INSTALL file
  60. explains how to install this library.
  61. OpenSSL includes a command line utility that can be used to perform a
  62. variety of cryptographic functions. It is described in the openssl(1)
  63. manpage. Documentation for developers is currently being written. A
  64. few manual pages already are available; overviews over libcrypto and
  65. libssl are given in the crypto(3) and ssl(3) manpages.
  66. The OpenSSL manpages are installed in /usr/local/ssl/man/ (or a
  67. different directory if you specified one as described in INSTALL).
  68. In addition, you can read the most current versions at
  69. <URL: http://www.openssl.org/docs/>.
  70. For information on parts of libcrypto that are not yet documented, you
  71. might want to read Ariel Glenn's documentation on SSLeay 0.9, OpenSSL's
  72. predecessor, at <URL: http://www.columbia.edu/~ariel/ssleay/>. Much
  73. of this still applies to OpenSSL.
  74. There is some documentation about certificate extensions and PKCS#12
  75. in doc/openssl.txt
  76. The original SSLeay documentation is included in OpenSSL as
  77. doc/ssleay.txt. It may be useful when none of the other resources
  78. help, but please note that it reflects the obsolete version SSLeay
  79. 0.6.6.
  80. * How can I contact the OpenSSL developers?
  81. The README file describes how to submit bug reports and patches to
  82. OpenSSL. Information on the OpenSSL mailing lists is available from
  83. <URL: http://www.openssl.org>.
  84. * Where can I get a compiled version of OpenSSL?
  85. You can finder pointers to binary distributions in
  86. http://www.openssl.org/related/binaries.html .
  87. Some applications that use OpenSSL are distributed in binary form.
  88. When using such an application, you don't need to install OpenSSL
  89. yourself; the application will include the required parts (e.g. DLLs).
  90. If you want to build OpenSSL on a Windows system and you don't have
  91. a C compiler, read the "Mingw32" section of INSTALL.W32 for information
  92. on how to obtain and install the free GNU C compiler.
  93. A number of Linux and *BSD distributions include OpenSSL.
  94. * Why aren't tools like 'autoconf' and 'libtool' used?
  95. autoconf will probably be used in future OpenSSL versions. If it was
  96. less Unix-centric, it might have been used much earlier.
  97. * What is an 'engine' version?
  98. With version 0.9.6 OpenSSL was extended to interface to external crypto
  99. hardware. This was realized in a special release '0.9.6-engine'. With
  100. version 0.9.7 (not yet released) the changes were merged into the main
  101. development line, so that the special release is no longer necessary.
  102. * How do I check the authenticity of the OpenSSL distribution?
  103. We provide MD5 digests and ASC signatures of each tarball.
  104. Use MD5 to check that a tarball from a mirror site is identical:
  105. md5sum TARBALL | awk '{print $1;}' | cmp - TARBALL.md5
  106. You can check authenticity using pgp or gpg. You need the OpenSSL team
  107. member public key used to sign it (download it from a key server). Then
  108. just do:
  109. pgp TARBALL.asc
  110. [LEGAL] =======================================================================
  111. * Do I need patent licenses to use OpenSSL?
  112. The patents section of the README file lists patents that may apply to
  113. you if you want to use OpenSSL. For information on intellectual
  114. property rights, please consult a lawyer. The OpenSSL team does not
  115. offer legal advice.
  116. You can configure OpenSSL so as not to use RC5 and IDEA by using
  117. ./config no-rc5 no-idea
  118. * Can I use OpenSSL with GPL software?
  119. On many systems including the major Linux and BSD distributions, yes (the
  120. GPL does not place restrictions on using libraries that are part of the
  121. normal operating system distribution).
  122. On other systems, the situation is less clear. Some GPL software copyright
  123. holders claim that you infringe on their rights if you use OpenSSL with
  124. their software on operating systems that don't normally include OpenSSL.
  125. If you develop open source software that uses OpenSSL, you may find it
  126. useful to choose an other license than the GPL, or state explicitly that
  127. "This program is released under the GPL with the additional exemption that
  128. compiling, linking, and/or using OpenSSL is allowed." If you are using
  129. GPL software developed by others, you may want to ask the copyright holder
  130. for permission to use their software with OpenSSL.
  131. [USER] ========================================================================
  132. * Why do I get a "PRNG not seeded" error message?
  133. Cryptographic software needs a source of unpredictable data to work
  134. correctly. Many open source operating systems provide a "randomness
  135. device" (/dev/urandom or /dev/random) that serves this purpose.
  136. All OpenSSL versions try to use /dev/urandom by default; starting with
  137. version 0.9.7, OpenSSL also tries /dev/random if /dev/urandom is not
  138. available.
  139. On other systems, applications have to call the RAND_add() or
  140. RAND_seed() function with appropriate data before generating keys or
  141. performing public key encryption. (These functions initialize the
  142. pseudo-random number generator, PRNG.) Some broken applications do
  143. not do this. As of version 0.9.5, the OpenSSL functions that need
  144. randomness report an error if the random number generator has not been
  145. seeded with at least 128 bits of randomness. If this error occurs and
  146. is not discussed in the documentation of the application you are
  147. using, please contact the author of that application; it is likely
  148. that it never worked correctly. OpenSSL 0.9.5 and later make the
  149. error visible by refusing to perform potentially insecure encryption.
  150. If you are using Solaris 8, you can add /dev/urandom and /dev/random
  151. devices by installing patch 112438 (Sparc) or 112439 (x86), which are
  152. available via the Patchfinder at <URL: http://sunsolve.sun.com>
  153. (Solaris 9 includes these devices by default). For /dev/random support
  154. for earlier Solaris versions, see Sun's statement at
  155. <URL: http://sunsolve.sun.com/pub-cgi/retrieve.pl?doc=fsrdb/27606&zone_32=SUNWski>
  156. (the SUNWski package is available in patch 105710).
  157. On systems without /dev/urandom and /dev/random, it is a good idea to
  158. use the Entropy Gathering Demon (EGD); see the RAND_egd() manpage for
  159. details. Starting with version 0.9.7, OpenSSL will automatically look
  160. for an EGD socket at /var/run/egd-pool, /dev/egd-pool, /etc/egd-pool and
  161. /etc/entropy.
  162. Most components of the openssl command line utility automatically try
  163. to seed the random number generator from a file. The name of the
  164. default seeding file is determined as follows: If environment variable
  165. RANDFILE is set, then it names the seeding file. Otherwise if
  166. environment variable HOME is set, then the seeding file is $HOME/.rnd.
  167. If neither RANDFILE nor HOME is set, versions up to OpenSSL 0.9.6 will
  168. use file .rnd in the current directory while OpenSSL 0.9.6a uses no
  169. default seeding file at all. OpenSSL 0.9.6b and later will behave
  170. similarly to 0.9.6a, but will use a default of "C:\" for HOME on
  171. Windows systems if the environment variable has not been set.
  172. If the default seeding file does not exist or is too short, the "PRNG
  173. not seeded" error message may occur.
  174. The openssl command line utility will write back a new state to the
  175. default seeding file (and create this file if necessary) unless
  176. there was no sufficient seeding.
  177. Pointing $RANDFILE to an Entropy Gathering Daemon socket does not work.
  178. Use the "-rand" option of the OpenSSL command line tools instead.
  179. The $RANDFILE environment variable and $HOME/.rnd are only used by the
  180. OpenSSL command line tools. Applications using the OpenSSL library
  181. provide their own configuration options to specify the entropy source,
  182. please check out the documentation coming the with application.
  183. * Why do I get an "unable to write 'random state'" error message?
  184. Sometimes the openssl command line utility does not abort with
  185. a "PRNG not seeded" error message, but complains that it is
  186. "unable to write 'random state'". This message refers to the
  187. default seeding file (see previous answer). A possible reason
  188. is that no default filename is known because neither RANDFILE
  189. nor HOME is set. (Versions up to 0.9.6 used file ".rnd" in the
  190. current directory in this case, but this has changed with 0.9.6a.)
  191. * How do I create certificates or certificate requests?
  192. Check out the CA.pl(1) manual page. This provides a simple wrapper round
  193. the 'req', 'verify', 'ca' and 'pkcs12' utilities. For finer control check
  194. out the manual pages for the individual utilities and the certificate
  195. extensions documentation (currently in doc/openssl.txt).
  196. * Why can't I create certificate requests?
  197. You typically get the error:
  198. unable to find 'distinguished_name' in config
  199. problems making Certificate Request
  200. This is because it can't find the configuration file. Check out the
  201. DIAGNOSTICS section of req(1) for more information.
  202. * Why does <SSL program> fail with a certificate verify error?
  203. This problem is usually indicated by log messages saying something like
  204. "unable to get local issuer certificate" or "self signed certificate".
  205. When a certificate is verified its root CA must be "trusted" by OpenSSL
  206. this typically means that the CA certificate must be placed in a directory
  207. or file and the relevant program configured to read it. The OpenSSL program
  208. 'verify' behaves in a similar way and issues similar error messages: check
  209. the verify(1) program manual page for more information.
  210. * Why can I only use weak ciphers when I connect to a server using OpenSSL?
  211. This is almost certainly because you are using an old "export grade" browser
  212. which only supports weak encryption. Upgrade your browser to support 128 bit
  213. ciphers.
  214. * How can I create DSA certificates?
  215. Check the CA.pl(1) manual page for a DSA certificate example.
  216. * Why can't I make an SSL connection to a server using a DSA certificate?
  217. Typically you'll see a message saying there are no shared ciphers when
  218. the same setup works fine with an RSA certificate. There are two possible
  219. causes. The client may not support connections to DSA servers most web
  220. browsers (including Netscape and MSIE) only support connections to servers
  221. supporting RSA cipher suites. The other cause is that a set of DH parameters
  222. has not been supplied to the server. DH parameters can be created with the
  223. dhparam(1) command and loaded using the SSL_CTX_set_tmp_dh() for example:
  224. check the source to s_server in apps/s_server.c for an example.
  225. * How can I remove the passphrase on a private key?
  226. Firstly you should be really *really* sure you want to do this. Leaving
  227. a private key unencrypted is a major security risk. If you decide that
  228. you do have to do this check the EXAMPLES sections of the rsa(1) and
  229. dsa(1) manual pages.
  230. * Why can't I use OpenSSL certificates with SSL client authentication?
  231. What will typically happen is that when a server requests authentication
  232. it will either not include your certificate or tell you that you have
  233. no client certificates (Netscape) or present you with an empty list box
  234. (MSIE). The reason for this is that when a server requests a client
  235. certificate it includes a list of CAs names which it will accept. Browsers
  236. will only let you select certificates from the list on the grounds that
  237. there is little point presenting a certificate which the server will
  238. reject.
  239. The solution is to add the relevant CA certificate to your servers "trusted
  240. CA list". How you do this depends on the server software in uses. You can
  241. print out the servers list of acceptable CAs using the OpenSSL s_client tool:
  242. openssl s_client -connect www.some.host:443 -prexit
  243. If your server only requests certificates on certain URLs then you may need
  244. to manually issue an HTTP GET command to get the list when s_client connects:
  245. GET /some/page/needing/a/certificate.html
  246. If your CA does not appear in the list then this confirms the problem.
  247. * Why does my browser give a warning about a mismatched hostname?
  248. Browsers expect the server's hostname to match the value in the commonName
  249. (CN) field of the certificate. If it does not then you get a warning.
  250. * How do I install a CA certificate into a browser?
  251. The usual way is to send the DER encoded certificate to the browser as
  252. MIME type application/x-x509-ca-cert, for example by clicking on an appropriate
  253. link. On MSIE certain extensions such as .der or .cacert may also work, or you
  254. can import the certificate using the certificate import wizard.
  255. You can convert a certificate to DER form using the command:
  256. openssl x509 -in ca.pem -outform DER -out ca.der
  257. Occasionally someone suggests using a command such as:
  258. openssl pkcs12 -export -out cacert.p12 -in cacert.pem -inkey cakey.pem
  259. DO NOT DO THIS! This command will give away your CAs private key and
  260. reduces its security to zero: allowing anyone to forge certificates in
  261. whatever name they choose.
  262. [BUILD] =======================================================================
  263. * Why does the linker complain about undefined symbols?
  264. Maybe the compilation was interrupted, and make doesn't notice that
  265. something is missing. Run "make clean; make".
  266. If you used ./Configure instead of ./config, make sure that you
  267. selected the right target. File formats may differ slightly between
  268. OS versions (for example sparcv8/sparcv9, or a.out/elf).
  269. In case you get errors about the following symbols, use the config
  270. option "no-asm", as described in INSTALL:
  271. BF_cbc_encrypt, BF_decrypt, BF_encrypt, CAST_cbc_encrypt,
  272. CAST_decrypt, CAST_encrypt, RC4, RC5_32_cbc_encrypt, RC5_32_decrypt,
  273. RC5_32_encrypt, bn_add_words, bn_div_words, bn_mul_add_words,
  274. bn_mul_comba4, bn_mul_comba8, bn_mul_words, bn_sqr_comba4,
  275. bn_sqr_comba8, bn_sqr_words, bn_sub_words, des_decrypt3,
  276. des_ede3_cbc_encrypt, des_encrypt, des_encrypt2, des_encrypt3,
  277. des_ncbc_encrypt, md5_block_asm_host_order, sha1_block_asm_data_order
  278. If none of these helps, you may want to try using the current snapshot.
  279. If the problem persists, please submit a bug report.
  280. * Why does the OpenSSL test fail with "bc: command not found"?
  281. You didn't install "bc", the Unix calculator. If you want to run the
  282. tests, get GNU bc from ftp://ftp.gnu.org or from your OS distributor.
  283. * Why does the OpenSSL test fail with "bc: 1 no implemented"?
  284. On some SCO installations or versions, bc has a bug that gets triggered
  285. when you run the test suite (using "make test"). The message returned is
  286. "bc: 1 not implemented".
  287. The best way to deal with this is to find another implementation of bc
  288. and compile/install it. GNU bc (see http://www.gnu.org/software/software.html
  289. for download instructions) can be safely used, for example.
  290. * Why does the OpenSSL test fail with "bc: stack empty"?
  291. On some DG/ux versions, bc seems to have a too small stack for calculations
  292. that the OpenSSL bntest throws at it. This gets triggered when you run the
  293. test suite (using "make test"). The message returned is "bc: stack empty".
  294. The best way to deal with this is to find another implementation of bc
  295. and compile/install it. GNU bc (see http://www.gnu.org/software/software.html
  296. for download instructions) can be safely used, for example.
  297. * Why does the OpenSSL compilation fail on Alpha Tru64 Unix?
  298. On some Alpha installations running Tru64 Unix and Compaq C, the compilation
  299. of crypto/sha/sha_dgst.c fails with the message 'Fatal: Insufficient virtual
  300. memory to continue compilation.' As far as the tests have shown, this may be
  301. a compiler bug. What happens is that it eats up a lot of resident memory
  302. to build something, probably a table. The problem is clearly in the
  303. optimization code, because if one eliminates optimization completely (-O0),
  304. the compilation goes through (and the compiler consumes about 2MB of resident
  305. memory instead of 240MB or whatever one's limit is currently).
  306. There are three options to solve this problem:
  307. 1. set your current data segment size soft limit higher. Experience shows
  308. that about 241000 kbytes seems to be enough on an AlphaServer DS10. You do
  309. this with the command 'ulimit -Sd nnnnnn', where 'nnnnnn' is the number of
  310. kbytes to set the limit to.
  311. 2. If you have a hard limit that is lower than what you need and you can't
  312. get it changed, you can compile all of OpenSSL with -O0 as optimization
  313. level. This is however not a very nice thing to do for those who expect to
  314. get the best result from OpenSSL. A bit more complicated solution is the
  315. following:
  316. ----- snip:start -----
  317. make DIRS=crypto SDIRS=sha "`grep '^CFLAG=' Makefile.ssl | \
  318. sed -e 's/ -O[0-9] / -O0 /'`"
  319. rm `ls crypto/*.o crypto/sha/*.o | grep -v 'sha_dgst\.o'`
  320. make
  321. ----- snip:end -----
  322. This will only compile sha_dgst.c with -O0, the rest with the optimization
  323. level chosen by the configuration process. When the above is done, do the
  324. test and installation and you're set.
  325. * Why does the OpenSSL compilation fail with "ar: command not found"?
  326. Getting this message is quite usual on Solaris 2, because Sun has hidden
  327. away 'ar' and other development commands in directories that aren't in
  328. $PATH by default. One of those directories is '/usr/ccs/bin'. The
  329. quickest way to fix this is to do the following (it assumes you use sh
  330. or any sh-compatible shell):
  331. ----- snip:start -----
  332. PATH=${PATH}:/usr/ccs/bin; export PATH
  333. ----- snip:end -----
  334. and then redo the compilation. What you should really do is make sure
  335. '/usr/ccs/bin' is permanently in your $PATH, for example through your
  336. '.profile' (again, assuming you use a sh-compatible shell).
  337. * Why does the OpenSSL compilation fail on Win32 with VC++?
  338. Sometimes, you may get reports from VC++ command line (cl) that it
  339. can't find standard include files like stdio.h and other weirdnesses.
  340. One possible cause is that the environment isn't correctly set up.
  341. To solve that problem, one should run VCVARS32.BAT which is found in
  342. the 'bin' subdirectory of the VC++ installation directory (somewhere
  343. under 'Program Files'). This needs to be done prior to running NMAKE,
  344. and the changes are only valid for the current DOS session.
  345. * What is special about OpenSSL on Redhat?
  346. Red Hat Linux (release 7.0 and later) include a preinstalled limited
  347. version of OpenSSL. For patent reasons, support for IDEA, RC5 and MDC2
  348. is disabled in this version. The same may apply to other Linux distributions.
  349. Users may therefore wish to install more or all of the features left out.
  350. To do this you MUST ensure that you do not overwrite the openssl that is in
  351. /usr/bin on your Red Hat machine. Several packages depend on this file,
  352. including sendmail and ssh. /usr/local/bin is a good alternative choice. The
  353. libraries that come with Red Hat 7.0 onwards have different names and so are
  354. not affected. (eg For Red Hat 7.2 they are /lib/libssl.so.0.9.6b and
  355. /lib/libcrypto.so.0.9.6b with symlinks /lib/libssl.so.2 and
  356. /lib/libcrypto.so.2 respectively).
  357. Please note that we have been advised by Red Hat attempting to recompile the
  358. openssl rpm with all the cryptography enabled will not work. All other
  359. packages depend on the original Red Hat supplied openssl package. It is also
  360. worth noting that due to the way Red Hat supplies its packages, updates to
  361. openssl on each distribution never change the package version, only the
  362. build number. For example, on Red Hat 7.1, the latest openssl package has
  363. version number 0.9.6 and build number 9 even though it contains all the
  364. relevant updates in packages up to and including 0.9.6b.
  365. A possible way around this is to persuade Red Hat to produce a non-US
  366. version of Red Hat Linux.
  367. FYI: Patent numbers and expiry dates of US patents:
  368. MDC-2: 4,908,861 13/03/2007
  369. IDEA: 5,214,703 25/05/2010
  370. RC5: 5,724,428 03/03/2015
  371. * Why does the OpenSSL test suite fail on MacOS X?
  372. If the failure happens when running 'make test' and the RC4 test fails,
  373. it's very probable that you have OpenSSL 0.9.6b delivered with the
  374. operating system (you can find out by running '/usr/bin/openssl version')
  375. and that you were trying to build OpenSSL 0.9.6d. The problem is that
  376. the loader ('ld') in MacOS X has a misfeature that's quite difficult to
  377. go around and has linked the programs "openssl" and the test programs
  378. with /usr/lib/libcrypto.dylib and /usr/lib/libssl.dylib instead of the
  379. libraries you just built.
  380. Look in the file PROBLEMS for a more detailed explanation and for possible
  381. solutions.
  382. [PROG] ========================================================================
  383. * Is OpenSSL thread-safe?
  384. Yes (with limitations: an SSL connection may not concurrently be used
  385. by multiple threads). On Windows and many Unix systems, OpenSSL
  386. automatically uses the multi-threaded versions of the standard
  387. libraries. If your platform is not one of these, consult the INSTALL
  388. file.
  389. Multi-threaded applications must provide two callback functions to
  390. OpenSSL. This is described in the threads(3) manpage.
  391. * I've compiled a program under Windows and it crashes: why?
  392. This is usually because you've missed the comment in INSTALL.W32.
  393. Your application must link against the same version of the Win32
  394. C-Runtime against which your openssl libraries were linked. The
  395. default version for OpenSSL is /MD - "Multithreaded DLL".
  396. If you are using Microsoft Visual C++'s IDE (Visual Studio), in
  397. many cases, your new project most likely defaulted to "Debug
  398. Singlethreaded" - /ML. This is NOT interchangeable with /MD and your
  399. program will crash, typically on the first BIO related read or write
  400. operation.
  401. For each of the six possible link stage configurations within Win32,
  402. your application must link against the same by which OpenSSL was
  403. built. If you are using MS Visual C++ (Studio) this can be changed
  404. by:
  405. 1. Select Settings... from the Project Menu.
  406. 2. Select the C/C++ Tab.
  407. 3. Select "Code Generation from the "Category" drop down list box
  408. 4. Select the Appropriate library (see table below) from the "Use
  409. run-time library" drop down list box. Perform this step for both
  410. your debug and release versions of your application (look at the
  411. top left of the settings panel to change between the two)
  412. Single Threaded /ML - MS VC++ often defaults to
  413. this for the release
  414. version of a new project.
  415. Debug Single Threaded /MLd - MS VC++ often defaults to
  416. this for the debug version
  417. of a new project.
  418. Multithreaded /MT
  419. Debug Multithreaded /MTd
  420. Multithreaded DLL /MD - OpenSSL defaults to this.
  421. Debug Multithreaded DLL /MDd
  422. Note that debug and release libraries are NOT interchangeable. If you
  423. built OpenSSL with /MD your application must use /MD and cannot use /MDd.
  424. * How do I read or write a DER encoded buffer using the ASN1 functions?
  425. You have two options. You can either use a memory BIO in conjunction
  426. with the i2d_XXX_bio() or d2i_XXX_bio() functions or you can use the
  427. i2d_XXX(), d2i_XXX() functions directly. Since these are often the
  428. cause of grief here are some code fragments using PKCS7 as an example:
  429. unsigned char *buf, *p;
  430. int len;
  431. len = i2d_PKCS7(p7, NULL);
  432. buf = OPENSSL_malloc(len); /* or Malloc, error checking omitted */
  433. p = buf;
  434. i2d_PKCS7(p7, &p);
  435. At this point buf contains the len bytes of the DER encoding of
  436. p7.
  437. The opposite assumes we already have len bytes in buf:
  438. unsigned char *p;
  439. p = buf;
  440. p7 = d2i_PKCS7(NULL, &p, len);
  441. At this point p7 contains a valid PKCS7 structure of NULL if an error
  442. occurred. If an error occurred ERR_print_errors(bio) should give more
  443. information.
  444. The reason for the temporary variable 'p' is that the ASN1 functions
  445. increment the passed pointer so it is ready to read or write the next
  446. structure. This is often a cause of problems: without the temporary
  447. variable the buffer pointer is changed to point just after the data
  448. that has been read or written. This may well be uninitialized data
  449. and attempts to free the buffer will have unpredictable results
  450. because it no longer points to the same address.
  451. * I've tried using <M_some_evil_pkcs12_macro> and I get errors why?
  452. This usually happens when you try compiling something using the PKCS#12
  453. macros with a C++ compiler. There is hardly ever any need to use the
  454. PKCS#12 macros in a program, it is much easier to parse and create
  455. PKCS#12 files using the PKCS12_parse() and PKCS12_create() functions
  456. documented in doc/openssl.txt and with examples in demos/pkcs12. The
  457. 'pkcs12' application has to use the macros because it prints out
  458. debugging information.
  459. * I've called <some function> and it fails, why?
  460. Before submitting a report or asking in one of the mailing lists, you
  461. should try to determine the cause. In particular, you should call
  462. ERR_print_errors() or ERR_print_errors_fp() after the failed call
  463. and see if the message helps. Note that the problem may occur earlier
  464. than you think -- you should check for errors after every call where
  465. it is possible, otherwise the actual problem may be hidden because
  466. some OpenSSL functions clear the error state.
  467. * I just get a load of numbers for the error output, what do they mean?
  468. The actual format is described in the ERR_print_errors() manual page.
  469. You should call the function ERR_load_crypto_strings() before hand and
  470. the message will be output in text form. If you can't do this (for example
  471. it is a pre-compiled binary) you can use the errstr utility on the error
  472. code itself (the hex digits after the second colon).
  473. * Why do I get errors about unknown algorithms?
  474. This can happen under several circumstances such as reading in an
  475. encrypted private key or attempting to decrypt a PKCS#12 file. The cause
  476. is forgetting to load OpenSSL's table of algorithms with
  477. OpenSSL_add_all_algorithms(). See the manual page for more information.
  478. * Why can't the OpenSSH configure script detect OpenSSL?
  479. Several reasons for problems with the automatic detection exist.
  480. OpenSSH requires at least version 0.9.5a of the OpenSSL libraries.
  481. Sometimes the distribution has installed an older version in the system
  482. locations that is detected instead of a new one installed. The OpenSSL
  483. library might have been compiled for another CPU or another mode (32/64 bits).
  484. Permissions might be wrong.
  485. The general answer is to check the config.log file generated when running
  486. the OpenSSH configure script. It should contain the detailed information
  487. on why the OpenSSL library was not detected or considered incompatible.
  488. * Can I use OpenSSL's SSL library with non-blocking I/O?
  489. Yes; make sure to read the SSL_get_error(3) manual page!
  490. A pitfall to avoid: Don't assume that SSL_read() will just read from
  491. the underlying transport or that SSL_write() will just write to it --
  492. it is also possible that SSL_write() cannot do any useful work until
  493. there is data to read, or that SSL_read() cannot do anything until it
  494. is possible to send data. One reason for this is that the peer may
  495. request a new TLS/SSL handshake at any time during the protocol,
  496. requiring a bi-directional message exchange; both SSL_read() and
  497. SSL_write() will try to continue any pending handshake.
  498. * Why doesn't my server application receive a client certificate?
  499. Due to the TLS protocol definition, a client will only send a certificate,
  500. if explicitly asked by the server. Use the SSL_VERIFY_PEER flag of the
  501. SSL_CTX_set_verify() function to enable the use of client certificates.
  502. ===============================================================================