xmss_hash_address.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* $OpenBSD: xmss_hash_address.c,v 1.2 2018/02/26 03:56:44 dtucker Exp $ */
  2. /*
  3. hash_address.c version 20160722
  4. Andreas Hülsing
  5. Joost Rijneveld
  6. Public domain.
  7. */
  8. #include "includes.h"
  9. #ifdef WITH_XMSS
  10. #ifdef HAVE_STDINT_H
  11. # include <stdint.h>
  12. #endif
  13. #include "xmss_hash_address.h" /* prototypes */
  14. void setLayerADRS(uint32_t adrs[8], uint32_t layer){
  15. adrs[0] = layer;
  16. }
  17. void setTreeADRS(uint32_t adrs[8], uint64_t tree){
  18. adrs[1] = (uint32_t) (tree >> 32);
  19. adrs[2] = (uint32_t) tree;
  20. }
  21. void setType(uint32_t adrs[8], uint32_t type){
  22. adrs[3] = type;
  23. int i;
  24. for(i = 4; i < 8; i++){
  25. adrs[i] = 0;
  26. }
  27. }
  28. void setKeyAndMask(uint32_t adrs[8], uint32_t keyAndMask){
  29. adrs[7] = keyAndMask;
  30. }
  31. // OTS
  32. void setOTSADRS(uint32_t adrs[8], uint32_t ots){
  33. adrs[4] = ots;
  34. }
  35. void setChainADRS(uint32_t adrs[8], uint32_t chain){
  36. adrs[5] = chain;
  37. }
  38. void setHashADRS(uint32_t adrs[8], uint32_t hash){
  39. adrs[6] = hash;
  40. }
  41. // L-tree
  42. void setLtreeADRS(uint32_t adrs[8], uint32_t ltree){
  43. adrs[4] = ltree;
  44. }
  45. // Hash Tree & L-tree
  46. void setTreeHeight(uint32_t adrs[8], uint32_t treeHeight){
  47. adrs[5] = treeHeight;
  48. }
  49. void setTreeIndex(uint32_t adrs[8], uint32_t treeIndex){
  50. adrs[6] = treeIndex;
  51. }
  52. #endif /* WITH_XMSS */