commit e5c34ad587d6e21ed6d6950f1250018e9b3ec274 parent d2f4ff23fb8e50208ab396f6e87e09a7a4fa17a6 Author: Christian Grothoff <christian@grothoff.org> Date: Sat, 10 Oct 2026 00:25:00 +0200 refuse exchange changing master key or currency when cherry-picking /keys Diffstat:
| M | src/lib/exchange_api_get-keys.c | | | 26 | ++++++++++++++++++++++++++ |
1 file changed, 26 insertions(+), 0 deletions(-)
diff --git a/src/lib/exchange_api_get-keys.c b/src/lib/exchange_api_get-keys.c @@ -359,6 +359,32 @@ keys_completed_cb (void *cls, kresp.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; break; } + if (NULL != gkh->prev_keys) + { + const struct TALER_EXCHANGE_Keys *kd_old = gkh->prev_keys; + + /* The denominations and auditor signatures we cherry-picked from + the previous response were validated against the master public + key of that response; refuse to re-attribute them to a + different master public key (or currency). */ + if ( (0 != + GNUNET_memcmp (&kd->master_pub, + &kd_old->master_pub)) || + (0 != + strcmp (kd->currency, + kd_old->currency)) ) + { + GNUNET_break_op (0); + TALER_LOG_ERROR ( + "Exchange changed master public key or currency in /keys\n"); + kd->rc = 1; + TALER_EXCHANGE_keys_decref (kd); + kd = NULL; + kresp.hr.http_status = 0; + kresp.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; + break; + } + } kd->rc = 1; kd->key_data_expiration = gkh->expire; if (GNUNET_TIME_relative_cmp (