Port of the eXtended Keccak Code Package

https://github.com/XKCP/XKCP
https://keccak.team/keccak.html
This commit is contained in:
Emery Hemingway
2018-11-10 11:55:21 +01:00
committed by Norman Feske
parent 4d10959476
commit 1f028daae3
12 changed files with 78 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
XKCP_SRC_DIR := $(call select_from_ports,xkcp)
ifeq ($(filter-out $(SPECS),64bit),)
INC_DIR += $(XKCP_SRC_DIR)/generic64/libkeccak.a
endif
ifeq ($(filter-out $(SPECS),32bit),)
INC_DIR += $(XKCP_SRC_DIR)/generic32/libkeccak.a
endif

0
lib/import/libkeccak.mk Normal file
View File

3
lib/mk/libkeccak.inc Normal file
View File

@@ -0,0 +1,3 @@
INC_DIR += $(REP_DIR)/src/lib/keccak
SRC_C += $(notdir $(wildcard $(KECCAK_SRC_DIR)/*.c))
vpath %.c $(KECCAK_SRC_DIR)

View File

@@ -0,0 +1,4 @@
XKCP_SRC_DIR := $(call select_from_ports,xkcp)
KECCAK_SRC_DIR := $(XKCP_SRC_DIR)/generic32/libkeccak.a
include $(REP_DIR)/lib/mk/libkeccak.inc

View File

@@ -0,0 +1,4 @@
XKCP_SRC_DIR := $(call select_from_ports,xkcp)
KECCAK_SRC_DIR := $(XKCP_SRC_DIR)/generic64/libkeccak.a
include $(REP_DIR)/lib/mk/libkeccak.inc

1
ports/xkcp.hash Normal file
View File

@@ -0,0 +1 @@
cafc0339ae335bd559d667749899feae48acc9c1

24
ports/xkcp.port Normal file
View File

@@ -0,0 +1,24 @@
LICENSE := CC0
VERSION := HEAD
DOWNLOADS := xkcp.archive
OWNER := XKCP
REPO := XKCP
REV := 645e825ae47d7c91780aa5e48eb07e0b035165ea
URL(xkcp) := https://github.com/$(OWNER)/$(REPO)/archive/$(REV).tar.gz
SHA(xkcp) := 883f13c471b31e6ca0329634e74abe5e11cadd50674625b51b40522834a2d6ab
DIR(xkcp) = tmp
_dirs: generic32/libkeccak.a generic64/libkeccak.a
generic32/libkeccak.a: tmp/bin/generic32_libkeccak.a.tar.gz
tar fx $<
generic64/libkeccak.a: tmp/bin/generic64_libkeccak.a.tar.gz
tar fx $<
tmp/bin/generic32_libkeccak.a.tar.gz: tmp
make -C $< generic32/libkeccak.a.pack
tmp/bin/generic64_libkeccak.a.tar.gz: tmp
make -C $< generic64/libkeccak.a.pack

0
src/lib/keccak/assert.h Normal file
View File

5
src/lib/keccak/stdint.h Normal file
View File

@@ -0,0 +1,5 @@
#include <base/fixed_stdint.h>
#include <stddef.h>
typedef genode_uint32_t uint32_t;
typedef genode_uint64_t uint64_t;

0
src/lib/keccak/stdio.h Normal file
View File

1
src/lib/keccak/stdlib.h Normal file
View File

@@ -0,0 +1 @@

27
src/lib/keccak/string.h Normal file
View File

@@ -0,0 +1,27 @@
#ifndef __FAKE_STRING_H__
#define __FAKE_STRING_H__
#include "stdint.h"
static inline int memcmp(const void *p0, const void *p1, size_t size)
{
const unsigned char *c0 = (const unsigned char *)p0;
const unsigned char *c1 = (const unsigned char *)p1;
size_t i;
for (i = 0; i < size; i++)
if (c0[i] != c1[i]) return c0[i] - c1[i];
return 0;
}
void *memcpy(void *dst, const void *src, size_t size);
void *memset(void *dst, int i, size_t size);
typedef void FILE;
static inline void assert() { }
static inline int fprintf(FILE * restrict stream, const char * restrict format, ...) { return -1; }
static inline int fputc(int c, FILE *stream) { return -1; }
#endif