| 749 | #include <sys/libkern.h> |
| 750 | |
| 751 | void |
| 752 | get_random_bytes(void *p, size_t n) |
| 753 | { |
| 754 | uint8_t *dp = p; |
| 755 | |
| 756 | while (n > 0) { |
| 757 | uint32_t v = arc4random(); |
| 758 | size_t nb = n > sizeof(uint32_t) ? sizeof(uint32_t) : n; |
| 759 | bcopy(&v, dp, n > sizeof(uint32_t) ? sizeof(uint32_t) : n); |
| 760 | dp += sizeof(uint32_t), n -= nb; |
| 761 | } |
| 762 | } |
| 763 | |
| 764 | /* |
| 765 | * Helper function for events that pass just a single mac address. |
no test coverage detected