]> granicus.if.org Git - p11-kit/commitdiff
Merge branch 'stable'
authorStef Walter <stef@thewalter.net>
Wed, 5 Jun 2013 20:01:31 +0000 (22:01 +0200)
committerStef Walter <stef@thewalter.net>
Wed, 5 Jun 2013 20:01:31 +0000 (22:01 +0200)
1  2 
NEWS
trust/module.c
trust/tests/test-module.c

diff --cc NEWS
index f7aa05045aa16923f33543ace127c0e6e0ed32a1,be0e3b49b7eaf0ab93d2cc3b9b6e28a1b2c6659f..ea42c8a67c7f54ca86c3f9abae4caa360cd36f9b
--- 1/NEWS
--- 2/NEWS
+++ b/NEWS
@@@ -1,14 -1,8 +1,19 @@@
 +0.19.0 (unstable)
 + * Refactor API to be able to handle managed modules
 + * Deprecate much of old p11-kit API
 + * Implement concept of managed modules
 + * Make C_CloseAllSessions function work for multiple callers
 + * New dependency on libffi
 + * Fix possible threading problems reported by hellgrind
 + * Add log-calls option
 + * Mark p11_kit_message() as a stable function
 + * Use our own unit testing framework
 +
+ 0.18.3 (stable)
+  * Fix reinitialization of trust module [#65401]
+  * Fix crash in trust module C_Initialize
+  * Mac OS fixes [#57714]
  0.18.2 (stable)
   * Build fixes [#64378 ...]
  
diff --cc trust/module.c
index 109ff5cc0ce0415c0258fc808b41156103c1e6bb,ba41884761a8fb9f4f5f96bc7d47ceab4feaba96..abfabaeb18f8043ad8d03a6b9b5e52536c34f7ac
@@@ -350,9 -436,11 +366,11 @@@ sys_C_Initialize (CK_VOID_PTR init_args
                 * We support setting the socket path and other arguments from from the
                 * pReserved pointer, similar to how NSS PKCS#11 components are initialized.
                 */
-               if (rv == CKR_OK) {
+               } else if (rv == CKR_OK) {
+                       p11_debug ("doing initialization");
                        if (args->pReserved)
 -                              parse_arguments ((const char*)args->pReserved);
 +                              p11_argv_parse ((const char*)args->pReserved, parse_argument, NULL);
  
                        gl.sessions = p11_dict_new (p11_dict_ulongptr_hash,
                                                    p11_dict_ulongptr_equal,
index 45ec74d295c16843547494cb10f6e5173f9dbd08,472263aec0a9f02cc3fbaff3ba538e3d6abd60f4..bf281249d0a1d5a074a98db5997f17662948143d
@@@ -132,15 -134,82 +132,80 @@@ test_get_slot_list (void
        count = NUM_SLOTS;
        memset (slots, 0, sizeof (slots));
        rv = test.module->C_GetSlotList (TRUE, slots, &count);
 -      CuAssertIntEquals (cu, CKR_OK, rv);
 -      CuAssertIntEquals (cu, NUM_SLOTS, count);
 +      assert_num_eq (CKR_OK, rv);
 +      assert_num_eq (NUM_SLOTS, count);
  
        for (i = 0; i < NUM_SLOTS; i++)
 -              CuAssertTrue (cu, slots[i] != 0);
 -
 -      teardown (cu);
 +              assert (slots[i] != 0);
  }
  
 -test_null_initialize (CuTest *cu)
+ static void
 -      CuAssertTrue (cu, rv == CKR_OK);
++test_null_initialize (void)
+ {
+       CK_FUNCTION_LIST *module;
+       CK_RV rv;
+       /* This is the entry point of the trust module, linked to this test */
+       rv = C_GetFunctionList (&module);
 -      CuAssertTrue (cu, rv == CKR_OK);
++      assert_num_eq (rv, CKR_OK);
+       rv = module->C_Initialize (NULL);
 -      CuAssertIntEquals (cu, CKR_OK, rv);
++      assert_num_eq (rv, CKR_OK);
+       rv = module->C_Finalize (NULL);
 -test_multi_initialize (CuTest *cu)
++      assert_num_eq (CKR_OK, rv);
+ }
+ static void
 -      CuAssertTrue (cu, rv == CKR_OK);
++test_multi_initialize (void)
+ {
+       static CK_C_INITIALIZE_ARGS args =
+               { NULL, NULL, NULL, NULL, CKF_OS_LOCKING_OK, NULL, };
+       CK_FUNCTION_LIST *module;
+       CK_SESSION_HANDLE session;
+       CK_SLOT_ID slots[8];
+       CK_SESSION_INFO info;
+       CK_ULONG count;
+       CK_RV rv;
+       /* This is the entry point of the trust module, linked to this test */
+       rv = C_GetFunctionList (&module);
 -      CuAssertTrue (cu, rv == CKR_OK);
++      assert_num_eq (rv, CKR_OK);
+       rv = module->C_Initialize (&args);
 -      CuAssertTrue (cu, rv == CKR_OK);
 -      CuAssertTrue (cu, count > 0);
++      assert_num_eq (rv, CKR_OK);
+       count = 8;
+       rv = module->C_GetSlotList (CK_TRUE, slots, &count);
 -      CuAssertTrue (cu, rv == CKR_OK);
++      assert_num_eq (rv, CKR_OK);
++      assert_num_cmp (count, >, 0);
+       rv = module->C_OpenSession (slots[0], CKF_SERIAL_SESSION, NULL, NULL, &session);
 -      CuAssertTrue (cu, rv == CKR_OK);
 -      CuAssertTrue (cu, info.slotID == slots[0]);
++      assert_num_eq (rv, CKR_OK);
+       rv = module->C_GetSessionInfo (session, &info);
 -      CuAssertTrue (cu, rv == CKR_OK);
++      assert_num_eq (rv, CKR_OK);
++      assert_num_eq (info.slotID, slots[0]);
+       rv = module->C_Initialize (&args);
 -      CuAssertTrue (cu, rv == CKR_OK);
 -      CuAssertTrue (cu, info.slotID == slots[0]);
++      assert_num_eq (rv, CKR_OK);
+       rv = module->C_GetSessionInfo (session, &info);
 -      CuAssertIntEquals (cu, CKR_OK, rv);
++      assert_num_eq (rv, CKR_OK);
++      assert_num_eq (info.slotID, slots[0]);
+       rv = module->C_Finalize (NULL);
 -      CuAssertIntEquals (cu, CKR_OK, rv);
++      assert_num_eq (CKR_OK, rv);
+       rv = module->C_Finalize (NULL);
 -      CuAssertIntEquals (cu, CKR_CRYPTOKI_NOT_INITIALIZED, rv);
++      assert_num_eq (CKR_OK, rv);
+       rv = module->C_Finalize (NULL);
++      assert_num_eq (CKR_CRYPTOKI_NOT_INITIALIZED, rv);
+ }
  static void
 -test_get_slot_info (CuTest *cu)
 +test_get_slot_info (void)
  {
        CK_SLOT_ID slots[NUM_SLOTS];
        CK_SLOT_INFO info;
@@@ -923,35 -1065,44 +988,37 @@@ test_login_logout (void
  }
  
  int
 -main (void)
 +main (int argc,
 +      char *argv[])
  {
 -      CuString *output = CuStringNew ();
 -      CuSuite* suite = CuSuiteNew ();
 -      int ret;
 -
 -      putenv ("P11_KIT_STRICT=1");
        p11_library_init ();
  
 -      SUITE_ADD_TEST (suite, test_null_initialize);
 -      SUITE_ADD_TEST (suite, test_multi_initialize);
 -      SUITE_ADD_TEST (suite, test_get_slot_list);
 -      SUITE_ADD_TEST (suite, test_get_slot_info);
 -      SUITE_ADD_TEST (suite, test_get_token_info);
 -      SUITE_ADD_TEST (suite, test_get_session_info);
 -      SUITE_ADD_TEST (suite, test_close_all_sessions);
 -      SUITE_ADD_TEST (suite, test_find_certificates);
 -      SUITE_ADD_TEST (suite, test_find_builtin);
 -      SUITE_ADD_TEST (suite, test_lookup_invalid);
 -      SUITE_ADD_TEST (suite, test_remove_token);
 -      SUITE_ADD_TEST (suite, test_setattr_token);
 -      SUITE_ADD_TEST (suite, test_session_object);
 -      SUITE_ADD_TEST (suite, test_session_find);
 -      SUITE_ADD_TEST (suite, test_session_find_no_attr);
 -      SUITE_ADD_TEST (suite, test_session_copy);
 -      SUITE_ADD_TEST (suite, test_session_remove);
 -      SUITE_ADD_TEST (suite, test_session_setattr);
 -      SUITE_ADD_TEST (suite, test_find_serial_der_decoded);
 -      SUITE_ADD_TEST (suite, test_find_serial_der_mismatch);
 -      SUITE_ADD_TEST (suite, test_login_logout);
 -
 -      CuSuiteRun (suite);
 -      CuSuiteSummary (suite, output);
 -      CuSuiteDetails (suite, output);
 -      printf ("%s\n", output->buffer);
 -      ret = suite->failCount;
 -      CuSuiteDelete (suite);
 -      CuStringDelete (output);
 -
 -      return ret;
 +      p11_fixture (setup, teardown);
 +      p11_test (test_get_slot_list, "/module/get_slot_list");
 +      p11_test (test_get_slot_info, "/module/get_slot_info");
 +
 +      p11_fixture (NULL, NULL);
++      p11_test (test_null_initialize, "/module/initialize-null");
++      p11_test (test_multi_initialize, "/module/initialize-multi");
 +      p11_test (test_get_token_info, "/module/get_token_info");
 +
 +      p11_fixture (setup, teardown);
 +      p11_test (test_get_session_info, "/module/get_session_info");
 +      p11_test (test_close_all_sessions, "/module/close_all_sessions");
 +      p11_test (test_find_certificates, "/module/find_certificates");
 +      p11_test (test_find_builtin, "/module/find_builtin");
 +      p11_test (test_lookup_invalid, "/module/lookup_invalid");
 +      p11_test (test_remove_token, "/module/remove_token");
 +      p11_test (test_setattr_token, "/module/setattr_token");
 +      p11_test (test_session_object, "/module/session_object");
 +      p11_test (test_session_find, "/module/session_find");
 +      p11_test (test_session_find_no_attr, "/module/session_find_no_attr");
 +      p11_test (test_session_copy, "/module/session_copy");
 +      p11_test (test_session_remove, "/module/session_remove");
 +      p11_test (test_session_setattr, "/module/session_setattr");
 +      p11_test (test_find_serial_der_decoded, "/module/find_serial_der_decoded");
 +      p11_test (test_find_serial_der_mismatch, "/module/find_serial_der_mismatch");
 +      p11_test (test_login_logout, "/module/login_logout");
 +
 +      return p11_test_run (argc, argv);
  }