secmod_cs.h (6164B)
1 /* 2 This file is part of TALER 3 Copyright (C) 2020-2022 Taler Systems SA 4 5 TALER is free software; you can redistribute it and/or modify it under the 6 terms of the GNU General Public License as published by the Free Software 7 Foundation; either version 3, or (at your option) any later version. 8 9 TALER is distributed in the hope that it will be useful, but WITHOUT ANY 10 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 11 A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 13 You should have received a copy of the GNU General Public License along with 14 TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> 15 */ 16 /** 17 * @file util/secmod_cs.h 18 * @brief IPC messages for the CS crypto helper. 19 * @author Christian Grothoff 20 * @author Gian Demarmels 21 * @author Lucien Heuzeveldt 22 */ 23 #ifndef TALER_EXCHANGE_SECMOD_CS_H 24 #define TALER_EXCHANGE_SECMOD_CS_H 25 26 #define TALER_HELPER_CS_MT_PURGE 1 27 #define TALER_HELPER_CS_MT_AVAIL 2 28 29 #define TALER_HELPER_CS_MT_REQ_INIT 3 30 #define TALER_HELPER_CS_MT_REQ_BATCH_SIGN 4 31 #define TALER_HELPER_CS_MT_REQ_SIGN 5 32 #define TALER_HELPER_CS_MT_REQ_REVOKE 6 33 #define TALER_HELPER_CS_MT_REQ_BATCH_RDERIVE 7 34 #define TALER_HELPER_CS_MT_REQ_RDERIVE 8 35 36 #define TALER_HELPER_CS_MT_RES_SIGNATURE 9 37 #define TALER_HELPER_CS_MT_RES_SIGN_FAILURE 10 38 #define TALER_HELPER_CS_MT_RES_BATCH_SIGN_FAILURE 11 39 #define TALER_HELPER_CS_MT_RES_RDERIVE 12 40 #define TALER_HELPER_CS_MT_RES_RDERIVE_FAILURE 13 41 #define TALER_HELPER_CS_MT_RES_BATCH_RDERIVE_FAILURE 14 42 43 #define TALER_HELPER_CS_SYNCED 15 44 45 GNUNET_NETWORK_STRUCT_BEGIN 46 47 48 /** 49 * Message sent if a key is available. 50 */ 51 struct TALER_CRYPTO_CsKeyAvailableNotification 52 { 53 /** 54 * Type is #TALER_HELPER_CS_MT_AVAIL 55 */ 56 struct GNUNET_MessageHeader header; 57 58 /** 59 * Number of bytes of the section name. 60 */ 61 uint32_t section_name_len; 62 63 /** 64 * When does the key become available? 65 */ 66 struct GNUNET_TIME_TimestampNBO anchor_time; 67 68 /** 69 * How long is the key available after @e anchor_time? 70 */ 71 struct GNUNET_TIME_RelativeNBO duration_withdraw; 72 73 /** 74 * Public key used to generate the @e sicm_sig. 75 */ 76 struct TALER_SecurityModulePublicKeyP secm_pub; 77 78 /** 79 * Signature affirming the announcement, of 80 * purpose #TALER_SIGNATURE_SM_CS_DENOMINATION_KEY. 81 */ 82 struct TALER_SecurityModuleSignatureP secm_sig; 83 84 /** 85 * Denomination Public key 86 */ 87 struct GNUNET_CRYPTO_CsPublicKey denom_pub; 88 89 /* followed by @e section_name bytes of the configuration section name 90 of the denomination of this key */ 91 92 }; 93 94 95 /** 96 * Message sent if a key was purged. 97 */ 98 struct TALER_CRYPTO_CsKeyPurgeNotification 99 { 100 /** 101 * Type is #TALER_HELPER_CS_MT_PURGE. 102 */ 103 struct GNUNET_MessageHeader header; 104 105 /** 106 * For now, always zero. 107 */ 108 uint32_t reserved; 109 110 /** 111 * Hash of the public key of the purged CS key. 112 */ 113 struct TALER_CsPubHashP h_cs; 114 115 }; 116 117 118 /** 119 * Message sent if a signature is requested. 120 */ 121 struct TALER_CRYPTO_CsSignRequestMessage 122 { 123 /** 124 * Type is #TALER_HELPER_CS_MT_REQ_SIGN. 125 */ 126 struct GNUNET_MessageHeader header; 127 128 /** 129 * 0 for withdraw, 1 for melt, in NBO. 130 */ 131 uint32_t for_melt; 132 133 /** 134 * Hash of the public key of the CS key to use for the signature. 135 */ 136 struct TALER_CsPubHashP h_cs; 137 138 /** 139 * Message to sign. 140 */ 141 struct GNUNET_CRYPTO_CsBlindedMessage message; 142 143 }; 144 145 146 /** 147 * Message sent if a batch of signatures is requested. 148 */ 149 struct TALER_CRYPTO_BatchSignRequest 150 { 151 /** 152 * Type is #TALER_HELPER_CS_MT_REQ_BATCH_SIGN. 153 */ 154 struct GNUNET_MessageHeader header; 155 156 /** 157 * Number of signatures to create, in NBO. 158 */ 159 uint32_t batch_size; 160 161 /* 162 * Followed by @e batch_size batch sign requests. 163 */ 164 165 }; 166 167 168 /** 169 * Message sent if a signature is requested. 170 */ 171 struct TALER_CRYPTO_CsRDeriveRequest 172 { 173 /** 174 * Type is #TALER_HELPER_CS_MT_REQ_RDERIVE. 175 */ 176 struct GNUNET_MessageHeader header; 177 178 /** 179 * 0 for withdraw, 1 for melt, in NBO. 180 */ 181 uint32_t for_melt; 182 183 /** 184 * Hash of the public key of the CS key to use for the derivation. 185 */ 186 struct TALER_CsPubHashP h_cs; 187 188 /** 189 * Withdraw nonce to derive R from 190 */ 191 struct GNUNET_CRYPTO_CsSessionNonce nonce; 192 }; 193 194 195 /** 196 * Message sent if a batch of derivations is requested. 197 */ 198 struct TALER_CRYPTO_BatchDeriveRequest 199 { 200 /** 201 * Type is #TALER_HELPER_CS_MT_REQ_BATCH_RDERIVE. 202 */ 203 struct GNUNET_MessageHeader header; 204 205 /** 206 * Number of derivations to create, in NBO. 207 */ 208 uint32_t batch_size; 209 210 /* 211 * Followed by @e batch_size derive requests. 212 */ 213 214 }; 215 216 217 /** 218 * Message sent if a key was revoked. 219 */ 220 struct TALER_CRYPTO_CsRevokeRequest 221 { 222 /** 223 * Type is #TALER_HELPER_CS_MT_REQ_REVOKE. 224 */ 225 struct GNUNET_MessageHeader header; 226 227 /** 228 * For now, always zero. 229 */ 230 uint32_t reserved; 231 232 /** 233 * Hash of the public key of the revoked CS key. 234 */ 235 struct TALER_CsPubHashP h_cs; 236 237 }; 238 239 240 /** 241 * Message sent if a signature was successfully computed. 242 */ 243 struct TALER_CRYPTO_SignResponse 244 { 245 /** 246 * Type is #TALER_HELPER_CS_MT_RES_SIGNATURE. 247 */ 248 struct GNUNET_MessageHeader header; 249 250 /** 251 * The chosen 'b' (0 or 1). 252 */ 253 uint32_t b; 254 255 /** 256 * Contains the blindided s. 257 */ 258 struct GNUNET_CRYPTO_CsBlindS cs_answer; 259 }; 260 261 /** 262 * Message sent if a R is successfully derived 263 */ 264 struct TALER_CRYPTO_RDeriveResponse 265 { 266 /** 267 * Type is #TALER_HELPER_CS_MT_RES_RDERIVE. 268 */ 269 struct GNUNET_MessageHeader header; 270 271 /** 272 * For now, always zero. 273 */ 274 uint32_t reserved; 275 276 /** 277 * Pair of derived R values 278 */ 279 struct GNUNET_CRYPTO_CSPublicRPairP r_pub; 280 }; 281 282 283 /** 284 * Message sent if signing failed. 285 */ 286 struct TALER_CRYPTO_SignFailure 287 { 288 /** 289 * Type is #TALER_HELPER_CS_MT_RES_SIGN_FAILURE. 290 */ 291 struct GNUNET_MessageHeader header; 292 293 /** 294 * If available, Taler error code. In NBO. 295 */ 296 uint32_t ec; 297 298 }; 299 300 /** 301 * Message sent if derivation failed. 302 */ 303 struct TALER_CRYPTO_RDeriveFailure 304 { 305 /** 306 * Type is #TALER_HELPER_CS_MT_RES_RDERIVE_FAILURE. 307 */ 308 struct GNUNET_MessageHeader header; 309 310 /** 311 * If available, Taler error code. In NBO. 312 */ 313 uint32_t ec; 314 315 }; 316 GNUNET_NETWORK_STRUCT_END 317 318 319 #endif