R-argon2/0001-Build-against-system-libraries.patch
Elliott Sales de Andrade 30b89d7096 Initial import (#1560764).
2018-03-27 17:53:50 -04:00

89 lines
2.2 KiB
Diff

From 1fef97eb3dfa1b7e3a88884b2eb448ad7f47363c Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Mon, 26 Mar 2018 01:33:04 -0400
Subject: [PATCH] Build against system libraries.
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
src/Makevars | 14 +++-----------
src/argon2.c | 2 +-
src/blake2.c | 4 ++--
src/raw_as_char.c | 1 -
4 files changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/Makevars b/src/Makevars
index 3f6df55..7b82ba7 100644
--- a/src/Makevars
+++ b/src/Makevars
@@ -1,17 +1,9 @@
-PKG_CFLAGS = $(SHLIB_OPENMP_CFLAGS)
-PKG_LIBS = $(SHLIB_OPENMP_CFLAGS)
-
-ARGON2_OBJS = \
- argon2/blake2/blake2b.o \
- argon2/argon2.o \
- argon2/core.o \
- argon2/encoding.o \
- argon2/ref.o \
- argon2/thread.o
+PKG_CFLAGS = $(shell pkg-config --cflags libargon2) $(SHLIB_OPENMP_CFLAGS)
+PKG_LIBS = $(shell pkg-config --libs libargon2) -lb2 $(SHLIB_OPENMP_CFLAGS)
R_OBJS = argon2_native.o argon2.o blake2.o gen_nonce.o raw_as_char.o
-OBJECTS = $(ARGON2_OBJS) $(R_OBJS)
+OBJECTS = $(R_OBJS)
all: $(SHLIB)
diff --git a/src/argon2.c b/src/argon2.c
index e5099a7..46ff6ba 100644
--- a/src/argon2.c
+++ b/src/argon2.c
@@ -26,7 +26,7 @@
#include "common.h"
-#include "argon2/argon2.h"
+#include "argon2.h"
#define CHECKRET(check) if (check != ARGON2_OK) error("%s\n", argon2_error_message(check))
diff --git a/src/blake2.c b/src/blake2.c
index 286bed1..a8e91ae 100644
--- a/src/blake2.c
+++ b/src/blake2.c
@@ -26,7 +26,7 @@
#include "common.h"
-#include "argon2/blake2/blake2.h"
+#include "blake2.h"
#define HASHLEN 64
@@ -81,7 +81,7 @@ SEXP R_blake2b(SEXP in_, SEXP key_)
PROTECT(ret = allocVector(RAWSXP, HASHLEN));
uchar_t *const hash = RAW(ret);
- blake2b(hash, HASHLEN, in, inlen, key, keylen);
+ blake2b(hash, in, key, HASHLEN, inlen, keylen);
UNPROTECT(1);
return ret;
diff --git a/src/raw_as_char.c b/src/raw_as_char.c
index 3ea80cd..67fc383 100644
--- a/src/raw_as_char.c
+++ b/src/raw_as_char.c
@@ -30,7 +30,6 @@
#include <stdint.h>
#include "common.h"
-#include "argon2/blake2/blake2.h"
SEXP R_raw_as_char(SEXP rawvec_, SEXP upper_, SEXP spaces_)
--
2.14.3