From 44a6b1b68029833893f6e9cee35aa27a974038f6 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Thu, 2 May 2013 22:51:50 -0400 Subject: 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. --- src/journal/fsprg.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/journal/fsprg.h') 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 #include +#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); -- cgit v1.2.3-54-g00ecf