aboutsummaryrefslogtreecommitdiff
path: root/src/mint/mint_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mint/mint_common.c')
-rw-r--r--src/mint/mint_common.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/mint/mint_common.c b/src/mint/mint_common.c
index 4afbf072b..734085e7b 100644
--- a/src/mint/mint_common.c
+++ b/src/mint/mint_common.c
@@ -47,11 +47,12 @@ signkeys_iterate_dir_iter (void *cls,
47 47
48 struct SignkeysIterateContext *skc = cls; 48 struct SignkeysIterateContext *skc = cls;
49 ssize_t nread; 49 ssize_t nread;
50 struct TALER_MINT_SignKeyIssue issue; 50 struct TALER_MINT_SignKeyIssuePriv issue;
51
51 nread = GNUNET_DISK_fn_read (filename, 52 nread = GNUNET_DISK_fn_read (filename,
52 &issue, 53 &issue,
53 sizeof (struct TALER_MINT_SignKeyIssue)); 54 sizeof (struct TALER_MINT_SignKeyIssuePriv));
54 if (nread != sizeof (struct TALER_MINT_SignKeyIssue)) 55 if (nread != sizeof (struct TALER_MINT_SignKeyIssuePriv))
55 { 56 {
56 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Invalid signkey file: '%s'\n", filename); 57 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Invalid signkey file: '%s'\n", filename);
57 return GNUNET_OK; 58 return GNUNET_OK;
@@ -87,7 +88,7 @@ TALER_MINT_signkeys_iterate (const char *mint_base_dir,
87 */ 88 */
88int 89int
89TALER_MINT_read_denom_key (const char *filename, 90TALER_MINT_read_denom_key (const char *filename,
90 struct TALER_MINT_DenomKeyIssue *dki) 91 struct TALER_MINT_DenomKeyIssuePriv *dki)
91{ 92{
92 uint64_t size; 93 uint64_t size;
93 size_t offset; 94 size_t offset;
@@ -97,8 +98,8 @@ TALER_MINT_read_denom_key (const char *filename,
97 98
98 ret = GNUNET_SYSERR; 99 ret = GNUNET_SYSERR;
99 data = NULL; 100 data = NULL;
100 offset = sizeof (struct TALER_MINT_DenomKeyIssue) 101 offset = sizeof (struct TALER_MINT_DenomKeyIssuePriv)
101 - offsetof (struct TALER_MINT_DenomKeyIssue, signature); 102 - offsetof (struct TALER_MINT_DenomKeyIssuePriv, issue.signature);
102 if (GNUNET_OK != GNUNET_DISK_file_size (filename, 103 if (GNUNET_OK != GNUNET_DISK_file_size (filename,
103 &size, 104 &size,
104 GNUNET_YES, 105 GNUNET_YES,
@@ -117,7 +118,7 @@ TALER_MINT_read_denom_key (const char *filename,
117 if (NULL == (priv = TALER_RSA_decode_key (data + offset, size - offset))) 118 if (NULL == (priv = TALER_RSA_decode_key (data + offset, size - offset)))
118 goto cleanup; 119 goto cleanup;
119 dki->denom_priv = priv; 120 dki->denom_priv = priv;
120 (void) memcpy (&dki->signature, data, offset); 121 memcpy (&dki->issue.signature, data, offset);
121 ret = GNUNET_OK; 122 ret = GNUNET_OK;
122 123
123 cleanup: 124 cleanup:
@@ -135,7 +136,7 @@ TALER_MINT_read_denom_key (const char *filename,
135 */ 136 */
136int 137int
137TALER_MINT_write_denom_key (const char *filename, 138TALER_MINT_write_denom_key (const char *filename,
138 const struct TALER_MINT_DenomKeyIssue *dki) 139 const struct TALER_MINT_DenomKeyIssuePriv *dki)
139{ 140{
140 struct TALER_RSA_PrivateKeyBinaryEncoded *priv_enc; 141 struct TALER_RSA_PrivateKeyBinaryEncoded *priv_enc;
141 struct GNUNET_DISK_FileHandle *fh; 142 struct GNUNET_DISK_FileHandle *fh;
@@ -153,10 +154,10 @@ TALER_MINT_write_denom_key (const char *filename,
153 goto cleanup; 154 goto cleanup;
154 if (NULL == (priv_enc = TALER_RSA_encode_key (dki->denom_priv))) 155 if (NULL == (priv_enc = TALER_RSA_encode_key (dki->denom_priv)))
155 goto cleanup; 156 goto cleanup;
156 wsize = sizeof (struct TALER_MINT_DenomKeyIssue) 157 wsize = sizeof (struct TALER_MINT_DenomKeyIssuePriv)
157 - offsetof (struct TALER_MINT_DenomKeyIssue, signature); 158 - offsetof (struct TALER_MINT_DenomKeyIssuePriv, issue.signature);
158 if (GNUNET_SYSERR == (wrote = GNUNET_DISK_file_write (fh, 159 if (GNUNET_SYSERR == (wrote = GNUNET_DISK_file_write (fh,
159 &dki->signature, 160 &dki->issue.signature,
160 wsize))) 161 wsize)))
161 goto cleanup; 162 goto cleanup;
162 if (wrote != wsize) 163 if (wrote != wsize)
@@ -183,11 +184,13 @@ denomkeys_iterate_keydir_iter (void *cls,
183{ 184{
184 185
185 struct DenomkeysIterateContext *dic = cls; 186 struct DenomkeysIterateContext *dic = cls;
186 struct TALER_MINT_DenomKeyIssue issue; 187 struct TALER_MINT_DenomKeyIssuePriv issue;
187 188
188 if (GNUNET_OK != TALER_MINT_read_denom_key (filename, &issue)) 189 if (GNUNET_OK != TALER_MINT_read_denom_key (filename, &issue))
189 { 190 {
190 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Invalid denomkey file: '%s'\n", filename); 191 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
192 "Invalid denomkey file: '%s'\n",
193 filename);
191 return GNUNET_OK; 194 return GNUNET_OK;
192 } 195 }
193 return dic->it (dic->it_cls, dic->alias, &issue); 196 return dic->it (dic->it_cls, dic->alias, &issue);