gnunet-android

GNUnet for Android
Log | Files | Refs | README

ext_lms.h (2218B)


      1 /* ext_lms.h
      2  *
      3  * Copyright (C) 2006-2025 wolfSSL Inc.
      4  *
      5  * This file is part of wolfSSL.
      6  *
      7  * wolfSSL is free software; you can redistribute it and/or modify
      8  * it under the terms of the GNU General Public License as published by
      9  * the Free Software Foundation; either version 3 of the License, or
     10  * (at your option) any later version.
     11  *
     12  * wolfSSL is distributed in the hope that it will be useful,
     13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15  * GNU General Public License for more details.
     16  *
     17  * You should have received a copy of the GNU General Public License
     18  * along with this program; if not, write to the Free Software
     19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
     20  */
     21 
     22 #ifndef EXT_LMS_H
     23 #define EXT_LMS_H
     24 
     25 #if defined(WOLFSSL_HAVE_LMS) && defined(HAVE_LIBLMS)
     26 
     27 #include <wolfssl/wolfcrypt/lms.h>
     28 
     29 /* hash-sigs LMS HSS includes */
     30 #include <hss.h>
     31 
     32 #if defined(WOLFSSL_WC_LMS)
     33 #error "This code is incompatible with wolfCrypt's implementation of LMS."
     34 #endif
     35 
     36 /*
     37  * The hash-sigs LMS lib supports from MIN_HSS_LEVELS to MAX_HSS_LEVELS
     38  * number of levels of Merkle trees. It allows for the tree height and
     39  * winternitz parameter to be unique per level.
     40  */
     41 
     42 /* hss structs */
     43 typedef struct hss_working_key hss_working_key;
     44 typedef struct hss_extra_info  hss_extra_info;
     45 
     46 struct LmsKey {
     47     unsigned             levels;                      /* Number of tree levels. */
     48     param_set_t          lm_type[MAX_HSS_LEVELS];     /* Height param per level. */
     49     param_set_t          lm_ots_type[MAX_HSS_LEVELS]; /* Winternitz param per level. */
     50     unsigned char        pub[HSS_MAX_PUBLIC_KEY_LEN];
     51 #ifndef WOLFSSL_LMS_VERIFY_ONLY
     52     hss_working_key *    working_key;
     53     wc_lms_write_private_key_cb write_private_key; /* Callback to write/update key. */
     54     wc_lms_read_private_key_cb  read_private_key;  /* Callback to read key. */
     55     void *               context;           /* Context arg passed to callbacks. */
     56     hss_extra_info       info;
     57 #endif /* ifndef WOLFSSL_LMS_VERIFY_ONLY */
     58     enum wc_LmsState     state;
     59 };
     60 
     61 #endif /* WOLFSSL_HAVE_LMS */
     62 #endif /* EXT_LMS_H */