Skip to content

[PATCH API-NEXT v1] api: crypto: deprecate per-session IV#32

Closed
lumag wants to merge 1 commit intoOpenDataPlane:api-nextfrom
lumag:crypto-no-iv
Closed

[PATCH API-NEXT v1] api: crypto: deprecate per-session IV#32
lumag wants to merge 1 commit intoOpenDataPlane:api-nextfrom
lumag:crypto-no-iv

Conversation

@lumag
Copy link

@lumag lumag commented May 17, 2017

Per-session IV (in it's current form) are static IVs used (possibly) for
several packets, and so they degradate security of genrated packets.
Instead of modifying semantics of IV wrt processed packets, etc. let's
deprecate (and in future remove) this IV altogether and enforce
applications to always specify correct IV in the per-packet operation
params.

Signed-off-by: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org

Per-session IV (in it's current form) are static IVs used (possibly) for
several packets, and so they degradate security of genrated packets.
Instead of modifying semantics of IV wrt processed packets, etc. let's
deprecate (and in future remove) this IV altogether and enforce
applications to always specify correct IV in the per-packet operation
params.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
@muvarov muvarov changed the title api: crypto: deprecate per-session IV [PATCH API-NEXT v1] api: crypto: deprecate per-session IV May 17, 2017
Copy link
Contributor

@Bill-Fischofer-Linaro Bill-Fischofer-Linaro left a comment

Choose a reason for hiding this comment

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

This looks like an important bug correction. Main suggestion is that a security bug be opened and this patch marked as a correction for it.

/* Generate an IV */
if (entry->esp.iv_len) {
int32_t size = entry->esp.iv_len;
int32_t ret = odp_random_data(esp->iv, size, 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should use enum here: ODP_RANDOM_CRYPTO

/** Cipher Initialization Vector (IV) */
odp_crypto_iv_t iv;
/** @deprecated use iv_length and per-packet IV instead */
ODP_DEPRECATE(odp_crypto_iv_t) ODP_DEPRECATE(iv);
Copy link
Contributor

Choose a reason for hiding this comment

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

Not clear why checkpatch gets confused here. It seems to think this is a cast of some sort. Another reason perhaps to simply correct this issue without deprecation.

uint32_t length;

} odp_crypto_iv_t;
} ODP_DEPRECATE(odp_crypto_iv_t);
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is really a bug correction, perhaps this should just be removed without deprecation? Why would anyone want to retain the incorrect behavior "for compatibility"?

Copy link
Author

Choose a reason for hiding this comment

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

@Bill-Fischofer-Linaro I would like to hear a word from other parties. This bug might be local to linux-generic. And there might be use cases for the IV specified at session creation time (e.g. if packets should be encrypted in one continuous stream).

Copy link
Contributor

Choose a reason for hiding this comment

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

During today's ARCH call this was discussed briefly and Nikhil pointed out that per-session IVs are useful for many cases, so deprecation may be premature, especially as we already permit per-packet IV overrides. We can continue this discussion on Monday's ARCH call if the mailing list can't reach resolution before then.

#if ODP_DEPRECATED_API
/* Copy of session IV data */
uint8_t iv_data[MAX_IV_LEN];
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

Needing an #ifdef looks ugly here and elsewhere in this series. Better to correct the code than retain "compatibility" here.

if (!((16 == session->p.iv_length) || (16 == session->p.iv.length)))
return -1;
#else
if (16 != session->p.iv_length)
Copy link
Contributor

Choose a reason for hiding this comment

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

The comment above got deleted. Magic numbers should either be enums or at least retain a comment explaining their use/significance.

@lumag lumag closed this Jun 30, 2017
@lumag lumag deleted the crypto-no-iv branch June 30, 2017 22:15
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.

3 participants