Revision 605bdf68df0f239ac2c74b752cc65b3e3bbe4275 authored by dependabot[bot] on 01 November 2024, 13:22:26 UTC, committed by GitHub on 01 November 2024, 13:22:26 UTC
Bumps [libopencm3](https://github.com/libopencm3/libopencm3) from `1f3abd4` to `201f5bc`. - [Commits](https://github.com/libopencm3/libopencm3/compare/1f3abd43763fa39d23e737602b6d0011a45c70b2...201f5bcfb3fa70ee34818152463e7139f24db377) --- updated-dependencies: - dependency-name: libopencm3 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com>
1 parent 3200c9e
keccaktest.c
// SPDX-License-Identifier: Apache-2.0 or CC0-1.0
#include "randombytes.h"
#include <hal.h>
#include <fips202.h>
#include <sendfn.h>
#include <randombytes.h>
#include <string.h>
#include <stdio.h>
#include <stdio.h>
#include <string.h>
const unsigned char msg1[] = {
0x84u, 0xb6u, 0x0cu, 0xb3u, 0x72u, 0x0bu, 0xf2u, 0x97u, 0x48u, 0x48u, 0x3cu, 0xf7u, 0xabu, 0xd0u, 0xd1u,
0xf1u, 0xd9u, 0x38u, 0x04u, 0x59u, 0xdfu, 0xa9u, 0x68u, 0x46u, 0x0cu, 0x86u, 0xe5u, 0xd1u, 0xa5u, 0x4fu,
0x0bu, 0x19u, 0xdau, 0xc6u, 0xa7u, 0x8bu, 0xf9u, 0x50u, 0x94u, 0x60u, 0xe2u, 0x9du, 0xd4u, 0x66u, 0xbbu,
0x8bu, 0xdfu, 0x04u, 0xe5u, 0x48u, 0x3bu, 0x78u, 0x2eu, 0xb7u, 0x4du, 0x64u, 0x48u, 0x16u, 0x6fu, 0x89u,
0x7au, 0xddu, 0x43u, 0xd2u, 0x95u, 0xe9u, 0x46u, 0x94u, 0x2au, 0xd9u, 0xa8u, 0x14u, 0xfau, 0xb9u, 0x5bu,
0x4au, 0xaeu, 0xdeu, 0x6au, 0xe4u, 0xc8u, 0x10u, 0x8cu, 0x8eu, 0xdau, 0xefu, 0xf9u, 0x71u, 0xf5u, 0x8fu,
0x7cu, 0xf9u, 0x65u, 0x66u, 0xc9u, 0xdcu, 0x9bu, 0x68u, 0x12u, 0x58u, 0x6bu, 0x70u, 0xd5u, 0xbcu, 0x78u,
0xe2u, 0xf8u, 0x29u, 0xecu, 0x8eu, 0x17u, 0x9au, 0x6cu, 0xd8u, 0x1du, 0x22u, 0x4bu, 0x16u, 0x11u, 0x75u,
0xfdu, 0x3au, 0x33u, 0xaau, 0xcfu, 0xb1u, 0x48u, 0x3fu,
};
const unsigned char md1[] = {
0x88u, 0x14u, 0x63u, 0x0au, 0x39u, 0xdcu, 0xb9u, 0x97u, 0x92u, 0xccu, 0x4eu,
0x08u, 0xcau, 0xe5u, 0xddu, 0x07u, 0x89u, 0x73u, 0xd1u, 0x5cu, 0xd1u, 0x9fu,
0x17u, 0xbau, 0xcfu, 0x04u, 0xdeu, 0xdau, 0x9eu, 0x62u, 0xc4u, 0x5fu,
};
static int test(void)
{
unsigned char buf[32];
int r = 0;
sha3_256(buf, msg1, sizeof(msg1));
if(memcmp(buf, md1, sizeof(buf))) {
hal_send_str("ERROR SHA3-256 output does not match test vector.\n");
r = 1;
}
return r;
}
static int bench(void)
{
char str[128];
unsigned char msg[1024*32];
unsigned char md[1024*32];
uint64_t t0, t1;
#define TESTMD(MD) \
hal_send_str("-"); \
t0 = hal_get_time(); \
MD(md, msg, sizeof(msg)); \
t1 = hal_get_time(); \
sprintf(str, #MD": %llu cycles", t1-t0); \
hal_send_str(str)
TESTMD(sha3_256);
TESTMD(sha3_384);
TESTMD(sha3_512);
#define TESTXOF(XOF) \
hal_send_str("-"); \
t0 = hal_get_time(); \
XOF(md, sizeof(md), msg, sizeof(msg)); \
t1 = hal_get_time(); \
sprintf(str, #XOF": %llu cycles", t1-t0); \
hal_send_str(str)
TESTXOF(shake128);
TESTXOF(shake256);
return 0;
}
int main(void)
{
hal_setup(CLOCK_BENCHMARK);
hal_send_str("===");
if(test()){
hal_send_str("ERR");
} else {
hal_send_str("ALL GOOD!");
}
bench();
hal_send_str("###");
return 0;
}

Computing file changes ...