summaryrefslogtreecommitdiffstats
path: root/ssl
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2022-07-26 12:44:28 +0100
committerMatt Caswell <matt@openssl.org>2022-08-18 16:38:13 +0100
commita16f9d3366a4b4e8c8014bbf39b86baaf1a04047 (patch)
treeb3ced35d6bc4dc44af6f35be806b9f979c3fc1b2 /ssl
parentd0b17ea025477ce13ebe5d802ada232a57e1a2f2 (diff)
Update the tls13encryptiontest for new read record layer
The tls13encryption is an internal test that reaches inside libssl to test encryption/decryption of records. It needs to be amended for the new code structure so that it is testing the equivalent things as before. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
Diffstat (limited to 'ssl')
-rw-r--r--ssl/record/methods/tls_common.c95
1 files changed, 54 insertions, 41 deletions
diff --git a/ssl/record/methods/tls_common.c b/ssl/record/methods/tls_common.c
index 8dace6c21a..4d6cc781e3 100644
--- a/ssl/record/methods/tls_common.c
+++ b/ssl/record/methods/tls_common.c
@@ -1045,35 +1045,46 @@ tls_int_new_record_layer(OSSL_LIB_CTX *libctx, const char *propq, int vers,
}
/* Loop through all the settings since they must all be understood */
- for (p = settings; p->key != NULL; p++) {
- if (strcmp(p->key, OSSL_LIBSSL_RECORD_LAYER_PARAM_USE_ETM) == 0) {
- if (!OSSL_PARAM_get_int(p, &rl->use_etm)) {
- RLAYERfatal(rl, SSL_AD_INTERNAL_ERROR, SSL_R_FAILED_TO_GET_PARAMETER);
- goto err;
- }
- } else if (strcmp(p->key, OSSL_LIBSSL_RECORD_LAYER_PARAM_MAX_FRAG_LEN) == 0) {
- if (!OSSL_PARAM_get_uint(p, &rl->max_frag_len)) {
- RLAYERfatal(rl, SSL_AD_INTERNAL_ERROR, SSL_R_FAILED_TO_GET_PARAMETER);
- goto err;
- }
- } else if (strcmp(p->key, OSSL_LIBSSL_RECORD_LAYER_PARAM_MAX_EARLY_DATA) == 0) {
- if (!OSSL_PARAM_get_uint32(p, &rl->max_early_data)) {
- RLAYERfatal(rl, SSL_AD_INTERNAL_ERROR, SSL_R_FAILED_TO_GET_PARAMETER);
- goto err;
- }
- } else if (strcmp(p->key, OSSL_LIBSSL_RECORD_LAYER_PARAM_STREAM_MAC) == 0) {
- if (!OSSL_PARAM_get_int(p, &rl->stream_mac)) {
- RLAYERfatal(rl, SSL_AD_INTERNAL_ERROR, SSL_R_FAILED_TO_GET_PARAMETER);
- goto err;
- }
- } else if (strcmp(p->key, OSSL_LIBSSL_RECORD_LAYER_PARAM_TLSTREE) == 0) {
- if (!OSSL_PARAM_get_int(p, &rl->tlstree)) {
- RLAYERfatal(rl, SSL_AD_INTERNAL_ERROR, SSL_R_FAILED_TO_GET_PARAMETER);
+ if (settings != NULL) {
+ for (p = settings; p->key != NULL; p++) {
+ if (strcmp(p->key, OSSL_LIBSSL_RECORD_LAYER_PARAM_USE_ETM) == 0) {
+ if (!OSSL_PARAM_get_int(p, &rl->use_etm)) {
+ RLAYERfatal(rl, SSL_AD_INTERNAL_ERROR,
+ SSL_R_FAILED_TO_GET_PARAMETER);
+ goto err;
+ }
+ } else if (strcmp(p->key,
+ OSSL_LIBSSL_RECORD_LAYER_PARAM_MAX_FRAG_LEN) == 0) {
+ if (!OSSL_PARAM_get_uint(p, &rl->max_frag_len)) {
+ RLAYERfatal(rl, SSL_AD_INTERNAL_ERROR,
+ SSL_R_FAILED_TO_GET_PARAMETER);
+ goto err;
+ }
+ } else if (strcmp(p->key,
+ OSSL_LIBSSL_RECORD_LAYER_PARAM_MAX_EARLY_DATA) == 0) {
+ if (!OSSL_PARAM_get_uint32(p, &rl->max_early_data)) {
+ RLAYERfatal(rl, SSL_AD_INTERNAL_ERROR,
+ SSL_R_FAILED_TO_GET_PARAMETER);
+ goto err;
+ }
+ } else if (strcmp(p->key,
+ OSSL_LIBSSL_RECORD_LAYER_PARAM_STREAM_MAC) == 0) {
+ if (!OSSL_PARAM_get_int(p, &rl->stream_mac)) {
+ RLAYERfatal(rl, SSL_AD_INTERNAL_ERROR,
+ SSL_R_FAILED_TO_GET_PARAMETER);
+ goto err;
+ }
+ } else if (strcmp(p->key, OSSL_LIBSSL_RECORD_LAYER_PARAM_TLSTREE) == 0) {
+ if (!OSSL_PARAM_get_int(p, &rl->tlstree)) {
+ RLAYERfatal(rl, SSL_AD_INTERNAL_ERROR,
+ SSL_R_FAILED_TO_GET_PARAMETER);
+ goto err;
+ }
+ } else {
+ RLAYERfatal(rl, SSL_AD_INTERNAL_ERROR,
+ SSL_R_UNKNOWN_MANDATORY_PARAMETER);
goto err;
}
- } else {
- RLAYERfatal(rl, SSL_AD_INTERNAL_ERROR, SSL_R_UNKNOWN_MANDATORY_PARAMETER);
- goto err;
}
}
@@ -1115,20 +1126,22 @@ tls_int_new_record_layer(OSSL_LIB_CTX *libctx, const char *propq, int vers,
rl->next = next;
rl->cbarg = cbarg;
- for (; fns->function_id != 0; fns++) {
- switch (fns->function_id) {
- case OSSL_FUNC_RLAYER_SKIP_EARLY_DATA:
- rl->skip_early_data = OSSL_FUNC_rlayer_skip_early_data(fns);
- break;
- case OSSL_FUNC_RLAYER_MSG_CALLBACK:
- rl->msg_callback = OSSL_FUNC_rlayer_msg_callback(fns);
- break;
- case OSSL_FUNC_RLAYER_SECURITY:
- rl->security = OSSL_FUNC_rlayer_security(fns);
- break;
- default:
- /* Just ignore anything we don't understand */
- break;
+ if (fns != NULL) {
+ for (; fns->function_id != 0; fns++) {
+ switch (fns->function_id) {
+ case OSSL_FUNC_RLAYER_SKIP_EARLY_DATA:
+ rl->skip_early_data = OSSL_FUNC_rlayer_skip_early_data(fns);
+ break;
+ case OSSL_FUNC_RLAYER_MSG_CALLBACK:
+ rl->msg_callback = OSSL_FUNC_rlayer_msg_callback(fns);
+ break;
+ case OSSL_FUNC_RLAYER_SECURITY:
+ rl->security = OSSL_FUNC_rlayer_security(fns);
+ break;
+ default:
+ /* Just ignore anything we don't understand */
+ break;
+ }
}
}