summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2010-10-13 23:10:28 +0200
committerMiloslav Trmač <mitr@redhat.com>2010-10-13 23:10:28 +0200
commitb777e41ccd09ed9202d38e4506a31b3e5780b098 (patch)
tree76001e15d74e5a4c8bbb6a6814f2d3632821bdaf /tests
parent4cf63ca284a1fe2b11170e8a50b2789f8491299a (diff)
downloadncrypto-b777e41ccd09ed9202d38e4506a31b3e5780b098.tar.gz
ncrypto-b777e41ccd09ed9202d38e4506a31b3e5780b098.tar.xz
ncrypto-b777e41ccd09ed9202d38e4506a31b3e5780b098.zip
Automatically initialize NSS on first use.
Diffstat (limited to 'tests')
-rw-r--r--tests/rsa.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/rsa.c b/tests/rsa.c
index d836690..9addcf4 100644
--- a/tests/rsa.c
+++ b/tests/rsa.c
@@ -53,9 +53,6 @@ main (void)
size_t src_size, dest_size;
CK_RV res;
- res = ncr_open ();
- assert (res == CKR_OK);
-
/* Test the generic version as well? */
res = ncr_public_key_create_rsa (&public, modulus, sizeof (modulus),
public_exponent, sizeof (public_exponent));
@@ -98,8 +95,17 @@ main (void)
res = ncr_public_key_destroy (public);
assert (res == CKR_OK);
+ /* Test reference counting */
+ res = ncr_open ();
+ assert (res == CKR_OK);
+ res = ncr_close ();
+ assert (res == CKR_OK);
+ /* Close the implicit reference */
res = ncr_close ();
assert (res == CKR_OK);
+ /* Check further closes are invalid */
+ res = ncr_close ();
+ assert (res == CKR_GENERAL_ERROR);
return EXIT_SUCCESS;
}