Crypto hardware acceleration problem with sha384 sha512

For SAMA5D2 Xplained, SAMA5D3 Xplained and SAMA5D4 Xplained

Moderator: nferre

Alexdev
Posts: 22
Joined: Thu Oct 22, 2015 9:14 am

Crypto hardware acceleration problem with sha384 sha512

Mon Nov 13, 2017 6:28 pm

Hi, all!

I am testing the Crypto hardware acceleration with sama5d3 Xplained. I think I found a problem with sha384 and sha512.

The problem comes when I try to encrypt "long" strings of text with sha384 or sha512.

I am attaching a sample program to reproduce the problem. It is based in the examples from the cyptodev repository. [https://github.com/cryptodev-linux/cryp ... ples/sha.c]

Examples of use.
./cryptodev-example long_text.txt sha1 (works)
./cryptodev-example long_text.txt sha256 (works)
./cryptodev-example short_text.txt sha384 (works)
./cryptodev-example long_text.txt sha384 (hangs)
./cryptodev-example long_text.txt sha512 (hangs)

In the last two examples, the ioctl(CIOCCRYPT) call never returns, so the application hangs. The problem does not seem to happen with the "short" text file:

"Short" text file contains: The quick brown fox jumps over the lazy dog
"Long" text file contains: The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazu dog.

I am using:
Kernel 4.9.52-linux4sam_5.7
cryptodev-1.9

Is this a known problem? Am I doing something wrong?

Thanks!
Regards!
Alex

[Edit]
I don't know why but I can't attach the files.
I upload it to google drive.
https://drive.google.com/open?id=1eVxFM ... -7x1-vRloY
blue_z
Location: USA
Posts: 1547
Joined: Thu Apr 19, 2007 10:15 pm

Re: Crypto hardware acceleration problem with sha384 sha512

Wed Nov 15, 2017 9:04 pm

Alexdev wrote:The problem comes when I try to encrypt "long" strings of text with sha384 or sha512.
Sha* is not for "encrypting" text, but rather generating a fixed-length hash or digest.

Alexdev wrote:I am attaching a sample program to reproduce the problem. It is based in the examples from the cyptodev repository. [https://github.com/cryptodev-linux/cryp ... ples/sha.c]
If you're going to modify and post code, a brief description of the changes you made would be appropriate.

Alexdev wrote:Am I doing something wrong?
Yes, you've posted buggy code to test for a possible system problem.
When I run your code, I see messages about invalid file descriptors (caused by stack corruption?) , which you apparently recklessly choose to ignore.

Regards
Alexdev
Posts: 22
Joined: Thu Oct 22, 2015 9:14 am

Re: Crypto hardware acceleration problem with sha384 sha512

Fri Nov 17, 2017 12:55 pm

Hi!
Thanks, BlueZ.
Sorry for the buggy code.

I've run another test. This time I used sha_speed.c. This test is located in the cryptodev repositories. https://github.com/cryptodev-linux/cryp ... ha_speed.c
The test remains in an infinite loop.

I think there's some problem.
Can this be easily tested if there really is a problem and be able to report it correctly?

Regards.

Return to “SAMA5 Xplained”

Who is online

Users browsing this forum: No registered users and 2 guests