Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PATCH v6] API: Crypto API additions #1910

Merged
merged 8 commits into from
Oct 20, 2023

Conversation

JannePeltonen
Copy link
Collaborator

api: crypto: clarify packet ordering of async crypto ops
api: crypto: add null_crypto crypto op flag for skipping crypto
api: crypto: allow both basic and out-of-place ops in one session

@odpbuild odpbuild changed the title API: Crypto API additions [PATCH v1] API: Crypto API additions Sep 19, 2023
include/odp/api/spec/crypto.h Show resolved Hide resolved
@@ -296,6 +296,17 @@ int odp_crypto_op(const odp_packet_t pkt_in[],
* All arrays should be of num_pkt size, except that pkt_out parameter
* is ignored when the crypto operation type is ODP_CRYPTO_OP_TYPE_BASIC.
*
* From packet ordering perspective this function behaves as if each input
* packet was enqueued to a crypto session specific ODP queue in the order
* the packets appear in the parameter array. The conceptial session input
Copy link
Collaborator

Choose a reason for hiding this comment

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

Typo: "conceptial".

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

v2

*
* This flag cannot be set when op_mode is ODP_CRYPTO_SYNC.
*
* The default value is false,
Copy link
Collaborator

Choose a reason for hiding this comment

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

"," -> "."

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

v2

@@ -801,6 +815,14 @@ typedef struct odp_crypto_packet_op_param_t {
*/
int32_t dst_offset_shift;

/** Use null crypto algorithms
*
* Process packet using the null cipher and null auth algorithm
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this mean memcpy need to be done based on ranges?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, just like when you do not have the null_crypto flag set but have configured the session with null crypto.

@odpbuild odpbuild changed the title [PATCH v1] API: Crypto API additions [PATCH v2] API: Crypto API additions Oct 2, 2023
@JannePeltonen
Copy link
Collaborator Author

v2: fixed typos and reworded one sentence (...f.lag cannot be set... --> ...flag must be set false...).

@odpbuild odpbuild changed the title [PATCH v2] API: Crypto API additions [PATCH v3] API: Crypto API additions Oct 9, 2023
@JannePeltonen
Copy link
Collaborator Author

v3: added validation tests and implementation

@MatiasElo MatiasElo added the API next API change for next release label Oct 18, 2023
@odpbuild odpbuild changed the title [PATCH v3] API: Crypto API additions [PATCH v4] API: Crypto API additions Oct 18, 2023
@JannePeltonen
Copy link
Collaborator Author

v4: rebased

@anoobj
Copy link
Contributor

anoobj commented Oct 19, 2023

ODP spec changes look good.

Reviewed-by: Anoob Joseph anoobj@marvell.com

@odpbuild odpbuild changed the title [PATCH v4] API: Crypto API additions [PATCH v5] API: Crypto API additions Oct 19, 2023
@JannePeltonen JannePeltonen added API Ready API change ready to be merged (with the next API version increment) and removed API next API change for next release labels Oct 19, 2023
Specify that packet order is preserved within one async crypto session but
not between sessions. Specify that ordering is as if there was a session
specific input queue to async crypto and then rely on generic ordering
rules regarding queue enqueue without trying to specify the rules here.

Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
Reviewed-by: Anoob Joseph <anoobj@marvell.com>
Add a crypto operation parameter that tells that a packet should be
processed as if the configured algorithms were the null cipher and null
auth algorithm. This makes it possible to direct packets that do not
require crypto through the same crypto session as packets that require
the crypto configured in the session. That in turn may be useful in
preserving packet order between those packets as there are ordering
guarantees in async crypto only within the same crypto session.

Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
Reviewed-by: Anoob Joseph <anoobj@marvell.com>
Add support for the null_crypto crypto operation parameter.

Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
Veridy that the null_crypto flag causes crypto to be skipped when
null_crypto is enabled at session creation and that the flag has no
effect otherwise.

Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
Add a default case in a switch statement looking at crypto op types.
This avoids a compilation failure due to -Wswitch and -Werror if a new
crypto operation type is added in ODP API.

Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
Introduce ODP_CRYPTO_OP_TYPE_BASIC_AND_OOP crypto operation type that
allows both basic and out-of-place operations in the same session.
The actual operation type applied depends on whether an output packet
is specified.

This can be useful for applications that want to perform both basic
and out-of-place operations with the same crypto and cannot have two
different sessions due to memory pressure or packet ordering constraints.

Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
Reviewed-by: Anoob Joseph <anoobj@marvell.com>
Implement the BASIC_AND_OOP crypto op type which allows both basic
and out-of-place operations with the same session. Add the support
only for the openssl crypto module as that is now the only one which
supports out-of-place crypto.

Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
Test session created with the ODP_CRYPTO_OP_TYPE_BASIC_AND_OOP operation
type with both basic and out-of-place operatons.

Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
@odpbuild odpbuild changed the title [PATCH v5] API: Crypto API additions [PATCH v6] API: Crypto API additions Oct 20, 2023
@MatiasElo MatiasElo enabled auto-merge (rebase) October 20, 2023 11:47
@MatiasElo MatiasElo merged commit ab21193 into OpenDataPlane:master Oct 20, 2023
174 checks passed
@JannePeltonen JannePeltonen deleted the crypto-ordering branch October 24, 2023 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Ready API change ready to be merged (with the next API version increment)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants