2
0

INSTALL 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. 0. Building on *nix from git repository
  2. Run the autogen script to generate configure, then proceed to step 1.
  3. Prerequisites: You'll need autoconf, automake and libtool installed.
  4. $ ./autogen.sh
  5. 1. Building on *nix from a release
  6. $ ./configure
  7. $ make
  8. $ make check # (optional, but highly recommended)
  9. $ sudo make install
  10. 2. Building on iOS
  11. Use on the xcode project in IDE/iOS/wolfssl.xcodeproj
  12. There is a README in IDE/iOS with more information
  13. 3. Building for Apple ARM64
  14. When building for an Apple ARM64 platform, ensure the host CPU type is detected as "aarch64" during configure, if not, pass --host=aarch64-apple-darwin to configure.
  15. 4. Building on Windows
  16. Use the Visual Studio Solution wolfssl64.sln
  17. 5. Building with IAR
  18. Please see the README in IDE/IAR-EWARM for detailed instructions
  19. 6. Building with Keil
  20. Please see the Keil Projects in IDE/MDK5-ARM/Projects
  21. 7. Building with Microchip tools
  22. Please see the README in mplabx
  23. 8. Building with Freescale MQX
  24. Please see the README in mqx
  25. 9. Building with Rowley CrossWorks for ARM
  26. Use the CrossWorks project in IDE/ROWLEY-CROSSWORKS-ARM/wolfssl.hzp
  27. There is a README.md in IDE/ROWLEY-CROSSWORKS-ARM with more information
  28. 10. Building with Arduino
  29. Use the script IDE/ARDUINO/wolfssl-arduino.sh to reformat the wolfSSL
  30. library for compatibility with the Arduino IDE. There is a README.md in
  31. IDE/ARDUINO for detailed instructions.
  32. 11. Building for Android with Visual Studio 2017
  33. Please see the README in IDE/VS-ARM.
  34. Use the Visual Studio solution IDE/VS-ARM/wolfssl.sln.
  35. 12. Building for Yocto Project or OpenEmbedded
  36. Please see the README in the "meta-wolfssl" repository. This repository
  37. holds wolfSSL's Yocto and OpenEmbedded layer, which contains recipes
  38. for wolfSSL, wolfSSH, wolfMQTT, wolfTPM, wolfCrypt examples, and OSS
  39. project bbappend files.
  40. https://github.com/wolfssl/meta-wolfssl
  41. The wolfSSL recipe can also be found in the OpenEmbedded
  42. "meta-openembedded/meta-networking/recipes-connectivity" layer:
  43. https://github.com/openembedded/meta-openembedded
  44. 13. Porting to a new platform
  45. Please see section 2.4 in the manual:
  46. http://www.wolfssl.com/yaSSL/Docs-cyassl-manual-2-building-cyassl.html
  47. 14. Building with CMake
  48. Note: Primary development uses automake (./configure). The support for CMake
  49. is still under development.
  50. For configuring wolfssl using CMake, we recommend downloading the CMake
  51. GUI (https://cmake.org/download/). This tool allows you to see all of
  52. wolfssl's configuration variables, set them, and view their descriptions.
  53. Looking at the GUI or CMakeCache.txt (generated after running cmake once) is
  54. the best way to find out what configuration options are available and what
  55. they do. You can also invoke CMake from the GUI, which is described in the
  56. Windows instructions below. For Unix-based systems, we describe the command
  57. line work flow. Regardless of your chosen workflow, cmake will generate
  58. a header options.h in the wolfssl directory that contains the options used
  59. to configure the build.
  60. Unix-based Platforms
  61. ---
  62. 1) Navigate to the wolfssl root directory containing "CMakeLists.txt".
  63. 2) Create a directory called "build" and change into it. This is where
  64. CMake will store build files.
  65. 3) Run `cmake ..` to generate the target build files (e.g. UNIX Makefiles).
  66. To enable or disable features, set them using -D<option>=[yes/no]. For
  67. example, to disable TLS 1.3 support, run cmake .. -DWOLFSSL_TLS13=no
  68. (autoconf equivalent: ./configure --disable-tls13) To enable DSA, run
  69. cmake .. -DWOLFSSL_DSA=yes (autoconf equivalent: ./configure
  70. --enable-dsa). Again, you can find a list of these options and their
  71. descriptions either using the CMake GUI or by looking at CMakeCache.txt.
  72. 5) The build directory should now contain the generated build files. Build
  73. with `cmake --build .`. Under the hood, this runs the target build tool
  74. (by default, make). You can also invoke the target build tool directly
  75. (e.g. make).
  76. To build with debugging use: `cmake .. -DCMAKE_BUILD_TYPE=Debug`.
  77. In the simplest form:
  78. # create a root directory for wolfssl repo
  79. git clone https://github.com/wolfSSL/wolfssl.git
  80. cd wolfssl
  81. # From the root of the wolfSSL repo:
  82. mkdir -p out
  83. pushd out
  84. cmake ..
  85. cmake --build .
  86. # View the available ciphers with:
  87. ./examples/client/client -e
  88. popd
  89. ARIA Cipher Suite.
  90. The ARIA cipher needs a 3rd party source binary, typically called
  91. `MagicCrypto.tar.gz`.
  92. The MagicCrypto files can be either copied to the local `wolfssl` directory,
  93. or an environment variable `ARIA_DIR` can be set to point to the location.
  94. Simply having the environment variable or local `MagicCrypto` directory
  95. will not automatically enable the ARIA Ciphers.
  96. To enable ARIA Ciphers in wolfSSL for `CMake`:
  97. # From the root of the wolfSSL repo:
  98. # set to your path
  99. export ARIA_DIR=~/workspace/MagicCrypto
  100. mkdir -p out
  101. pushd out
  102. cmake .. -DWOLFSSL_ARIA=yes
  103. cmake --build .
  104. # View the available ciphers with:
  105. ./examples/client/client -e
  106. popd
  107. Windows (Visual Studio)
  108. ---
  109. 1) Go to this page, download the appropriate Windows installer, and install
  110. to get the CMake GUI: https://cmake.org/download/ Native CMake support in
  111. Visual Studio 16 2019 (and possibly older versions) has proven buggy. We
  112. recommend using the CMake GUI in concert with Visual Studio, as described
  113. in these steps.
  114. 2) Open CMake.
  115. 3) Where is the source code: <root directory of wolfssl containing
  116. CMakeLists.txt>
  117. 4) Where to build the binaries: <build directory, e.g. wolfssl/build>
  118. 5) Hit Configure. CMake runs the code in CMakeLists.txt and builds up an
  119. internal representation of the project.
  120. 6) Hit Generate. CMake generates the build files. For Windows, this will
  121. be Visual Studio project (.vcxproj) and solution (.sln) files.
  122. 7) Open Visual Studio and select "Open a project or solution".
  123. 8) Navigate to the build directory and select wolfssl.sln to load the
  124. project.
  125. Windows (command line)
  126. ---
  127. 1) Open Command Prompt
  128. 2) Run the Visual Studio batch to setup command line variables, e.g. C:\Program Files (x86)\Microsoft Visual
  129. Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat
  130. 3) Follow steps in "Unix-based Platforms" above.
  131. 15. Building with liboqs for TLS 1.3 [EXPERIMENTAL]
  132. In order be able to use liboqs, you must have it built and installed on your
  133. system. We support liboqs at a specific git commit.
  134. NOTE: Even if you have already installed liboqs, you need to follow these
  135. steps to install liboqs again as we support sphincs variants that are
  136. disabled by default in OQS's fork of OpenSSL.
  137. Here are instructions for obtaining and building liboqs:
  138. $ mkdir ~/oqs
  139. $ cd ~/oqs
  140. $ git clone --single-branch https://github.com/open-quantum-safe/liboqs.git
  141. $ cd liboqs/
  142. $ git checkout 0.8.0
  143. $ mkdir build
  144. $ cd build
  145. $ cmake -DOQS_USE_OPENSSL=0 ..
  146. $ make all
  147. $ sudo make install
  148. And then for building wolfssl, the following is sufficient:
  149. $ cd wolfssl
  150. $ ./autogen.sh (Might not be necessary)
  151. $ ./configure --with-liboqs
  152. $ make all
  153. Execute the following to see the liboqs-related options for KEM groups near
  154. the end of the output of these commands:
  155. $ ./examples/server/server -?
  156. $ ./examples/client/client -?
  157. For a quick start, you can run the client and server like this:
  158. $ ./examples/server/server -v 4 --pqc P521_KYBER_LEVEL5
  159. $ ./examples/client/client -v 4 --pqc P521_KYBER_LEVEL5
  160. Look for the following line in the output of the server and client:
  161. ```
  162. Using Post-Quantum KEM: P521_KYBER_LEVEL5
  163. ```
  164. For authentication, you can generate a certificate chain using a patch on
  165. top of the Open Quantum Safe project's fork of OpenSSL. We support
  166. certificates and keys generated by the patched version which is maintained
  167. in our OSP repo.
  168. Instructions for obtaining and building our patched version of OQS's fork of
  169. OpenSSL can be found at:
  170. https://github.com/wolfSSL/osp/tree/master/oqs/README.md
  171. There are scripts for generating FALCON, Dilithium and SPHINCS+ certificate
  172. chains which can be found in the same directory as the `README.md` file in
  173. the `osp` github repo. Please find instructions on how to generate the keys
  174. and certificates in the `README.md` file.
  175. Once the certificates and keys are generated, copy them from the
  176. to the certs directory of wolfssl. Now you can run the server and client
  177. like this:
  178. $ examples/server/server -v 4 -l TLS_AES_256_GCM_SHA384 \
  179. -A certs/falcon_level5_root_cert.pem \
  180. -c certs/falcon_level1_entity_cert.pem \
  181. -k certs/falcon_level1_entity_key.pem \
  182. --pqc P521_KYBER_LEVEL5
  183. $ examples/client/client -v 4 -l TLS_AES_256_GCM_SHA384 \
  184. -A certs/falcon_level1_root_cert.pem \
  185. -c certs/falcon_level5_entity_cert.pem \
  186. -k certs/falcon_level5_entity_key.pem \
  187. --pqc P521_KYBER_LEVEL5
  188. Congratulations! You have just achieved a fully quantum-safe TLS 1.3
  189. connection!
  190. The following NIST Competition winning algorithms are supported:
  191. - CRYSTALS-KYBER (KEM)
  192. - Dilithium (signature scheme)
  193. - FALCON (signature scheme)
  194. - SPHINCS+ (signature scheme)
  195. The following NIST Competition Round 3 finalist algorithms were supported,
  196. but have been removed after 5.3.3
  197. - SABER (KEM)
  198. - NTRU (KEM)
  199. Links to more information about all of these algorithms can be found here:
  200. https://csrc.nist.gov/projects/post-quantum-cryptography/round-3-submissions
  201. NOTE: The quantum-safe algorithms provided by liboqs are unstandardized and
  202. experimental. It is highly advised that they NOT be used in production
  203. environments. All OIDs and codepoints are temporary and expected to
  204. change in the future. You should have no expectation of backwards
  205. compatibility.
  206. 16. Building with vcpkg
  207. # Building wolfssl - Using vcpkg
  208. You can download and install wolfssl using the [vcpkg](https://github.com/Microsoft/vcpkg):
  209. git clone https://github.com/Microsoft/vcpkg.git
  210. cd vcpkg
  211. ./bootstrap-vcpkg.sh
  212. OR for Windows
  213. bootstrap-vcpkg.bat
  214. ./vcpkg integrate install
  215. ./vcpkg install wolfssl
  216. The wolfssl port in vcpkg is kept up to date by wolfSSL.
  217. We also have vcpkg ports for wolftpm, wolfmqtt and curl.
  218. 17. Building with hash-sigs lib for LMS/HSS support [EXPERIMENTAL]
  219. Using LMS/HSS requires that the hash-sigs lib has been built on
  220. your system. We support hash-sigs lib at this git commit:
  221. b0631b8891295bf2929e68761205337b7c031726
  222. At the time of writing this, this is the HEAD of the master
  223. branch of the hash-sigs project.
  224. Currently the hash-sigs project only builds static libraries:
  225. - hss_verify.a: a single-threaded verify-only static lib.
  226. - hss_lib.a: a single-threaded static lib.
  227. - hss_lib_thread.a: a multi-threaded static lib.
  228. The multi-threaded version will mainly have speedups for key
  229. generation and signing.
  230. The default LMS build (--enable-lms) will look for
  231. hss_lib.a first, and hss_lib_thread.a second, in a specified
  232. hash-sigs dir.
  233. The LMS verify-only build (--enable-lms=verify-only) will look
  234. for hss_verify.a only, which is a slimmer library that includes
  235. only the minimal functions necessary for signature verification.
  236. How to get and build the hash-sigs library:
  237. $ mkdir ~/hash_sigs
  238. $ cd ~/hash_sigs
  239. $ git clone https://github.com/cisco/hash-sigs.git src
  240. $ cd src
  241. $ git checkout b0631b8891295bf2929e68761205337b7c031726
  242. In sha256.h, set USE_OPENSSL to 0:
  243. #define USE_OPENSSL 0
  244. To build the single-threaded version:
  245. $ make hss_lib.a
  246. $ ls *.a
  247. hss_lib.a
  248. To build multi-threaded:
  249. $ make hss_lib_thread.a
  250. $ ls *.a
  251. hss_lib_thread.a
  252. To build verify-only:
  253. $ make hss_verify.a
  254. $ ls *.a
  255. hss_verify.a
  256. Build wolfSSL with
  257. $ ./configure \
  258. --enable-static \
  259. --disable-shared \
  260. --enable-lms \
  261. --with-liblms=<path to dir containing hss_lib.a or hss_lib_thread.a>
  262. $ make
  263. Run the benchmark against LMS/HSS with:
  264. $ ./wolfcrypt/benchmark/benchmark -lms_hss
  265. 18. Building for Debian, Ubuntu, Linux Mint, and derivatives
  266. To generate a .deb package, configure wolfSSL with the desired
  267. configuration. Then run `make deb` to generate a Debian package
  268. with the current configuration. To build the package inside a
  269. Docker container, use `make deb-docker`. In both cases the
  270. resulting packages are placed in the root directory of the
  271. project.
  272. 19. Building for RHEL, Fedora, CentOS, SUSE, and openSUSE
  273. To generate a .rpm package, configure wolfSSL with the desired
  274. configuration. Then run `make rpm` to generate a .rpm package
  275. with the current configuration. To build the package inside a
  276. Docker container, use `make rpm-docker`. In both cases the
  277. resulting packages are placed in the root directory of the
  278. project.
  279. 20. Building with xmss-reference lib for XMSS/XMSS^MT support [EXPERIMENTAL]
  280. Experimental support for XMSS/XMSS^MT has been achieved by integration
  281. with the xmss-reference implementation from RFC 8391 (XMSS: eXtended
  282. Merkle Signature Scheme). We support a patched version of xmss-reference
  283. based on this git commit:
  284. 171ccbd26f098542a67eb5d2b128281c80bd71a6
  285. At the time of writing this, this is the HEAD of the master branch of
  286. the xmss-reference project.
  287. How to get the xmss-reference library:
  288. $ mkdir ~/xmss
  289. $ cd ~/xmss
  290. $ git clone https://github.com/XMSS/xmss-reference.git src
  291. $ cd src
  292. $ git checkout 171ccbd26f098542a67eb5d2b128281c80bd71a6
  293. $ git apply <path to xmss reference patch>
  294. The patch may be found in the wolfssl-examples repo here:
  295. pq/stateful_hash_sig/0001-Patch-to-support-wolfSSL-xmss-reference-integration.patch
  296. To build patched xmss-reference:
  297. $ make xmss_lib.a
  298. To build verify-only patched xmss-reference:
  299. $ make xmss_verify_lib.a
  300. Note that this patch changes xmss-reference to use wolfCrypt SHA256 hashing,
  301. by registering a SHA callback function in xmss-reference. It
  302. thus benefits from all the same asm speedups as wolfCrypt SHA hashing.
  303. Depending on architecture you may build with --enable-intelasm, or
  304. --enable-armasm, and see 30-40% speedups in XMSS/XMSS^MT.
  305. For full keygen, signing, verifying, and benchmarking support, build
  306. wolfSSL with:
  307. $ ./configure \
  308. --enable-xmss \
  309. --with-libxmss=<path to xmss src dir>
  310. $ make
  311. Run the benchmark against XMSS/XMSS^MT with:
  312. $ ./wolfcrypt/benchmark/benchmark -xmss_xmssmt
  313. For a leaner xmss verify-only build, build with
  314. $ ./configure \
  315. --enable-xmss=verify-only \
  316. --with-libxmss=<path to xmss src dir>
  317. $ make