LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 07-18-2005, 07:11 AM   #1
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
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
 
Old 07-19-2005, 12:52 AM   #2
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 118Reputation: 118
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.
 
Old 07-19-2005, 01:41 AM   #3
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Original Poster
Rep: Reputation: Disabled
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
 
Old 07-19-2005, 08:21 AM   #4
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Original Poster
Rep: Reputation: Disabled
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
 
Old 07-19-2005, 03:39 PM   #5
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 118Reputation: 118
I'm also kinda curious what you're looking to implement, for my own personal info.
 
Old 07-22-2005, 09:27 AM   #6
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Original Poster
Rep: Reputation: Disabled
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
 
Old 04-13-2011, 04:39 PM   #7
kalloc
LQ Newbie
 
Registered: Feb 2011
Posts: 20

Rep: Reputation: 0
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 View Post
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
 
Old 06-19-2011, 11:43 PM   #8
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by kalloc View Post
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Error] Kernel Module : No kernel module build environment saman007uk Debian 7 09-09-2006 07:34 PM
Problem with writing module mohsena Programming 3 10-16-2005 10:51 AM
kernel module ignorant newbie looking for any one with kernel module knowledge cpoet Slackware 4 11-24-2003 10:37 PM
Caesar Cypher algorithm (JAVA) randomx Programming 4 10-05-2003 11:16 PM
writing to proc module dmaxj Linux - General 5 07-02-2003 10:44 AM


All times are GMT -5. The time now is 11:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration