Skip to contentSkip to conversation

Testing the geode-aes driver with the tcrypt module completely freezes the machine

DISCUSSION Martin Schiller 4 participants 7 messages May 3, 2007 Crypto API

lore
Share & tools
lore
#0 lore raw
Quoted 1 line · Evgeniy Polyakov

Hi Martin.

Hi Evgeniy

Quoted 3 lines
Quoted 3 lines

Sorry for my late answer, but I didn't get your message because I haven't subscribed to the mailing-list.
I've "found" it yesterday on the mailing-list archive. So please, could

you

Quoted 5 lines
Quoted 1 line

reply directly to me and to the mailing-list on any further messages?

I did, but your mail server bounced message.
This message is also sent to you directly, hope it will pass through. Btw, AMD list bounces too.

It didn't, but I talked to our mail server admin and now your mails should reach me. :-)

After adding the debug outputs from your last patch, none of them was displayed.
So I started adding some more outputs and doing a "line-by-line" debugging and found out this (so far):

The freeze is the result of an invinite while-loop in the function geode_ecb_encrypt()
(and maybe also in the geode_ecb_decrypt()).

The cause for this seems to be, that the op->src == op->dst whereby the geode_aes_crypt() function does nothing at all,
and so the value of nbytes will never be changed.

Regards,
Martin

-------------------------------------------

Martin Schiller
Dipl.-Inf. FH
Entwicklung / Development

T.D.T. Transfer Data Test GmbH
Siemensstrasse 18
Gewerbegebiet Altheim
84051 Essenbach
Germany

[email protected]
www.tdt.de

tel: +49 8703 929 00
fax: +49 8703 929 201

Geschäftsführer: Elisabeth Pickhardt & Michael Pickhardt Registergericht Landshut, HRB: 1193

#1 lore raw
Quoted 7 lines · Martin Schiller

The freeze is the result of an invinite while-loop in the function geode_ecb_encrypt()
(and maybe also in the geode_ecb_decrypt()).

The cause for this seems to be, that the op->src == op->dst whereby the geode_aes_crypt() function does nothing at all,
and so the value of nbytes will never be changed.

Hm, driver does not perform encryption in-place at all. Since we did not hear from AMD quite for a while, could you please remove src==dst check in geode_aes_crypt() and run tests again. If it is software protection against hardware bug, I doubt such hardware should be used at all...

Quoted 2 lines

Regards,
Martin

Signature · 1 line
	Evgeniy Polyakov
maintainer
#2 lore raw
Quoted 6 lines · Evgeniy Polyakov

Hm, driver does not perform encryption in-place at all. Since we did not hear from AMD quite for a while, could you please remove src==dst check in geode_aes_crypt() and run tests again. If it is software protection against hardware bug, I doubt such hardware should be used at all...

I agree. Jordan, could you please see if this can be fixed up?

Cheers,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#5 lore raw
In reply to Evgeniy Polyakov
Quoted 9 lines · Evgeniy Polyakov
Quoted 6 lines · Martin Schiller

The freeze is the result of an invinite while-loop in the function geode_ecb_encrypt() (and maybe also in the geode_ecb_decrypt()).

The cause for this seems to be, that the op->src == op->dst whereby the geode_aes_crypt() function does nothing at all, and so the value of nbytes will never be changed.

Quoted 6 lines

Hm, driver does not perform encryption in-place at all. Since we did not hear from AMD quite for a while, could you please remove src==dst check in geode_aes_crypt() and run tests again. If it is software protection against hardware bug, I doubt such hardware should be used at all...

Removing the src==dst check solves the freeze problem, but the encryption/decryption results are wrong:

Encryption:
Should be: 69c4e0d86a7b0430d8cdb78070b4c55a
But is: c8a331ff8edd3db175e1545dbefb760b

Decryption:
Should be: 00112233445566778899aabbccddeeff
But is: 69c4e0d86a7b0430d8cdb78070b4c55a (same as input)

Regards,
Martin

#3 lore raw
In reply to Herbert Xu
Quoted 9 lines · Herbert Xu
Quoted 6 lines · Evgeniy Polyakov

Hm, driver does not perform encryption in-place at all. Since we did not hear from AMD quite for a while, could you please remove src==dst check in geode_aes_crypt() and run tests again. If it is software protection against hardware bug, I doubt such hardware should be used at all...

I agree. Jordan, could you please see if this can be fixed up?

On older versions of the chip, in-place encryption was not possible, even though there was no hardware protection against it. I can't remember if the newer chip version can handle in place encryption or not.

I missed out on the context of this thread - does the tcrypt demand in-place encryption?

Jordan

Signature · 4 lines
Jordan Crouse
Senior Linux Engineer
Advanced Micro Devices, Inc.
<www.amd.com/embeddedprocessors>
#6 lore raw
In reply to Martin Schiller
Quoted 10 lines · Martin Schiller
Quoted 6 lines

Hm, driver does not perform encryption in-place at all. Since we did not hear from AMD quite for a while, could you please remove src==dst check in geode_aes_crypt() and run tests again. If it is software protection against hardware bug, I doubt such hardware should be used at all...

Removing the src==dst check solves the freeze problem, but the encryption/decryption results are wrong:

Quoted 7 lines

Encryption:
Should be: 69c4e0d86a7b0430d8cdb78070b4c55a
But is: c8a331ff8edd3db175e1545dbefb760b

Decryption:
Should be: 00112233445566778899aabbccddeeff
But is: 69c4e0d86a7b0430d8cdb78070b4c55a (same as input)

That means that hardware does not work when source and destination addresses are the same, roughly saying it will not work with majority cases of ipsec and dm-crypt.

As a workaround one needs to allocate a buffer and copy there data and then encrypt/decrypt from buffer into destination.

Quoted 3 lines

Regards,
Martin

Signature · 1 line
	Evgeniy Polyakov
#4 lore raw
In reply to Jordan Crouse
Quoted 9 lines · Jordan Crouse
Quoted 8 lines · Herbert Xu
Quoted 6 lines · Evgeniy Polyakov

Hm, driver does not perform encryption in-place at all. Since we did not hear from AMD quite for a while, could you please remove src==dst check in geode_aes_crypt() and run tests again. If it is software protection against hardware bug, I doubt such hardware should be used at all...

Quoted 8 lines
Quoted 1 line

I agree. Jordan, could you please see if this can be fixed up?

On older versions of the chip, in-place encryption was not possible, even though there was no hardware protection against it. I can't remember if the newer chip version can handle in place encryption or not.

I missed out on the context of this thread - does the tcrypt demand in-place encryption?

Majority of the in-kernel crypto users require in-place crypto processing. The only way to fix this I see is to allocate a buffer, copy data and then perform crypto processing. But I seriously doubt it will be faster then software encryption/decryption on that processor.

Test for possibility for in-place encryption can be done in module load time and in case of failed crypto processing driver should fail into alternative (with allocation) ecryption way (at least similar check I perform in hifn module).

Quoted 1 line

Jordan

Signature · 1 line
	Evgeniy Polyakov