Skip to content

Commit 5fc6304

Browse files
committed
resolve copilot comments
1 parent 2059217 commit 5fc6304

File tree

3 files changed

+97
-65
lines changed

3 files changed

+97
-65
lines changed

include/utility/mpt_utility.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ extern "C" {
2424
#define kMPT_BLINDING_FACTOR_SIZE 32
2525

2626
// Gamal & Pedersen primitive sizes in bytes
27-
#define kMPT_GAMAL_CIPHER_SIZE 33
28-
#define kMPT_GAMAL_TOTAL_SIZE 66
27+
#define kMPT_ELGAMAL_CIPHER_SIZE 33
28+
#define kMPT_ELGAMAL_TOTAL_SIZE 66
2929
#define kMPT_PEDERSEN_COMMIT_SIZE 64
3030

3131
// Proof sizes in bytes
@@ -76,7 +76,7 @@ typedef struct
7676
struct mpt_confidential_recipient
7777
{
7878
uint8_t pubkey[kMPT_PUBKEY_SIZE];
79-
uint8_t encrypted_amount[kMPT_GAMAL_TOTAL_SIZE];
79+
uint8_t encrypted_amount[kMPT_ELGAMAL_TOTAL_SIZE];
8080
};
8181

8282
/**
@@ -97,7 +97,7 @@ struct mpt_pedersen_proof_params
9797
/**
9898
* @brief The 66-byte buffer containing the encrypted amount.
9999
*/
100-
uint8_t encrypted_amount[kMPT_GAMAL_TOTAL_SIZE];
100+
uint8_t encrypted_amount[kMPT_ELGAMAL_TOTAL_SIZE];
101101

102102
/**
103103
* @brief The 32-byte secret random value used to blind the Pedersen commitment.
@@ -180,22 +180,22 @@ get_confidential_send_proof_size(size_t n_recipients);
180180
*/
181181
bool
182182
mpt_make_ec_pair(
183-
uint8_t const buffer[kMPT_GAMAL_TOTAL_SIZE],
183+
uint8_t const buffer[kMPT_ELGAMAL_TOTAL_SIZE],
184184
secp256k1_pubkey& out1,
185185
secp256k1_pubkey& out2);
186186

187187
/**
188-
* @brief Parses a 66-byte buffer into two internal secp256k1 public keys.
188+
* @brief Serializes two internal secp256k1 public keys into a 66-byte buffer.
189189
* @param in1 [in] Internal format of the first point (C1).
190190
* @param in2 [in] Internal format of the second point (C2).
191-
* @param out [out] 66-byte buffer to write the points.
192-
* @return true if both points were valid and successfully parsed, false otherwise.
191+
* @param out [out] 66-byte buffer to write the serialized points.
192+
* @return true if both points were valid and successfully serialized, false otherwise.
193193
*/
194194
bool
195195
mpt_serialize_ec_pair(
196196
secp256k1_pubkey const& in1,
197197
secp256k1_pubkey const& in2,
198-
uint8_t out[kMPT_GAMAL_TOTAL_SIZE]);
198+
uint8_t out[kMPT_ELGAMAL_TOTAL_SIZE]);
199199

200200
/**
201201
* @brief Generates a new Secp256k1 ElGamal keypair.
@@ -204,7 +204,7 @@ mpt_serialize_ec_pair(
204204
* @return 0 on success, -1 on failure.
205205
*/
206206
int
207-
mpt_generate_keypair(uint8_t* out_priv, uint8_t* out_pub);
207+
mpt_generate_keypair(uint8_t* out_privkey, uint8_t* out_pubkey);
208208

209209
/**
210210
* @brief Generates a 32-byte blinding factor.
@@ -227,7 +227,7 @@ mpt_encrypt_amount(
227227
uint64_t amount,
228228
uint8_t const pubkey[kMPT_PUBKEY_SIZE],
229229
uint8_t const blinding_factor[kMPT_BLINDING_FACTOR_SIZE],
230-
uint8_t out_ciphertext[kMPT_GAMAL_TOTAL_SIZE]);
230+
uint8_t out_ciphertext[kMPT_ELGAMAL_TOTAL_SIZE]);
231231

232232
/**
233233
* @brief Decrypts an MPT amount from a ciphertext pair.
@@ -238,7 +238,7 @@ mpt_encrypt_amount(
238238
*/
239239
int
240240
mpt_decrypt_amount(
241-
uint8_t const ciphertext[kMPT_GAMAL_TOTAL_SIZE],
241+
uint8_t const ciphertext[kMPT_ELGAMAL_TOTAL_SIZE],
242242
uint8_t const privkey[kMPT_PRIVKEY_SIZE],
243243
uint64_t* out_amount);
244244

@@ -372,7 +372,7 @@ mpt_get_clawback_proof(
372372
uint8_t const pub[kMPT_PUBKEY_SIZE],
373373
uint8_t const context_hash[kMPT_HALF_SHA_SIZE],
374374
uint64_t const amount,
375-
uint8_t const encrypted_amount[kMPT_GAMAL_TOTAL_SIZE],
375+
uint8_t const encrypted_amount[kMPT_ELGAMAL_TOTAL_SIZE],
376376
uint8_t out_proof[kMPT_EQUALITY_PROOF_SIZE]);
377377

378378
#ifdef __cplusplus

0 commit comments

Comments
 (0)