diff options
Diffstat (limited to 'src/util/crypto_ecc_setup.c')
-rw-r--r-- | src/util/crypto_ecc_setup.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/util/crypto_ecc_setup.c b/src/util/crypto_ecc_setup.c index f7cd8c6d9..21ce48eef 100644 --- a/src/util/crypto_ecc_setup.c +++ b/src/util/crypto_ecc_setup.c | |||
@@ -134,8 +134,10 @@ read_from_file (const char *filename, | |||
134 | * @param filename name of file to use to store the key | 134 | * @param filename name of file to use to store the key |
135 | * @param do_create should a file be created? | 135 | * @param do_create should a file be created? |
136 | * @param[out] pkey set to the private key from @a filename on success | 136 | * @param[out] pkey set to the private key from @a filename on success |
137 | * @return #GNUNET_OK on success, #GNUNET_NO if @a do_create was set but | 137 | * @return - #GNUNET_OK on success, |
138 | * we found an existing file, #GNUNET_SYSERR on failure | 138 | * - #GNUNET_NO if @a do_create was set but we found an existing file, |
139 | * - #GNUNET_SYSERR on failure _or_ if the file didn't exist and @a | ||
140 | * do_create was not set | ||
139 | */ | 141 | */ |
140 | enum GNUNET_GenericReturnValue | 142 | enum GNUNET_GenericReturnValue |
141 | GNUNET_CRYPTO_eddsa_key_from_file (const char *filename, | 143 | GNUNET_CRYPTO_eddsa_key_from_file (const char *filename, |
@@ -152,6 +154,11 @@ GNUNET_CRYPTO_eddsa_key_from_file (const char *filename, | |||
152 | /* file existed, report that we didn't create it... */ | 154 | /* file existed, report that we didn't create it... */ |
153 | return (do_create) ? GNUNET_NO : GNUNET_OK; | 155 | return (do_create) ? GNUNET_NO : GNUNET_OK; |
154 | } | 156 | } |
157 | else if (! do_create) | ||
158 | { | ||
159 | return GNUNET_SYSERR; | ||
160 | } | ||
161 | |||
155 | GNUNET_CRYPTO_eddsa_key_create (pkey); | 162 | GNUNET_CRYPTO_eddsa_key_create (pkey); |
156 | ret = GNUNET_DISK_fn_write (filename, | 163 | ret = GNUNET_DISK_fn_write (filename, |
157 | pkey, | 164 | pkey, |