Skip to content

Commit

Permalink
crypto: import zinc
Browse files Browse the repository at this point in the history
  • Loading branch information
zx2c4 committed Aug 29, 2018
1 parent 02ae6d9 commit 96cfdd9
Show file tree
Hide file tree
Showing 52 changed files with 13,082 additions and 6,534 deletions.
9 changes: 2 additions & 7 deletions src/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,10 @@ ccflags-y := -O3 -fvisibility=hidden
ccflags-$(CONFIG_WIREGUARD_DEBUG) += -DDEBUG -g
ccflags-y += -Wframe-larger-than=8192
ccflags-y += -D'pr_fmt(fmt)=KBUILD_MODNAME ": " fmt'
wireguard-y := main.o noise.o device.o peer.o timers.o queueing.o send.o receive.o socket.o hashtables.o allowedips.o ratelimiter.o cookie.o netlink.o
wireguard-y += crypto/chacha20.o crypto/poly1305.o crypto/chacha20poly1305.o crypto/curve25519.o crypto/blake2s.o

wireguard-$(CONFIG_X86_64) += crypto/chacha20-x86_64.o crypto/poly1305-x86_64.o crypto/blake2s-x86_64.o
wireguard-$(CONFIG_ARM) += crypto/chacha20-arm.o crypto/poly1305-arm.o crypto/curve25519-arm.o
wireguard-$(CONFIG_ARM64) += crypto/chacha20-arm64.o crypto/poly1305-arm64.o
wireguard-$(if $(filter yy,$(CONFIG_MIPS)$(CONFIG_64BIT)),y,n) += crypto/poly1305-mips64.o
wireguard-$(if $(filter yy,$(CONFIG_MIPS)$(CONFIG_CPU_MIPS32_R2)),y,n) += crypto/poly1305-mips.o crypto/chacha20-mips.o
wireguard-y := main.o noise.o device.o peer.o timers.o queueing.o send.o receive.o socket.o hashtables.o allowedips.o ratelimiter.o cookie.o netlink.o

include $(src)/crypto/Kbuild.include
include $(src)/compat/Kbuild.include

obj-$(if $(KBUILD_EXTMOD),m,$(CONFIG_WIREGUARD)) := wireguard.o
5 changes: 3 additions & 2 deletions src/cookie.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
#include "messages.h"
#include "ratelimiter.h"
#include "timers.h"
#include "crypto/blake2s.h"
#include "crypto/chacha20poly1305.h"

#include <zinc/blake2s.h>
#include <zinc/chacha20poly1305.h>

#include <net/ipv6.h>
#include <crypto/algapi.h>
Expand Down
64 changes: 64 additions & 0 deletions src/crypto/Kbuild.include
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
ifeq ($(wildcard $(src)/compat/compat.h),)
cmd_include_path_prefix := $(srctree)/$(src)
else
cmd_include_path_prefix := $(src)
endif

ccflags-y += -I$(src)/crypto/include

wireguard-y += crypto/zinc/chacha20/chacha20.o
ifeq ($(CONFIG_X86_64),y)
wireguard-y += crypto/zinc/chacha20/chacha20-x86_64.o
CFLAGS_chacha20.o += -include $(cmd_include_path_prefix)/crypto/zinc/chacha20/chacha20-x86_64-glue.h
endif
ifeq ($(CONFIG_ARM),y)
wireguard-y += crypto/zinc/chacha20/chacha20-arm.o
CFLAGS_chacha20.o += -include $(cmd_include_path_prefix)/crypto/zinc/chacha20/chacha20-arm-glue.h
endif
ifeq ($(CONFIG_ARM64),y)
wireguard-y += crypto/zinc/chacha20/chacha20-arm64.o
CFLAGS_chacha20.o += -include $(cmd_include_path_prefix)/crypto/zinc/chacha20/chacha20-arm-glue.h
endif
ifeq ($(CONFIG_MIPS)$(CONFIG_CPU_MIPS32_R2),yy)
wireguard-y += crypto/zinc/chacha20/chacha20-mips.o
CFLAGS_chacha20.o += -include $(cmd_include_path_prefix)/crypto/zinc/chacha20/chacha20-mips-glue.h
endif

wireguard-y += crypto/zinc/poly1305/poly1305.o
ifeq ($(CONFIG_X86_64),y)
wireguard-y += crypto/zinc/poly1305/poly1305-x86_64.o
CFLAGS_poly1305.o += -include $(cmd_include_path_prefix)/crypto/zinc/poly1305/poly1305-x86_64-glue.h
endif
ifeq ($(CONFIG_ARM),y)
wireguard-y += crypto/zinc/poly1305/poly1305-arm.o
CFLAGS_poly1305.o += -include $(cmd_include_path_prefix)/crypto/zinc/poly1305/poly1305-arm-glue.h
endif
ifeq ($(CONFIG_ARM64),y)
wireguard-y += crypto/zinc/poly1305/poly1305-arm64.o
CFLAGS_poly1305.o += -include $(cmd_include_path_prefix)/crypto/zinc/poly1305/poly1305-arm-glue.h
endif
ifeq ($(CONFIG_MIPS)$(CONFIG_CPU_MIPS32_R2),yy)
wireguard-y += crypto/zinc/poly1305/poly1305-mips.o
CFLAGS_poly1305.o += -include $(cmd_include_path_prefix)/crypto/zinc/poly1305/poly1305-mips-glue.h
endif
ifeq ($(CONFIG_MIPS)$(CONFIG_64BIT),yy)
wireguard-y += crypto/zinc/poly1305/poly1305-mips64.o
CFLAGS_poly1305.o += -include $(cmd_include_path_prefix)/crypto/zinc/poly1305/poly1305-mips-glue.h
endif

wireguard-y += crypto/zinc/chacha20poly1305.o

wireguard-y += crypto/zinc/curve25519/curve25519.o
ifeq ($(CONFIG_ARM)$(CONFIG_KERNEL_MODE_NEON),yy)
wireguard-y += crypto/zinc/curve25519/curve25519-arm.o
CFLAGS_curve25519.o += -include $(cmd_include_path_prefix)/crypto/zinc/curve25519/curve25519-arm-glue.h
endif
ifeq ($(CONFIG_X86_64),y)
CFLAGS_curve25519.o += -include $(cmd_include_path_prefix)/crypto/zinc/curve25519/curve25519-x86_64-glue.h
endif

wireguard-y += crypto/zinc/blake2s/blake2s.o
ifeq ($(CONFIG_X86_64),y)
wireguard-y += crypto/zinc/blake2s/blake2s-x86_64.o
CFLAGS_blake2s.o += -include $(cmd_include_path_prefix)/crypto/zinc/blake2s/blake2s-x86_64-glue.h
endif
240 changes: 0 additions & 240 deletions src/crypto/chacha20.c

This file was deleted.

52 changes: 0 additions & 52 deletions src/crypto/chacha20poly1305.h

This file was deleted.

Loading

0 comments on commit 96cfdd9

Please sign in to comment.