]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Add some tests for optional arguments in gnutls_privkey_import_rsa_raw().
authorNikolay Sivov <nsivov@codeweavers.com>
Tue, 1 Sep 2020 18:00:18 +0000 (21:00 +0300)
committerNikolay Sivov <nsivov@codeweavers.com>
Tue, 1 Sep 2020 18:09:55 +0000 (21:09 +0300)
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
tests/key-import-export.c

index 45434eeb2d96a790ead10ccf6acf2c1cbcdb4b3f..776a519dbe16e688209098e4fd2f67a1028d82ad 100644 (file)
@@ -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");