Commit graph

10690 commits

Author SHA1 Message Date
Adam Langley
a2eef41993 AEAD Tests.
Add tests for AEAD functions: AES-128-GCM, AES-256-GCM and
ChaCha20+Poly1305.
2013-10-01 15:34:44 -04:00
Adam Langley
9a8646510b chacha20poly1305
Add support for Chacha20 + Poly1305.
2013-10-01 14:59:22 -04:00
Adam Langley
fa03d0117a Use AEAD for AES-GCM.
Switches AES-GCM ciphersuites to use AEAD interfaces.
2013-10-01 13:09:12 -04:00
Adam Langley
03614034e9 AEAD support in ssl/
This change allows AEADs to be used in ssl/ to implement SSL/TLS
ciphersuites.
2013-10-01 12:49:50 -04:00
Adam Langley
444b1d416b AEAD support.
This change adds an AEAD interface to EVP and an AES-GCM implementation
suitable for use in TLS.
2013-10-01 12:30:52 -04:00
Adam Langley
4055ca1f9e Rework tls1_change_cipher_state.
The previous version of the function made adding AEAD changes very
difficult. This change should be a semantic no-op - it should be purely
a cleanup.
2013-10-01 11:31:30 -04:00
Ben Laurie
7a216dfee5 Constification. 2013-10-01 14:51:04 +01:00
Dr. Stephen Henson
a78b21fc67 Update cms docs.
(cherry picked from commit dfcb42c68e)
2013-10-01 14:01:19 +01:00
Ben Laurie
a808002bc3 Correctly test for no-ec.
(cherry picked from commit d5605699a1)
2013-10-01 14:01:19 +01:00
Dr. Stephen Henson
2fc368c111 Don't run ECDH CMS tests if EC disabled.
(cherry picked from commit b85f8afe37)
2013-10-01 14:01:18 +01:00
Dr. Stephen Henson
6ed3af7d50 Add X9.42 DH test.
(cherry picked from commit bbc098ffb3)
2013-10-01 14:01:18 +01:00
Dr. Stephen Henson
d037e0d30c New CMS tests.
Add some ECDH CMS tests.
(cherry picked from commit 5cdc25a754)
2013-10-01 14:01:18 +01:00
Dr. Stephen Henson
51cb950904 Add X9.42 DH certificate to S/MIME test
(cherry picked from commit 75787fd833)
2013-10-01 14:01:18 +01:00
Dr. Stephen Henson
4bfa88bb4c Scripts to recreate S/MIME test certificates.
Add a script to generate keys and certificates for the S/MIME and CMS
tests.

Update certificates and add EC examples.
(cherry picked from commit a0957d5505)
2013-10-01 14:01:18 +01:00
Dr. Stephen Henson
9d1e475db6 Custom key wrap option for cms utility.
(cherry picked from commit 5711885a2b)
2013-10-01 14:01:18 +01:00
Dr. Stephen Henson
3e792793f6 add cofactor ECDH support from fips branch
(cherry picked from commit a3a2e3a43d)
2013-10-01 14:01:18 +01:00
Ben Laurie
ac5cb33356 Fix compile errors.
(cherry picked from commit a0aaa5660a)
2013-10-01 14:01:18 +01:00
Dr. Stephen Henson
aaf74259ec CMS RFC2631 X9.42 DH enveloped data support.
(cherry picked from commit bd59f2b91d)

Conflicts:

	crypto/dh/dh.h
	crypto/dh/dh_err.c

Sync error codes with 1.0.1.
2013-10-01 14:01:18 +01:00
Dr. Stephen Henson
ecf9ceb90d Minor optimisation to KDF algorithm.
Don't need to use temporary buffer if remaining length equals digest length.
(cherry picked from commit 3f6b6f0b8c)
2013-10-01 14:01:18 +01:00
Dr. Stephen Henson
5c4ff8ad37 Add KDF for DH.
Add X9.42 DH KDF. Move sharedinfo generation code to CMS library as the
same structure is used by DH and ECDH.

