19 Commits

Author SHA1 Message Date
Daniel Pouzzner
ff4c6e5d7b linuxkm: relocate WOLFSSL_LINUXKM code in wolfssl/wolfcrypt/wc_port.h and wolfcrypt/src/memory.c to linuxkm/{linuxkm_wc_port.h,linuxkm_memory.c}, and gate SIMD in IRQ handlers on -DLINUXKM_SIMD_IRQ in prep for Linux 5.16;
linuxkm: when -DWOLFCRYPT_ONLY, don't include ssl.h in module_exports.c.template and module_hooks.c, and fix gating to work right with that;

wolfssl/wolfcrypt/types.h: add support for a WOLFSSL_XFREE_NO_NULLNESS_CHECK gate (used in cppcheck analysis).
2022-01-07 22:39:38 -06:00
Daniel Pouzzner
313d29f752 linuxkm: in module_hooks.c, refactor WOLFSSL_LINUXKM_SIMD_X86_IRQ_ALLOWED gates to WOLFSSL_LINUXKM_SIMD_X86, and add updateFipsHash(). 2021-11-09 22:02:17 -06:00
Daniel Pouzzner
beebd1411d linuxkm/module_hooks.c: fix whitespace, and update code around WOLFCRYPT_FIPS_CORE_DYNAMIC_HASH_VALUE and updateFipsHash(). 2021-11-08 17:35:10 -06:00
Daniel Pouzzner
6f18ba15b0 linuxkm: accommodate printk()->_printk() renaming in kernel 5.15+. 2021-11-01 11:49:56 -06:00
Daniel Pouzzner
8ee49cd50c linuxkm: in module_hooks.c:wolfssl_init(), add support for WC_RNG_SEED_CB. 2021-10-26 20:24:29 -05:00
Daniel Pouzzner
071be3171e linuxkm: in module_hooks.c, fix logic+gating around CONFIG_MODULE_SIG and WOLFCRYPT_FIPS_CORE_DYNAMIC_HASH_VALUE. 2021-10-26 20:24:29 -05:00
Daniel Pouzzner
6d715130a2 linuxkm: cleanups and smallstack refactors related to WOLFSSL_LINUXKM_SIMD_X86_IRQ_ALLOWED, associated linuxkm-SIMD-IRQ PR, and associated peer review:
smallstack refactors for wolfcrypt/src/rsa.c:wc_CheckProbablePrime_ex() and wolfcrypt/src/pwdbased.c:wc_PKCS12_PBKDF_ex();

add WARN_UNUSED_RESULT macro to types.h;

text format cleanup;

fix internal.c:LowResTimer() implementation.

refactor tls13.c:TimeNowInMilliseconds() for kernel 4.9 and 3.16 compat.

use ktime_get_coarse_real_ts64() only for kernel 5.x+.  in kernel 4.x, use its older form, current_kernel_time64(), and in 3.x, use getnstimeofday().

linuxkm/module_hooks.c: fix wolfssl_init() pie code to be compatible with kernel 4.4-;

fix allocate_wolfcrypt_irq_fpu_states() return codes to all be wolfcrypt codes, and in calling code, pass up that code (suggested by dgarske peer review).
2021-09-20 13:46:51 -05:00
Daniel Pouzzner
83e0e19e03 linuxkm feature additions:
add build-time support for module signing using native Linux facility;

add support for alternative licenses using WOLFSSL_LICENSE macro;

improve load-time kernel log messages;

add support for sp-math-all asm/AVX2 acceleration;

add error-checking and return in SAVE_VECTOR_REGISTERS();

implement support for x86 accelerated crypto from interrupt handlers, gated on WOLFSSL_LINUXKM_SIMD_X86_IRQ_ALLOWED:

  * wolfcrypt_irq_fpu_states
  * am_in_hard_interrupt_handler()
  * allocate_wolfcrypt_irq_fpu_states()
  * free_wolfcrypt_irq_fpu_states()
  * save_vector_registers_x86()
  * restore_vector_registers_x86()

add WOLFSSL_LINUXKM_SIMD, WOLFSSL_LINUXKM_SIMD_X86, and WOLFSSL_LINUXKM_SIMD_ARM macros for more readable gating.
2021-09-20 10:27:13 -05:00
Daniel Pouzzner
3226e69649
--enable-linuxkm-pie (FIPS Linux kernel module) ()
* Adds `--enable-linuxkm-pie` and associated infrastructure, to support FIPS mode in the Linux kernel module.
* Adds `tests/api.c` missing (void) arglist to `test_SSL_CIPHER_get_xxx()`.
2021-08-19 09:15:52 -07:00
Jacob Barthelmeh
c729318ddd update copyright date 2021-03-11 13:42:46 +07:00
Daniel Pouzzner
542ad0a81b linuxkm/module_hooks.c: separate cleanup into static libwolfssl_cleanup(), and call it from wolfssl_init() if wolfcrypt_test() fails. 2020-12-22 21:57:17 -06:00
Daniel Pouzzner
4efa85dc03 linuxkm/module_hooks.c: add support for WOLFCRYPT_ONLY. 2020-12-11 14:16:44 -06:00
Daniel Pouzzner
5504d9cd4e linuxkm: dial in SIMD options in Kbuild; add boilerplate at the top of all files added for linuxkm. 2020-09-23 18:32:16 -05:00
Daniel Pouzzner
217ec4ebd3 lkm: tweaks to self-test dynamics/messages. 2020-09-23 18:32:15 -05:00
Daniel Pouzzner
554879da00 lkm: self-test working now (certain options, which ones TBD, crash kernel). 2020-09-23 18:32:15 -05:00
Daniel Pouzzner
34fd53b4fc linuxkm: WIP support for wolfcrypt_test() at module load time. 2020-09-23 18:32:15 -05:00
Daniel Pouzzner
0c35998178 linuxkm/module_hooks.c: log "cleanup complete" at unload time. 2020-09-23 18:32:15 -05:00
Daniel Pouzzner
2a3fd57b36 linuxkm/Kbuild, linuxkm/module_hooks.c: tweaks for buildability on kernel 4.9 (may also fix build on 3.x). 2020-09-23 18:32:15 -05:00
Daniel Pouzzner
1aa15632ce initial buildability of full libwolfssl.ko loadable kernel module for Linux via ./configure --enable-linuxkm && make. 2020-09-23 18:32:15 -05:00