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 API-NEXT v4] crypto: add new algorithms #434

Closed
wants to merge 15 commits into from

Conversation

lumag
Copy link

@lumag lumag commented Jan 27, 2018

This is a copy of #430 , incorporating changes from #428 , implementation of CCM (declared at #430) and declaration and implentation of AES-CMAC, requested by our customers. I'd like to get #422 in for TigerMoth. Otherwise we seem more or less complete.

@muvarov muvarov changed the title crypto: add new algorithms [PATCH API-NEXT v1] crypto: add new algorithms Jan 27, 2018
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 good. Most of the Checkpatch issues are false positives, but dropping the URLs will fix one "line too long" check.

If PR #422 is a pre-req it needs to have Travis issues resolved first. PR #430 can be merged first and that deleted from v2 of this patch, unless @psavol wants to withdraw it and use this PR's copy.

static crypto_test_reference_t aes_ccm_reference[] = {
/*
* AES-CCM reference from RFC 3610:
* https://tools.ietf.org/html/rfc3610#section-8
Copy link
Contributor

Choose a reason for hiding this comment

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

The RFC citation is sufficient. URLs should not be included as they tend to get stale.

/*
* Test vector from RFC 7539, sections 2.8.2, A.5:
* https://tools.ietf.org/html/rfc7539#section-2.8.2
* https://tools.ietf.org/html/rfc7539#appendix-A.5
Copy link
Contributor

Choose a reason for hiding this comment

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

The RFC citation is sufficient.

@@ -477,6 +606,244 @@ static crypto_test_reference_t aes_gmac_reference[] = {
},
};

/* Test vectors from SP800-38B / CSRC examples:
* https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Standards-and-Guidelines/documents/examples/AES_CMAC.pdf
Copy link
Contributor

Choose a reason for hiding this comment

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

The NIST SP citation is sufficient. Any reader can easily Google it if needed. URLs tend to get stale quickly, and checkpatch flags it as too long.

@lumag
Copy link
Author

lumag commented Jan 27, 2018

#422 is not a prereq.
I will update PR, dropping URLs

@muvarov muvarov changed the title [PATCH API-NEXT v1] crypto: add new algorithms [PATCH API-NEXT v2] crypto: add new algorithms Jan 28, 2018
@codecov
Copy link

codecov bot commented Jan 28, 2018

Codecov Report

❗ No coverage uploaded for pull request base (api-next@5718327). Click here to learn what that means.
The diff coverage is 73.89%.

@@             Coverage Diff              @@
##             api-next      #434   +/-   ##
============================================
  Coverage            ?   78.463%           
============================================
  Files               ?       196           
  Lines               ?     35308           
  Branches            ?         0           
============================================
  Hits                ?     27704           
  Misses              ?      7604           
  Partials            ?         0
Impacted Files Coverage Δ
test/validation/api/ipsec/ipsec_test_in.c 97.746% <0%> (ø)
test/validation/api/ipsec/ipsec_test_out.c 95.435% <0%> (ø)
platform/linux-generic/odp_ipsec_sad.c 78.223% <0%> (ø)
test/validation/api/ipsec/ipsec.c 79.191% <50%> (ø)
test/validation/api/crypto/odp_crypto_test_inp.c 77.858% <77.858%> (ø)

@Bill-Fischofer-Linaro
Copy link
Contributor

Remaining checkpatch issues are false positives.

@lumag
Copy link
Author

lumag commented Jan 30, 2018

@muvarov I'll refresh this PR after #436 is merged

@muvarov muvarov changed the title [PATCH API-NEXT v2] crypto: add new algorithms [PATCH API-NEXT v3] crypto: add new algorithms Jan 30, 2018
@muvarov
Copy link
Contributor

muvarov commented Jan 30, 2018

#436 is merged. You can refresh this one.

Dmitry Eremin-Solenikov added 7 commits January 30, 2018 19:09
Add enumeration for AES CMAC authentication algorithm.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
ChaCha20-Poly1305 is a promising AEAD algorithm. Add decarations to
support it.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
Merge f925f10 changed EOL to DOS
convention in this file. Change it back.

Fixes: f925f10
Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
Checking that cipher is not NULL was required because GMAC used NULL
cipher to specify it's IV. Now it is obosolete, as auths has their own
IV.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
Merge defines for AES-CBC/CTR/GCM keys.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
Neither RFC 3610 nor SP 800-38C contains test vectors for 192 and 256
bit keys and none contains test vectors for 11-bit IV (used in IPsec).
So I've used 1st test vector from RFC 3610 and generated the rest of
test vectors.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
Dmitry Eremin-Solenikov added 8 commits January 30, 2018 19:09
Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
Drop crypto_kind_t, unused now.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
OpenSSL >= 1.1.0 supports ChaCha20-Poly1305 AEAD cipher, so let's
support it in linux-generic.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
AES-CCM support in OpenSSL is quite unique: it requires whole data to be
passed in single EVP_EncryptUpdate/EVP_DecryptUpdate call. Supporting
this requires copying data back-and-forth between packet and temporary
buffer.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
Point that current authentication functions use HMAC by including hmac
in their names.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
Support IPsec ChaCha20-Poly1305 on top of linux-generic's crypto
support.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
@muvarov muvarov changed the title [PATCH API-NEXT v3] crypto: add new algorithms [PATCH API-NEXT v4] crypto: add new algorithms Jan 30, 2018
@lumag
Copy link
Author

lumag commented Jan 30, 2018

@muvarov @psavol rebased. Please review.

Copy link
Collaborator

@psavol psavol left a comment

Choose a reason for hiding this comment

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

API modifications OK.

Reviewed-by: Petri Savolainen petri.savolainen@linaro.org

@muvarov
Copy link
Contributor

muvarov commented Feb 2, 2018

Merged.

@muvarov muvarov closed this Feb 2, 2018
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.

None yet

4 participants