Move ASN1_OBJECT typedef to ossl_typ.h so it can be picked up by dh headers
without the need to use ASN1.
(cherry picked from commit dc1ce3bc64)
2013-10-01 14:01:18 +01:00
Dr. Stephen Henson
dc427fc8e2 Return correct enveloped data type in ASN1 methods.
For RSA and DSA keys return an appropriate RecipientInfo type. By setting
CMS_RECIPINFO_NONE for DSA keys an appropriate error is returned if
an attempt is made to use DSA with enveloped data.
(cherry picked from commit 41b920ef01)
2013-10-01 14:01:18 +01:00
Dr. Stephen Henson
e1e6c4dae7 Algorithm parameter support.
Check and set AlgorithmIdenfier parameters for key wrap algorithms.
Currently these just set parameters to NULL.
(cherry picked from commit e61f5d55bc)
2013-10-01 14:01:18 +01:00
Dr. Stephen Henson
1747fd1cc6 Add support for ECDH KARI.
Add support for ECDH in enveloped data. The CMS ctrls for the EC ASN1
method decode/encode the appropriate parameters from the CMS ASN1 data
and send appropriate data to the EC public key method.
(cherry picked from commit 88e20b8584)
2013-10-01 14:01:18 +01:00
Dr. Stephen Henson
a119822b90 Add support for X9.62 KDF.
Add X9.62 KDF to EC EVP_PKEY_METHOD.
(cherry picked from commit 25af7a5dbc)
2013-10-01 14:01:18 +01:00
Dr. Stephen Henson
8c798690ce CMS support for key agreeement recipient info.
Add hooks to support key agreement recipient info type (KARI) using
algorithm specific code in the relevant public key ASN1 method.
(cherry picked from commit 17c2764d2e)
2013-10-01 14:01:18 +01:00
Dr. Stephen Henson
ea6bf26657 Add new CMS tests.
Add new tests to cms-test.pl covering PSS and OAEP.
(cherry picked from commit 32b18e0338)
2013-10-01 14:01:18 +01:00
Dr. Stephen Henson
4a26fd6e3b Add -keyopt option to cms utility.
Add support for custom public key parameters in the cms utility using
the -keyopt switch. Works for -sign and also -encrypt if -recip is used.
(cherry picked from commit 02498cc885)
2013-10-01 14:01:18 +01:00
Dr. Stephen Henson
dddb38834e Update cms docs.
Document use of -keyopt to use RSA-PSS and RSA-OAEP modes.
(cherry picked from commit 4bf4a6501c)
2013-10-01 14:01:18 +01:00
Dr. Stephen Henson
af7d6b936b CMS RSA-OAEP and RSA-PSS support.
Extend RSA ASN1 method to support CMS PSS signatures for both sign
and verify.

For signing the EVP_PKEY_CTX parameters are read and the appropriate
CMS structures set up.

For verification the CMS structures are analysed and the corresponding
parameters in the EVP_PKEY_CTX set.

Also add RSA-OAEP support.

For encrypt the EVP_PKEY_CTX parameters are used.

For decrypt the CMS structure is uses to set the appropriate EVP_PKEY_CTX
parameters.
(cherry picked from commit 0574cadf85)

Also sync error codes with OpenSSL 1.0.1 and add new ones.
2013-10-01 14:01:18 +01:00
Dr. Stephen Henson
a64b8786b5 Update to OAEP support.
Add OAEP ctrls to retrieve MD and label. Return errors if
an attempt is made to set or retrieve OAEP parameters when
padding mode is not OAEP.
(cherry picked from commit 211a14f627)
2013-10-01 14:01:17 +01:00
Dr. Stephen Henson
25f93585a7 Exetended OAEP support.
Extend OAEP support. Generalise the OAEP padding functions to support
arbitrary digests. Extend EVP_PKEY RSA method to handle the new OAEP
padding functions and add ctrls to set the additional parameters.
(cherry picked from commit 271fef0ef3)

Conflicts:

	CHANGES
2013-10-01 14:01:17 +01:00
Dr. Stephen Henson
0d5a49e150 Add FIPS RSA error code.
Add some RSA error codes used by the FIPS module.
2013-10-01 14:01:17 +01:00
Dr. Stephen Henson
5c49a98c5e Set CMS EnvelopedData version correctly.
(cherry picked from commit ff7b6ce9db)
2013-10-01 14:01:17 +01:00
Dr. Stephen Henson
869772ff08 Initialise CMS signature buffer length properly.
(cherry picked from commit e0f7cfda68)
2013-10-01 14:01:17 +01:00
Dr. Stephen Henson
f2edf3181e CMS public key parameter support.
Add support for customisation of CMS handling of signed and enveloped
data from custom public key parameters.

