frosix

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

frosix-util.c (1643B)


      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 util/frosix-util.c
     18  * @brief helper functions for various tasks
     19  * @author Joel Urech
     20  */
     21 
     22 #include "frosix_util_lib.h"
     23 #include "frost_low.h"
     24 #include "frost_high.h"
     25 
     26 
     27 
     28 
     29 
     30 
     31 void
     32 FROSIX_debug_print_point (const struct FROST_Point *pt)
     33 {
     34   for (int i = 0; i < sizeof (pt); i++)
     35     fprintf (stderr, "%02X ", pt->xcoord[i]);
     36   fprintf (stderr, "\n");
     37 }
     38 
     39 void
     40 FROSIX_debug_print_scalar (const struct FROST_Scalar *scal)
     41 {
     42   for (int i = 0; i < sizeof (scal); i++)
     43     fprintf (stderr, "%02X ", scal->scalarbytes[i]);
     44   fprintf (stderr, "\n");
     45 }
     46 
     47 void
     48 FROSIX_debug_print_crockford32 (const void *data,
     49                                 size_t length,
     50                                 const char *title)
     51 {
     52   char *crock;
     53   crock = GNUNET_STRINGS_data_to_string_alloc (data,
     54                                                length);
     55   fprintf (stderr,
     56            "%s: %s\n",
     57            title,
     58            crock);
     59   free (crock);
     60 }