Simplify ssl_get_message somewhat.
It still places the current message all over the place, but remove the
bizarre init_num/error/ok split. Now callers get the message length out
of init_num, which mirrors init_msg. Also fix some signedness.
Change-Id: Ic2e97b6b99e234926504ff217b8aedae85ba6596
Reviewed-on: https://boringssl-review.googlesource.com/8690
Reviewed-by: David Benjamin <davidben@google.com>
diff --git a/ssl/internal.h b/ssl/internal.h
index bdc1230..e15555e 100644
--- a/ssl/internal.h
+++ b/ssl/internal.h
@@ -834,8 +834,12 @@
int (*begin_handshake)(SSL *ssl);
/* finish_handshake is called when a handshake completes. */
void (*finish_handshake)(SSL *ssl);
- long (*ssl_get_message)(SSL *ssl, int msg_type,
- enum ssl_hash_message_t hash_message, int *ok);
+ /* ssl_get_message reads the next handshake message. If |msg_type| is not -1,
+ * the message must have the specified type. On success, it returns one and
+ * sets |ssl->s3->tmp.message_type|, |ssl->init_msg|, and |ssl->init_num|.
+ * Otherwise, it returns <= 0. */
+ int (*ssl_get_message)(SSL *ssl, int msg_type,
+ enum ssl_hash_message_t hash_message);
/* hash_current_message incorporates the current handshake message into the
* handshake hash. It returns one on success and zero on allocation
* failure. */
@@ -1025,8 +1029,8 @@
int ssl3_send_change_cipher_spec(SSL *ssl);
void ssl3_cleanup_key_block(SSL *ssl);
int ssl3_send_alert(SSL *ssl, int level, int desc);
-long ssl3_get_message(SSL *ssl, int msg_type,
- enum ssl_hash_message_t hash_message, int *ok);
+int ssl3_get_message(SSL *ssl, int msg_type,
+ enum ssl_hash_message_t hash_message);
int ssl3_hash_current_message(SSL *ssl);
/* ssl3_cert_verify_hash writes the SSL 3.0 CertificateVerify hash into the
@@ -1105,8 +1109,7 @@
int dtls1_connect(SSL *ssl);
void dtls1_free(SSL *ssl);
-long dtls1_get_message(SSL *ssl, int mt, enum ssl_hash_message_t hash_message,
- int *ok);
+int dtls1_get_message(SSL *ssl, int mt, enum ssl_hash_message_t hash_message);
int dtls1_hash_current_message(SSL *ssl);
int dtls1_dispatch_alert(SSL *ssl);