This will provide support for RSA-PSS and RSA-OAEP but could also be
applied to other algorithms.
(cherry picked from commit e365352d6a)
2013-10-01 14:01:17 +01:00
Dr. Stephen Henson
d6dc5c506a Add control to retrieve signature MD.
(cherry picked from commit 810639536c)
2013-10-01 14:01:17 +01:00
Dr. Stephen Henson
eebd5e5dd7 Add new OIDs from RFC5753
Add OIDs for KDF schemes from RFC5753 and add cross references for
each type and the appropriate digest to use.
(cherry picked from commit 6af440ced4)

Conflicts:

	crypto/objects/obj_dat.h
	crypto/objects/obj_mac.num
2013-10-01 14:01:17 +01:00
Dr. Stephen Henson
868b266451 Add new OID to pSpecified from PKCS#1
(cherry picked from commit e423c360fd)

Conflicts:

	crypto/objects/obj_dat.h
	crypto/objects/obj_mac.num
2013-10-01 14:01:17 +01:00
Dr. Stephen Henson
3fa23ff0f1 Add FIPS 186-2 DSA parameter generation algorithm.
Backport support for FIPS 186-2 DSA parameter generation from
HEAD. Redirect to FIPS in FIPS mode and workaround prototype error.
2013-10-01 14:01:17 +01:00
Dr. Stephen Henson
c275fb091e Extend DH parameter generation support.
Add support for DH parameter generation using DSA methods including
FIPS 186-3.
(cherry picked from commit 3909087801)
2013-10-01 14:01:17 +01:00
Dr. Stephen Henson
90c341c601 Enhance DH dup functions.
Make DHparams_dup work properly with X9.42 DH parameters.
(cherry picked from commit d3cc91eee2)
2013-10-01 14:01:17 +01:00
Dr. Stephen Henson
52d0e1ca4e If present print j, seed and counter values for DH
(cherry picked from commit c9577ab5ea)

Conflicts:

	crypto/dh/dh_ameth.c
2013-10-01 14:01:17 +01:00
Dr. Stephen Henson
c6f3386577 EVP support for wrapping algorithms.
Add support for key wrap algorithms via EVP interface.

Generalise AES wrap algorithm and add to modes, making existing
AES wrap algorithm a special case.

Move test code to evptests.txt
(cherry picked from commit 97cf1f6c28)

Conflicts:

	CHANGES
2013-10-01 14:01:17 +01:00
Andy Polyakov
cf65a07256 evptests.txt: add XTS test vectors
(cherry picked from commit c9a8e3d1c7)
2013-10-01 14:01:17 +01:00
Andy Polyakov
051dc9db2b evptests.txt: additional GCM test vectors.
(cherry picked from commit ca303d333b)
2013-10-01 14:01:17 +01:00
Ben Laurie
93a886b45a Fix warnings.
(cherry picked from commit 282a480a35)
2013-10-01 14:01:17 +01:00
Dr. Stephen Henson
ec19082ecc GCM and CCM test support
Add code to support GCM an CCM modes in evp_test. On encrypt this
will compare the expected ciphertext and tag. On decrypt it will
compare the expected plaintext: tag comparison is done internally.

Add a simple CCM test case and convert all tests from crypto/modes/gcm128.c
(cherry picked from commit 15652f9825)
2013-10-01 14:01:17 +01:00
Dr. Stephen Henson
0eff7c7c88 Add CCM ciphers to tables.
(cherry picked from commit 95248de327)
2013-10-01 14:01:17 +01:00
Dr. Stephen Henson
6c4b3514d7 New SP 800-56A compliant version of DH_compute_key().
(cherry picked from commit bc91494e06)
2013-10-01 14:01:17 +01:00
Dr. Stephen Henson
d84cca7447 Typo.
(cherry picked from commit 415ece7301)
2013-10-01 14:01:16 +01:00