aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2016-05-17 15:27:09 +0100
committerMatt Caswell <matt@openssl.org>2016-05-17 16:37:45 +0100
commitbe9c8deb7de92feb5e5300f2e46d3516bcc43c00 (patch)
treebfde2dc86b6efbc7937ab43c4c9fadf5567e4fdc
parent8aac5d2e5a4c5d1c13e0f671d263a9eb59031514 (diff)
downloadopenssl-be9c8deb7de92feb5e5300f2e46d3516bcc43c00.tar.gz
Add a comment to explain the use of |num_recs|
In the SSLV2ClientHello processing code in ssl3_get_record, the value of |num_recs| will always be 0. This isn't obvious from the code so a comment is added to explain it. Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
-rw-r--r--ssl/record/ssl3_record.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/ssl/record/ssl3_record.c b/ssl/record/ssl3_record.c
index beef2b3dfb..57fef4a671 100644
--- a/ssl/record/ssl3_record.c
+++ b/ssl/record/ssl3_record.c
@@ -270,7 +270,15 @@ int ssl3_get_record(SSL *s)
if (s->first_packet && s->server && !s->read_hash
&& !s->enc_read_ctx
&& (p[0] & 0x80) && (p[2] == SSL2_MT_CLIENT_HELLO)) {
- /* SSLv2 style record */
+ /*
+ * SSLv2 style record
+ *
+ * |num_recs| here will actually always be 0 because
+ * |num_recs > 0| only ever occurs when we are processing
+ * multiple app data records - which we know isn't the case here
+ * because it is an SSLv2ClientHello. We keep it using
+ * |num_recs| for the sake of consistency
+ */
rr[num_recs].type = SSL3_RT_HANDSHAKE;
rr[num_recs].rec_version = SSL2_VERSION;