Skip to content

Commit

Permalink
Remove the crypto section due to poor maintenance
Browse files Browse the repository at this point in the history
The past content in the crypto section lacks informative descriptions,
and there should be a proper procedure to demonstrate how Linux
cryptography works. Due to poor maintenance, let's drop the section.
  • Loading branch information
jserv committed Apr 15, 2024
1 parent 1d38d2e commit f5893d8
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 306 deletions.
2 changes: 0 additions & 2 deletions examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ obj-m += sched.o
obj-m += chardev2.o
obj-m += syscall-steal.o
obj-m += intrpt.o
obj-m += cryptosha256.o
obj-m += cryptosk.o
obj-m += completions.o
obj-m += example_tasklet.o
obj-m += devicemodel.o
Expand Down
68 changes: 0 additions & 68 deletions examples/cryptosha256.c

This file was deleted.

199 changes: 0 additions & 199 deletions examples/cryptosk.c

This file was deleted.

37 changes: 0 additions & 37 deletions lkmpg.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1910,43 +1910,6 @@ \subsection{Bottom Half}

\samplec{examples/bottomhalf.c}

\section{Crypto}
\label{sec:crypto}
At the dawn of the internet, everybody trusted everybody completely\ldots{}but that did not work out so well.
When this guide was originally written, it was a more innocent era in which almost nobody actually gave a damn about crypto - least of all kernel developers.
That is certainly no longer the case now.
To handle crypto stuff, the kernel has its own API enabling common methods of encryption, decryption and your favourite hash functions.

\subsection{Hash functions}
\label{sec:hashfunc}

Calculating and checking the hashes of things is a common operation.
Here is a demonstration of how to calculate a sha256 hash within a kernel module.
To provide the sha256 algorithm support, make sure \cpp|CONFIG_CRYPTO_SHA256| is enabled in kernel.

\samplec{examples/cryptosha256.c}

Install the module:

\begin{codebash}
sudo insmod cryptosha256.ko
sudo dmesg
\end{codebash}

And you should see that the hash was calculated for the test string.

Finally, remove the test module:

\begin{codebash}
sudo rmmod cryptosha256
\end{codebash}

\subsection{Symmetric key encryption}
\label{sec:org2fab20b}
Here is an example of symmetrically encrypting a string using the AES algorithm and a password.

\samplec{examples/cryptosk.c}

\section{Virtual Input Device Driver}
\label{sec:vinput}
The input device driver is a module that provides a way to communicate with the interaction device via the event.
Expand Down

0 comments on commit f5893d8

Please sign in to comment.