You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Copy file name to clipboardExpand all lines: lkmpg.tex
-37Lines changed: 0 additions & 37 deletions
Original file line number
Diff line number
Diff line change
@@ -1910,43 +1910,6 @@ \subsection{Bottom Half}
1910
1910
1911
1911
\samplec{examples/bottomhalf.c}
1912
1912
1913
-
\section{Crypto}
1914
-
\label{sec:crypto}
1915
-
At the dawn of the internet, everybody trusted everybody completely\ldots{}but that did not work out so well.
1916
-
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.
1917
-
That is certainly no longer the case now.
1918
-
To handle crypto stuff, the kernel has its own API enabling common methods of encryption, decryption and your favourite hash functions.
1919
-
1920
-
\subsection{Hash functions}
1921
-
\label{sec:hashfunc}
1922
-
1923
-
Calculating and checking the hashes of things is a common operation.
1924
-
Here is a demonstration of how to calculate a sha256 hash within a kernel module.
1925
-
To provide the sha256 algorithm support, make sure \cpp|CONFIG_CRYPTO_SHA256| is enabled in kernel.
1926
-
1927
-
\samplec{examples/cryptosha256.c}
1928
-
1929
-
Install the module:
1930
-
1931
-
\begin{codebash}
1932
-
sudo insmod cryptosha256.ko
1933
-
sudo dmesg
1934
-
\end{codebash}
1935
-
1936
-
And you should see that the hash was calculated for the test string.
1937
-
1938
-
Finally, remove the test module:
1939
-
1940
-
\begin{codebash}
1941
-
sudo rmmod cryptosha256
1942
-
\end{codebash}
1943
-
1944
-
\subsection{Symmetric key encryption}
1945
-
\label{sec:org2fab20b}
1946
-
Here is an example of symmetrically encrypting a string using the AES algorithm and a password.
1947
-
1948
-
\samplec{examples/cryptosk.c}
1949
-
1950
1913
\section{Virtual Input Device Driver}
1951
1914
\label{sec:vinput}
1952
1915
The input device driver is a module that provides a way to communicate with the interaction device via the event.
0 commit comments