Re: [Ocf-linux-users] Computing SHA1 for large files
Brought to you by:
david-m
From: Ajay M. <aj...@sy...> - 2012-06-20 17:08:55
|
Thanks David. As it turns out, I am unable to use OpenSSL for this purpose. An example of how to SHA1 for large files would be great help. I have looked at OpenSSL code eng_cryptodev.c, it seems to buffer up the data and make one ioctl call (depending on EVP_MD_CTX_FLAG_ONESHOT flag) -- which doesn't make much sense to me. Thanks! --ajay -----Original Message----- From: David McCullough [mailto:dav...@mc...] Sent: Tuesday, June 19, 2012 6:02 PM To: Ajay Matai Cc: ocf...@li... Subject: Re: [Ocf-linux-users] Computing SHA1 for large files Jivin Ajay Matai lays it down ... > Thanks David. > > Openssl is definitely an option and I think, a good suggestion. > > Out of curiosity, I am wondering what would be involved working with OCF framework directly. > Just a gist would do. I honestly don't know and would have to go look at some code and figure it out, so I pass on that for now ;-) In theory you could dig out the code from openssl as an example. You will need to enable cryptodev digests in openssl to get OCF acceleration. The general rule is that user space acceleration of hashes is not worth the cost, so it is disabled by default. Its a config options to openssl, check the OCF doc, it should be in there, Cheers, Davidm > -----Original Message----- > From: David McCullough [mailto:dav...@mc...] > Sent: Tuesday, June 19, 2012 5:27 PM > To: Ajay Matai > Cc: ocf...@li... > Subject: Re: [Ocf-linux-users] Computing SHA1 for large files > > > Jivin Ajay Matai lays it down ... > > Hello, > > I am a beginner at OCF interface. I have been trying to compute SHA1 hash for a large file (say 2GB). > > > > I thought, I could read the file say 8192 sized block at a time, call CIOCCRYPT with updated buffer. > > In the end, call CIOCCRYPT one last time with src=NULL and len=0. > > I should be able to get the mac back in the buffer pointed by mac. > > > > Tried it but this doesn't seem to work. What is the right way of working with large files and OCF framework. > > > > I know very basic question but any amount of googling and stack-overflowing didn't help. > > I would recommend you use openssl (libcrpyto) to do this using the published openssl API's. Unless you are on a very resource constrained device which cannot afford to have openssl installed that is. > > The openssl API's are better documented, will let your application run on multiple different HW accelerated solutions including OCF, so it gives you a good plan going forward. > > You will need to load the cryptodev driver to use OCF with openssl. > > If openssl isn't an options let us know and I'll see what I can dig up > in way of an example talking directly to OCF, > > Cheers, > Davidm > > > -- > David McCullough, dav...@mc..., Ph:+61 734352815 > McAfee - SnapGear http://www.mcafee.com http://www.uCdot.org > > -- David McCullough, dav...@mc..., Ph:+61 734352815 McAfee - SnapGear http://www.mcafee.com http://www.uCdot.org |