Skip to content

Add zynqmp AES support#86

Open
victor-dumas wants to merge 1 commit intocryptodev-linux:masterfrom
victor-dumas:zynqmpAES
Open

Add zynqmp AES support#86
victor-dumas wants to merge 1 commit intocryptodev-linux:masterfrom
victor-dumas:zynqmpAES

Conversation

@victor-dumas
Copy link
Copy Markdown

Add ioctl cipher for Xilinx zynqmp AES HW accelerator support. Cryptodev is 5 times faster than the Xilinx's proposed "legacy" solution (AF_ALG).

stream = 1;
aead = 1;
break;
case CRYPTO_ZYNQMP_AES_GCM:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is a dedicated (vendor-specific) ioctl required? Isn't the generic gcm(aes) ioctl working for you?

Copy link
Copy Markdown
Author

@victor-dumas victor-dumas Jul 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because the generic gcm(aes) ioctl is defined with higher priority(300) than the HW accelerated one(200). And the HW accelerated one has the same generic name. So there is no way to select the vendor specific one unless I'm mistaken ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First of all, I would check why this happens - in theory, HW-accelerated version should have a higher priority. Is there a specific reason why the Linux kernel developers defined the priorities this way?

Besides this, Linux kernel provides an interface that allows user space to change crypto algorithms' priority dynamically (at runtime). Linux kernel needs to be compiled with CONFIG_CRYPTO_USER=y/m. You could try using "crconf" - the Linux crypto layer configuration tool (https://sourceforge.net/projects/crconf) to change priorities, though I am not sure it's still in sync with the kernel (IIRC it uses some of kernel's internal headers).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why they set the priority lower than the software version. Maybe because the HW-accelerated one is slower ? It is still useful as it frees up cycles for the CPU.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO cryptodev is not the right place to implement policies in general, in this case setting / altering crypto algorithms' priorities.

You could ask on the linux-crypto mailing list or send a patch / RFC. This should clarify why priorities are set up as they are today and whether a change is acceptable.
If this is not viable, then use the 2nd option - a user-space tool to configure priorities at runtime.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@horiag @victor-dumas We'll have to see what's the right approach here but it seems Linux is already establishing policies - for good or worse- with its algorithm priorities

@horia, can you investigate the usability status of this third-party tool so we can direct people to it?
@victor-dumas please ask linux-crypto mailinglist to comment on this priority issue so we know their position in the future.

I understand it's not exactly zero work on top of a three line patch but with the right answers we'll be in better position to justify a direction. Thank you all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants