Skip to content

Commit

Permalink
Use stdint.h/stddef.h
Browse files Browse the repository at this point in the history
Use clang's stdint.h and stddef.h instead of our own types.
  • Loading branch information
mchack-work committed Sep 13, 2023
1 parent 299a77a commit 9ff4102
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 31 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ libcrt0.a: libcrt0/crt0.o
LIBOBJS=libcommon/assert.o libcommon/blake2s.o libcommon/led.o libcommon/lib.o libcommon/proto.o libcommon/qemu_debug.o
libcommon.a: $(LIBOBJS)
llvm-ar -qc $@ $(LIBOBJS)
$(LIBOBJS): include/blake2s.h include/types.h include/tk1_mem.h include/lib.h include/proto.h include/led.h include/assert.h include/qemu_debug.h
$(LIBOBJS): include/blake2s.h include/tk1_mem.h include/lib.h include/proto.h include/led.h include/assert.h include/qemu_debug.h

# Monocypher
MONOOBJS=monocypher/monocypher.o monocypher/monocypher-ed25519.o
Expand Down
2 changes: 1 addition & 1 deletion example-app/blue.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (C) Tillitis AB
// SPDX-License-Identifier: GPL-2.0-only

#include <types.h>
#include <stdint.h>
#include <tk1_mem.h>
#include <qemu_debug.h>

Expand Down
3 changes: 2 additions & 1 deletion include/blake2s.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
#ifndef BLAKE2S_H
#define BLAKE2S_H

#include <types.h>
#include <stddef.h>
#include <stdint.h>

// blake2s state context
typedef struct {
Expand Down
2 changes: 1 addition & 1 deletion include/led.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#ifndef LED_H
#define LED_H

#include <stdint.h>
#include <tk1_mem.h>
#include <types.h>

// clang-format off
#define LED_BLACK 0
Expand Down
3 changes: 2 additions & 1 deletion include/lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
#ifndef LIB_H
#define LIB_H

#include <types.h>
#include <stddef.h>
#include <stdint.h>

void *memset(void *dest, int c, unsigned n);
void *memcpy(void *dest, const void *src, unsigned n);
Expand Down
3 changes: 2 additions & 1 deletion include/proto.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Copyright (C) 2022, 2023 - Tillitis AB
// SPDX-License-Identifier: GPL-2.0-only

#include <types.h>
#include <stddef.h>
#include <stdint.h>

#ifndef PROTO_H
#define PROTO_H
Expand Down
2 changes: 1 addition & 1 deletion include/qemu_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#ifndef QEMU_DEBUG_H
#define QEMU_DEBUG_H

#include <types.h>
#include <stdint.h>

#ifndef QEMU_DEBUG
#define qemu_putchar(ch)
Expand Down
20 changes: 0 additions & 20 deletions include/types.h

This file was deleted.

2 changes: 1 addition & 1 deletion libcommon/blake2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// SPDX-License-Identifier: GPL-2.0-only

#include <blake2s.h>
#include <stdint.h>
#include <tk1_mem.h>
#include <types.h>

typedef int (*fw_blake2s_p)(void *out, unsigned long outlen, const void *key,
unsigned long keylen, const void *in,
Expand Down
2 changes: 1 addition & 1 deletion libcommon/lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#include <assert.h>
#include <lib.h>
#include <stdint.h>
#include <tk1_mem.h>
#include <types.h>

void *memset(void *dest, int c, unsigned n)
{
Expand Down
2 changes: 1 addition & 1 deletion libcommon/qemu_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#include <lib.h>
#include <qemu_debug.h>
#include <stdint.h>
#include <tk1_mem.h>
#include <types.h>

// clang-format off
static volatile uint8_t* const debugtx = (volatile uint8_t *)TK1_MMIO_QEMU_DEBUG;
Expand Down
3 changes: 2 additions & 1 deletion monocypher/monocypher.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
#ifndef MONOCYPHER_H
#define MONOCYPHER_H

#include <types.h>
#include <stdint.h>
#include <stddef.h>

#ifdef MONOCYPHER_CPP_NAMESPACE
namespace MONOCYPHER_CPP_NAMESPACE {
Expand Down

0 comments on commit 9ff4102

Please sign in to comment.