diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-04-05 12:47:03 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-04-05 14:53:44 +0200 |
commit | c29d90c528a642c3dafdb99c23b242f577a47ae2 (patch) | |
tree | a1fdfba108f74f0db2fd18eeaf94b9b0aa82d64e | |
parent | 8617e22c44cfa589a7bc7a766156f4c726700e22 (diff) | |
download | gnutls-c29d90c528a642c3dafdb99c23b242f577a47ae2.tar.gz |
handshake/record: mark with comments all expected fall-through switches
This reduces warnings from static analysers like coverity and makes
explicit the intention.
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r-- | lib/handshake.c | 71 | ||||
-rw-r--r-- | lib/record.c | 4 |
2 files changed, 41 insertions, 34 deletions
diff --git a/lib/handshake.c b/lib/handshake.c index 308c3224f7..638fcbdf03 100644 --- a/lib/handshake.c +++ b/lib/handshake.c @@ -2800,7 +2800,7 @@ static int handshake_client(gnutls_session_t session) ret = send_hello(session, AGAIN(STATE1)); STATE = STATE1; IMED_RET("send hello", ret, 1); - + /* fall through */ case STATE2: if (IS_DTLS(session)) { ret = @@ -2815,6 +2815,7 @@ static int handshake_client(gnutls_session_t session) return 1; } } + /* fall through */ case STATE3: /* receive the server hello */ ret = @@ -2823,26 +2824,26 @@ static int handshake_client(gnutls_session_t session) 0, NULL); STATE = STATE3; IMED_RET("recv hello", ret, 1); - + /* fall through */ case STATE4: ret = _gnutls_ext_sr_verify(session); STATE = STATE4; IMED_RET("recv hello", ret, 0); - + /* fall through */ case STATE5: if (session->security_parameters.do_recv_supplemental) { ret = _gnutls_recv_supplemental(session); STATE = STATE5; IMED_RET("recv supplemental", ret, 1); } - + /* fall through */ case STATE6: /* RECV CERTIFICATE */ if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */ ret = _gnutls_recv_server_certificate(session); STATE = STATE6; IMED_RET("recv server certificate", ret, 1); - + /* fall through */ case STATE7: #ifdef ENABLE_OCSP /* RECV CERTIFICATE STATUS */ @@ -2853,6 +2854,7 @@ static int handshake_client(gnutls_session_t session) STATE = STATE7; IMED_RET("recv server certificate", ret, 1); #endif + /* fall through */ case STATE8: ret = run_verify_callback(session, GNUTLS_CLIENT); STATE = STATE8; @@ -2864,7 +2866,7 @@ static int handshake_client(gnutls_session_t session) ret = _gnutls_recv_server_kx_message(session); STATE = STATE9; IMED_RET("recv server kx message", ret, 1); - + /* fall through */ case STATE10: /* receive the server certificate request - if any */ @@ -2874,7 +2876,7 @@ static int handshake_client(gnutls_session_t session) STATE = STATE10; IMED_RET("recv server certificate request message", ret, 1); - + /* fall through */ case STATE11: /* receive the server hello done */ if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */ @@ -2884,7 +2886,7 @@ static int handshake_client(gnutls_session_t session) 0, NULL); STATE = STATE11; IMED_RET("recv server hello done", ret, 1); - + /* fall through */ case STATE12: if (session->security_parameters.do_send_supplemental) { ret = @@ -2893,7 +2895,7 @@ static int handshake_client(gnutls_session_t session) STATE = STATE12; IMED_RET("send supplemental", ret, 0); } - + /* fall through */ case STATE13: /* send our certificate - if any and if requested */ @@ -2904,7 +2906,7 @@ static int handshake_client(gnutls_session_t session) (STATE13)); STATE = STATE13; IMED_RET("send client certificate", ret, 0); - + /* fall through */ case STATE14: if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */ ret = @@ -2912,7 +2914,7 @@ static int handshake_client(gnutls_session_t session) AGAIN(STATE14)); STATE = STATE14; IMED_RET("send client kx", ret, 0); - + /* fall through */ case STATE15: /* send client certificate verify */ if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */ @@ -2922,7 +2924,7 @@ static int handshake_client(gnutls_session_t session) (STATE15)); STATE = STATE15; IMED_RET("send client certificate verify", ret, 1); - + /* fall through */ case STATE16: STATE = STATE16; if (session->internals.resumed == RESUME_FALSE) { @@ -2935,7 +2937,7 @@ static int handshake_client(gnutls_session_t session) 1); #endif } - + /* fall through */ case STATE17: STATE = STATE17; if (session->internals.resumed == RESUME_FALSE && (session->internals.flags & GNUTLS_ENABLE_FALSE_START) && can_send_false_start(session)) { @@ -2951,7 +2953,7 @@ static int handshake_client(gnutls_session_t session) } else { session->internals.false_start_used = 0; } - + /* fall through */ case STATE18: STATE = STATE18; @@ -2965,7 +2967,7 @@ static int handshake_client(gnutls_session_t session) ret = recv_handshake_final(session, TRUE); IMED_RET("recv handshake final", ret, 1); } - + /* fall through */ case STATE19: STATE = STATE19; if (session->internals.resumed == RESUME_FALSE) { @@ -2977,6 +2979,7 @@ static int handshake_client(gnutls_session_t session) } STATE = STATE0; + /* fall through */ default: break; } @@ -3074,7 +3077,7 @@ static int send_handshake_final(gnutls_session_t session, int init) return ret; } - /* fallthrough */ + /* fall through */ case STATE2: /* send the finished message */ ret = _gnutls_send_finished(session, FAGAIN(STATE2)); @@ -3086,6 +3089,7 @@ static int send_handshake_final(gnutls_session_t session, int init) } FINAL_STATE = STATE0; + /* fall through */ default: break; } @@ -3159,8 +3163,7 @@ static int recv_handshake_final(gnutls_session_t session, int init) gnutls_assert(); return ret; } - - /* fallthrough */ + /* fall through */ case STATE31: FINAL_STATE = STATE31; @@ -3179,6 +3182,7 @@ static int recv_handshake_final(gnutls_session_t session, int init) return ret; } FINAL_STATE = STATE0; + /* fall through */ default: break; } @@ -3211,17 +3215,17 @@ static int handshake_server(gnutls_session_t session) STATE = STATE1; } IMED_RET("recv hello", ret, 1); - + /* fall through */ case STATE2: ret = _gnutls_ext_sr_verify(session); STATE = STATE2; IMED_RET("recv hello", ret, 0); - + /* fall through */ case STATE3: ret = send_hello(session, AGAIN(STATE3)); STATE = STATE3; IMED_RET("send hello", ret, 1); - + /* fall through */ case STATE4: if (session->security_parameters.do_send_supplemental) { ret = @@ -3230,8 +3234,8 @@ static int handshake_server(gnutls_session_t session) STATE = STATE4; IMED_RET("send supplemental data", ret, 0); } - /* SEND CERTIFICATE + KEYEXCHANGE + CERTIFICATE_REQUEST */ + /* fall through */ case STATE5: /* NOTE: these should not be send if we are resuming */ @@ -3241,7 +3245,7 @@ static int handshake_server(gnutls_session_t session) AGAIN(STATE5)); STATE = STATE5; IMED_RET("send server certificate", ret, 0); - + /* fall through */ case STATE6: #ifdef ENABLE_OCSP if (session->internals.resumed == RESUME_FALSE) @@ -3252,6 +3256,7 @@ static int handshake_server(gnutls_session_t session) STATE = STATE6; IMED_RET("send server certificate status", ret, 0); #endif + /* fall through */ case STATE7: /* send server key exchange (A) */ if (session->internals.resumed == RESUME_FALSE) @@ -3260,7 +3265,7 @@ static int handshake_server(gnutls_session_t session) AGAIN(STATE7)); STATE = STATE7; IMED_RET("send server kx", ret, 0); - + /* fall through */ case STATE8: /* Send certificate request - if requested to */ if (session->internals.resumed == RESUME_FALSE) @@ -3269,7 +3274,7 @@ static int handshake_server(gnutls_session_t session) AGAIN(STATE8)); STATE = STATE8; IMED_RET("send server cert request", ret, 0); - + /* fall through */ case STATE9: /* send the server hello done */ if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */ @@ -3279,35 +3284,35 @@ static int handshake_server(gnutls_session_t session) AGAIN(STATE9)); STATE = STATE9; IMED_RET("send server hello done", ret, 1); - + /* fall through */ case STATE10: if (session->security_parameters.do_recv_supplemental) { ret = _gnutls_recv_supplemental(session); STATE = STATE10; IMED_RET("recv client supplemental", ret, 1); } - /* RECV CERTIFICATE + KEYEXCHANGE + CERTIFICATE_VERIFY */ + /* fall through */ case STATE11: /* receive the client certificate message */ if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */ ret = _gnutls_recv_client_certificate(session); STATE = STATE11; IMED_RET("recv client certificate", ret, 1); - + /* fall through */ case STATE12: ret = run_verify_callback(session, GNUTLS_SERVER); STATE = STATE12; if (ret < 0) return gnutls_assert_val(ret); - + /* fall through */ case STATE13: /* receive the client key exchange message */ if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */ ret = _gnutls_recv_client_kx_message(session); STATE = STATE13; IMED_RET("recv client kx", ret, 1); - + /* fall through */ case STATE14: /* receive the client certificate verify message */ if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */ @@ -3316,7 +3321,7 @@ static int handshake_server(gnutls_session_t session) (session); STATE = STATE14; IMED_RET("recv client certificate verify", ret, 1); - + /* fall through */ case STATE15: STATE = STATE15; if (session->internals.resumed == RESUME_FALSE) { /* if we are not resuming */ @@ -3326,7 +3331,7 @@ static int handshake_server(gnutls_session_t session) ret = send_handshake_final(session, TRUE); IMED_RET("send handshake final 2", ret, 1); } - + /* fall through */ case STATE16: #ifdef ENABLE_SESSION_TICKETS ret = @@ -3335,6 +3340,7 @@ static int handshake_server(gnutls_session_t session) STATE = STATE16; IMED_RET("send handshake new session ticket", ret, 0); #endif + /* fall through */ case STATE17: STATE = STATE17; if (session->internals.resumed == RESUME_FALSE) { /* if we are not resuming */ @@ -3354,6 +3360,7 @@ static int handshake_server(gnutls_session_t session) } STATE = STATE0; + /* fall through */ default: break; } diff --git a/lib/record.c b/lib/record.c index e2921055d2..1545cfd23c 100644 --- a/lib/record.c +++ b/lib/record.c @@ -292,7 +292,7 @@ int gnutls_bye(gnutls_session_t session, gnutls_close_request_t how) gnutls_assert(); return ret; } - /* fallthrough */ + /* fall through */ case BYE_STATE1: ret = gnutls_alert_send(session, GNUTLS_AL_WARNING, @@ -302,7 +302,7 @@ int gnutls_bye(gnutls_session_t session, gnutls_close_request_t how) gnutls_assert(); return ret; } - + /* fall through */ case BYE_STATE2: BYE_STATE = BYE_STATE2; if (how == GNUTLS_SHUT_RDWR) { |