You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 line
1.1 KiB

  1. #include <stdint.h>
  2. void set_layer_addr(uint32_t addr[8], uint32_t layer)
  3. {
  4. addr[0] = layer;
  5. }
  6. void set_tree_addr(uint32_t addr[8], uint64_t tree)
  7. {
  8. addr[1] = (uint32_t) (tree >> 32);
  9. addr[2] = (uint32_t) tree;
  10. }
  11. void set_type(uint32_t addr[8], uint32_t type)
  12. {
  13. int i;
  14. addr[3] = type;
  15. for (i = 4; i < 8; i++) {
  16. addr[i] = 0;
  17. }
  18. }
  19. void set_key_and_mask(uint32_t addr[8], uint32_t key_and_mask)
  20. {
  21. addr[7] = key_and_mask;
  22. }
  23. /* These functions are used for OTS addresses. */
  24. void set_ots_addr(uint32_t addr[8], uint32_t ots)
  25. {
  26. addr[4] = ots;
  27. }
  28. void set_chain_addr(uint32_t addr[8], uint32_t chain)
  29. {
  30. addr[5] = chain;
  31. }
  32. void set_hash_addr(uint32_t addr[8], uint32_t hash)
  33. {
  34. addr[6] = hash;
  35. }
  36. /* This function is used for L-tree addresses. */
  37. void set_ltree_addr(uint32_t addr[8], uint32_t ltree)
  38. {
  39. addr[4] = ltree;
  40. }
  41. /* These functions are used for hash tree addresses. */
  42. void set_tree_height(uint32_t addr[8], uint32_t treeHeight)
  43. {
  44. addr[5] = treeHeight;
  45. }
  46. void set_tree_index(uint32_t addr[8], uint32_t treeIndex)
  47. {
  48. addr[6] = treeIndex;
  49. }