frosix

Multiparty signature service (experimental)
Log | Files | Refs | README | LICENSE

keygen_common.h (3467B)


      1 /*
      2   This file is part of Frosix
      3   Copyright (C) 2022, 2023 Joel Urech
      4 
      5   Frosix is free software; you can redistribute it and/or modify it under the
      6   terms of the GNU Affero General Public License as published by the Free Software
      7   Foundation; either version 3, or (at your option) any later version.
      8 
      9   Frosix 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 Affero General Public License for more details.
     12 
     13   You should have received a copy of the GNU Affero General Public License along with
     14   Frosix; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
     15 */
     16 /**
     17  * @file keygen_common.h
     18  * @brief Implementation of some functions which are used several times in
     19  * different steps of the distributed key generation process.
     20  * @author Joel Urech
     21 */
     22 #ifndef FROST_KEYGEN_COMMON_H
     23 #define FROST_KEYGEN_COMMON_H
     24 
     25 #include "high_common.h"
     26 
     27 /**
     28  * Struct for the challenge of the dkg zkp
     29 */
     30 struct FROST_DkgChallenge
     31 {
     32   /**
     33    * The challenge is a scalar
     34   */
     35   struct FROST_Scalar c;
     36 };
     37 
     38 /**
     39  * Struct for a secret key during a key generation process
     40 */
     41 struct FROST_DkgSecretKey
     42 {
     43   /**
     44    * Our secret key is a scalar
     45   */
     46   struct FROST_Scalar sk;
     47 };
     48 
     49 /**
     50  * @brief Generates the challenge of the zero knowledge proof of the secret
     51  * \f$a_{i0}\f$
     52  * \f$c_i = H(i,"Context-String",g^{a_{i0}},R_i)\f$
     53  *
     54  * @param[out] challenge The resulting challenge, a scalar in the range of the
     55  * order of the ristretto255-group.
     56  * @param[in] generator_index Index of the participant who has the secret
     57  * \f$a_{i0}\f$
     58  * @param[in] s_pub The value \f$g^{a_{i0}}\f$
     59  * @param[in] zkp The value \f$R_i = g^k\f$ where k is a random nonce only
     60  * known to the participant who has the secret \f$a_{i0}\f$
     61  * @param[in] additional_data If not NULL, this data will be included in the
     62  * challenge of the @a zkp.
     63 */
     64 void
     65 FROST_generate_dkg_challenge_ (struct FROST_DkgChallenge *challenge,
     66                                uint8_t generator_index,
     67                                const struct FROST_DkgShareCommitment *s_pub,
     68                                const struct FROST_DkgZkp *zkp,
     69                                const struct FROST_HashCode *additional_data);
     70 
     71 /**
     72  * @brief Generates a random threshold-1 degree polynomial and the
     73  * corresponding commitment values.
     74  *
     75  * @param[out] shares Coefficients of the random generated polynomial
     76  * @param[out] dkg_commitment A commitment value for every share
     77  * \f$g^{a_{ij}}\f$, 0 <= j <= threshold-1.
     78  * To use this function in a trusted dealer setup, there are no dkg commitments
     79  * and therefore submit the value NULL.
     80  * @param[in] secret A secret value, which will be added as the constant value
     81  * of the polynomial.
     82  * @param[in] coeff_masterkey Source of high entropy to derive the coefficients
     83  * from and compute the secret polynomial.
     84  * @param num_of_participants How many are participating?
     85  * @param threshold How many participants are required to restore the secret
     86  * (sign a message)?
     87 */
     88 void
     89 FROST_generate_shares_ (struct FROST_DkgShare shares[],
     90                         struct FROST_DkgCommitment *dkg_commitment,
     91                         const struct FROST_DkgSecretKey *secret,
     92                         const struct FROST_ShortHashCode *coeff_masterkey,
     93                         uint8_t num_of_participants,
     94                         uint8_t threshold);
     95 
     96 #endif