From: Peiwei Hu Date: Sun, 14 Nov 2021 16:27:31 +0000 (+0800) Subject: SSL_export_keying_material: fix return check X-Git-Tag: openssl-3.2.0-alpha1~3304 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40649e36c4c0c9438f62e1bf2ccb983f6854c662;p=thirdparty%2Fopenssl.git SSL_export_keying_material: fix return check Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/17028) --- diff --git a/apps/s_client.c b/apps/s_client.c index d40f7c948fa..e0748496de3 100644 --- a/apps/s_client.c +++ b/apps/s_client.c @@ -3295,11 +3295,11 @@ static void print_stuff(BIO *bio, SSL *s, int full) BIO_printf(bio, " Label: '%s'\n", keymatexportlabel); BIO_printf(bio, " Length: %i bytes\n", keymatexportlen); exportedkeymat = app_malloc(keymatexportlen, "export key"); - if (!SSL_export_keying_material(s, exportedkeymat, + if (SSL_export_keying_material(s, exportedkeymat, keymatexportlen, keymatexportlabel, strlen(keymatexportlabel), - NULL, 0, 0)) { + NULL, 0, 0) <= 0) { BIO_printf(bio, " Error\n"); } else { BIO_printf(bio, " Keying material: "); diff --git a/apps/s_server.c b/apps/s_server.c index 13d59faf14a..d60a1f3c852 100644 --- a/apps/s_server.c +++ b/apps/s_server.c @@ -2959,11 +2959,11 @@ static void print_connection_info(SSL *con) BIO_printf(bio_s_out, " Label: '%s'\n", keymatexportlabel); BIO_printf(bio_s_out, " Length: %i bytes\n", keymatexportlen); exportedkeymat = app_malloc(keymatexportlen, "export key"); - if (!SSL_export_keying_material(con, exportedkeymat, + if (SSL_export_keying_material(con, exportedkeymat, keymatexportlen, keymatexportlabel, strlen(keymatexportlabel), - NULL, 0, 0)) { + NULL, 0, 0) <= 0) { BIO_printf(bio_s_out, " Error\n"); } else { BIO_printf(bio_s_out, " Keying material: ");