LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 04-26-2011, 05:21 PM   #1
binzhou
LQ Newbie
 
Registered: Apr 2011
Posts: 1

Rep: Reputation: 0
Linux Async Crypto APIs for hash


Hi,
I'm new to crypto APIs and have some questions about Async hash APIs since I need to write a HW crypto driver.

When use crypto_ahash_digest(request), I understand that request includes everything needed to finish the hash. But we can also use following sequence of calls instead of one step and in this case I don't know how to interpret request in each call:
crypto_ahash_init(request); crypto_ahash_update(request);
... (Multiple updates allowed?)
crypto_ahash_final(request);

And each request contains:
struct ahash_request {
struct crypto_async_request base;

unsigned int nbytes;
struct scatterlist *src;
u8 *result;

/* This field may only be used by the ahash API code. */
void *priv;

void *__ctx[] CRYPTO_MINALIGN_ATTR;
};

From test_hash() in crypto/testmgr.c, I saw the same request was passed to crypto_ahash_init(), crypto_ahash_update() and crypto_ahash_final(), which makes me confused.

Even more complicated, there is crypto_ahash_finup() and I don't know the use case of it.

Can somebody explain the right way to use the APIs and how the driver is expected to interpret each field of ahash_request data structure in crypto_ahash_xxx() call?

Many thanks,
Bin
 
  


Reply



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
Perl Hash of Hash reference query kdelover Programming 1 02-19-2011 04:47 AM
How to use kernel's crypto API inside the kernel to compute an MD5 hash ? linuxabhinav Linux - Kernel 2 05-28-2008 11:35 AM
Using hash value as key for other hash in Perl scuzzman Programming 6 02-14-2006 05:08 PM
linux crypto api saajii Programming 3 08-31-2004 09:16 PM
Windows APIs on Linux ?? sheenak Programming 2 07-02-2004 06:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 09:59 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
Open Source Consulting | Domain Registration