basic: use _nonnull_if_nonzero_ where appropriate

This commit is contained in:
Mike Yuan
2025-02-16 12:37:10 +09:00
committed by Yu Watanabe
parent 6bdbfb7eb6
commit 6da2ea9fa9
11 changed files with 34 additions and 30 deletions
+5 -3
View File
@@ -6,8 +6,10 @@
#include <stdint.h>
#include <sys/uio.h>
void random_bytes(void *p, size_t n); /* Returns random bytes suitable for most uses, but may be insecure sometimes. */
int crypto_random_bytes(void *p, size_t n); /* Returns secure random bytes after waiting for the RNG to initialize. */
#include "macro.h"
void random_bytes(void *p, size_t n) _nonnull_if_nonzero_(1, 2); /* Returns random bytes suitable for most uses, but may be insecure sometimes. */
int crypto_random_bytes(void *p, size_t n) _nonnull_if_nonzero_(1, 2); /* Returns secure random bytes after waiting for the RNG to initialize. */
int crypto_random_bytes_allocate_iovec(size_t n, struct iovec *ret);
static inline uint64_t random_u64(void) {
@@ -29,6 +31,6 @@ static inline uint32_t random_u32(void) {
size_t random_pool_size(void);
int random_write_entropy(int fd, const void *seed, size_t size, bool credit);
int random_write_entropy(int fd, const void *seed, size_t size, bool credit) _nonnull_if_nonzero_(2, 3);
uint64_t random_u64_range(uint64_t max);