mbedtls/include/mbedtls
Hanno Becker f9c6a4bea1 Add pointers to in/out CID fields to mbedtls_ssl_context
mbedtls_ssl_context contains pointers in_buf, in_hdr, in_len, ...
which point to various parts of the header of an incoming TLS or
DTLS record; similarly, there are pointers out_buf, ... for
outgoing records.

This commit adds fields in_cid and out_cid which point to where
the CID of incoming/outgoing records should reside, if present,
namely prior to where the record length resides.

Quoting https://tools.ietf.org/html/draft-ietf-tls-dtls-connection-id-04:

   The DTLSInnerPlaintext value is then encrypted and the CID added to
   produce the final DTLSCiphertext.

        struct {
            ContentType special_type = tls12_cid; /* 25 */
            ProtocolVersion version;
            uint16 epoch;
            uint48 sequence_number;
            opaque cid[cid_length];               // New field
            uint16 length;
            opaque enc_content[DTLSCiphertext.length];
        } DTLSCiphertext;

For outgoing records, out_cid is set in ssl_update_out_pointers()
based on the settings in the current outgoing transform.

For incoming records, ssl_update_in_pointers() sets in_cid as if no
CID was present, and it is the responsibility of ssl_parse_record_header()
to update the field (as well as in_len, in_msg and in_iv) when parsing
records that do contain a CID. This will be done in a subsequent commit.

Finally, the code around the invocations of ssl_decrypt_buf()
and ssl_encrypt_buf() is adapted to transfer the CID from the
input/output buffer to the CID field in the internal record
structure (which is what ssl_{encrypt/decrypt}_buf() uses).

Note that mbedtls_ssl_in_hdr_len() doesn't need change because
it infers the header length as in_iv - in_hdr, which will account
for the CID for records using such.
2019-06-03 16:07:50 +01:00
..
aes.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
aesni.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
arc4.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
aria.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
asn1.h Merge remote-tracking branch 'upstream-restricted/pr/398' into development-restricted-proposed 2018-03-13 17:18:06 +01:00
asn1write.h Merge remote-tracking branch 'origin/pr/2092' into development 2019-04-24 11:17:21 +01:00
base64.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
bignum.h Merge remote-tracking branch 'origin/pr/2092' into development 2019-04-24 11:17:21 +01:00
blowfish.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
bn_mul.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
camellia.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
ccm.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
certs.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
chacha20.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
chachapoly.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
check_config.h Check static bounds of CID lengths in check_config.h 2019-06-03 14:43:16 +01:00
cipher.h Add NIST keywrap as a cipher mode 2019-04-02 10:02:55 -07:00
cipher_internal.h Adapt to the new key allocation mechanism 2019-01-08 09:36:01 -05:00
cmac.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
compat-1.3.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
config.h Add CID configuration API 2019-06-03 16:07:50 +01:00
ctr_drbg.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
debug.h Add tests for record encryption/decryption 2019-04-25 12:58:21 +01:00
des.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
dhm.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
ecdh.h Define MBEDTLS_ECDH_LEGACY_CONTEXT in config.h 2019-02-22 13:04:20 +01:00
ecdsa.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
ecjpake.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
ecp.h Make ecp_get_type public 2019-02-26 16:49:42 +00:00
ecp_internal.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
entropy.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
entropy_poll.h Update Doxygen file blocks to remove copyright and license information 2018-01-23 15:44:39 +00:00
error.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
gcm.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
havege.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
hkdf.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
hmac_drbg.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
md.h Provide standalone version of ssl_decrypt_buf 2019-04-25 12:58:21 +01:00
md2.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
md4.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
md5.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
md_internal.h Merge remote-tracking branch 'upstream-public/pr/1294' into development 2018-01-25 14:47:39 +00:00
memory_buffer_alloc.h Update Doxygen file blocks to remove copyright and license information 2018-01-23 15:44:39 +00:00
net.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
net_sockets.h Merge remote-tracking branch 'upstream-public/pr/1861' into development 2018-08-10 11:17:14 +01:00
nist_kw.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
oid.h Merge remote-tracking branch 'origin/pr/2530' into development 2019-05-20 18:02:25 +01:00
padlock.h Improve macro hygiene 2019-02-19 17:59:00 +00:00
pem.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
pk.h Documentation fixes 2019-02-05 05:06:35 -05:00
pk_internal.h Align names to use "opaque" only everywhere 2018-11-22 09:59:34 +01:00
pkcs5.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
pkcs11.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
pkcs12.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
platform.h Merge remote-tracking branch 'origin/pr/1551' into development 2019-01-30 13:24:55 +00:00
platform_time.h Update Doxygen file blocks to remove copyright and license information 2018-01-23 15:44:39 +00:00
platform_util.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
poly1305.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
psa_util.h Define maximum EC public key length depending on enabled curves 2019-02-18 17:04:24 +00:00
ripemd160.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
rsa.h Revert "Forbid passing NULL input buffers to RSA encryption routines" 2019-02-08 08:43:31 -05:00
rsa_internal.h Merge remote-tracking branch 'upstream-public/pr/1457' into development-proposed 2018-04-04 09:19:27 +02:00
sha1.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
sha256.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
sha512.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
ssl.h Add pointers to in/out CID fields to mbedtls_ssl_context 2019-06-03 16:07:50 +01:00
ssl_cache.h Remove peer CRT from cache if !MBEDTLS_SSL_KEEP_PEER_CERTIFICATE 2019-02-26 14:38:09 +00:00
ssl_ciphersuites.h Introduce helper function to determine whether suite uses server CRT 2019-02-26 14:38:09 +00:00
ssl_cookie.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
ssl_internal.h Account for additional record expansion when using CIDs 2019-06-03 16:07:50 +01:00
ssl_ticket.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00
threading.h Deprecate hardware acceleration errors 2018-11-09 15:01:07 +00:00
timing.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
version.h Update library version to 2.17.0 2019-03-19 16:12:55 +00:00
x509.h Suppport otherName of type hardware module name 2019-05-07 17:04:57 +03:00
x509_crl.h Fix #2370, minor typos and spelling mistakes 2019-01-24 10:37:40 +01:00
x509_crt.h Documentation fixes 2019-05-15 15:15:55 +03:00
x509_csr.h Improve docs for named bitstrings and their usage 2019-02-28 09:36:30 +00:00
xtea.h Merge development commit 8e76332 into development-psa 2019-01-31 08:20:20 -05:00