aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/util/crypto_helper_denom.c36
-rw-r--r--src/util/crypto_helper_esign.c10
-rw-r--r--src/util/taler-exchange-secmod-rsa.c3
-rw-r--r--src/util/test_helper_rsa.c2
4 files changed, 27 insertions, 24 deletions
diff --git a/src/util/crypto_helper_denom.c b/src/util/crypto_helper_denom.c
index 93b5211e2..f55d2cd82 100644
--- a/src/util/crypto_helper_denom.c
+++ b/src/util/crypto_helper_denom.c
@@ -145,28 +145,19 @@ try_connect (struct TALER_CRYPTO_DenominationHelper *dh)
/* Fix permissions on client UNIX domain socket,
just in case umask() is not set to enable group write */
{
- char path[sizeof (dh->my_sa) + 1];
+ char path[sizeof (dh->my_sa.sun_path) + 1];
strncpy (path,
- (const char *) &dh->my_sa,
- sizeof (dh->my_sa));
- path[sizeof (dh->my_sa)] = '\0';
+ dh->my_sa.sun_path,
+ sizeof (path) - 1);
+ path[sizeof (dh->my_sa.sun_path)] = '\0';
+ if (0 != chmod (path,
+ S_IRUSR | S_IWUSR | S_IWGRP))
{
- char path[sizeof (dh->sa.sun_path) + 1];
-
- strncpy (path,
- dh->my_sa.sun_path,
- sizeof (dh->my_sa.sun_path));
- path[sizeof (dh->my_sa.sun_path)] = '\0';
-
- if (0 != chmod (path,
- S_IRUSR | S_IWUSR | S_IWGRP))
- {
- GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
- "chmod",
- path);
- }
+ GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
+ "chmod",
+ path);
}
}
GNUNET_free (tmpdir);
@@ -445,6 +436,7 @@ TALER_CRYPTO_helper_denom_poll (struct TALER_CRYPTO_DenominationHelper *dh)
ssize_t ret;
const struct GNUNET_MessageHeader *hdr
= (const struct GNUNET_MessageHeader *) buf;
+ int flag = MSG_DONTWAIT;
try_connect (dh);
if (-1 == dh->sock)
@@ -454,11 +446,14 @@ TALER_CRYPTO_helper_denom_poll (struct TALER_CRYPTO_DenominationHelper *dh)
ret = recv (dh->sock,
buf,
sizeof (buf),
- MSG_DONTWAIT);
+ flag);
if (ret < 0)
{
if (EAGAIN == errno)
{
+ /* EAGAIN should only happen if we did not
+ already go through this loop */
+ GNUNET_assert (0 != flag);
if (dh->synced)
break;
if (! await_read_ready (dh))
@@ -471,7 +466,7 @@ TALER_CRYPTO_helper_denom_poll (struct TALER_CRYPTO_DenominationHelper *dh)
if (-1 == dh->sock)
return; /* give up */
}
- /* FIXME: We should not retry infinitely */
+ flag = 0; /* syscall must be non-blocking this time */
continue; /* try again */
}
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
@@ -480,6 +475,7 @@ TALER_CRYPTO_helper_denom_poll (struct TALER_CRYPTO_DenominationHelper *dh)
return;
}
+ flag = MSG_DONTWAIT;
if ( (ret < sizeof (struct GNUNET_MessageHeader)) ||
(ret != ntohs (hdr->size)) )
{
diff --git a/src/util/crypto_helper_esign.c b/src/util/crypto_helper_esign.c
index 2c51187d0..f98faae2c 100644
--- a/src/util/crypto_helper_esign.c
+++ b/src/util/crypto_helper_esign.c
@@ -146,11 +146,11 @@ try_connect (struct TALER_CRYPTO_ExchangeSignHelper *esh)
/* Fix permissions on client UNIX domain socket,
just in case umask() is not set to enable group write */
{
- char path[sizeof (esh->sa.sun_path) + 1];
+ char path[sizeof (esh->my_sa.sun_path) + 1];
strncpy (path,
esh->my_sa.sun_path,
- sizeof (esh->my_sa.sun_path));
+ sizeof (path) - 1);
path[sizeof (esh->my_sa.sun_path)] = '\0';
if (0 != chmod (path,
@@ -393,6 +393,7 @@ TALER_CRYPTO_helper_esign_poll (struct TALER_CRYPTO_ExchangeSignHelper *esh)
ssize_t ret;
const struct GNUNET_MessageHeader *hdr
= (const struct GNUNET_MessageHeader *) buf;
+ int flag = MSG_DONTWAIT;
try_connect (esh);
if (-1 == esh->sock)
@@ -402,11 +403,12 @@ TALER_CRYPTO_helper_esign_poll (struct TALER_CRYPTO_ExchangeSignHelper *esh)
ret = recv (esh->sock,
buf,
sizeof (buf),
- MSG_DONTWAIT);
+ flag);
if (ret < 0)
{
if (EAGAIN == errno)
{
+ GNUNET_assert (0 != flag);
if (esh->synced)
break;
if (! await_read_ready (esh))
@@ -419,6 +421,7 @@ TALER_CRYPTO_helper_esign_poll (struct TALER_CRYPTO_ExchangeSignHelper *esh)
if (-1 == esh->sock)
return; /* give up */
}
+ flag = 0; /* syscall must be non-blocking this time */
continue; /* try again */
}
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
@@ -427,6 +430,7 @@ TALER_CRYPTO_helper_esign_poll (struct TALER_CRYPTO_ExchangeSignHelper *esh)
return;
}
+ flag = MSG_DONTWAIT;
if ( (ret < sizeof (struct GNUNET_MessageHeader)) ||
(ret != ntohs (hdr->size)) )
{
diff --git a/src/util/taler-exchange-secmod-rsa.c b/src/util/taler-exchange-secmod-rsa.c
index 717c37549..35bd78902 100644
--- a/src/util/taler-exchange-secmod-rsa.c
+++ b/src/util/taler-exchange-secmod-rsa.c
@@ -883,8 +883,9 @@ setup_key (struct DenominationKey *dk,
}
GNUNET_free (buf);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Setup fresh private key %s in `%s'\n",
+ "Setup fresh private key %s at %s in `%s'\n",
GNUNET_h2s (&dk->h_denom_pub),
+ GNUNET_STRINGS_absolute_time_to_string (dk->anchor),
dk->filename);
dk->denom_priv.rsa_private_key = priv;
dk->denom_pub.rsa_public_key = pub;
diff --git a/src/util/test_helper_rsa.c b/src/util/test_helper_rsa.c
index 4a9fa9058..7011afb22 100644
--- a/src/util/test_helper_rsa.c
+++ b/src/util/test_helper_rsa.c
@@ -146,6 +146,7 @@ key_cb (void *cls,
return;
}
+
GNUNET_break (NULL != denom_pub);
for (unsigned int i = 0; i<MAX_KEYS; i++)
if (! keys[i].valid)
@@ -253,6 +254,7 @@ test_signing (struct TALER_CRYPTO_DenominationHelper *dh)
{
void *buf;
size_t buf_size;
+
GNUNET_assert (GNUNET_YES ==
TALER_rsa_blind (&m_hash,
&bks,