aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan
diff options
context:
space:
mode:
authorReto Buerki <reet@codelabs.ch>2012-06-12 10:54:02 +0200
committerMartin Willi <martin@revosec.ch>2012-07-16 14:53:34 +0200
commit605985d122cd854ea7c1b85ce3ec107752c9f103 (patch)
tree19325f83d0425f061b45cbbd0c3467b375501f41 /src/libstrongswan
parentf3ca96b2bfd60a9896d89f5e84cb9e737f6f1784 (diff)
downloadstrongswan-605985d122cd854ea7c1b85ce3ec107752c9f103.tar.bz2
strongswan-605985d122cd854ea7c1b85ce3ec107752c9f103.tar.xz
Nonce: Let get_nonce, allocate_nonce return boolean
Diffstat (limited to 'src/libstrongswan')
-rw-r--r--src/libstrongswan/crypto/nonce_gen.h6
-rw-r--r--src/libstrongswan/plugins/nonce/nonce_nonceg.c6
2 files changed, 8 insertions, 4 deletions
diff --git a/src/libstrongswan/crypto/nonce_gen.h b/src/libstrongswan/crypto/nonce_gen.h
index 889d04a40..ffa82aa90 100644
--- a/src/libstrongswan/crypto/nonce_gen.h
+++ b/src/libstrongswan/crypto/nonce_gen.h
@@ -35,16 +35,18 @@ struct nonce_gen_t {
*
* @param size size of nonce in bytes
* @param buffer pointer where the generated nonce will be written
+ * @return TRUE if nonce allocation was succesful, FALSE otherwise
*/
- void (*get_nonce) (nonce_gen_t *this, size_t size, u_int8_t *buffer);
+ bool (*get_nonce) (nonce_gen_t *this, size_t size, u_int8_t *buffer);
/**
* Generates a nonce and allocates space for it.
*
* @param size size of nonce in bytes
* @param chunk chunk which will hold the generated nonce
+ * @return TRUE if nonce allocation was succesful, FALSE otherwise
*/
- void (*allocate_nonce) (nonce_gen_t *this, size_t size, chunk_t *chunk);
+ bool (*allocate_nonce) (nonce_gen_t *this, size_t size, chunk_t *chunk);
/**
* Destroys a nonce generator object.
diff --git a/src/libstrongswan/plugins/nonce/nonce_nonceg.c b/src/libstrongswan/plugins/nonce/nonce_nonceg.c
index 726f6e550..fd1bbe9d8 100644
--- a/src/libstrongswan/plugins/nonce/nonce_nonceg.c
+++ b/src/libstrongswan/plugins/nonce/nonce_nonceg.c
@@ -35,16 +35,18 @@ struct private_nonce_nonceg_t {
rng_t* rng;
};
-METHOD(nonce_gen_t, get_nonce, void,
+METHOD(nonce_gen_t, get_nonce, bool,
private_nonce_nonceg_t *this, size_t size, u_int8_t *buffer)
{
this->rng->get_bytes(this->rng, size, buffer);
+ return TRUE;
}
-METHOD(nonce_gen_t, allocate_nonce, void,
+METHOD(nonce_gen_t, allocate_nonce, bool,
private_nonce_nonceg_t *this, size_t size, chunk_t *chunk)
{
this->rng->allocate_bytes(this->rng, size, chunk);
+ return TRUE;
}
METHOD(nonce_gen_t, destroy, void,