diff options
Diffstat (limited to 'pkcs11/gkm')
-rw-r--r-- | pkcs11/gkm/Makefile.am | 251 | ||||
-rw-r--r-- | pkcs11/gkm/mock-module.c | 2 | ||||
-rw-r--r-- | pkcs11/gkm/test-certificate.c | 2 | ||||
-rw-r--r-- | pkcs11/gkm/test-data-asn1.c | 2 | ||||
-rw-r--r-- | pkcs11/gkm/test-data-der.c | 12 | ||||
-rw-r--r-- | pkcs11/gkm/test-object.c | 2 |
6 files changed, 156 insertions, 115 deletions
diff --git a/pkcs11/gkm/Makefile.am b/pkcs11/gkm/Makefile.am index 45f61b00..20c7d912 100644 --- a/pkcs11/gkm/Makefile.am +++ b/pkcs11/gkm/Makefile.am @@ -1,111 +1,152 @@ -INCLUDES = \ - -I$(top_builddir) \ - -I$(top_srcdir) \ - -I$(top_srcdir)/pkcs11 \ - -DSRCDIR="\"@abs_srcdir@\"" \ - $(GOBJECT_CFLAGS) \ - $(LIBGCRYPT_CFLAGS) \ - $(GLIB_CFLAGS) # ------------------------------------------------------------------------------ # The GKM library -noinst_LTLIBRARIES = \ +noinst_LTLIBRARIES += \ libgkm.la -BUILT_SOURCES = \ +gkm_BUILT = \ gkm-marshal.c gkm-marshal.h -libgkm_la_SOURCES = \ - gkm-aes-key.c gkm-aes-key.h \ - gkm-aes-mechanism.c gkm-aes-mechanism.h \ - gkm-assertion.c gkm-assertion.h \ - gkm-attributes.c gkm-attributes.h \ - gkm-certificate.c gkm-certificate.h \ - gkm-certificate-key.c gkm-certificate-key.h \ - gkm-credential.c gkm-credential.h \ - gkm-crypto.c gkm-crypto.h \ - gkm-data-asn1.c gkm-data-asn1.h \ - gkm-data-der.c gkm-data-der.h \ - gkm-data-types.h \ - gkm-debug.c gkm-debug.h \ - gkm-dh-key.c gkm-dh-key.h \ - gkm-dh-mechanism.c gkm-dh-mechanism.h \ - gkm-dh-private-key.c gkm-dh-private-key.h \ - gkm-dh-public-key.c gkm-dh-public-key.h \ - gkm-dsa-mechanism.c gkm-dsa-mechanism.h \ - gkm-factory.c gkm-factory.h \ - gkm-file-tracker.c gkm-file-tracker.h \ - gkm-generic-key.c gkm-generic-key.h \ - gkm-hkdf-mechanism.c gkm-hkdf-mechanism.h \ - gkm-log.c gkm-log.h \ - gkm-manager.c gkm-manager.h \ - gkm-memory-store.c gkm-memory-store.h \ - gkm-mock.c gkm-mock.h \ - gkm-module.c gkm-module.h gkm-module-ep.h \ - gkm-null-key.c gkm-null-key.h \ - gkm-null-mechanism.c gkm-null-mechanism.h \ - gkm-object.c gkm-object.h \ - gkm-oids.h \ - gkm-private-xsa-key.c gkm-private-xsa-key.h \ - gkm-public-xsa-key.c gkm-public-xsa-key.h \ - gkm-rsa-mechanism.c gkm-rsa-mechanism.h \ - gkm-secret.c gkm-secret.h \ - gkm-secret-key.c gkm-secret-key.h \ - gkm-serializable.c gkm-serializable.h \ - gkm-session.c gkm-session.h \ - gkm-sexp.c gkm-sexp.h \ - gkm-sexp-key.c gkm-sexp-key.h \ - gkm-store.c gkm-store.h \ - gkm-test.c gkm-test.h \ - gkm-timer.c gkm-timer.h \ - gkm-transaction.c gkm-transaction.h \ - gkm-trust.c gkm-trust.h \ - gkm-types.h \ - gkm-util.c gkm-util.h \ - $(BUILT_SOURCES) +BUILT_SOURCES += $(gkm_BUILT) +libgkm_la_SOURCES = \ + pkcs11/gkm/gkm-aes-key.c \ + pkcs11/gkm/gkm-aes-key.h \ + pkcs11/gkm/gkm-aes-mechanism.c \ + pkcs11/gkm/gkm-aes-mechanism.h \ + pkcs11/gkm/gkm-assertion.c \ + pkcs11/gkm/gkm-assertion.h \ + pkcs11/gkm/gkm-attributes.c \ + pkcs11/gkm/gkm-attributes.h \ + pkcs11/gkm/gkm-certificate.c \ + pkcs11/gkm/gkm-certificate.h \ + pkcs11/gkm/gkm-certificate-key.c \ + pkcs11/gkm/gkm-certificate-key.h \ + pkcs11/gkm/gkm-credential.c \ + pkcs11/gkm/gkm-credential.h \ + pkcs11/gkm/gkm-crypto.c \ + pkcs11/gkm/gkm-crypto.h \ + pkcs11/gkm/gkm-data-asn1.c \ + pkcs11/gkm/gkm-data-asn1.h \ + pkcs11/gkm/gkm-data-der.c \ + pkcs11/gkm/gkm-data-der.h \ + pkcs11/gkm/gkm-data-types.h \ + pkcs11/gkm/gkm-debug.c \ + pkcs11/gkm/gkm-debug.h \ + pkcs11/gkm/gkm-dh-key.c \ + pkcs11/gkm/gkm-dh-key.h \ + pkcs11/gkm/gkm-dh-mechanism.c \ + pkcs11/gkm/gkm-dh-mechanism.h \ + pkcs11/gkm/gkm-dh-private-key.c \ + pkcs11/gkm/gkm-dh-private-key.h \ + pkcs11/gkm/gkm-dh-public-key.c \ + pkcs11/gkm/gkm-dh-public-key.h \ + pkcs11/gkm/gkm-dsa-mechanism.c \ + pkcs11/gkm/gkm-dsa-mechanism.h \ + pkcs11/gkm/gkm-factory.c \ + pkcs11/gkm/gkm-factory.h \ + pkcs11/gkm/gkm-file-tracker.c \ + pkcs11/gkm/gkm-file-tracker.h \ + pkcs11/gkm/gkm-generic-key.c \ + pkcs11/gkm/gkm-generic-key.h \ + pkcs11/gkm/gkm-hkdf-mechanism.c \ + pkcs11/gkm/gkm-hkdf-mechanism.h \ + pkcs11/gkm/gkm-log.c \ + pkcs11/gkm/gkm-log.h \ + pkcs11/gkm/gkm-manager.c \ + pkcs11/gkm/gkm-manager.h \ + pkcs11/gkm/gkm-memory-store.c \ + pkcs11/gkm/gkm-memory-store.h \ + pkcs11/gkm/gkm-mock.c \ + pkcs11/gkm/gkm-mock.h \ + pkcs11/gkm/gkm-module.c \ + pkcs11/gkm/gkm-module.h \ + pkcs11/gkm/gkm-module-ep.h \ + pkcs11/gkm/gkm-null-key.c \ + pkcs11/gkm/gkm-null-key.h \ + pkcs11/gkm/gkm-null-mechanism.c \ + pkcs11/gkm/gkm-null-mechanism.h \ + pkcs11/gkm/gkm-object.c \ + pkcs11/gkm/gkm-object.h \ + pkcs11/gkm/gkm-oids.h \ + pkcs11/gkm/gkm-private-xsa-key.c \ + pkcs11/gkm/gkm-private-xsa-key.h \ + pkcs11/gkm/gkm-public-xsa-key.c \ + pkcs11/gkm/gkm-public-xsa-key.h \ + pkcs11/gkm/gkm-rsa-mechanism.c \ + pkcs11/gkm/gkm-rsa-mechanism.h \ + pkcs11/gkm/gkm-secret.c \ + pkcs11/gkm/gkm-secret.h \ + pkcs11/gkm/gkm-secret-key.c \ + pkcs11/gkm/gkm-secret-key.h \ + pkcs11/gkm/gkm-serializable.c \ + pkcs11/gkm/gkm-serializable.h \ + pkcs11/gkm/gkm-session.c \ + pkcs11/gkm/gkm-session.h \ + pkcs11/gkm/gkm-sexp.c \ + pkcs11/gkm/gkm-sexp.h \ + pkcs11/gkm/gkm-sexp-key.c \ + pkcs11/gkm/gkm-sexp-key.h \ + pkcs11/gkm/gkm-store.c \ + pkcs11/gkm/gkm-store.h \ + pkcs11/gkm/gkm-test.c \ + pkcs11/gkm/gkm-test.h \ + pkcs11/gkm/gkm-timer.c \ + pkcs11/gkm/gkm-timer.h \ + pkcs11/gkm/gkm-transaction.c \ + pkcs11/gkm/gkm-transaction.h \ + pkcs11/gkm/gkm-trust.c \ + pkcs11/gkm/gkm-trust.h \ + pkcs11/gkm/gkm-types.h \ + pkcs11/gkm/gkm-util.c \ + pkcs11/gkm/gkm-util.h \ + $(gkm_BUILT) libgkm_la_CFLAGS = \ + -I$(srcdir)/pkcs11 \ -DG_LOG_DOMAIN=\"Gkm\" \ $(GOBJECT_CFLAGS) \ $(LIBGCRYPT_CFLAGS) \ $(LIBTASN1_CFLAGS) \ $(GLIB_CFLAGS) - libgkm_la_LIBADD = \ - $(top_builddir)/egg/libegg.la \ + libegg.la \ $(GOBJECT_LIBS) \ $(LIBGCRYPT_LIBS) \ $(GLIB_LIBS) -gkm-marshal.h: gkm-marshal.list $(GLIB_GENMARSHAL) +gkm-marshal.h: pkcs11/gkm/gkm-marshal.list $(GLIB_GENMARSHAL) $(GLIB_GENMARSHAL) $< --header --prefix=gkm_marshal > $@ - -gkm-marshal.c: gkm-marshal.list $(GLIB_GENMARSHAL) +gkm-marshal.c: pkcs11/gkm/gkm-marshal.list $(GLIB_GENMARSHAL) echo "#include \"gkm-marshal.h\"" > $@ && \ $(GLIB_GENMARSHAL) $< --body --prefix=gkm_marshal >> $@ -EXTRA_DIST = \ - gkm-marshal.list +EXTRA_DIST += \ + pkcs11/gkm/gkm-marshal.list # ------------------------------------------------------------------------------- # TESTS -LDADD = \ - $(top_builddir)/pkcs11/gkm/libgkm.la \ - $(top_builddir)/egg/libegg.la \ - $(GLIB_LIBS) \ - $(GTHREAD_LIBS) \ - $(LIBGCRYPT_LIBS) +EXTRA_DIST += pkcs11/gkm/fixtures -noinst_LIBRARIES = libgkm-mock.a +noinst_LIBRARIES += libgkm-mock.a libgkm_mock_a_SOURCES = \ - mock-module.c mock-module.h \ - mock-locked-object.c mock-locked-object.h \ - test.asn.h + pkcs11/gkm/mock-module.c \ + pkcs11/gkm/mock-module.h \ + pkcs11/gkm/mock-locked-object.c \ + pkcs11/gkm/mock-locked-object.h \ + pkcs11/gkm/test.asn.h -TEST_PROGS = \ +gkm_LIBS = \ + libgkm-mock.a \ + libgkm.la \ + libegg.la \ + $(GLIB_LIBS) \ + $(GTHREAD_LIBS) \ + $(LIBGCRYPT_LIBS) + +TEST_PROGS += \ test-attributes \ test-credential \ test-data-asn1 \ @@ -120,43 +161,43 @@ TEST_PROGS = \ test-timer \ test-transaction -test_credential_LDADD = \ - libgkm-mock.a \ - $(LDADD) +test_attributes_SOURCES = pkcs11/gkm/test-attributes.c +test_attributes_LDADD = $(gkm_LIBS) -test_memory_store_LDADD = \ - libgkm-mock.a \ - $(LDADD) +test_credential_SOURCES = pkcs11/gkm/test-credential.c +test_credential_LDADD = $(gkm_LIBS) -test_object_LDADD = \ - libgkm-mock.a \ - $(LDADD) +test_data_asn1_SOURCES = pkcs11/gkm/test-data-asn1.c +test_data_asn1_LDADD = $(gkm_LIBS) -test_certificate_LDADD = \ - libgkm-mock.a \ - $(LDADD) +test_data_der_SOURCES = pkcs11/gkm/test-data-der.c +test_data_der_LDADD = $(gkm_LIBS) -test_store_LDADD = \ - libgkm-mock.a \ - $(LDADD) +test_file_tracker_SOURCES = pkcs11/gkm/test-file-tracker.c +test_file_tracker_LDADD = $(gkm_LIBS) -test_timer_LDADD = \ - libgkm-mock.a \ - $(LDADD) +test_memory_store_SOURCES = pkcs11/gkm/test-memory-store.c +test_memory_store_LDADD = $(gkm_LIBS) -check_PROGRAMS = $(TEST_PROGS) +test_object_SOURCES = pkcs11/gkm/test-object.c +test_object_LDADD = $(gkm_LIBS) -test: $(TEST_PROGS) - gtester --verbose -m $(TEST_MODE) --g-fatal-warnings $(TEST_PROGS) +test_certificate_SOURCES = pkcs11/gkm/test-certificate.c +test_certificate_LDADD = $(gkm_LIBS) -check-local: test +test_secret_SOURCES = pkcs11/gkm/test-secret.c +test_secret_LDADD = $(gkm_LIBS) -all-local: $(check_PROGRAMS) +test_sexp_SOURCES = pkcs11/gkm/test-sexp.c +test_sexp_LDADD = $(gkm_LIBS) -EXTRA_DIST += \ - test.asn \ - fixtures +test_store_SOURCES = pkcs11/gkm/test-store.c +test_store_LDADD = $(gkm_LIBS) + +test_timer_SOURCES = pkcs11/gkm/test-timer.c +test_timer_LDADD = $(gkm_LIBS) + +test_transaction_SOURCES = pkcs11/gkm/test-transaction.c +test_transaction_LDADD = $(gkm_LIBS) -asn: - asn1Parser -o test.asn.h test.asn - sed -i 's|#include.*|/* \0 */|' test.asn.h +ASN1_FILES += pkcs11/gkm/test.asn diff --git a/pkcs11/gkm/mock-module.c b/pkcs11/gkm/mock-module.c index 56760262..4b4fb55d 100644 --- a/pkcs11/gkm/mock-module.c +++ b/pkcs11/gkm/mock-module.c @@ -109,7 +109,7 @@ mock_module_object_new (GkmSession *session) { CKA_CERTIFICATE_TYPE, &type, sizeof (type) }, }; - if (!g_file_get_contents (SRCDIR "/fixtures/test-certificate-1.der", &data, &n_data, NULL)) + if (!g_file_get_contents (SRCDIR "/pkcs11/gkm/fixtures/test-certificate-1.der", &data, &n_data, NULL)) g_assert_not_reached (); attrs[0].pValue = data; diff --git a/pkcs11/gkm/test-certificate.c b/pkcs11/gkm/test-certificate.c index 9356ad2e..a74577c2 100644 --- a/pkcs11/gkm/test-certificate.c +++ b/pkcs11/gkm/test-certificate.c @@ -53,7 +53,7 @@ setup_basic (Test* test, test->module = mock_module_initialize_and_enter (); test->session = mock_module_open_session (TRUE); - if (!g_file_get_contents (SRCDIR "/fixtures/test-certificate-1.der", &data, &length, NULL)) + if (!g_file_get_contents (SRCDIR "/pkcs11/gkm/fixtures/test-certificate-1.der", &data, &length, NULL)) g_assert_not_reached (); test->certificate_data = g_bytes_new_take (data, length); diff --git a/pkcs11/gkm/test-data-asn1.c b/pkcs11/gkm/test-data-asn1.c index 79786524..5b20bb21 100644 --- a/pkcs11/gkm/test-data-asn1.c +++ b/pkcs11/gkm/test-data-asn1.c @@ -50,7 +50,7 @@ setup (Test *test, gconstpointer unused) gchar *contents; gsize length; - if (!g_file_get_contents (SRCDIR "/fixtures/test-certificate-1.der", &contents, &length, NULL)) + if (!g_file_get_contents (SRCDIR "/pkcs11/gkm/fixtures/test-certificate-1.der", &contents, &length, NULL)) g_assert_not_reached (); data = g_bytes_new_take (contents, length); diff --git a/pkcs11/gkm/test-data-der.c b/pkcs11/gkm/test-data-der.c index 592ed9b9..70253ec3 100644 --- a/pkcs11/gkm/test-data-der.c +++ b/pkcs11/gkm/test-data-der.c @@ -119,7 +119,7 @@ setup (Test *test, gconstpointer unused) { GBytes *data; - if (!g_file_get_contents (SRCDIR "/fixtures/test-certificate-1.der", &test->certificate_data, &test->n_certificate_data, NULL)) + if (!g_file_get_contents (SRCDIR "/pkcs11/gkm/fixtures/test-certificate-1.der", &test->certificate_data, &test->n_certificate_data, NULL)) g_assert_not_reached (); data = g_bytes_new (test->certificate_data, test->n_certificate_data); @@ -127,7 +127,7 @@ setup (Test *test, gconstpointer unused) g_assert (test->certificate != NULL); g_bytes_unref (data); - if (!g_file_get_contents (SRCDIR "/fixtures/test-certificate-2.der", &test->certificate2_data, &test->n_certificate2_data, NULL)) + if (!g_file_get_contents (SRCDIR "/pkcs11/gkm/fixtures/test-certificate-2.der", &test->certificate2_data, &test->n_certificate2_data, NULL)) g_assert_not_reached (); data = g_bytes_new (test->certificate2_data, test->n_certificate2_data); test->certificate2 = egg_asn1x_create_and_decode (pkix_asn1_tab, "Certificate", data); @@ -342,7 +342,7 @@ test_read_ca_certificates_public_key_info (Test *test, gconstpointer unused) gchar *data; gsize n_data; - if (!g_file_get_contents (SRCDIR "/fixtures/ca-certificates.crt", &data, &n_data, NULL)) + if (!g_file_get_contents (SRCDIR "/pkcs11/gkm/fixtures/ca-certificates.crt", &data, &n_data, NULL)) g_assert_not_reached (); bytes = g_bytes_new_take (data, n_data); @@ -448,7 +448,7 @@ test_read_all_pkcs8 (Test *test, gconstpointer unused) gsize n_data; gchar *path; - dir = g_dir_open (SRCDIR "/fixtures", 0, NULL); + dir = g_dir_open (SRCDIR "/pkcs11/gkm/fixtures", 0, NULL); g_assert (dir); for(;;) { @@ -459,7 +459,7 @@ test_read_all_pkcs8 (Test *test, gconstpointer unused) if (!g_pattern_match_simple ("der-key-*", name)) continue; - path = g_build_filename (SRCDIR "/fixtures", name, NULL); + path = g_build_filename (SRCDIR "/pkcs11/gkm/fixtures", name, NULL); if (!g_file_get_contents (path, &data, &n_data, NULL)) g_assert_not_reached (); g_free (path); @@ -485,7 +485,7 @@ test_read_pkcs8_bad_password (Test *test, gconstpointer unused) gchar *data; gsize n_data; - if (!g_file_get_contents (SRCDIR "/fixtures/der-key-encrypted-pkcs5.p8", &data, &n_data, NULL)) + if (!g_file_get_contents (SRCDIR "/pkcs11/gkm/fixtures/der-key-encrypted-pkcs5.p8", &data, &n_data, NULL)) g_assert_not_reached (); bytes = g_bytes_new_take (data, n_data); diff --git a/pkcs11/gkm/test-object.c b/pkcs11/gkm/test-object.c index 53c2e9be..d9b4adcf 100644 --- a/pkcs11/gkm/test-object.c +++ b/pkcs11/gkm/test-object.c @@ -47,7 +47,7 @@ setup (Test* test, gconstpointer unused) test->module = mock_module_initialize_and_enter (); test->session = mock_module_open_session (TRUE); - if (!g_file_get_contents (SRCDIR "/fixtures/test-certificate-1.der", &test->certificate_data, &test->n_certificate_data, NULL)) + if (!g_file_get_contents (SRCDIR "/pkcs11/gkm/fixtures/test-certificate-1.der", &test->certificate_data, &test->n_certificate_data, NULL)) g_assert_not_reached (); } |