]>
git.ipfire.org Git - thirdparty/strongswan.git/blob - src/libstrongswan/crypto/nonce_gen.h
2 * Copyright (C) 2012 Adrian-Ken Rueegsegger
4 * Copyright (C) secunet Security Networks AG
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * @defgroup nonce_gen nonce_gen
25 typedef struct nonce_gen_t nonce_gen_t
;
30 * Generic interface for nonce generators.
35 * Generates a nonce and writes it into the buffer.
37 * @param size size of nonce in bytes
38 * @param buffer pointer where the generated nonce will be written
39 * @return TRUE if nonce allocation was successful, FALSE otherwise
41 bool (*get_nonce
)(nonce_gen_t
*this, size_t size
,
42 uint8_t *buffer
) __attribute__((warn_unused_result
));
45 * Generates a nonce and allocates space for it.
47 * @param size size of nonce in bytes
48 * @param chunk chunk which will hold the generated nonce
49 * @return TRUE if nonce allocation was successful, FALSE otherwise
51 bool (*allocate_nonce
)(nonce_gen_t
*this, size_t size
,
52 chunk_t
*chunk
) __attribute__((warn_unused_result
));
55 * Destroys a nonce generator object.
57 void (*destroy
)(nonce_gen_t
*this);
60 #endif /** NONCE_GEN_H_ @}*/