Better comments
This commit is contained in:
parent
fa486e27d3
commit
1b5ad5f5a8
|
@ -205,7 +205,7 @@ cleanup:
|
|||
* cryptic_prime_order_group_more_bases:
|
||||
* @nb: number of new bases to pick.
|
||||
*
|
||||
* Pick nb ganarators in the prime order group.
|
||||
* Pick nb generators in the prime order group.
|
||||
*
|
||||
* Return value: #CRYPTIC_NO_ERROR if successful, an error code otherwise.
|
||||
*/
|
||||
|
|
|
@ -42,12 +42,12 @@ typedef struct _CrypticPrimeOrderGroupClass CrypticPrimeOrderGroupClass;
|
|||
|
||||
/**
|
||||
* CrypticPrimeOrderGroup:
|
||||
* @p: Nb of quantities in the DL representation to prove.
|
||||
* @pp: base for the DL representation.
|
||||
* @order: DL representation to prove.
|
||||
* @generator: modulus of the group.
|
||||
* @bases: Randoms used for the commitment.
|
||||
* @nb_generator: The commitment.
|
||||
* @p: group modulus - safe prime.
|
||||
* @pp: Cathy-germain of p.
|
||||
* @order: group order.
|
||||
* @generator: group generator.
|
||||
* @bases: table of generators used as bases for DL representation.
|
||||
* @nb_generator: size of the table bases.
|
||||
*
|
||||
* Group of prime order.
|
||||
*
|
||||
|
|
|
@ -344,19 +344,6 @@ cleanup:
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* cryptic_qrg_verif_generator:
|
||||
*
|
||||
* Verify the group of quadratic residues.
|
||||
*
|
||||
* Here we test that the base is in QRn with the Legendre symbol
|
||||
* (a/p) = 0 if p/a, A, 1 if a in QRp, -1 if a in QRp
|
||||
* a in QRn in QRp in QRq
|
||||
* (a/p) = a^((p-1)/2) mod p
|
||||
*
|
||||
* Return value: 1 if the group is ok, an error code otherwise.
|
||||
*
|
||||
*/
|
||||
/*int
|
||||
cryptic_qrg_verif_generator(CrypticQRG *qrg)
|
||||
{
|
||||
|
@ -369,8 +356,21 @@ cryptic_qrg_verif_generator(CrypticQRG *qrg)
|
|||
return 1;
|
||||
}*/
|
||||
|
||||
/**
|
||||
* cryptic_qrg_check_qr:
|
||||
* @qr: number to check
|
||||
* @p: one of the two primes of the QRG modulus
|
||||
*
|
||||
* Test with the Legendre symbol
|
||||
* (qr/p) = qr^((p-1)/2) mod p
|
||||
* Qr valid if the symbol = 1
|
||||
* Qr must be valid with both the primes of the QRG modulus
|
||||
*
|
||||
* Return value: 1 if the Qr is valid for this prime, an error code otherwise.
|
||||
*
|
||||
*/
|
||||
int
|
||||
cryptic_qrg_check_qr(BIGNUM *qr, BIGNUM *modulus)
|
||||
cryptic_qrg_check_qr(BIGNUM *qr, BIGNUM *prime)
|
||||
{
|
||||
int rc = CRYPTIC_ERROR_UNDEFINED;
|
||||
|
||||
|
@ -380,7 +380,7 @@ cryptic_qrg_check_qr(BIGNUM *qr, BIGNUM *modulus)
|
|||
|
||||
goto_cleanup_if_fail_with_rc_with_warning(qr != NULL,
|
||||
CRYPTIC_MATHS_QR_GROUP_NO_QR_TO_VERIFY);
|
||||
goto_cleanup_if_fail_with_rc_with_warning(modulus != NULL,
|
||||
goto_cleanup_if_fail_with_rc_with_warning(prime != NULL,
|
||||
CRYPTIC_MATHS_QR_GROUP_MODULUS_MISSING);
|
||||
goto_cleanup_if_fail_with_rc_with_warning(BN_ucmp(qr, BN_value_one()) != 0,
|
||||
CRYPTIC_MATHS_QR_GROUP_NOT_A_QR);
|
||||
|
@ -391,11 +391,11 @@ cryptic_qrg_check_qr(BIGNUM *qr, BIGNUM *modulus)
|
|||
|
||||
goto_cleanup_if_fail_with_rc_with_warning_openssl(ctx = BN_CTX_new());
|
||||
goto_cleanup_if_fail_with_rc_with_warning_openssl(mont=BN_MONT_CTX_new());
|
||||
goto_cleanup_if_fail_with_rc_with_warning_openssl(BN_MONT_CTX_set(mont,modulus,ctx));
|
||||
goto_cleanup_if_fail_with_rc_with_warning_openssl(BN_MONT_CTX_set(mont,prime,ctx));
|
||||
|
||||
goto_cleanup_if_fail_with_rc_with_warning_openssl(BN_sub(tmp1,modulus,BN_value_one()));
|
||||
goto_cleanup_if_fail_with_rc_with_warning_openssl(BN_sub(tmp1,prime,BN_value_one()));
|
||||
goto_cleanup_if_fail_with_rc_with_warning_openssl(BN_div(tmp1,NULL,tmp1,two,ctx) == 1);
|
||||
goto_cleanup_if_fail_with_rc_with_warning_openssl(BN_mod_exp_mont(tmp1,qr,tmp1,modulus,ctx,mont));
|
||||
goto_cleanup_if_fail_with_rc_with_warning_openssl(BN_mod_exp_mont(tmp1,qr,tmp1,prime,ctx,mont));
|
||||
goto_cleanup_if_fail_with_rc_with_warning(BN_ucmp(tmp1, BN_value_one()) == 0,
|
||||
CRYPTIC_MATHS_QR_GROUP_NOT_A_QR);
|
||||
|
||||
|
|
Reference in New Issue