Skip to content

Commit

Permalink
Fix SSL_export_keying_material for QUIC
Browse files Browse the repository at this point in the history
Reviewed-by: Matt Caswell <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
(Merged from openssl#23567)
  • Loading branch information
hlandau authored and t8m committed Feb 14, 2024
1 parent 09a5037 commit 498d4e4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 4 additions & 3 deletions ssl/ssl_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -3754,9 +3754,10 @@ int SSL_export_keying_material(SSL *s, unsigned char *out, size_t olen,
|| (sc->version < TLS1_VERSION && sc->version != DTLS1_BAD_VER))
return -1;

return s->method->ssl3_enc->export_keying_material(sc, out, olen, label,
llen, context,
contextlen, use_context);
return sc->ssl.method->ssl3_enc->export_keying_material(sc, out, olen, label,
llen, context,
contextlen,
use_context);
}

int SSL_export_keying_material_early(SSL *s, unsigned char *out, size_t olen,
Expand Down
8 changes: 7 additions & 1 deletion test/quicapitest.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static int test_quic_write_read(int idx)
SSL *clientquic = NULL;
QUIC_TSERVER *qtserv = NULL;
int j, k, ret = 0;
unsigned char buf[20];
unsigned char buf[20], scratch[64];
static char *msg = "A test message";
size_t msglen = strlen(msg);
size_t numbytes = 0;
Expand Down Expand Up @@ -153,6 +153,12 @@ static int test_quic_write_read(int idx)
goto end;
}

/* Test that exporters work. */
if (!TEST_true(SSL_export_keying_material(clientquic, scratch,
sizeof(scratch), "test", 4, (unsigned char *)"ctx", 3,
1)))
goto end;

if (sess == NULL) {
/* We didn't supply a session so we're not expecting resumption */
if (!TEST_false(SSL_session_reused(clientquic)))
Expand Down

0 comments on commit 498d4e4

Please sign in to comment.