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.

пре 8 година
пре 8 година
пре 8 година
пре 8 година
пре 8 година
пре 8 година
пре 8 година
пре 8 година
пре 8 година
пре 8 година
пре 8 година
пре 8 година
пре 8 година
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. void copy_subtree_addr(uint32_t out[8], const uint32_t in[8])
  24. {
  25. out[0] = in[0];
  26. out[1] = in[1];
  27. out[2] = in[2];
  28. }
  29. /* These functions are used for OTS addresses. */
  30. void set_ots_addr(uint32_t addr[8], uint32_t ots)
  31. {
  32. addr[4] = ots;
  33. }
  34. void set_chain_addr(uint32_t addr[8], uint32_t chain)
  35. {
  36. addr[5] = chain;
  37. }
  38. void set_hash_addr(uint32_t addr[8], uint32_t hash)
  39. {
  40. addr[6] = hash;
  41. }
  42. /* This function is used for L-tree addresses. */
  43. void set_ltree_addr(uint32_t addr[8], uint32_t ltree)
  44. {
  45. addr[4] = ltree;
  46. }
  47. /* These functions are used for hash tree addresses. */
  48. void set_tree_height(uint32_t addr[8], uint32_t tree_height)
  49. {
  50. addr[5] = tree_height;
  51. }
  52. void set_tree_index(uint32_t addr[8], uint32_t tree_index)
  53. {
  54. addr[6] = tree_index;
  55. }