summaryrefslogtreecommitdiffstats
path: root/src/journal/fsprg.h
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-05-03 04:51:50 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-05-03 04:52:09 +0200
commit44a6b1b68029833893f6e9cee35aa27a974038f6 (patch)
tree170b79abd66a206598ac095156a6c4012d0583f4 /src/journal/fsprg.h
parenthashmap.h: fix coding style issue (diff)
downloadsystemd-44a6b1b68029833893f6e9cee35aa27a974038f6.tar.xz
systemd-44a6b1b68029833893f6e9cee35aa27a974038f6.zip
Add __attribute__((const, pure, format)) in various places
I'm assuming that it's fine if a _const_ or _pure_ function calls assert. It is assumed that the assert won't trigger, and even if it does, it can only trigger on the first call with a given set of parameters, and we don't care if the compiler moves the order of calls.
Diffstat (limited to 'src/journal/fsprg.h')
-rw-r--r--src/journal/fsprg.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/journal/fsprg.h b/src/journal/fsprg.h
index 306ef18d73..150d034828 100644
--- a/src/journal/fsprg.h
+++ b/src/journal/fsprg.h
@@ -28,6 +28,8 @@
#include <sys/types.h>
#include <inttypes.h>
+#include "macro.h"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -35,9 +37,9 @@ extern "C" {
#define FSPRG_RECOMMENDED_SECPAR 1536
#define FSPRG_RECOMMENDED_SEEDLEN (96/8)
-size_t FSPRG_mskinbytes(unsigned secpar);
-size_t FSPRG_mpkinbytes(unsigned secpar);
-size_t FSPRG_stateinbytes(unsigned secpar);
+size_t FSPRG_mskinbytes(unsigned secpar) _const_;
+size_t FSPRG_mpkinbytes(unsigned secpar) _const_;
+size_t FSPRG_stateinbytes(unsigned secpar) _const_;
/* Setup msk and mpk. Providing seed != NULL makes this algorithm deterministic. */
void FSPRG_GenMK(void *msk, void *mpk, const void *seed, size_t seedlen, unsigned secpar);
@@ -50,7 +52,7 @@ void FSPRG_GenState0(void *state, const void *mpk, const void *seed, size_t seed
void FSPRG_Evolve(void *state);
-uint64_t FSPRG_GetEpoch(const void *state);
+uint64_t FSPRG_GetEpoch(const void *state) _pure_;
/* Seek to any arbitrary state (by providing msk together with seed from GenState0). */
void FSPRG_Seek(void *state, uint64_t epoch, const void *msk, const void *seed, size_t seedlen);