Add a test for the problem fixed by the previous commit
authorMatt Caswell <matt@openssl.org>
Mon, 3 Apr 2017 13:18:24 +0000 (14:18 +0100)
committerMatt Caswell <matt@openssl.org>
Mon, 3 Apr 2017 18:07:29 +0000 (19:07 +0100)
Make sure the server can write normal data after earlier writing early data.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3091)

test/sslapitest.c

index 8859ef322299422061b43b8e55a6532e269ce3e4..ed804c9da39a813f27b748558ec40815d768ed6c 100644 (file)
@@ -1544,7 +1544,8 @@ static int test_set_sigalgs(int idx)
 #define MSG3    "This"
 #define MSG4    "is"
 #define MSG5    "a"
-#define MSG6    "test."
+#define MSG6    "test"
+#define MSG7    "message."
 
 /*
  * Helper method to setup objects for early data test. Caller frees objects on
@@ -1775,6 +1776,19 @@ static int test_early_data_read_write(int idx)
         goto end;
     }
 
+    /* Server should be able to write normal data */
+    if (!SSL_write_ex(serverssl, MSG7, strlen(MSG7), &written)
+            || written != strlen(MSG7)) {
+        printf("Failed writing normal data message 7\n");
+        goto end;
+    }
+    if (!SSL_read_ex(clientssl, buf, sizeof(buf), &readbytes)
+            || readbytes != strlen(MSG7)
+            || memcmp(MSG7, buf, strlen(MSG7))) {
+        printf("Failed reading message 7\n");
+        goto end;
+    }
+
     SSL_SESSION_free(sess);
     sess = SSL_get1_session(clientssl);