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

session->minor_ver is never populated #273

Open
zhihan opened this issue May 26, 2021 · 6 comments
Open

session->minor_ver is never populated #273

zhihan opened this issue May 26, 2021 · 6 comments

Comments

@zhihan
Copy link

zhihan commented May 26, 2021

It seems to me that session->minor_ver is never populated. When we disable TLS 1.2 and below, I am hitting this error.

@zhihan
Copy link
Author

zhihan commented May 26, 2021

I think I should add a line below this statement , but the comment looks a little concerning.

@zhihan
Copy link
Author

zhihan commented May 27, 2021

I think the long term solution is to parse the session header and get the version fields from the headers. If omitting headers, it is assumed that the serialized data matches the default versions. Let me know if my understanding is wrong.

@hanno-becker
Copy link
Collaborator

I think the long term solution is to parse the session header and get the version fields from the headers. If omitting headers, it is assumed that the serialized data matches the default versions. Let me know if my understanding is wrong.

That's right @zhihan - we need to add a version specifier to serialized session data.

@hanno-becker
Copy link
Collaborator

hanno-becker commented Jul 22, 2021

I think when supporting 1.2 and 1.3 alongside each other, we require a serialized session format along the following lines:

/*
 * Serialize a session in the following format:
 * (in the presentation language of TLS, RFC 8446 section 3)
 *
 *  struct {
 *
 *    opaque mbedtls_version[3];   // major, minor, patch
 *    opaque session_format[2];    // version-specific 16-bit field determining
 *                                 // the format of the remaining
 *                                 // serialized data.
 *  
 *          Note: When updating the format, remember to keep
 *          these version+format bytes.
 *  
 *                                 // In this version, `session_format` determines
 *                                 // the setting of those compile-time
 *                                 // configuration options which influence
 *                                 // the structure of mbedtls_ssl_session.
 *  
 *    uint8_t minor_ver;           // Possible values:
 *                                 // - TLS 1.2 (MBEDTLS_SSL_MINOR_VERSION_3) 
 *                                 // - TLS 1.3 (MBEDTLS_SSL_MINOR_VERSION_4) 
 *   
 *    select (serialized_session.minor_ver) {
 *
 *      case MBEDTLS_SSL_MINOR_VERSION_3: // TLS 1.2
 *        uint64 start_time;
 *        uint8 ciphersuite[2];           // defined by the standard
 *        uint8 compression;              // 0 or 1
 *        uint8 session_id_len;           // at most 32
 *        opaque session_id[32];
 *        opaque master[48];              // fixed length in the standard
 *        uint32 verify_result;
 *        opaque peer_cert<0..2^24-1>;    // length 0 means no peer cert
 *        opaque ticket<0..2^24-1>;       // length 0 means no ticket
 *        uint32 ticket_lifetime;
 *        uint8 mfl_code;                 // up to 255 according to standard
 *        uint8 trunc_hmac;               // 0 or 1
 *        uint8 encrypt_then_mac;         // 0 or 1
 *
 *      case MBEDTLS_SSL_MINOR_VERSION_4: // TLS 1.3
 *        uint64 start_time;
 *        uint8 ciphersuite[2];
 *        uint32 ticket_lifetime;
 *        uint32 ticket_age_add;
 *        uint8 ticket_flags;
 *        opaque resumption_key<0..255>;
 *        opaque ticket<0..2^16-1>;
 *
 *   };
 *  
 * } serialized_session;
 * 
 */

@hanno-becker
Copy link
Collaborator

I created Mbed-TLS#4802 to track the necessary preparation on upstream Mbed TLS.

@hanno-becker
Copy link
Collaborator

ARMmbed#4802 has been merged. We can close this after the next merge of development into tls13-prototype

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 a pull request may close this issue.

2 participants