[rs-commit] r75 - in /redwax-signtext/trunk/src/linux: crypto.c main.c message.c signtext.c
rs-commit at redwax.eu
rs-commit at redwax.eu
Tue Sep 20 16:23:23 CEST 2022
Author: minfrin at redwax.eu
Date: Tue Sep 20 16:23:23 2022
New Revision: 75
Log:
Silence debugging messages.
Modified:
redwax-signtext/trunk/src/linux/crypto.c
redwax-signtext/trunk/src/linux/main.c
redwax-signtext/trunk/src/linux/message.c
redwax-signtext/trunk/src/linux/signtext.c
Modified: redwax-signtext/trunk/src/linux/crypto.c
==============================================================================
--- redwax-signtext/trunk/src/linux/crypto.c (original)
+++ redwax-signtext/trunk/src/linux/crypto.c Tue Sep 20 16:23:23 2022
@@ -142,14 +142,11 @@
if (g_list_find_custom(instance->cas, dn, g_bytes_compare)) {
g_bytes_unref(dn);
- g_printerr("crypto_filter_match: found\n");
return TRUE;
}
g_bytes_unref(dn);
}
-
- g_printerr("crypto_filter_match: not found\n");
return FALSE;
}
@@ -208,7 +205,9 @@
GError *gerror = NULL;
GcrCertificateChainStatus status;
+#if 0
g_printerr("crypto_chain_done\n");
+#endif
if (!gcr_certificate_chain_build_finish(chain, res, &gerror)) {
goto fatal;
@@ -226,11 +225,9 @@
switch (status) {
case GCR_CERTIFICATE_CHAIN_ANCHORED:
- g_printerr("crypto_chain_done: anchored\n");
signtext->anchored_len++;
break;
default:
- g_printerr("crypto_chain_done: not anchored\n");
break;
}
@@ -249,7 +246,6 @@
if (!gcr_collection_contains(signtext->certificates, l->data)) {
g_object_ref(l->data);
gcr_simple_collection_add(GCR_SIMPLE_COLLECTION(signtext->certificates), l->data);
-g_printerr("crypto_chain_done: add\n");
}
}
@@ -259,7 +255,6 @@
if (!gcr_collection_contains(signtext->incoming, l->data)) {
gcr_simple_collection_remove(GCR_SIMPLE_COLLECTION(signtext->certificates), l->data);
g_object_unref(l->data);
-g_printerr("crypto_chain_done: remove\n");
}
}
@@ -290,7 +285,9 @@
GcrCertificateChain *chain = gcr_certificate_chain_new();
+#if 0
g_printerr("crypto_chain_do\n");
+#endif
gcr_certificate_chain_add (chain, current->data);
@@ -312,7 +309,9 @@
GError *gerror = NULL;
guint certificates_len;
+#if 0
g_printerr("crypto_slots_done\n");
+#endif
incoming = gck_enumerator_next_finish(GCK_ENUMERATOR(source_object), res, &gerror);
@@ -411,7 +410,9 @@
SignTextToken *signtext_token = NULL, *st;
+#if 0
g_printerr("crypto_slots_do: %d/%d\n", slots_len, signtext->slots_len);
+#endif
for (l = slots; l; l = g_list_next (l)) {
@@ -421,8 +422,6 @@
st->signtext = signtext;
st->slot = slot;
- //st->token_info = gck_slot_get_token_info (slot);
- //st->certificates = gcr_simple_collection_new();
st->next = signtext_token;
signtext_token = st;
@@ -464,7 +463,9 @@
GError *gerror = NULL;
guint modules_len;
+#if 0
g_printerr("crypto_init_done\n");
+#endif
signtext->modules = gck_modules_initialize_registered_finish(res, &gerror);
@@ -497,7 +498,9 @@
void
crypto_start(SignTextData *signtext)
{
+#if 0
g_printerr("crypto_start\n");
+#endif
gck_modules_initialize_registered_async(signtext->cancellable, (GAsyncReadyCallback)crypto_init_done, signtext);
}
@@ -508,7 +511,9 @@
GObject *selected;
SignTextInstance *instance = user_data;
+#if 0
g_printerr("crypto_selector_changed\n");
+#endif
selected = gcr_combo_selector_get_selected(selector);
@@ -524,8 +529,6 @@
gboolean can_sign = FALSE;
gboolean can_pin = FALSE;
-
- g_printerr("crypto_selector_changed: token\n");
gtk_entry_set_max_length(instance->pin, token_info->max_pin_len);
@@ -536,8 +539,6 @@
can_sign = TRUE;
can_pin = FALSE;
-g_printerr("crypto_selector_changed: CKF_PROTECTED_AUTHENTICATION_PATH\n");
-
}
else {
gtk_entry_set_icon_from_icon_name(instance->pin, GTK_ENTRY_ICON_PRIMARY, "dialog-password-symbolic");
@@ -546,8 +547,6 @@
can_sign = token_info->min_pin_len ? FALSE : TRUE;
can_pin = TRUE;
-
-g_printerr("crypto_selector_changed: PIN\n");
}
if (!(token_info->flags & CKF_USER_PIN_INITIALIZED)) {
@@ -556,9 +555,6 @@
can_sign = FALSE;
can_pin = FALSE;
-
-g_printerr("crypto_selector_changed: PIN is not initialised\n");
-
}
else if (token_info->flags & CKF_USER_PIN_LOCKED) {
gtk_entry_set_icon_from_icon_name(instance->pin, GTK_ENTRY_ICON_PRIMARY, "dialog-error-symbolic");
@@ -566,8 +562,6 @@
can_sign = FALSE;
can_pin = FALSE;
-
-g_printerr("crypto_selector_changed: PIN is locked\n");
}
else if (token_info->flags & CKF_USER_PIN_TO_BE_CHANGED) {
gtk_entry_set_icon_from_icon_name(instance->pin, GTK_ENTRY_ICON_PRIMARY, "dialog-unavailable-symbolic");
@@ -575,25 +569,20 @@
can_sign = FALSE;
can_pin = FALSE;
-
-g_printerr("crypto_selector_changed: PIN must be changed before use\n");
}
else if (token_info->flags & CKF_USER_PIN_FINAL_TRY) {
gtk_entry_set_icon_from_icon_name(instance->pin, GTK_ENTRY_ICON_PRIMARY, "dialog-warning-symbolic");
gtk_entry_set_placeholder_text(GTK_ENTRY(instance->pin), "Final try on PIN");
-
-g_printerr("crypto_selector_changed: Final try on PIN\n");
-
}
else if (token_info->flags & CKF_USER_PIN_COUNT_LOW) {
gtk_entry_set_icon_from_icon_name(instance->pin, GTK_ENTRY_ICON_PRIMARY, "dialog-warning-symbolic");
gtk_entry_set_placeholder_text(GTK_ENTRY(instance->pin), "PIN retries are low");
-
-g_printerr("crypto_selector_changed: PIN retries are low\n");
}
-else {
-g_printerr("crypto_selector_changed: %d\n", (int)token_info->flags);
-}
+#if 0
+ else {
+ g_printerr("crypto_selector_changed: %d\n", (int)token_info->flags);
+ }
+#endif
gtk_widget_set_sensitive(GTK_WIDGET(instance->sign), can_sign);
gtk_widget_set_sensitive(GTK_WIDGET(instance->pin), can_pin);
@@ -609,7 +598,9 @@
GcrPkcs11Certificate *certificate;
SignTextInstance *instance = user_data;
+#if 0
g_printerr("crypto_pin_changed\n");
+#endif
certificate = GCR_PKCS11_CERTIFICATE(gcr_combo_selector_get_selected(instance->selector));
@@ -622,8 +613,6 @@
if (token_info) {
gboolean can_sign = FALSE;
-
- g_printerr("crypto_pin_changed: token\n");
if (gtk_entry_get_text_length(instance->pin) >= token_info->min_pin_len) {
can_sign = TRUE;
@@ -656,7 +645,9 @@
GError *gerror = NULL;
SignTextInstance *instance = user_data;
+#if 0
g_printerr("crypto_sign_loggedout\n");
+#endif
if (gck_session_logout_finish(instance->session, res, &gerror)) {
@@ -680,7 +671,9 @@
static void
crypto_sign_logout(SignTextInstance *instance)
{
+#if 0
g_printerr("crypto_sign_logout\n");
+#endif
gck_session_logout_async (instance->session, instance->signtext->cancellable, crypto_sign_loggedout, instance);
}
@@ -713,7 +706,9 @@
SignTextInstance *instance = cb_value;
gsize len;
+#if 0
g_printerr("pem_writer_cb: %d\n", (int)count);
+#endif
len = instance->payload_len + count;
instance->payload = g_realloc(instance->payload, len);
@@ -733,7 +728,9 @@
{
GError *gerror = NULL;
+#if 0
g_printerr("crypto_sign_done\n");
+#endif
crypto_sign_logout(instance);
@@ -755,7 +752,9 @@
);
gsize c1, c2;
+#if 0
g_printerr("crypto_sign_send_payload\n");
+#endif
instance->done = done;
@@ -798,8 +797,9 @@
gpg_error_t err;
int rc;
+#if 0
g_printerr("crypto_sign_do\n");
-
+#endif
/* Main building loop. */
err = ksba_cms_build (instance->cms, &instance->stopreason);
@@ -810,8 +810,9 @@
if (instance->stopreason == KSBA_SR_BEGIN_DATA) {
+#if 0
g_printerr("crypto_sign_do: begin data\n");
-
+#endif
}
@@ -838,15 +839,19 @@
unsigned char *data;
gsize data_len;
+#if 0
g_printerr("crypto_sign_do: need sig\n");
+#endif
slot = gck_session_get_slot(instance->session);
mechanisms = gck_slot_get_mechanisms(slot);
+#if 0
//int i;
//for (i = 0; i < gck_mechanisms_length(mechanisms); i++) {
//g_printerr("crypto_sign_do: mechs: 0x%lxUL (%s)\n", gck_mechanisms_at(mechanisms, i), gcry_pk_algo_name(gck_mechanisms_at(mechanisms, i)));
//}
+#endif
if (!gck_mechanisms_check(mechanisms, CKM_RSA_PKCS, GCK_INVALID)) {
gerror = g_error_new(RST_CORE_ERROR, RST_CORE_ERROR_SIGN_ERROR, "CKM_RSA_PKCS not supported by this card.");
@@ -1147,7 +1152,9 @@
gpg_error_t err;
+#if 0
g_printerr("crypto_sign_lookup\n");
+#endif
certificate = GCR_PKCS11_CERTIFICATE(gcr_pkcs11_certificate_lookup_issuer_finish(res, &gerror));
@@ -1228,8 +1235,6 @@
}
gcry_md_enable (instance->data_md, instance->hash_alg);
-
- g_printerr("crypto_sign_lookup: after\n");
if (instance->detached) {
@@ -1275,8 +1280,6 @@
g_date_time_unref(now);
g_time_zone_unref(utc);
-
-g_printerr("crypto_sign_lookup: %.16s\n", signed_time);
err = ksba_cms_set_signing_time (instance->cms, 0, signed_time);
if (err) {
@@ -1315,7 +1318,9 @@
gsize der_len;
gpg_error_t err;
+#if 0
g_printerr("crypto_sign\n");
+#endif
instance->certificate = GCR_PKCS11_CERTIFICATE(g_object_ref(gcr_combo_selector_get_selected(instance->selector)));
if (!instance->certificate) {
@@ -1397,7 +1402,9 @@
break;
}
+#if 0
g_printerr("crypto_sign: %s %d\n", instance->hash_oid, instance->hash_alg);
+#endif
err = ksba_cms_add_signer (instance->cms, instance->signer);
if (err) {
Modified: redwax-signtext/trunk/src/linux/main.c
==============================================================================
--- redwax-signtext/trunk/src/linux/main.c (original)
+++ redwax-signtext/trunk/src/linux/main.c Tue Sep 20 16:23:23 2022
@@ -36,7 +36,9 @@
{
SignTextData *signtext = user_data;
+#if 0
g_printerr ("activate\n");
+#endif
signtext->cancellable = g_cancellable_new();
@@ -92,7 +94,9 @@
gint argc;
gint i;
+#if 0
g_printerr ("command_line\n");
+#endif
// g_application_hold(app);
Modified: redwax-signtext/trunk/src/linux/message.c
==============================================================================
--- redwax-signtext/trunk/src/linux/message.c (original)
+++ redwax-signtext/trunk/src/linux/message.c Tue Sep 20 16:23:23 2022
@@ -31,7 +31,9 @@
{
SignTextInstance *instance = user_data;
+#if 0
g_printerr("message_sign_clicked\n");
+#endif
crypto_sign(instance);
@@ -42,7 +44,9 @@
{
SignTextInstance *instance = user_data;
+#if 0
g_printerr("message_cancel_clicked\n");
+#endif
/*
* Send an error to show we cancelled.
@@ -70,7 +74,9 @@
GError *gerror = NULL;
JsonParser *parser = NULL;
+#if 0
g_printerr("message_receive_done\n");
+#endif
parser = g_task_propagate_pointer (G_TASK (res), &gerror);
@@ -282,7 +288,9 @@
guint32 size;
gsize count;
+#if 0
g_printerr("message_receive_do\n");
+#endif
stream = g_unix_input_stream_new (STDIN_FILENO, FALSE);
@@ -364,7 +372,9 @@
SignTextData *signtext = user_data;
GError *gerror = NULL;
+#if 0
g_printerr("message_send_done\n");
+#endif
g_task_propagate_boolean (G_TASK (res), &gerror);
@@ -403,7 +413,9 @@
guint32 size;
gsize count;
+#if 0
g_printerr("message_send_do\n");
+#endif
generator = json_generator_new();
Modified: redwax-signtext/trunk/src/linux/signtext.c
==============================================================================
--- redwax-signtext/trunk/src/linux/signtext.c (original)
+++ redwax-signtext/trunk/src/linux/signtext.c Tue Sep 20 16:23:23 2022
@@ -152,11 +152,8 @@
g_list_free(pages);
if (instance->uuid) g_free(instance->uuid);
- g_printerr("signtext_instance_free: 1\n");
if (instance->uri) g_uri_unref(instance->uri);
- g_printerr("signtext_instance_free: 2\n");
// if (instance->label) g_object_unref(instance->label);
- g_printerr("signtext_instance_free: 3\n");
if (instance->label_text) g_free(instance->label_text);
// if (instance->textview) g_object_unref(instance->textview);
// if (instance->label_agree) g_object_unref(instance->label_agree);
@@ -166,9 +163,7 @@
// if (instance->cancel) g_object_unref(instance->cancel);
// if (instance->sign) g_object_unref(instance->sign);
// if (instance->box) g_object_unref(instance->box);
- g_printerr("signtext_instance_free:4\n");
// if (instance->certificate) g_object_unref(instance->certificate);
- g_printerr("signtext_instance_free: 5\n");
if (instance->w) {
ksba_writer_release(instance->w);
More information about the rs-commit
mailing list