FAQ 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898
  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. * Why is OpenSSL x509 DN output not conformant to RFC2253?
  28. * What is a "128 bit certificate"? Can I create one with OpenSSL?
  29. [BUILD] Questions about building and testing OpenSSL
  30. * Why does the linker complain about undefined symbols?
  31. * Why does the OpenSSL test fail with "bc: command not found"?
  32. * Why does the OpenSSL test fail with "bc: 1 no implemented"?
  33. * Why does the OpenSSL test fail with "bc: stack empty"?
  34. * Why does the OpenSSL compilation fail on Alpha Tru64 Unix?
  35. * Why does the OpenSSL compilation fail with "ar: command not found"?
  36. * Why does the OpenSSL compilation fail on Win32 with VC++?
  37. * What is special about OpenSSL on Redhat?
  38. * Why does the OpenSSL compilation fail on MacOS X?
  39. * Why does the OpenSSL test suite fail on MacOS X?
  40. * Why does the OpenSSL test suite fail in BN_sqr test [on a 64-bit platform]?
  41. * Why does OpenBSD-i386 build fail on des-586.s with "Unimplemented segment type"?
  42. * Why does the OpenSSL test suite fail in sha512t on x86 CPU?
  43. * Why does compiler fail to compile sha512.c?
  44. * Test suite still fails, what to do?
  45. [PROG] Questions about programming with OpenSSL
  46. * Is OpenSSL thread-safe?
  47. * I've compiled a program under Windows and it crashes: why?
  48. * How do I read or write a DER encoded buffer using the ASN1 functions?
  49. * OpenSSL uses DER but I need BER format: does OpenSSL support BER?
  50. * I've tried using <M_some_evil_pkcs12_macro> and I get errors why?
  51. * I've called <some function> and it fails, why?
  52. * I just get a load of numbers for the error output, what do they mean?
  53. * Why do I get errors about unknown algorithms?
  54. * Why can't the OpenSSH configure script detect OpenSSL?
  55. * Can I use OpenSSL's SSL library with non-blocking I/O?
  56. * Why doesn't my server application receive a client certificate?
  57. * Why does compilation fail due to an undefined symbol NID_uniqueIdentifier?
  58. * I think I've detected a memory leak, is this a bug?
  59. ===============================================================================
  60. [MISC] ========================================================================
  61. * Which is the current version of OpenSSL?
  62. The current version is available from <URL: http://www.openssl.org>.
  63. OpenSSL 0.9.8e was released on February 23rd, 2007.
  64. In addition to the current stable release, you can also access daily
  65. snapshots of the OpenSSL development version at <URL:
  66. ftp://ftp.openssl.org/snapshot/>, or get it by anonymous CVS access.
  67. * Where is the documentation?
  68. OpenSSL is a library that provides cryptographic functionality to
  69. applications such as secure web servers. Be sure to read the
  70. documentation of the application you want to use. The INSTALL file
  71. explains how to install this library.
  72. OpenSSL includes a command line utility that can be used to perform a
  73. variety of cryptographic functions. It is described in the openssl(1)
  74. manpage. Documentation for developers is currently being written. A
  75. few manual pages already are available; overviews over libcrypto and
  76. libssl are given in the crypto(3) and ssl(3) manpages.
  77. The OpenSSL manpages are installed in /usr/local/ssl/man/ (or a
  78. different directory if you specified one as described in INSTALL).
  79. In addition, you can read the most current versions at
  80. <URL: http://www.openssl.org/docs/>.
  81. For information on parts of libcrypto that are not yet documented, you
  82. might want to read Ariel Glenn's documentation on SSLeay 0.9, OpenSSL's
  83. predecessor, at <URL: http://www.columbia.edu/~ariel/ssleay/>. Much
  84. of this still applies to OpenSSL.
  85. There is some documentation about certificate extensions and PKCS#12
  86. in doc/openssl.txt
  87. The original SSLeay documentation is included in OpenSSL as
  88. doc/ssleay.txt. It may be useful when none of the other resources
  89. help, but please note that it reflects the obsolete version SSLeay
  90. 0.6.6.
  91. * How can I contact the OpenSSL developers?
  92. The README file describes how to submit bug reports and patches to
  93. OpenSSL. Information on the OpenSSL mailing lists is available from
  94. <URL: http://www.openssl.org>.
  95. * Where can I get a compiled version of OpenSSL?
  96. You can finder pointers to binary distributions in
  97. http://www.openssl.org/related/binaries.html .
  98. Some applications that use OpenSSL are distributed in binary form.
  99. When using such an application, you don't need to install OpenSSL
  100. yourself; the application will include the required parts (e.g. DLLs).
  101. If you want to build OpenSSL on a Windows system and you don't have
  102. a C compiler, read the "Mingw32" section of INSTALL.W32 for information
  103. on how to obtain and install the free GNU C compiler.
  104. A number of Linux and *BSD distributions include OpenSSL.
  105. * Why aren't tools like 'autoconf' and 'libtool' used?
  106. autoconf will probably be used in future OpenSSL versions. If it was
  107. less Unix-centric, it might have been used much earlier.
  108. * What is an 'engine' version?
  109. With version 0.9.6 OpenSSL was extended to interface to external crypto
  110. hardware. This was realized in a special release '0.9.6-engine'. With
  111. version 0.9.7 the changes were merged into the main development line,
  112. so that the special release is no longer necessary.
  113. * How do I check the authenticity of the OpenSSL distribution?
  114. We provide MD5 digests and ASC signatures of each tarball.
  115. Use MD5 to check that a tarball from a mirror site is identical:
  116. md5sum TARBALL | awk '{print $1;}' | cmp - TARBALL.md5
  117. You can check authenticity using pgp or gpg. You need the OpenSSL team
  118. member public key used to sign it (download it from a key server, see a
  119. list of keys at <URL: http://www.openssl.org/about/>). Then
  120. just do:
  121. pgp TARBALL.asc
  122. [LEGAL] =======================================================================
  123. * Do I need patent licenses to use OpenSSL?
  124. The patents section of the README file lists patents that may apply to
  125. you if you want to use OpenSSL. For information on intellectual
  126. property rights, please consult a lawyer. The OpenSSL team does not
  127. offer legal advice.
  128. You can configure OpenSSL so as not to use IDEA, MDC2 and RC5 by using
  129. ./config no-idea no-mdc2 no-rc5
  130. * Can I use OpenSSL with GPL software?
  131. On many systems including the major Linux and BSD distributions, yes (the
  132. GPL does not place restrictions on using libraries that are part of the
  133. normal operating system distribution).
  134. On other systems, the situation is less clear. Some GPL software copyright
  135. holders claim that you infringe on their rights if you use OpenSSL with
  136. their software on operating systems that don't normally include OpenSSL.
  137. If you develop open source software that uses OpenSSL, you may find it
  138. useful to choose an other license than the GPL, or state explicitly that
  139. "This program is released under the GPL with the additional exemption that
  140. compiling, linking, and/or using OpenSSL is allowed." If you are using
  141. GPL software developed by others, you may want to ask the copyright holder
  142. for permission to use their software with OpenSSL.
  143. [USER] ========================================================================
  144. * Why do I get a "PRNG not seeded" error message?
  145. Cryptographic software needs a source of unpredictable data to work
  146. correctly. Many open source operating systems provide a "randomness
  147. device" (/dev/urandom or /dev/random) that serves this purpose.
  148. All OpenSSL versions try to use /dev/urandom by default; starting with
  149. version 0.9.7, OpenSSL also tries /dev/random if /dev/urandom is not
  150. available.
  151. On other systems, applications have to call the RAND_add() or
  152. RAND_seed() function with appropriate data before generating keys or
  153. performing public key encryption. (These functions initialize the
  154. pseudo-random number generator, PRNG.) Some broken applications do
  155. not do this. As of version 0.9.5, the OpenSSL functions that need
  156. randomness report an error if the random number generator has not been
  157. seeded with at least 128 bits of randomness. If this error occurs and
  158. is not discussed in the documentation of the application you are
  159. using, please contact the author of that application; it is likely
  160. that it never worked correctly. OpenSSL 0.9.5 and later make the
  161. error visible by refusing to perform potentially insecure encryption.
  162. If you are using Solaris 8, you can add /dev/urandom and /dev/random
  163. devices by installing patch 112438 (Sparc) or 112439 (x86), which are
  164. available via the Patchfinder at <URL: http://sunsolve.sun.com>
  165. (Solaris 9 includes these devices by default). For /dev/random support
  166. for earlier Solaris versions, see Sun's statement at
  167. <URL: http://sunsolve.sun.com/pub-cgi/retrieve.pl?doc=fsrdb/27606&zone_32=SUNWski>
  168. (the SUNWski package is available in patch 105710).
  169. On systems without /dev/urandom and /dev/random, it is a good idea to
  170. use the Entropy Gathering Demon (EGD); see the RAND_egd() manpage for
  171. details. Starting with version 0.9.7, OpenSSL will automatically look
  172. for an EGD socket at /var/run/egd-pool, /dev/egd-pool, /etc/egd-pool and
  173. /etc/entropy.
  174. Most components of the openssl command line utility automatically try
  175. to seed the random number generator from a file. The name of the
  176. default seeding file is determined as follows: If environment variable
  177. RANDFILE is set, then it names the seeding file. Otherwise if
  178. environment variable HOME is set, then the seeding file is $HOME/.rnd.
  179. If neither RANDFILE nor HOME is set, versions up to OpenSSL 0.9.6 will
  180. use file .rnd in the current directory while OpenSSL 0.9.6a uses no
  181. default seeding file at all. OpenSSL 0.9.6b and later will behave
  182. similarly to 0.9.6a, but will use a default of "C:\" for HOME on
  183. Windows systems if the environment variable has not been set.
  184. If the default seeding file does not exist or is too short, the "PRNG
  185. not seeded" error message may occur.
  186. The openssl command line utility will write back a new state to the
  187. default seeding file (and create this file if necessary) unless
  188. there was no sufficient seeding.
  189. Pointing $RANDFILE to an Entropy Gathering Daemon socket does not work.
  190. Use the "-rand" option of the OpenSSL command line tools instead.
  191. The $RANDFILE environment variable and $HOME/.rnd are only used by the
  192. OpenSSL command line tools. Applications using the OpenSSL library
  193. provide their own configuration options to specify the entropy source,
  194. please check out the documentation coming the with application.
  195. * Why do I get an "unable to write 'random state'" error message?
  196. Sometimes the openssl command line utility does not abort with
  197. a "PRNG not seeded" error message, but complains that it is
  198. "unable to write 'random state'". This message refers to the
  199. default seeding file (see previous answer). A possible reason
  200. is that no default filename is known because neither RANDFILE
  201. nor HOME is set. (Versions up to 0.9.6 used file ".rnd" in the
  202. current directory in this case, but this has changed with 0.9.6a.)
  203. * How do I create certificates or certificate requests?
  204. Check out the CA.pl(1) manual page. This provides a simple wrapper round
  205. the 'req', 'verify', 'ca' and 'pkcs12' utilities. For finer control check
  206. out the manual pages for the individual utilities and the certificate
  207. extensions documentation (currently in doc/openssl.txt).
  208. * Why can't I create certificate requests?
  209. You typically get the error:
  210. unable to find 'distinguished_name' in config
  211. problems making Certificate Request
  212. This is because it can't find the configuration file. Check out the
  213. DIAGNOSTICS section of req(1) for more information.
  214. * Why does <SSL program> fail with a certificate verify error?
  215. This problem is usually indicated by log messages saying something like
  216. "unable to get local issuer certificate" or "self signed certificate".
  217. When a certificate is verified its root CA must be "trusted" by OpenSSL
  218. this typically means that the CA certificate must be placed in a directory
  219. or file and the relevant program configured to read it. The OpenSSL program
  220. 'verify' behaves in a similar way and issues similar error messages: check
  221. the verify(1) program manual page for more information.
  222. * Why can I only use weak ciphers when I connect to a server using OpenSSL?
  223. This is almost certainly because you are using an old "export grade" browser
  224. which only supports weak encryption. Upgrade your browser to support 128 bit
  225. ciphers.
  226. * How can I create DSA certificates?
  227. Check the CA.pl(1) manual page for a DSA certificate example.
  228. * Why can't I make an SSL connection to a server using a DSA certificate?
  229. Typically you'll see a message saying there are no shared ciphers when
  230. the same setup works fine with an RSA certificate. There are two possible
  231. causes. The client may not support connections to DSA servers most web
  232. browsers (including Netscape and MSIE) only support connections to servers
  233. supporting RSA cipher suites. The other cause is that a set of DH parameters
  234. has not been supplied to the server. DH parameters can be created with the
  235. dhparam(1) command and loaded using the SSL_CTX_set_tmp_dh() for example:
  236. check the source to s_server in apps/s_server.c for an example.
  237. * How can I remove the passphrase on a private key?
  238. Firstly you should be really *really* sure you want to do this. Leaving
  239. a private key unencrypted is a major security risk. If you decide that
  240. you do have to do this check the EXAMPLES sections of the rsa(1) and
  241. dsa(1) manual pages.
  242. * Why can't I use OpenSSL certificates with SSL client authentication?
  243. What will typically happen is that when a server requests authentication
  244. it will either not include your certificate or tell you that you have
  245. no client certificates (Netscape) or present you with an empty list box
  246. (MSIE). The reason for this is that when a server requests a client
  247. certificate it includes a list of CAs names which it will accept. Browsers
  248. will only let you select certificates from the list on the grounds that
  249. there is little point presenting a certificate which the server will
  250. reject.
  251. The solution is to add the relevant CA certificate to your servers "trusted
  252. CA list". How you do this depends on the server software in uses. You can
  253. print out the servers list of acceptable CAs using the OpenSSL s_client tool:
  254. openssl s_client -connect www.some.host:443 -prexit
  255. If your server only requests certificates on certain URLs then you may need
  256. to manually issue an HTTP GET command to get the list when s_client connects:
  257. GET /some/page/needing/a/certificate.html
  258. If your CA does not appear in the list then this confirms the problem.
  259. * Why does my browser give a warning about a mismatched hostname?
  260. Browsers expect the server's hostname to match the value in the commonName
  261. (CN) field of the certificate. If it does not then you get a warning.
  262. * How do I install a CA certificate into a browser?
  263. The usual way is to send the DER encoded certificate to the browser as
  264. MIME type application/x-x509-ca-cert, for example by clicking on an appropriate
  265. link. On MSIE certain extensions such as .der or .cacert may also work, or you
  266. can import the certificate using the certificate import wizard.
  267. You can convert a certificate to DER form using the command:
  268. openssl x509 -in ca.pem -outform DER -out ca.der
  269. Occasionally someone suggests using a command such as:
  270. openssl pkcs12 -export -out cacert.p12 -in cacert.pem -inkey cakey.pem
  271. DO NOT DO THIS! This command will give away your CAs private key and
  272. reduces its security to zero: allowing anyone to forge certificates in
  273. whatever name they choose.
  274. * Why is OpenSSL x509 DN output not conformant to RFC2253?
  275. The ways to print out the oneline format of the DN (Distinguished Name) have
  276. been extended in version 0.9.7 of OpenSSL. Using the new X509_NAME_print_ex()
  277. interface, the "-nameopt" option could be introduded. See the manual
  278. page of the "openssl x509" commandline tool for details. The old behaviour
  279. has however been left as default for the sake of compatibility.
  280. * What is a "128 bit certificate"? Can I create one with OpenSSL?
  281. The term "128 bit certificate" is a highly misleading marketing term. It does
  282. *not* refer to the size of the public key in the certificate! A certificate
  283. containing a 128 bit RSA key would have negligible security.
  284. There were various other names such as "magic certificates", "SGC
  285. certificates", "step up certificates" etc.
  286. You can't generally create such a certificate using OpenSSL but there is no
  287. need to any more. Nowadays web browsers using unrestricted strong encryption
  288. are generally available.
  289. When there were tight export restrictions on the export of strong encryption
  290. software from the US only weak encryption algorithms could be freely exported
  291. (initially 40 bit and then 56 bit). It was widely recognised that this was
  292. inadequate. A relaxation the rules allowed the use of strong encryption but
  293. only to an authorised server.
  294. Two slighly different techniques were developed to support this, one used by
  295. Netscape was called "step up", the other used by MSIE was called "Server Gated
  296. Cryptography" (SGC). When a browser initially connected to a server it would
  297. check to see if the certificate contained certain extensions and was issued by
  298. an authorised authority. If these test succeeded it would reconnect using
  299. strong encryption.
  300. Only certain (initially one) certificate authorities could issue the
  301. certificates and they generally cost more than ordinary certificates.
  302. Although OpenSSL can create certificates containing the appropriate extensions
  303. the certificate would not come from a permitted authority and so would not
  304. be recognized.
  305. The export laws were later changed to allow almost unrestricted use of strong
  306. encryption so these certificates are now obsolete.
  307. [BUILD] =======================================================================
  308. * Why does the linker complain about undefined symbols?
  309. Maybe the compilation was interrupted, and make doesn't notice that
  310. something is missing. Run "make clean; make".
  311. If you used ./Configure instead of ./config, make sure that you
  312. selected the right target. File formats may differ slightly between
  313. OS versions (for example sparcv8/sparcv9, or a.out/elf).
  314. In case you get errors about the following symbols, use the config
  315. option "no-asm", as described in INSTALL:
  316. BF_cbc_encrypt, BF_decrypt, BF_encrypt, CAST_cbc_encrypt,
  317. CAST_decrypt, CAST_encrypt, RC4, RC5_32_cbc_encrypt, RC5_32_decrypt,
  318. RC5_32_encrypt, bn_add_words, bn_div_words, bn_mul_add_words,
  319. bn_mul_comba4, bn_mul_comba8, bn_mul_words, bn_sqr_comba4,
  320. bn_sqr_comba8, bn_sqr_words, bn_sub_words, des_decrypt3,
  321. des_ede3_cbc_encrypt, des_encrypt, des_encrypt2, des_encrypt3,
  322. des_ncbc_encrypt, md5_block_asm_host_order, sha1_block_asm_data_order
  323. If none of these helps, you may want to try using the current snapshot.
  324. If the problem persists, please submit a bug report.
  325. * Why does the OpenSSL test fail with "bc: command not found"?
  326. You didn't install "bc", the Unix calculator. If you want to run the
  327. tests, get GNU bc from ftp://ftp.gnu.org or from your OS distributor.
  328. * Why does the OpenSSL test fail with "bc: 1 no implemented"?
  329. On some SCO installations or versions, bc has a bug that gets triggered
  330. when you run the test suite (using "make test"). The message returned is
  331. "bc: 1 not implemented".
  332. The best way to deal with this is to find another implementation of bc
  333. and compile/install it. GNU bc (see http://www.gnu.org/software/software.html
  334. for download instructions) can be safely used, for example.
  335. * Why does the OpenSSL test fail with "bc: stack empty"?
  336. On some DG/ux versions, bc seems to have a too small stack for calculations
  337. that the OpenSSL bntest throws at it. This gets triggered when you run the
  338. test suite (using "make test"). The message returned is "bc: stack empty".
  339. The best way to deal with this is to find another implementation of bc
  340. and compile/install it. GNU bc (see http://www.gnu.org/software/software.html
  341. for download instructions) can be safely used, for example.
  342. * Why does the OpenSSL compilation fail on Alpha Tru64 Unix?
  343. On some Alpha installations running Tru64 Unix and Compaq C, the compilation
  344. of crypto/sha/sha_dgst.c fails with the message 'Fatal: Insufficient virtual
  345. memory to continue compilation.' As far as the tests have shown, this may be
  346. a compiler bug. What happens is that it eats up a lot of resident memory
  347. to build something, probably a table. The problem is clearly in the
  348. optimization code, because if one eliminates optimization completely (-O0),
  349. the compilation goes through (and the compiler consumes about 2MB of resident
  350. memory instead of 240MB or whatever one's limit is currently).
  351. There are three options to solve this problem:
  352. 1. set your current data segment size soft limit higher. Experience shows
  353. that about 241000 kbytes seems to be enough on an AlphaServer DS10. You do
  354. this with the command 'ulimit -Sd nnnnnn', where 'nnnnnn' is the number of
  355. kbytes to set the limit to.
  356. 2. If you have a hard limit that is lower than what you need and you can't
  357. get it changed, you can compile all of OpenSSL with -O0 as optimization
  358. level. This is however not a very nice thing to do for those who expect to
  359. get the best result from OpenSSL. A bit more complicated solution is the
  360. following:
  361. ----- snip:start -----
  362. make DIRS=crypto SDIRS=sha "`grep '^CFLAG=' Makefile.ssl | \
  363. sed -e 's/ -O[0-9] / -O0 /'`"
  364. rm `ls crypto/*.o crypto/sha/*.o | grep -v 'sha_dgst\.o'`
  365. make
  366. ----- snip:end -----
  367. This will only compile sha_dgst.c with -O0, the rest with the optimization
  368. level chosen by the configuration process. When the above is done, do the
  369. test and installation and you're set.
  370. 3. Reconfigure the toolkit with no-sha0 option to leave out SHA0. It
  371. should not be used and is not used in SSL/TLS nor any other recognized
  372. protocol in either case.
  373. * Why does the OpenSSL compilation fail with "ar: command not found"?
  374. Getting this message is quite usual on Solaris 2, because Sun has hidden
  375. away 'ar' and other development commands in directories that aren't in
  376. $PATH by default. One of those directories is '/usr/ccs/bin'. The
  377. quickest way to fix this is to do the following (it assumes you use sh
  378. or any sh-compatible shell):
  379. ----- snip:start -----
  380. PATH=${PATH}:/usr/ccs/bin; export PATH
  381. ----- snip:end -----
  382. and then redo the compilation. What you should really do is make sure
  383. '/usr/ccs/bin' is permanently in your $PATH, for example through your
  384. '.profile' (again, assuming you use a sh-compatible shell).
  385. * Why does the OpenSSL compilation fail on Win32 with VC++?
  386. Sometimes, you may get reports from VC++ command line (cl) that it
  387. can't find standard include files like stdio.h and other weirdnesses.
  388. One possible cause is that the environment isn't correctly set up.
  389. To solve that problem for VC++ versions up to 6, one should run
  390. VCVARS32.BAT which is found in the 'bin' subdirectory of the VC++
  391. installation directory (somewhere under 'Program Files'). For VC++
  392. version 7 (and up?), which is also called VS.NET, the file is called
  393. VSVARS32.BAT instead.
  394. This needs to be done prior to running NMAKE, and the changes are only
  395. valid for the current DOS session.
  396. * What is special about OpenSSL on Redhat?
  397. Red Hat Linux (release 7.0 and later) include a preinstalled limited
  398. version of OpenSSL. For patent reasons, support for IDEA, RC5 and MDC2
  399. is disabled in this version. The same may apply to other Linux distributions.
  400. Users may therefore wish to install more or all of the features left out.
  401. To do this you MUST ensure that you do not overwrite the openssl that is in
  402. /usr/bin on your Red Hat machine. Several packages depend on this file,
  403. including sendmail and ssh. /usr/local/bin is a good alternative choice. The
  404. libraries that come with Red Hat 7.0 onwards have different names and so are
  405. not affected. (eg For Red Hat 7.2 they are /lib/libssl.so.0.9.6b and
  406. /lib/libcrypto.so.0.9.6b with symlinks /lib/libssl.so.2 and
  407. /lib/libcrypto.so.2 respectively).
  408. Please note that we have been advised by Red Hat attempting to recompile the
  409. openssl rpm with all the cryptography enabled will not work. All other
  410. packages depend on the original Red Hat supplied openssl package. It is also
  411. worth noting that due to the way Red Hat supplies its packages, updates to
  412. openssl on each distribution never change the package version, only the
  413. build number. For example, on Red Hat 7.1, the latest openssl package has
  414. version number 0.9.6 and build number 9 even though it contains all the
  415. relevant updates in packages up to and including 0.9.6b.
  416. A possible way around this is to persuade Red Hat to produce a non-US
  417. version of Red Hat Linux.
  418. FYI: Patent numbers and expiry dates of US patents:
  419. MDC-2: 4,908,861 13/03/2007
  420. IDEA: 5,214,703 25/05/2010
  421. RC5: 5,724,428 03/03/2015
  422. * Why does the OpenSSL compilation fail on MacOS X?
  423. If the failure happens when trying to build the "openssl" binary, with
  424. a large number of undefined symbols, it's very probable that you have
  425. OpenSSL 0.9.6b delivered with the operating system (you can find out by
  426. running '/usr/bin/openssl version') and that you were trying to build
  427. OpenSSL 0.9.7 or newer. The problem is that the loader ('ld') in
  428. MacOS X has a misfeature that's quite difficult to go around.
  429. Look in the file PROBLEMS for a more detailed explanation and for possible
  430. solutions.
  431. * Why does the OpenSSL test suite fail on MacOS X?
  432. If the failure happens when running 'make test' and the RC4 test fails,
  433. it's very probable that you have OpenSSL 0.9.6b delivered with the
  434. operating system (you can find out by running '/usr/bin/openssl version')
  435. and that you were trying to build OpenSSL 0.9.6d. The problem is that
  436. the loader ('ld') in MacOS X has a misfeature that's quite difficult to
  437. go around and has linked the programs "openssl" and the test programs
  438. with /usr/lib/libcrypto.dylib and /usr/lib/libssl.dylib instead of the
  439. libraries you just built.
  440. Look in the file PROBLEMS for a more detailed explanation and for possible
  441. solutions.
  442. * Why does the OpenSSL test suite fail in BN_sqr test [on a 64-bit platform]?
  443. Failure in BN_sqr test is most likely caused by a failure to configure the
  444. toolkit for current platform or lack of support for the platform in question.
  445. Run './config -t' and './apps/openssl version -p'. Do these platform
  446. identifiers match? If they don't, then you most likely failed to run
  447. ./config and you're hereby advised to do so before filing a bug report.
  448. If ./config itself fails to run, then it's most likely problem with your
  449. local environment and you should turn to your system administrator (or
  450. similar). If identifiers match (and/or no alternative identifier is
  451. suggested by ./config script), then the platform is unsupported. There might
  452. or might not be a workaround. Most notably on SPARC64 platforms with GNU
  453. C compiler you should be able to produce a working build by running
  454. './config -m32'. I understand that -m32 might not be what you want/need,
  455. but the build should be operational. For further details turn to
  456. <openssl-dev@openssl.org>.
  457. * Why does OpenBSD-i386 build fail on des-586.s with "Unimplemented segment type"?
  458. As of 0.9.7 assembler routines were overhauled for position independence
  459. of the machine code, which is essential for shared library support. For
  460. some reason OpenBSD is equipped with an out-of-date GNU assembler which
  461. finds the new code offensive. To work around the problem, configure with
  462. no-asm (and sacrifice a great deal of performance) or patch your assembler
  463. according to <URL: http://www.openssl.org/~appro/gas-1.92.3.OpenBSD.patch>.
  464. For your convenience a pre-compiled replacement binary is provided at
  465. <URL: http://www.openssl.org/~appro/gas-1.92.3.static.aout.bin>.
  466. Reportedly elder *BSD a.out platforms also suffer from this problem and
  467. remedy should be same. Provided binary is statically linked and should be
  468. working across wider range of *BSD branches, not just OpenBSD.
  469. * Why does the OpenSSL test suite fail in sha512t on x86 CPU?
  470. If the test program in question fails withs SIGILL, Illegal Instruction
  471. exception, then you more than likely to run SSE2-capable CPU, such as
  472. Intel P4, under control of kernel which does not support SSE2
  473. instruction extentions. See accompanying INSTALL file and
  474. OPENSSL_ia32cap(3) documentation page for further information.
  475. * Why does compiler fail to compile sha512.c?
  476. OpenSSL SHA-512 implementation depends on compiler support for 64-bit
  477. integer type. Few elder compilers [ULTRIX cc, SCO compiler to mention a
  478. couple] lack support for this and therefore are incapable of compiling
  479. the module in question. The recommendation is to disable SHA-512 by
  480. adding no-sha512 to ./config [or ./Configure] command line. Another
  481. possible alternative might be to switch to GCC.
  482. * Test suite still fails, what to do?
  483. Another common reason for failure to complete some particular test is
  484. simply bad code generated by a buggy component in toolchain or deficiency
  485. in run-time environment. There are few cases documented in PROBLEMS file,
  486. consult it for possible workaround before you beat the drum. Even if you
  487. don't find solution or even mention there, do reserve for possibility of
  488. a compiler bug. Compiler bugs might appear in rather bizarre ways, they
  489. never make sense, and tend to emerge when you least expect them. In order
  490. to identify one, drop optimization level, e.g. by editing CFLAG line in
  491. top-level Makefile, recompile and re-run the test.
  492. [PROG] ========================================================================
  493. * Is OpenSSL thread-safe?
  494. Yes (with limitations: an SSL connection may not concurrently be used
  495. by multiple threads). On Windows and many Unix systems, OpenSSL
  496. automatically uses the multi-threaded versions of the standard
  497. libraries. If your platform is not one of these, consult the INSTALL
  498. file.
  499. Multi-threaded applications must provide two callback functions to
  500. OpenSSL by calling CRYPTO_set_locking_callback() and
  501. CRYPTO_set_id_callback(). This is described in the threads(3)
  502. manpage.
  503. * I've compiled a program under Windows and it crashes: why?
  504. This is usually because you've missed the comment in INSTALL.W32.
  505. Your application must link against the same version of the Win32
  506. C-Runtime against which your openssl libraries were linked. The
  507. default version for OpenSSL is /MD - "Multithreaded DLL".
  508. If you are using Microsoft Visual C++'s IDE (Visual Studio), in
  509. many cases, your new project most likely defaulted to "Debug
  510. Singlethreaded" - /ML. This is NOT interchangeable with /MD and your
  511. program will crash, typically on the first BIO related read or write
  512. operation.
  513. For each of the six possible link stage configurations within Win32,
  514. your application must link against the same by which OpenSSL was
  515. built. If you are using MS Visual C++ (Studio) this can be changed
  516. by:
  517. 1. Select Settings... from the Project Menu.
  518. 2. Select the C/C++ Tab.
  519. 3. Select "Code Generation from the "Category" drop down list box
  520. 4. Select the Appropriate library (see table below) from the "Use
  521. run-time library" drop down list box. Perform this step for both
  522. your debug and release versions of your application (look at the
  523. top left of the settings panel to change between the two)
  524. Single Threaded /ML - MS VC++ often defaults to
  525. this for the release
  526. version of a new project.
  527. Debug Single Threaded /MLd - MS VC++ often defaults to
  528. this for the debug version
  529. of a new project.
  530. Multithreaded /MT
  531. Debug Multithreaded /MTd
  532. Multithreaded DLL /MD - OpenSSL defaults to this.
  533. Debug Multithreaded DLL /MDd
  534. Note that debug and release libraries are NOT interchangeable. If you
  535. built OpenSSL with /MD your application must use /MD and cannot use /MDd.
  536. As per 0.9.8 the above limitation is eliminated for .DLLs. OpenSSL
  537. .DLLs compiled with some specific run-time option [we insist on the
  538. default /MD] can be deployed with application compiled with different
  539. option or even different compiler. But there is a catch! Instead of
  540. re-compiling OpenSSL toolkit, as you would have to with prior versions,
  541. you have to compile small C snippet with compiler and/or options of
  542. your choice. The snippet gets installed as
  543. <install-root>/include/openssl/applink.c and should be either added to
  544. your application project or simply #include-d in one [and only one]
  545. of your application source files. Failure to link this shim module
  546. into your application manifests itself as fatal "no OPENSSL_Applink"
  547. run-time error. An explicit reminder is due that in this situation
  548. [mixing compiler options] it is as important to add CRYPTO_malloc_init
  549. prior first call to OpenSSL.
  550. * How do I read or write a DER encoded buffer using the ASN1 functions?
  551. You have two options. You can either use a memory BIO in conjunction
  552. with the i2d_*_bio() or d2i_*_bio() functions or you can use the
  553. i2d_*(), d2i_*() functions directly. Since these are often the
  554. cause of grief here are some code fragments using PKCS7 as an example:
  555. unsigned char *buf, *p;
  556. int len;
  557. len = i2d_PKCS7(p7, NULL);
  558. buf = OPENSSL_malloc(len); /* or Malloc, error checking omitted */
  559. p = buf;
  560. i2d_PKCS7(p7, &p);
  561. At this point buf contains the len bytes of the DER encoding of
  562. p7.
  563. The opposite assumes we already have len bytes in buf:
  564. unsigned char *p;
  565. p = buf;
  566. p7 = d2i_PKCS7(NULL, &p, len);
  567. At this point p7 contains a valid PKCS7 structure of NULL if an error
  568. occurred. If an error occurred ERR_print_errors(bio) should give more
  569. information.
  570. The reason for the temporary variable 'p' is that the ASN1 functions
  571. increment the passed pointer so it is ready to read or write the next
  572. structure. This is often a cause of problems: without the temporary
  573. variable the buffer pointer is changed to point just after the data
  574. that has been read or written. This may well be uninitialized data
  575. and attempts to free the buffer will have unpredictable results
  576. because it no longer points to the same address.
  577. * OpenSSL uses DER but I need BER format: does OpenSSL support BER?
  578. The short answer is yes, because DER is a special case of BER and OpenSSL
  579. ASN1 decoders can process BER.
  580. The longer answer is that ASN1 structures can be encoded in a number of
  581. different ways. One set of ways is the Basic Encoding Rules (BER) with various
  582. permissible encodings. A restriction of BER is the Distinguished Encoding
  583. Rules (DER): these uniquely specify how a given structure is encoded.
  584. Therefore, because DER is a special case of BER, DER is an acceptable encoding
  585. for BER.
  586. * I've tried using <M_some_evil_pkcs12_macro> and I get errors why?
  587. This usually happens when you try compiling something using the PKCS#12
  588. macros with a C++ compiler. There is hardly ever any need to use the
  589. PKCS#12 macros in a program, it is much easier to parse and create
  590. PKCS#12 files using the PKCS12_parse() and PKCS12_create() functions
  591. documented in doc/openssl.txt and with examples in demos/pkcs12. The
  592. 'pkcs12' application has to use the macros because it prints out
  593. debugging information.
  594. * I've called <some function> and it fails, why?
  595. Before submitting a report or asking in one of the mailing lists, you
  596. should try to determine the cause. In particular, you should call
  597. ERR_print_errors() or ERR_print_errors_fp() after the failed call
  598. and see if the message helps. Note that the problem may occur earlier
  599. than you think -- you should check for errors after every call where
  600. it is possible, otherwise the actual problem may be hidden because
  601. some OpenSSL functions clear the error state.
  602. * I just get a load of numbers for the error output, what do they mean?
  603. The actual format is described in the ERR_print_errors() manual page.
  604. You should call the function ERR_load_crypto_strings() before hand and
  605. the message will be output in text form. If you can't do this (for example
  606. it is a pre-compiled binary) you can use the errstr utility on the error
  607. code itself (the hex digits after the second colon).
  608. * Why do I get errors about unknown algorithms?
  609. This can happen under several circumstances such as reading in an
  610. encrypted private key or attempting to decrypt a PKCS#12 file. The cause
  611. is forgetting to load OpenSSL's table of algorithms with
  612. OpenSSL_add_all_algorithms(). See the manual page for more information.
  613. * Why can't the OpenSSH configure script detect OpenSSL?
  614. Several reasons for problems with the automatic detection exist.
  615. OpenSSH requires at least version 0.9.5a of the OpenSSL libraries.
  616. Sometimes the distribution has installed an older version in the system
  617. locations that is detected instead of a new one installed. The OpenSSL
  618. library might have been compiled for another CPU or another mode (32/64 bits).
  619. Permissions might be wrong.
  620. The general answer is to check the config.log file generated when running
  621. the OpenSSH configure script. It should contain the detailed information
  622. on why the OpenSSL library was not detected or considered incompatible.
  623. * Can I use OpenSSL's SSL library with non-blocking I/O?
  624. Yes; make sure to read the SSL_get_error(3) manual page!
  625. A pitfall to avoid: Don't assume that SSL_read() will just read from
  626. the underlying transport or that SSL_write() will just write to it --
  627. it is also possible that SSL_write() cannot do any useful work until
  628. there is data to read, or that SSL_read() cannot do anything until it
  629. is possible to send data. One reason for this is that the peer may
  630. request a new TLS/SSL handshake at any time during the protocol,
  631. requiring a bi-directional message exchange; both SSL_read() and
  632. SSL_write() will try to continue any pending handshake.
  633. * Why doesn't my server application receive a client certificate?
  634. Due to the TLS protocol definition, a client will only send a certificate,
  635. if explicitly asked by the server. Use the SSL_VERIFY_PEER flag of the
  636. SSL_CTX_set_verify() function to enable the use of client certificates.
  637. * Why does compilation fail due to an undefined symbol NID_uniqueIdentifier?
  638. For OpenSSL 0.9.7 the OID table was extended and corrected. In earlier
  639. versions, uniqueIdentifier was incorrectly used for X.509 certificates.
  640. The correct name according to RFC2256 (LDAP) is x500UniqueIdentifier.
  641. Change your code to use the new name when compiling against OpenSSL 0.9.7.
  642. * I think I've detected a memory leak, is this a bug?
  643. In most cases the cause of an apparent memory leak is an OpenSSL internal table
  644. that is allocated when an application starts up. Since such tables do not grow
  645. in size over time they are harmless.
  646. These internal tables can be freed up when an application closes using various
  647. functions. Currently these include following:
  648. Thread-local cleanup functions:
  649. ERR_remove_state()
  650. Application-global cleanup functions that are aware of usage (and therefore
  651. thread-safe):
  652. ENGINE_cleanup() and CONF_modules_unload()
  653. "Brutal" (thread-unsafe) Application-global cleanup functions:
  654. ERR_free_strings(), EVP_cleanup() and CRYPTO_cleanup_all_ex_data().
  655. ===============================================================================