* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
+ */
+
+/*
+ * See "Practical Secure Logging: Seekable Sequential Key Generators"
+ * by G. A. Marson, B. Poettering for details:
*
+ * http://eprint.iacr.org/2013/397
*/
#include <gcrypt.h>
assert(gcry_mpi_cmp_ui(x, 0) >= 0);
len = (gcry_mpi_get_nbits(x) + 7) / 8;
assert(len <= buflen);
- memset(buf, 0, buflen);
+ memzero(buf, buflen);
gcry_mpi_print(GCRYMPI_FMT_USG, buf + (buflen - len), len, &nwritten, x);
assert(nwritten == len);
}
((uint8_t*) buf)[7] = (x >> 0) & 0xff;
}
-static uint64_t uint64_import(const void *buf, size_t buflen) {
+_pure_ static uint64_t uint64_import(const void *buf, size_t buflen) {
assert(buflen == 8);
return
(uint64_t)(((uint8_t*) buf)[0]) << 56 |
memcpy(state, mpk, 2 + secpar / 8);
mpi_export(state + 2 + 1 * secpar / 8, secpar / 8, x);
- memset(state + 2 + 2 * secpar / 8, 0, 8);
+ memzero(state + 2 + 2 * secpar / 8, 8);
gcry_mpi_release(n);
gcry_mpi_release(x);