goto end;
/* Write and read some early data */
- if (!SSL_write_early(clientssl, MSG1, strlen(MSG1), &written)
+ if (!SSL_write_early_data(clientssl, MSG1, strlen(MSG1), &written)
|| written != strlen(MSG1)) {
printf("Failed writing early data message 1\n");
goto end;
}
- if (SSL_read_early(serverssl, buf, sizeof(buf), &readbytes)
- != SSL_READ_EARLY_SUCCESS
+ if (SSL_read_early_data(serverssl, buf, sizeof(buf), &readbytes)
+ != SSL_READ_EARLY_DATA_SUCCESS
|| readbytes != strlen(MSG1)
|| memcmp(MSG1, buf, strlen(MSG1))) {
printf("Failed reading early data message 1\n");
}
/*
- * Server should be able to write normal data, and client should be able to
+ * Server should be able to write data, and client should be able to
* read it.
*/
- if (!SSL_write_ex(serverssl, MSG2, strlen(MSG2), &written)
+ if (!SSL_write_early_data(serverssl, MSG2, strlen(MSG2), &written)
|| written != strlen(MSG2)) {
printf("Failed writing message 2\n");
goto end;
}
/* Even after reading normal data, client should be able write early data */
- if (!SSL_write_early(clientssl, MSG3, strlen(MSG3), &written)
+ if (!SSL_write_early_data(clientssl, MSG3, strlen(MSG3), &written)
|| written != strlen(MSG3)) {
printf("Failed writing early data message 3\n");
goto end;
}
- /* Server should still be able read early data after writing normal data */
- if (SSL_read_early(serverssl, buf, sizeof(buf), &readbytes)
- != SSL_READ_EARLY_SUCCESS
+ /* Server should still be able read early data after writing data */
+ if (SSL_read_early_data(serverssl, buf, sizeof(buf), &readbytes)
+ != SSL_READ_EARLY_DATA_SUCCESS
|| readbytes != strlen(MSG3)
|| memcmp(MSG3, buf, strlen(MSG3))) {
printf("Failed reading early data message 3\n");
goto end;
}
- /* Write more normal data from server and read it from client */
- if (!SSL_write_ex(serverssl, MSG4, strlen(MSG4), &written)
+ /* Write more data from server and read it from client */
+ if (!SSL_write_early_data(serverssl, MSG4, strlen(MSG4), &written)
|| written != strlen(MSG4)) {
printf("Failed writing message 4\n");
goto end;
}
/* Server should be told that there is no more early data */
- if (SSL_read_early(serverssl, buf, sizeof(buf), &readbytes)
- != SSL_READ_EARLY_FINISH
+ if (SSL_read_early_data(serverssl, buf, sizeof(buf), &readbytes)
+ != SSL_READ_EARLY_DATA_FINISH
|| readbytes != 0) {
printf("Failed finishing read of early data\n");
goto end;
goto end;
}
- /* Client and server should not be able to write early data now */
- if (SSL_write_early(clientssl, MSG6, strlen(MSG6), &written)) {
+ /* Client and server should not be able to write/read early data now */
+ if (SSL_write_early_data(clientssl, MSG6, strlen(MSG6), &written)) {
printf("Unexpected success writing early data\n");
goto end;
}
ERR_clear_error();
- if (SSL_read_early(serverssl, buf, sizeof(buf), &readbytes)
- != SSL_READ_EARLY_ERROR) {
+ if (SSL_read_early_data(serverssl, buf, sizeof(buf), &readbytes)
+ != SSL_READ_EARLY_DATA_ERROR) {
printf("Unexpected success reading early data\n");
goto end;
}
}
/* Write and read some early data */
- if (!SSL_write_early(clientssl, MSG1, strlen(MSG1), &written)
+ if (!SSL_write_early_data(clientssl, MSG1, strlen(MSG1), &written)
|| written != strlen(MSG1)) {
printf("Failed writing early data message 1\n");
goto end;
}
- if (SSL_read_early(serverssl, buf, sizeof(buf), &readbytes)
- != SSL_READ_EARLY_SUCCESS
+ if (SSL_read_early_data(serverssl, buf, sizeof(buf), &readbytes)
+ != SSL_READ_EARLY_DATA_SUCCESS
|| readbytes != strlen(MSG1)
|| memcmp(MSG1, buf, strlen(MSG1))) {
printf("Failed reading early data message 1\n");
goto end;
}
- /*
- * We expect SSL_accept() to initially block as it handles the end of early
- * data alert
- */
- if (SSL_accept(serverssl) > 0) {
- printf("Unexpected success completing server handshake\n");
- goto end;
- }
-
if (SSL_accept(serverssl) <= 0) {
printf("Unable to complete server handshake\n");
goto end;
}
- /* Client and server should not be able to write early data now */
- if (SSL_write_early(clientssl, MSG6, strlen(MSG6), &written)) {
+ /* Client and server should not be able to write/read early data now */
+ if (SSL_write_early_data(clientssl, MSG6, strlen(MSG6), &written)) {
printf("Unexpected success writing early data (2)\n");
goto end;
}
ERR_clear_error();
- if (SSL_read_early(serverssl, buf, sizeof(buf), &readbytes)
- != SSL_READ_EARLY_ERROR) {
+ if (SSL_read_early_data(serverssl, buf, sizeof(buf), &readbytes)
+ != SSL_READ_EARLY_DATA_ERROR) {
printf("Unexpected success reading early data (2)\n");
goto end;
}
}
/* Write some early data */
- if (!SSL_write_early(clientssl, MSG1, strlen(MSG1), &written)
+ if (!SSL_write_early_data(clientssl, MSG1, strlen(MSG1), &written)
|| written != strlen(MSG1)) {
printf("Failed writing early data message 1\n");
goto end;
}
/* Server should reject the early data and skip over it */
- if (SSL_read_early(serverssl, buf, sizeof(buf), &readbytes)
- != SSL_READ_EARLY_FINISH
+ if (SSL_read_early_data(serverssl, buf, sizeof(buf), &readbytes)
+ != SSL_READ_EARLY_DATA_FINISH
|| readbytes != 0) {
printf("Failed reading early data\n");
goto end;
}
/* Server should detect that early data has not been sent */
- if (SSL_read_early(serverssl, buf, sizeof(buf), &readbytes)
- != SSL_READ_EARLY_FINISH
+ if (SSL_read_early_data(serverssl, buf, sizeof(buf), &readbytes)
+ != SSL_READ_EARLY_DATA_FINISH
|| readbytes != 0) {
printf("Failed reading early data\n");
goto end;
goto end;
/* Write some early data */
- if (!SSL_write_early(clientssl, MSG1, strlen(MSG1), &written)) {
+ if (!SSL_write_early_data(clientssl, MSG1, strlen(MSG1), &written)) {
printf("Unexpected failure writing message 1\n");
goto end;
}
/*
* Server should do TLSv1.2 handshake. First it will block waiting for more
- * messages from client after ServerDone. Then SSL_read_early should finish
- * and detect that early data has not been sent
+ * messages from client after ServerDone. Then SSL_read_early_data should
+ * finish and detect that early data has not been sent
*/
- if (SSL_read_early(serverssl, buf, sizeof(buf), &readbytes)
- != SSL_READ_EARLY_ERROR) {
+ if (SSL_read_early_data(serverssl, buf, sizeof(buf), &readbytes)
+ != SSL_READ_EARLY_DATA_ERROR) {
printf("Unexpected success reading early data\n");
goto end;
}
goto end;
}
- if (SSL_read_early(serverssl, buf, sizeof(buf), &readbytes)
- != SSL_READ_EARLY_FINISH
+ if (SSL_read_early_data(serverssl, buf, sizeof(buf), &readbytes)
+ != SSL_READ_EARLY_DATA_FINISH
|| readbytes != 0) {
printf("Failed reading early data\n");
goto end;