tile_random_driver.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /**
  2. * NOTICE
  3. *
  4. * Copyright 2020 Tile Inc. All Rights Reserved.
  5. * All code or other information included in the accompanying files ("Tile Source Material")
  6. * is PROPRIETARY information of Tile Inc. ("Tile") and access and use of the Tile Source Material
  7. * is subject to these terms. The Tile Source Material may only be used for demonstration purposes,
  8. * and may not be otherwise distributed or made available to others, including for commercial purposes.
  9. * Without limiting the foregoing , you understand and agree that no production use
  10. * of the Tile Source Material is allowed without a Tile ID properly obtained under a separate
  11. * agreement with Tile.
  12. * You also understand and agree that Tile may terminate the limited rights granted under these terms
  13. * at any time in its discretion.
  14. * All Tile Source Material is provided AS-IS without warranty of any kind.
  15. * Tile does not warrant that the Tile Source Material will be error-free or fit for your purposes.
  16. * Tile will not be liable for any damages resulting from your use of or inability to use
  17. * the Tile Source Material.
  18. *
  19. * Support: firmware_support@tile.com
  20. */
  21. /** @file tile_random_driver.h
  22. ** @brief Tile Random Bytes Generation. Provides TileLib an interface to generate random numbers.
  23. */
  24. #ifndef TILE_RANDOM_DRIVER_H_
  25. #define TILE_RANDOM_DRIVER_H_
  26. #include <stdint.h>
  27. /**
  28. * Tile random number driver
  29. */
  30. struct tile_random_driver
  31. {
  32. /**
  33. * Generate random bytes.
  34. *
  35. * @param[out] dst Buffer to write random bytes to.
  36. * @param[in] length Number of random bytes to generate.
  37. *
  38. * @return See @ref TILE_ERROR_CODES.
  39. */
  40. int (*random_bytes)(uint8_t *dst, uint8_t length);
  41. };
  42. /**
  43. * Register the Tile random driver.
  44. */
  45. int tile_random_register(struct tile_random_driver *driver);
  46. #endif