X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Futil%2Fcrypto_rsa.c;h=99e4bc1c1cd07ac4af70b50ce8e07e4bd01f7655;hb=76c024311489ede1bca79cf647e568dde70d8a48;hp=c3bf4cc5541b5757e5808571d2f90df06a60fb70;hpb=76ca1c38c35fdd93ee7f082c4874bc7f951915d5;p=oweals%2Fgnunet.git diff --git a/src/util/crypto_rsa.c b/src/util/crypto_rsa.c index c3bf4cc55..99e4bc1c1 100644 --- a/src/util/crypto_rsa.c +++ b/src/util/crypto_rsa.c @@ -571,7 +571,9 @@ GNUNET_CRYPTO_rsa_key_create_from_file (const char *filename) return NULL; while (GNUNET_YES != GNUNET_DISK_file_test (filename)) { - fd = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_FAILIFEXISTS); + fd = GNUNET_DISK_file_open (filename, + GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_FAILIFEXISTS, + GNUNET_DISK_PERM_USER_READ| GNUNET_DISK_PERM_USER_WRITE | GNUNET_DISK_PERM_GROUP_READ); if (NULL == fd) { if (errno == EEXIST) @@ -607,7 +609,7 @@ GNUNET_CRYPTO_rsa_key_create_from_file (const char *filename) if (GNUNET_YES != GNUNET_DISK_file_unlock (fd, 0, sizeof (struct RsaPrivateKeyBinaryEncoded))) GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "fcntl", filename); - GNUNET_assert (GNUNET_YES != GNUNET_DISK_file_close (fd)); + GNUNET_assert (GNUNET_YES == GNUNET_DISK_file_close (fd)); GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Stored new private key in `%s'.\n"), filename); return ret; @@ -687,11 +689,9 @@ GNUNET_CRYPTO_rsa_key_create_from_file (const char *filename) filename); } GNUNET_free (enc); -#ifndef MINGW if (GNUNET_YES != GNUNET_DISK_file_unlock (fd, 0, sizeof (struct RsaPrivateKeyBinaryEncoded))) GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "fcntl", filename); -#endif - GNUNET_assert (0 == GNUNET_DISK_file_close (fd)); + GNUNET_assert (GNUNET_YES == GNUNET_DISK_file_close (fd)); return ret; } @@ -806,7 +806,7 @@ GNUNET_CRYPTO_rsa_decrypt (const struct GNUNET_CRYPTO_RsaPrivateKey *hostkey, * * @param hostkey private key to use for the signing * @param purpose what to sign (size, purpose) - * @param result where to write the signature + * @param sig where to write the signature * @return GNUNET_SYSERR on error, GNUNET_OK on success */ int