summaryrefslogtreecommitdiffhomepage
path: root/src/selftest
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2016-12-11 14:25:28 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2016-12-11 14:25:28 +0100
commit32216b8d5dc5a6f0e3185b0d959e4db855ce7ac5 (patch)
treef1288270505e5bf5c6fed90e6dc8e59f2ab0a4dd /src/selftest
parentd8331fc7dcacd721a1d1ef85336faa99f19b3e82 (diff)
global: move to consistent use of uN instead of uintN_t for kernel code
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/selftest')
-rw-r--r--src/selftest/chacha20poly1305.h4
-rw-r--r--src/selftest/curve25519.h8
-rw-r--r--src/selftest/routing-table.h8
-rw-r--r--src/selftest/siphash24.h10
4 files changed, 15 insertions, 15 deletions
diff --git a/src/selftest/chacha20poly1305.h b/src/selftest/chacha20poly1305.h
index 6b4893f..7f21ec6 100644
--- a/src/selftest/chacha20poly1305.h
+++ b/src/selftest/chacha20poly1305.h
@@ -1,7 +1,7 @@
#ifdef DEBUG
/* ChaCha20-Poly1305 AEAD test vectors from RFC7539 2.8.2 */
struct chacha20poly1305_testvec {
- uint8_t *key, *nonce, *assoc, *input, *result;
+ u8 *key, *nonce, *assoc, *input, *result;
size_t alen, ilen;
};
static const struct chacha20poly1305_testvec chacha20poly1305_enc_vectors[] = { {
@@ -26,7 +26,7 @@ static const struct chacha20poly1305_testvec chacha20poly1305_dec_vectors[] = {
bool chacha20poly1305_selftest(void)
{
size_t i;
- uint8_t computed_result[512];
+ u8 computed_result[512];
bool success = true;
for (i = 0; i < ARRAY_SIZE(chacha20poly1305_enc_vectors); ++i) {
diff --git a/src/selftest/curve25519.h b/src/selftest/curve25519.h
index 1ba1dde..490b1e9 100644
--- a/src/selftest/curve25519.h
+++ b/src/selftest/curve25519.h
@@ -1,8 +1,8 @@
#ifdef DEBUG
struct curve25519_test_vector {
- uint8_t private[CURVE25519_POINT_SIZE];
- uint8_t public[CURVE25519_POINT_SIZE];
- uint8_t result[CURVE25519_POINT_SIZE];
+ u8 private[CURVE25519_POINT_SIZE];
+ u8 public[CURVE25519_POINT_SIZE];
+ u8 result[CURVE25519_POINT_SIZE];
};
static const struct curve25519_test_vector curve25519_test_vectors[] = {
{
@@ -45,7 +45,7 @@ bool curve25519_selftest(void)
{
bool success = true;
size_t i = 0;
- uint8_t out[CURVE25519_POINT_SIZE];
+ u8 out[CURVE25519_POINT_SIZE];
for (i = 0; i < ARRAY_SIZE(curve25519_test_vectors); ++i) {
memset(out, 0, CURVE25519_POINT_SIZE);
diff --git a/src/selftest/routing-table.h b/src/selftest/routing-table.h
index fe7a0bc..d395a7f 100644
--- a/src/selftest/routing-table.h
+++ b/src/selftest/routing-table.h
@@ -1,15 +1,15 @@
#ifdef DEBUG
-static inline struct in_addr *ip4(uint8_t a, uint8_t b, uint8_t c, uint8_t d)
+static inline struct in_addr *ip4(u8 a, u8 b, u8 c, u8 d)
{
static struct in_addr ip;
- uint8_t *split = (uint8_t *)&ip;
+ u8 *split = (u8 *)&ip;
split[0] = a;
split[1] = b;
split[2] = c;
split[3] = d;
return &ip;
}
-static inline struct in6_addr *ip6(uint32_t a, uint32_t b, uint32_t c, uint32_t d)
+static inline struct in6_addr *ip6(u32 a, u32 b, u32 c, u32 d)
{
static struct in6_addr ip;
__be32 *split = (__be32 *)&ip;
@@ -108,7 +108,7 @@ bool routing_table_selftest(void)
for (i = 0; i < 128; ++i) {
part = cpu_to_be64(~(1LLU << (i % 64)));
memset(&ip, 0xff, 16);
- memcpy((uint8_t *)&ip + (i < 64) * 8, &part, 8);
+ memcpy((u8 *)&ip + (i < 64) * 8, &part, 8);
routing_table_insert_v6(&t, &ip, 128, a);
}
diff --git a/src/selftest/siphash24.h b/src/selftest/siphash24.h
index 98db647..62efe08 100644
--- a/src/selftest/siphash24.h
+++ b/src/selftest/siphash24.h
@@ -1,5 +1,5 @@
#ifdef DEBUG
-static const uint8_t test_vectors[64][8] = {
+static const u8 test_vectors[64][8] = {
{ 0x31, 0x0e, 0x0e, 0xdd, 0x47, 0xdb, 0x6f, 0x72 },
{ 0xfd, 0x67, 0xdc, 0x93, 0xc5, 0x39, 0xf8, 0x74 },
{ 0x5a, 0x4f, 0xa9, 0xd9, 0x09, 0x80, 0x6c, 0x0d },
@@ -68,16 +68,16 @@ static const uint8_t test_vectors[64][8] = {
bool siphash24_selftest(void)
{
- uint8_t in[64], k[16];
- uint64_t out;
+ u8 in[64], k[16];
+ u64 out;
bool success = true;
size_t i;
for (i = 0; i < 16; ++i)
- k[i] = (uint8_t)i;
+ k[i] = (u8)i;
for (i = 0; i < 64; ++i) {
- in[i] = (uint8_t)i;
+ in[i] = (u8)i;
out = siphash24(in, i, k);
if (memcmp(&out, test_vectors[i], 8)) {
pr_info("siphash24 self-test %zu: FAIL\n", i + 1);