From c3072208437f56371bc772671595becbcf85c119 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Tue, 1 Sep 2020 21:00:18 +0300 Subject: Add some tests for optional arguments in gnutls_privkey_import_rsa_raw(). Signed-off-by: Nikolay Sivov --- tests/key-import-export.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/key-import-export.c b/tests/key-import-export.c index 45434eeb2d..776a519dbe 100644 --- a/tests/key-import-export.c +++ b/tests/key-import-export.c @@ -341,6 +341,36 @@ int check_privkey_import_export(void) if (ret < 0) fail("error\n"); + /* Optional arguments */ + ret = gnutls_privkey_import_rsa_raw(key, &_rsa_m, &_rsa_e, &_rsa_d, &_rsa_p, &_rsa_q, NULL, NULL, NULL); + if (ret < 0) + fail("error\n"); + + ret = gnutls_privkey_import_rsa_raw(key, &_rsa_m, &_rsa_e, &_rsa_d, &_rsa_p, &_rsa_q, NULL, &_rsa_e1, &_rsa_e2); + if (ret < 0) + fail("error\n"); + + ret = gnutls_privkey_import_rsa_raw(key, &_rsa_m, &_rsa_e, &_rsa_d, &_rsa_p, &_rsa_q, NULL, &_rsa_e1, NULL); + if (ret < 0) + fail("error\n"); + + ret = gnutls_privkey_import_rsa_raw(key, &_rsa_m, &_rsa_e, &_rsa_d, &_rsa_p, &_rsa_q, NULL, NULL, &_rsa_e2); + if (ret < 0) + fail("error\n"); + + ret = gnutls_privkey_import_rsa_raw(key, &_rsa_m, &_rsa_e, &_rsa_d, &_rsa_p, &_rsa_q, &_rsa_u, NULL, NULL); + if (ret < 0) + fail("error\n"); + + ret = gnutls_privkey_import_rsa_raw(key, &_rsa_m, &_rsa_e, &_rsa_d, &_rsa_p, &_rsa_q, &_rsa_u, &_rsa_e1, NULL); + if (ret < 0) + fail("error\n"); + + ret = gnutls_privkey_import_rsa_raw(key, &_rsa_m, &_rsa_e, &_rsa_d, &_rsa_p, &_rsa_q, &_rsa_u, NULL, &_rsa_e2); + if (ret < 0) + fail("error\n"); + + /* Import/export */ ret = gnutls_privkey_import_rsa_raw(key, &_rsa_m, &_rsa_e, &_rsa_d, &_rsa_p, &_rsa_q, &_rsa_u, &_rsa_e1, &_rsa_e2); if (ret < 0) fail("error\n"); -- cgit v1.2.1