From: asterix Date: Tue, 5 Oct 2010 09:29:31 +0000 (+0000) Subject: Some fix to compile run test check. X-Git-Tag: 2.6.0~5^2~116 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=5e615954460b48f828c99e03166687f0a91668dc;p=bertos.git Some fix to compile run test check. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4404 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/sec/cipher/blowfish_test.c b/bertos/sec/cipher/blowfish_test.c index 5a2ba230..ab60babc 100644 --- a/bertos/sec/cipher/blowfish_test.c +++ b/bertos/sec/cipher/blowfish_test.c @@ -26,7 +26,7 @@ * invalidate any other reasons why the executable file might be covered by * the GNU General Public License. * - * Copyright 2006 Develer S.r.l. (http://www.develer.com/) + * Copyright 2010 Develer S.r.l. (http://www.develer.com/) * * --> * diff --git a/bertos/sec/hash/md5.c b/bertos/sec/hash/md5.c index 8e89907b..306bacc0 100644 --- a/bertos/sec/hash/md5.c +++ b/bertos/sec/hash/md5.c @@ -37,7 +37,7 @@ static void byteReverse(uint32_t *buf, unsigned longs) static void MD5_begin(Hash *h) { MD5_Context *ctx = (MD5_Context *)h; - + ctx->buf[0] = 0x67452301; ctx->buf[1] = 0xefcdab89; ctx->buf[2] = 0x98badcfe; @@ -136,7 +136,7 @@ static uint8_t* MD5_final(struct Hash *h) PURGE(ctx->in); PURGE(ctx->bits); - return ctx->buf; + return (uint8_t *)ctx->buf; } diff --git a/bertos/sec/hash/ripemd_test.c b/bertos/sec/hash/ripemd_test.c index 4fe5428c..5c3c0512 100644 --- a/bertos/sec/hash/ripemd_test.c +++ b/bertos/sec/hash/ripemd_test.c @@ -1,8 +1,9 @@ +#include "ripemd.h" + #include #include -#include "RIPEMD.h" #include int RIPEMD_testSetup(void) diff --git a/bertos/sec/kdf/pbkdf2.h b/bertos/sec/kdf/pbkdf2.h index 43d44d18..3a313711 100644 --- a/bertos/sec/kdf/pbkdf2.h +++ b/bertos/sec/kdf/pbkdf2.h @@ -32,7 +32,7 @@ * * \brief PBKDF2 implementation * \author Giovanni Bajo - * + * */ #ifndef SEC_KDF_PBKDF2_H @@ -41,7 +41,7 @@ #include #include -typedef struct +typedef struct { Kdf kdf; Mac *mac; diff --git a/bertos/sec/kdf/pbkdf2_test.c b/bertos/sec/kdf/pbkdf2_test.c index 326817cb..f5f726f7 100644 --- a/bertos/sec/kdf/pbkdf2_test.c +++ b/bertos/sec/kdf/pbkdf2_test.c @@ -1,10 +1,53 @@ -#include -#include +/** + * \file + * + * + * \brief PBKDF2 testsuite + * \author Giovanni Bajo + * + */ + + +#include "pbkdf2.h" + #include #include + #include #include -#include + +#include + +#include + int PBKDF2_testSetup(void) { @@ -19,25 +62,25 @@ int PBKDF2_testTearDown(void) int PBKDF2_testRun(void) { - Kdf *kdf = PBKDF2_stackinit(HMAC_stackinit(SHA1_stackinit())); + Kdf *kdf = PBKDF2_stackinit(hmac_stackinit(SHA1_stackinit())); uint8_t res[32]; - + PBKDF2_set_iterations(kdf, 1); kdf_begin(kdf, "password", 8, (const uint8_t*)"salt", 4); kdf_read(kdf, res, 20); ASSERT(memcmp(res, "\x0c\x60\xc8\x0f\x96\x1f\x0e\x71\xf3\xa9\xb5\x24\xaf\x60\x12\x06\x2f\xe0\x37\xa6", 20) == 0); - + PBKDF2_set_iterations(kdf, 2); kdf_begin(kdf, "password", 8, (const uint8_t*)"salt", 4); kdf_read(kdf, res, 20); ASSERT(memcmp(res, "\xea\x6c\x01\x4d\xc7\x2d\x6f\x8c\xcd\x1e\xd9\x2a\xce\x1d\x41\xf0\xd8\xde\x89\x57", 20) == 0); - + PBKDF2_set_iterations(kdf, 4096); kdf_begin(kdf, "password", 8, (const uint8_t*)"salt", 4); kdf_read(kdf, res, 20); - ASSERT(memcmp(res, "\x4b\x00\x79\x01\xb7\x65\x48\x9a\xbe\xad\x49\xd9\x26\xf7\x21\xd0\x65\xa4\x29\xc1", 20) == 0); - + ASSERT(memcmp(res, "\x4b\x00\x79\x01\xb7\x65\x48\x9a\xbe\xad\x49\xd9\x26\xf7\x21\xd0\x65\xa4\x29\xc1", 20) == 0); + #if CPU_X86 // Too slow for an embedded system... PBKDF2_set_iterations(kdf, 16777216); diff --git a/bertos/sec/mac/hmac.h b/bertos/sec/mac/hmac.h index 038c4575..8e0b3573 100644 --- a/bertos/sec/mac/hmac.h +++ b/bertos/sec/mac/hmac.h @@ -40,6 +40,7 @@ #include #include + #include typedef struct HmacContext diff --git a/bertos/sec/mac/hmac_test.c b/bertos/sec/mac/hmac_test.c index a5edc460..1e89aae2 100644 --- a/bertos/sec/mac/hmac_test.c +++ b/bertos/sec/mac/hmac_test.c @@ -173,4 +173,4 @@ int hmac_testRun(void) return 0; } -TEST_MAIN(HMAC); +TEST_MAIN(hmac); diff --git a/test/run_tests.sh b/test/run_tests.sh index 9a479899..9419451d 100755 --- a/test/run_tests.sh +++ b/test/run_tests.sh @@ -65,7 +65,16 @@ SRC_LIST=" bertos/io/kblock_ram.c bertos/io/kblock_posix.c bertos/io/kfile.c + bertos/sec/cipher.c bertos/sec/cipher/blowfish.c + bertos/sec/cipher/aes.c + bertos/sec/kdf/pbkdf1.c + bertos/sec/kdf/pbkdf2.c + bertos/sec/hash/sha1.c + bertos/sec/hash/md5.c + bertos/sec/hash/ripemd.c + bertos/sec/mac/hmac.c + bertos/sec/mac/omac.c " buildout='/dev/null'