Use tor specific headers and memwipe() instead of memset_s(), and build.

This is where things get tor specific.  It's just replacing stdint.h
and memset_s with the tor compat code so going back is trivial...
This commit is contained in:
Yawning Angel 2015-12-18 22:18:00 +00:00
parent 18685df031
commit 5356eba6ca
3 changed files with 17 additions and 8 deletions

View File

@ -135,3 +135,14 @@ noinst_HEADERS += $(ED25519_DONNA_HDRS)
LIBED25519_DONNA=src/ext/ed25519/donna/libed25519_donna.a LIBED25519_DONNA=src/ext/ed25519/donna/libed25519_donna.a
noinst_LIBRARIES += $(LIBED25519_DONNA) noinst_LIBRARIES += $(LIBED25519_DONNA)
src_ext_keccak_tiny_libkeccak_tiny_a_CFLAGS=
src_ext_keccak_tiny_libkeccak_tiny_a_SOURCES= \
src/ext/keccak-tiny/keccak-tiny-unrolled.c
LIBKECCAK_TINY_HDRS = \
src/ext/keccak-tiny/keccak-tiny.h
LIBKECCAK_TINY=src/ext/keccak-tiny/libkeccak-tiny.a
noinst_LIBRARIES += $(LIBKECCAK_TINY)

View File

@ -8,10 +8,8 @@
*/ */
#include "keccak-tiny.h" #include "keccak-tiny.h"
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include "crypto.h"
/******** The Keccak-f[1600] permutation ********/ /******** The Keccak-f[1600] permutation ********/
@ -168,7 +166,7 @@ keccak_finalize(keccak_state *s)
// Xor in the last block. // Xor in the last block.
xorin(s->a, s->block, s->offset); xorin(s->a, s->block, s->offset);
memset_s(s->block, sizeof(s->block), 0, sizeof(s->block)); memwipe(s->block, 0, sizeof(s->block));
s->finalized = 1; s->finalized = 1;
s->offset = s->rate; s->offset = s->rate;
} }
@ -310,7 +308,7 @@ keccak_clone(keccak_state *out, const keccak_state *in)
void void
keccak_cleanse(keccak_state *s) keccak_cleanse(keccak_state *s)
{ {
memset_s(s, sizeof(keccak_state), 0, sizeof(keccak_state)); memwipe(s, 0, sizeof(keccak_state));
} }
/** The sponge-based hash construction. **/ /** The sponge-based hash construction. **/

View File

@ -1,8 +1,8 @@
#ifndef KECCAK_FIPS202_H #ifndef KECCAK_FIPS202_H
#define KECCAK_FIPS202_H #define KECCAK_FIPS202_H
#define __STDC_WANT_LIB_EXT1__ 1
#include <stdint.h> #include <stddef.h>
#include <stdlib.h> #include "torint.h"
#define KECCAK_MAX_RATE 200 #define KECCAK_MAX_RATE 200