diff options
author | lloyd <[email protected]> | 2012-06-10 12:11:53 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2012-06-10 12:11:53 +0000 |
commit | 657ffc49505fa1b5ec675f2be22e8a8a15fd8918 (patch) | |
tree | 644af596d68fa316d68c732dee20980fe62ed21f /src/tls | |
parent | 972629873d6c32055d75c2340faea1c8b0572467 (diff) |
Add Handshake_Type codes for RFC 6066 handshake types.
Change the switch in bitmask_for_handshake_type to not have a default:
branch, so GCC can warn if we are missing a type. Instead throw if
the switch failed to return.
Diffstat (limited to 'src/tls')
-rw-r--r-- | src/tls/tls_handshake_state.cpp | 43 | ||||
-rw-r--r-- | src/tls/tls_magic.h | 3 |
2 files changed, 27 insertions, 19 deletions
diff --git a/src/tls/tls_handshake_state.cpp b/src/tls/tls_handshake_state.cpp index 8b06facc3..481e16e0d 100644 --- a/src/tls/tls_handshake_state.cpp +++ b/src/tls/tls_handshake_state.cpp @@ -20,59 +20,64 @@ u32bit bitmask_for_handshake_type(Handshake_Type type) { switch(type) { - case HELLO_REQUEST: + case HELLO_VERIFY_REQUEST: return (1 << 0); + case HELLO_REQUEST: + return (1 << 1); + /* * Same code point for both client hello styles */ case CLIENT_HELLO: case CLIENT_HELLO_SSLV2: - return (1 << 1); + return (1 << 2); case SERVER_HELLO: - return (1 << 2); + return (1 << 3); case CERTIFICATE: - return (1 << 3); + return (1 << 4); + + case CERTIFICATE_URL: + return (1 << 5); + + case CERTIFICATE_STATUS: + return (1 << 6); case SERVER_KEX: - return (1 << 4); + return (1 << 7); case CERTIFICATE_REQUEST: - return (1 << 5); + return (1 << 8); case SERVER_HELLO_DONE: - return (1 << 6); + return (1 << 9); case CERTIFICATE_VERIFY: - return (1 << 7); + return (1 << 10); case CLIENT_KEX: - return (1 << 8); + return (1 << 11); case NEXT_PROTOCOL: - return (1 << 9); + return (1 << 12); case NEW_SESSION_TICKET: - return (1 << 10); + return (1 << 13); case HANDSHAKE_CCS: - return (1 << 11); + return (1 << 14); case FINISHED: - return (1 << 12); + return (1 << 15); // allow explicitly disabling new handshakes case HANDSHAKE_NONE: return 0; - - default: - throw Internal_Error("Unknown handshake type " + - std::to_string(type)); } - return 0; + throw Internal_Error("Unknown handshake type " + std::to_string(type)); } } @@ -126,7 +131,7 @@ void Handshake_State::confirm_transition_to(Handshake_Type handshake_msg) throw Unexpected_Message("Unexpected state transition in handshake, got " + std::to_string(handshake_msg) + " expected " + std::to_string(hand_expecting_mask) + - " recveived " + std::to_string(hand_received_mask)); + " received " + std::to_string(hand_received_mask)); /* We don't know what to expect next, so force a call to set_expected_next; if it doesn't happen, the next transition diff --git a/src/tls/tls_magic.h b/src/tls/tls_magic.h index 2972321c9..0a097a6b8 100644 --- a/src/tls/tls_magic.h +++ b/src/tls/tls_magic.h @@ -51,6 +51,9 @@ enum Handshake_Type { CLIENT_KEX = 16, FINISHED = 20, + CERTIFICATE_URL = 21, + CERTIFICATE_STATUS = 22, + NEXT_PROTOCOL = 67, HANDSHAKE_CCS = 254, // Not a wire value |