ext_xmss.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* ext_xmss.h
  2. *
  3. * Copyright (C) 2006-2023 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 2 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. #ifndef EXT_XMSS_H
  22. #define EXT_XMSS_H
  23. #ifdef WOLFSSL_HAVE_XMSS
  24. #include <wolfssl/wolfcrypt/xmss.h>
  25. #if !defined(HAVE_LIBXMSS)
  26. #error "This code requires libxmss"
  27. #endif
  28. #include <xmss.h>
  29. #include <params.h>
  30. #if defined(WOLFSSL_WC_XMSS)
  31. #error "This code is incompatible with wolfCrypt's implementation of XMSS."
  32. #endif
  33. struct XmssKey {
  34. unsigned char pk[XMSS_SHA256_PUBLEN];
  35. uint32_t oid;
  36. int is_xmssmt;
  37. xmss_params params;
  38. #ifndef WOLFSSL_XMSS_VERIFY_ONLY
  39. /* The secret key length is a function of xmss_params. */
  40. unsigned char * sk;
  41. word32 sk_len;
  42. write_private_key_cb write_private_key; /* Callback to write/update key. */
  43. read_private_key_cb read_private_key; /* Callback to read key. */
  44. void * context; /* Context arg passed to callbacks. */
  45. #endif /* ifndef WOLFSSL_XMSS_VERIFY_ONLY */
  46. enum wc_XmssState state;
  47. };
  48. #endif /* WOLFSSL_HAVE_XMSS */
  49. #endif /* EXT_XMSS_H */