diff options
-rw-r--r-- | src/libstrongswan/crypto/prf_plus.c | 10 | ||||
-rw-r--r-- | src/libstrongswan/crypto/prf_plus.h | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/libstrongswan/crypto/prf_plus.c b/src/libstrongswan/crypto/prf_plus.c index 8ddacfe6e..2e7f87d1f 100644 --- a/src/libstrongswan/crypto/prf_plus.c +++ b/src/libstrongswan/crypto/prf_plus.c @@ -57,7 +57,7 @@ struct private_prf_plus_t { chunk_t buffer; }; -METHOD(prf_plus_t, get_bytes, void, +METHOD(prf_plus_t, get_bytes, bool, private_prf_plus_t *this, size_t length, u_int8_t *buffer) { size_t round, written = 0; @@ -87,6 +87,7 @@ METHOD(prf_plus_t, get_bytes, void, this->used += round; written += round; } + return TRUE; } METHOD(prf_plus_t, allocate_bytes, bool, @@ -95,12 +96,9 @@ METHOD(prf_plus_t, allocate_bytes, bool, if (length) { *chunk = chunk_alloc(length); - get_bytes(this, length, chunk->ptr); - } - else - { - *chunk = chunk_empty; + return get_bytes(this, length, chunk->ptr); } + *chunk = chunk_empty; return TRUE; } diff --git a/src/libstrongswan/crypto/prf_plus.h b/src/libstrongswan/crypto/prf_plus.h index 72009da89..1f668edf2 100644 --- a/src/libstrongswan/crypto/prf_plus.h +++ b/src/libstrongswan/crypto/prf_plus.h @@ -36,8 +36,10 @@ struct prf_plus_t { * * @param length number of bytes to get * @param buffer pointer where the generated bytes will be written + * @return TRUE if bytes generated successfully */ - void (*get_bytes) (prf_plus_t *this, size_t length, u_int8_t *buffer); + __attribute__((warn_unused_result)) + bool (*get_bytes) (prf_plus_t *this, size_t length, u_int8_t *buffer); /** * Allocate pseudo random bytes. |