@@ -31,6 +31,8 @@ extern "C" {
3131#define kMPT_SCHNORR_PROOF_SIZE 65
3232#define kMPT_EQUALITY_PROOF_SIZE 98
3333#define kMPT_PEDERSEN_LINK_SIZE 195
34+ #define kMPT_SINGLE_BULLETPROOF_SIZE 688
35+ #define kMPT_DOUBLE_BULLETPROOF_SIZE 754
3436
3537// Field sizes in bytes for context hash
3638#define kMPT_TYPE_SIZE 2
@@ -199,7 +201,7 @@ mpt_serialize_ec_pair(
199201/**
200202 * @brief Generates a new Secp256k1 ElGamal keypair.
201203 * @param out_privkey [out] A 32-byte buffer for private key.
202- * @param out_pubkey [out] A 64 -byte buffer for public key.
204+ * @param out_pubkey [out] A 33 -byte buffer for public key.
203205 * @return 0 on success, -1 on failure.
204206 */
205207int
@@ -216,7 +218,7 @@ mpt_generate_blinding_factor(uint8_t out_factor[kMPT_BLINDING_FACTOR_SIZE]);
216218/**
217219 * @brief Encrypts an uint64 amount using an ElGamal public key.
218220 * @param amount [in] The integer value to encrypt.
219- * @param pubkey [in] The 64 -byte public key.
221+ * @param pubkey [in] The 33 -byte public key.
220222 * @param blinding_factor [in] The 32-byte random blinding factor (scalar r).
221223 * @param out_ciphertext [out] A 66-byte buffer to store the resulting ciphertext (C1, C2).
222224 * @return 0 on success, -1 on failure.
@@ -252,7 +254,7 @@ mpt_decrypt_amount(
252254 * sender possesses the private key associated with the account, binding it
253255 * to the specific transaction via the ctx_hash.
254256 *
255- * @param pubkey [in] 64 -byte public key of the account.
257+ * @param pubkey [in] 33 -byte public key of the account.
256258 * @param privkey [in] 32-byte private key of the account.
257259 * @param ctx_hash [in] 32-byte hash of the transaction (challenge).
258260 * @param out_proof [out] 65-byte buffer to store the Schnorr proof.
@@ -269,7 +271,7 @@ mpt_get_convert_proof(
269271 * @brief Computes a Pedersen Commitment point for Confidential MPT.
270272 * @param amount [in] The 64-bit unsigned integer value to commit.
271273 * @param blinding_factor [in] A 32-byte secret scalar (rho) used to hide the amount.
272- * @param out_commitment [out] A 64 -byte buffer to store the commitment
274+ * @param out_commitment [out] A 33 -byte buffer to store the commitment
273275 */
274276int
275277mpt_get_pedersen_commitment (
@@ -279,7 +281,7 @@ mpt_get_pedersen_commitment(
279281
280282/**
281283 * @brief Generates a ZK linkage proof between an ElGamal ciphertext and a Pedersen commitment.
282- * @param pubkey [in] 64 -byte internal format of the sender's public key .
284+ * @param pubkey [in] 33 -byte public key of the sender.
283285 * @param blinding_factor [in] 32-byte blinding factor used for the ElGamal encryption.
284286 * @param context_hash [in] 32-byte hash of the transaction context.
285287 * @param params [in] Struct containing commitment, amount, and ciphertext.
@@ -297,7 +299,7 @@ mpt_get_amount_linkage_proof(
297299/**
298300 * @brief Generates a ZK linkage proof for the sender's balance.
299301 * @param priv [in] 32-byte private key of the sender.
300- * @param pub [in] 64 -byte internal format of the sender's public key .
302+ * @param pub [in] 33 -byte public key of the sender.
301303 * @param context_hash [in] 32-byte hash of the transaction context.
302304 * @param params [in] Struct containing commitment, amount, and ciphertext.
303305 * @param out [out] Buffer of exactly 195 bytes to store the proof.
@@ -341,28 +343,30 @@ mpt_get_confidential_send_proof(
341343/**
342344 * @brief Generates proof for ConfidentialMPTConvertBack.
343345 * @param priv [in] The holder's 32-byte private key.
344- * @param pub [in] The holder's 64 -byte public key (internal format) .
346+ * @param pub [in] The holder's 33 -byte public key.
345347 * @param context_hash [in] The 32-byte context hash binding the proof to the transaction.
348+ * @param amount [in] The amount to convert back.
346349 * @param params [in] Pedersen commitment parameters.
347- * @param out_proof [out] The 65 -byte buffer to be filled with the Pedersen linkage proof.
350+ * @param out_proof [out] The 883 -byte buffer to be filled with the Pedersen linkage proof and range proof.
348351 * @return 0 on success, -1 on failure (e.g., math error or invalid parameters).
349352 */
350353int
351354mpt_get_convert_back_proof (
352355 uint8_t const priv [kMPT_PRIVKEY_SIZE ],
353356 uint8_t const pub [kMPT_PUBKEY_SIZE ],
354357 uint8_t const context_hash [kMPT_HALF_SHA_SIZE ],
358+ uint64_t const amount ,
355359 mpt_pedersen_proof_params const * params ,
356- uint8_t out_proof [kMPT_PEDERSEN_LINK_SIZE ]);
360+ uint8_t out_proof [kMPT_PEDERSEN_LINK_SIZE + kMPT_SINGLE_BULLETPROOF_SIZE ]);
357361
358362/**
359363 * @brief Generates proof for ConfidentialMPTClawback.
360364 * @param priv [in] The issuer's 32-byte private key.
361- * @param pub [in] The issuer's 64 -byte public key.
365+ * @param pub [in] The issuer's 33 -byte public key.
362366 * @param context_hash [in] The 32-byte context hash binding the proof to the transaction.
363367 * @param amount [in] The plaintext amount to be clawed back.
364368 * @param encrypted_amount [in] The 66-byte sfIssuerEncryptedBalance blob from the ledger.
365- * @param out_proof [out] The 64 -byte buffer to be filled with the equality proof.
369+ * @param out_proof [out] The 98 -byte buffer to be filled with the equality proof.
366370 * @return 0 on success, -1 on failure (e.g., math error or invalid ciphertext).
367371 */
368372int
0 commit comments