LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Tutorial for writing cypher kernel module (https://www.linuxquestions.org/questions/programming-9/tutorial-for-writing-cypher-kernel-module-344223/)

ta0kira 07-18-2005 06:11 AM

Tutorial for writing cypher kernel module
 
I've been looking for a tutorial for writing a cipher kernel module for a little while. I'm pretty sure it needs to be a block device driver, but I'm not sure if it should also be a character device driver. Has anyone seen a tutorial specifically for a cypher module? Thanks.
ta0kira

Matir 07-18-2005 11:52 PM

If you're talking about the kernel crypto API drivers, I don't believe they are block or character drivers, but a category entirely unto themselves.

ta0kira 07-19-2005 12:41 AM

Yes, I think that's what I'm talking about. Is that what they are called? I'll try a search for that. If anything I'll just look at the sources for des.o and figure something out that way. Hopefully it's got lots of comments. Thanks.
ta0kira

ta0kira 07-19-2005 07:21 AM

twofish.c and crypto.h have a lot of useful info. More than enough to model something off of. It took a little while to find those (names especially) since I'm not on my Linux box.
http://fxr.watson.org/fxr/source/cry...v=linux-2.4.22
http://fxr.watson.org/fxr/source/inc...v=linux-2.4.22

ta0kira

Matir 07-19-2005 02:39 PM

I'm also kinda curious what you're looking to implement, for my own personal info. :)

ta0kira 07-22-2005 08:27 AM

I looked in the kernel source directory in the crypto folder and modeled something after twofish.c. I also looked at crypto.h. All I really wanted out of it was the module structure and the registering process for a cipher. I have my own encryption algorithm that I always wanted to use to encrypt an entire device or a mountable disk image, so I decided to make a module out of it. I am currently trying to get losetup to work (doesn't work with any of the standard ciphers either), but once I test the module and get it working I'll post it on my SourceForge page. As of now I have a command line tool I am very happy with (was posted, but I took it off for now until I restructure how I do my releases). I'll let you know when I post the module.
ta0kira

kalloc 04-13-2011 03:39 PM

Cipher module
 
CAn you post your cipher module to help me understand how to write one to be included as kernel module to allow my network data to be encrypted using the custom cipher algo. i am in great urgency.. as i am doing my master thesis and wanted to do something similar

Quote:

Originally Posted by ta0kira (Post 1759915)
I looked in the kernel source directory in the crypto folder and modeled something after twofish.c. I also looked at crypto.h. All I really wanted out of it was the module structure and the registering process for a cipher. I have my own encryption algorithm that I always wanted to use to encrypt an entire device or a mountable disk image, so I decided to make a module out of it. I am currently trying to get losetup to work (doesn't work with any of the standard ciphers either), but once I test the module and get it working I'll post it on my SourceForge page. As of now I have a command line tool I am very happy with (was posted, but I took it off for now until I restructure how I do my releases). I'll let you know when I post the module.
ta0kira


ta0kira 06-19-2011 10:43 PM

Quote:

Originally Posted by kalloc (Post 4323749)
CAn you post your cipher module to help me understand how to write one to be included as kernel module to allow my network data to be encrypted using the custom cipher algo. i am in great urgency.. as i am doing my master thesis and wanted to do something similar

I hope your thesis didn't depend on me responding. I appreciate your interest, but I'm not sure where the code is, it was probably written for a 2.4 kernel, and this was my only kernel-programming experience (i.e. not a good example for others.) I can't say I learned how to write encryption modules; I merely hacked some of the existing modules until I was able to loop, mkfs, and mount with my own cipher inserted. I abandoned it permanently because my cipher required so much modification to fit the paradigm of block-device encryption that it no longer had any of the features that made it unique (except maybe a gaping hole as a result.) These are two important lessons that might save you some time:
  1. If you're thesis primarily concerns a type of cipher or a specific cipher, it might not work with block devices.
  2. If you're good at C, you'll learn just as much as I did by pulling apart some existing modules. If your thesis is related to kernels, you'll probably have an even easier time.
Kevin Barry


All times are GMT -5. The time now is 03:38 AM.