Solved Disabling crypto and aesni support in kernel cause make to fail

Hi. I made a custom kernel by copying GENERIC to a new file called MYKERNEL and I built kernel with KERNCONF=MYKERNEL. My problem is when i commented out those two lines below, make buildkernel command fails with errors. If I don't comment out these lines, make doesn't fail. I would want to know why that happens.

Code:
# Pseudo devices.
device          crypto                  # core crypto support
device          aesni                   # AES-NI OpenCrypto module

Code:
--- kernel.full ---
linking kernel.full
ld: error: undefined symbol: crypto_freesession
>>> referenced by ktls_ocf.c:978 (/usr/src/sys/opencrypto/ktls_ocf.c:978)
>>>               ktls_ocf.o:(ktls_ocf_free)
>>> referenced by ktls_ocf.c:979 (/usr/src/sys/opencrypto/ktls_ocf.c:979)
>>>               ktls_ocf.o:(ktls_ocf_free)
>>> referenced by ktls_ocf.c:980 (/usr/src/sys/opencrypto/ktls_ocf.c:980)
>>>               ktls_ocf.o:(ktls_ocf_free)
>>> referenced 1 more times

ld: error: undefined symbol: crypto_newsession
>>> referenced by ktls_ocf.c:1105 (/usr/src/sys/opencrypto/ktls_ocf.c:1105)
>>>               ktls_ocf.o:(ktls_ocf_try)
>>> referenced by ktls_ocf.c:1113 (/usr/src/sys/opencrypto/ktls_ocf.c:1113)
>>>               ktls_ocf.o:(ktls_ocf_try)
>>> referenced by ktls_ocf.c:1124 (/usr/src/sys/opencrypto/ktls_ocf.c:1124)
>>>               ktls_ocf.o:(ktls_ocf_try)

ld: error: undefined symbol: crypto_ses2caps
>>> referenced by ktls_ocf.c:1157 (/usr/src/sys/opencrypto/ktls_ocf.c:1157)
>>>               ktls_ocf.o:(ktls_ocf_try)
>>> referenced by ktls_ocf.c:208 (/usr/src/sys/opencrypto/ktls_ocf.c:208)
>>>               ktls_ocf.o:(ktls_ocf_dispatch)
>>> referenced by ktls_ocf.c:208 (/usr/src/sys/opencrypto/ktls_ocf.c:208)
>>>               ktls_ocf.o:(ktls_ocf_dispatch)

ld: error: undefined symbol: crypto_initreq
>>> referenced by ktls_ocf.c:802 (/usr/src/sys/opencrypto/ktls_ocf.c:802)
>>>               ktls_ocf.o:(ktls_ocf_tls13_aead_encrypt)
>>> referenced by ktls_ocf.c:933 (/usr/src/sys/opencrypto/ktls_ocf.c:933)
>>>               ktls_ocf.o:(ktls_ocf_tls13_aead_recrypt)
>>> referenced by ktls_ocf.c:881 (/usr/src/sys/opencrypto/ktls_ocf.c:881)
>>>               ktls_ocf.o:(ktls_ocf_tls13_aead_decrypt)
>>> referenced 7 more times

ld: error: undefined symbol: crypto_dispatch
>>> referenced by ktls_ocf.c:268 (/usr/src/sys/opencrypto/ktls_ocf.c:268)
>>>               ktls_ocf.o:(ktls_ocf_tls13_aead_encrypt)
>>> referenced by ktls_ocf.c:212 (/usr/src/sys/opencrypto/ktls_ocf.c:212)
>>>               ktls_ocf.o:(ktls_ocf_dispatch)
>>> referenced by ktls_ocf.c:212 (/usr/src/sys/opencrypto/ktls_ocf.c:212)
>>>               ktls_ocf.o:(ktls_ocf_dispatch)
>>> referenced 2 more times

ld: error: undefined symbol: crypto_destroyreq
>>> referenced by ktls_ocf.c:0 (/usr/src/sys/opencrypto/ktls_ocf.c:0)
>>>               ktls_ocf.o:(ktls_ocf_tls13_aead_encrypt)
>>> referenced by ktls_ocf.c:956 (/usr/src/sys/opencrypto/ktls_ocf.c:956)
>>>               ktls_ocf.o:(ktls_ocf_tls13_aead_recrypt)
>>> referenced by ktls_ocf.c:909 (/usr/src/sys/opencrypto/ktls_ocf.c:909)
>>>               ktls_ocf.o:(ktls_ocf_tls13_aead_decrypt)
>>> referenced 8 more times

ld: error: undefined symbol: comp_algo_deflate
>>> referenced by key.c:8642 (/usr/src/sys/netipsec/key.c:8642)
>>>               key.o:(comp_algorithm_lookup)

ld: error: undefined symbol: enc_xform_aes_cbc
>>> referenced by key.c
>>>               key.o:(supported_ealgs)

ld: error: undefined symbol: enc_xform_null
>>> referenced by key.c
>>>               key.o:(supported_ealgs)

ld: error: undefined symbol: enc_xform_aes_icm
>>> referenced by key.c
>>>               key.o:(supported_ealgs)

ld: error: undefined symbol: enc_xform_aes_nist_gcm
>>> referenced by key.c
>>>               key.o:(supported_ealgs)

ld: error: undefined symbol: enc_xform_aes_nist_gmac
>>> referenced by key.c
>>>               key.o:(supported_ealgs)

ld: error: undefined symbol: enc_xform_chacha20_poly1305
>>> referenced by key.c
>>>               key.o:(supported_ealgs)

ld: error: undefined symbol: auth_hash_null
>>> referenced by key.c
>>>               key.o:(supported_aalgs)

ld: error: undefined symbol: auth_hash_hmac_sha1
>>> referenced by key.c
>>>               key.o:(supported_aalgs)

ld: error: undefined symbol: auth_hash_hmac_sha2_256
>>> referenced by key.c
>>>               key.o:(supported_aalgs)

ld: error: undefined symbol: auth_hash_hmac_sha2_384
>>> referenced by key.c
>>>               key.o:(supported_aalgs)

ld: error: undefined symbol: auth_hash_hmac_sha2_512
>>> referenced by key.c
>>>               key.o:(supported_aalgs)

ld: error: undefined symbol: auth_hash_nist_gmac_aes_128
>>> referenced by key.c
>>>               key.o:(supported_aalgs)

ld: error: undefined symbol: auth_hash_nist_gmac_aes_192
>>> referenced by key.c
>>>               key.o:(supported_aalgs)

ld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)
*** [kernel.full] Error code 1

make[2]: stopped in /usr/obj/usr/src/amd64.amd64/sys/MYKERNEL
1 error

make[2]: stopped in /usr/obj/usr/src/amd64.amd64/sys/MYKERNEL
      327.36 real      2211.59 user       174.27 sys

make[1]: stopped in /usr/src

make: stopped in /usr/src
 
remove both and try again (IPSEC and KERN_TLS)
Thank you, it built successfully. Now I see them in the error output, netipsec and ktls.
Code:
      340.08 real      2207.72 user       179.55 sys
--------------------------------------------------------------
>>> Kernel build for MYKERNEL completed on Tue Nov 28 21:50:33 +03 2023
--------------------------------------------------------------
>>> Kernel(s)  MYKERNEL built in 342 seconds, ncpu: 8, make -j8
--------------------------------------------------------------
 
Back
Top