diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-10-31 23:11:00 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-10-31 23:11:00 +0100 |
commit | 542861816d8305afa113653a84073be2fca68e50 (patch) | |
tree | 16f2f302a87ed73c35204e6606e4339b00c051fc /src/fastd.h | |
parent | 66a953a83f162ed5e096d75a5ddf4e2a80ea15b3 (diff) | |
download | fastd-542861816d8305afa113653a84073be2fca68e50.tar fastd-542861816d8305afa113653a84073be2fca68e50.zip |
Implement HKDF
Diffstat (limited to 'src/fastd.h')
-rw-r--r-- | src/fastd.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/fastd.h b/src/fastd.h index c24781f..2c3de6a 100644 --- a/src/fastd.h +++ b/src/fastd.h @@ -407,8 +407,12 @@ static inline int fastd_rand(fastd_context_t *ctx, int min, int max) { (type *)( (char *)__mptr - offsetof(type,member) );}) +static inline size_t block_count(size_t l, size_t a) { + return (l+a-1)/a; +} + static inline size_t alignto(size_t l, size_t a) { - return ((l+a-1)/a)*a; + return block_count(l, a)*a; } static inline fastd_buffer_t fastd_buffer_alloc(const fastd_context_t *ctx, size_t len, size_t head_space, size_t tail_space) { |