frosix

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

validate_params.c (1346B)


      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 validate_params.c
     18  * @brief Does a validation of the submitted parameter for the key generation.
     19  * @author Joel Urech
     20 */
     21 #include "keygen.h"
     22 
     23 enum GNUNET_GenericReturnValue
     24 FROST_validate_dkg_params (uint8_t identifier,
     25                            uint8_t threshold,
     26                            uint8_t num_of_participants)
     27 {
     28   if (identifier <= 0
     29       || identifier >= 255
     30       || identifier > num_of_participants
     31       || threshold > num_of_participants
     32       || threshold <= 0
     33       || threshold >= 254
     34       || num_of_participants <= 0
     35       || num_of_participants >= 255)
     36     return GNUNET_NO;
     37   return GNUNET_OK;
     38 }