Search code examples
cmacosopensslkernelkernel-extension

How to use OpenSSL in network kernel extension?


I'm building a network kernel extension which requires the OpenSSL library by including a few headers in some of my project files.

The problem is that OpenSSL includes stdlib.h (among other headers) which all throw errors (File not found). Same happens if I include stdlib.h in a project file.

I guess that's due to the fact that they are not available in the kernel. So, how do I include them? What am I missing?

Otherwise, how do I include CommonCrypto or any crypto library in the kernel?

Thank you!


Solution

  • OpenSSL and CommonCrypto are userspace libraries. They are not available in the kernel.

    Some parts of CoreCrypto are available in the kernel under <libkern/crypto/…> and <corecrypto/…>. Generally speaking, however, this is limited to cryptographic primitives (AES, RSA, SHA, etc), not higher-level tools like X509 certificate parsing, key exchange algorithms, or TLS.