mirror of
https://github.com/MiyooCFW/buildroot.git
synced 2025-09-27 22:24:19 +03:00
Merge from bittboy/buildroot@db180c0
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
From d667b13a87cf3207599a19eb981a893a1d7a67ee Mon Sep 17 00:00:00 2001
|
||||
From: Brendan Heading <brendanheading@gmail.com>
|
||||
Date: Mon, 14 Sep 2015 23:25:52 +0100
|
||||
Subject: [PATCH 1/1] ibrcommon/data/File.cpp: support POSIX basename call
|
||||
|
||||
Firstly, and somewhat strangely, musl chooses not to provide a basename(3)
|
||||
prototype within <string.h> whenever __cplusplus is defined. This can be
|
||||
solved by including the <libgen.h> header defined by POSIX 1003.1 whenever
|
||||
__GLIBC__ is not defined.
|
||||
|
||||
However, this leads to a second problem. POSIX defines the function as
|
||||
char* basename(char*) and this is the only version supported by musl.
|
||||
However, the std::string.cstr() method returns a const char*.
|
||||
|
||||
POSIX says that the string parameter can be modified. However the GNU
|
||||
implementation never modifies it. glibc therefore supports an extension
|
||||
when compiling under C++ by also supplying
|
||||
const char* basename(const char*). This extension is not present on musl
|
||||
which is the cause of the failure.
|
||||
|
||||
The solution is reasonably straightforward; test if __GLIBC__ is defined
|
||||
before calling basename. If not, use the fallback already provided for
|
||||
other platforms whereby basename() is called on a temporary copy.
|
||||
|
||||
Signed-off-by: Brendan Heading <brendanheading@gmail.com>
|
||||
Upstream-status: pending
|
||||
---
|
||||
ibrcommon/data/File.cpp | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/ibrcommon/data/File.cpp b/ibrcommon/data/File.cpp
|
||||
index 31af4ae..68e9b4f 100644
|
||||
--- a/ibrcommon/data/File.cpp
|
||||
+++ b/ibrcommon/data/File.cpp
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <cerrno>
|
||||
#include <fstream>
|
||||
|
||||
-#if !defined(HAVE_FEATURES_H) || defined(ANDROID)
|
||||
+#if !defined(HAVE_FEATURES_H) || !defined(__GLIBC__) || defined(ANDROID)
|
||||
#include <libgen.h>
|
||||
#endif
|
||||
|
||||
@@ -225,7 +225,7 @@ namespace ibrcommon
|
||||
|
||||
std::string File::getBasename() const
|
||||
{
|
||||
-#if !defined(ANDROID) && defined(HAVE_FEATURES_H)
|
||||
+#if !defined(ANDROID) && defined(HAVE_FEATURES_H) && defined(__GLIBC__)
|
||||
return std::string(basename(_path.c_str()));
|
||||
#else
|
||||
char path[_path.length()+1];
|
||||
--
|
||||
2.4.3
|
||||
|
||||
@@ -0,0 +1,357 @@
|
||||
From a801d10a081e3130e24042256a43190c9eb6c112 Mon Sep 17 00:00:00 2001
|
||||
From: Eneas Queiroz <35331380+cotequeiroz@users.noreply.github.com>
|
||||
Date: Wed, 23 May 2018 03:09:02 -0300
|
||||
Subject: [PATCH] ibrcommon: added openssl 1.1 compatibility (#264)
|
||||
|
||||
This patch adds compatibility to openssl 1.1.0.
|
||||
|
||||
Backported from master branch:
|
||||
https://github.com/ibrdtn/ibrdtn/commit/a801d10a081e3130e24042256a43190c9eb6c112
|
||||
|
||||
Signed-off-by: Eneas U de Queiroz <cote2004-github@yahoo.com>
|
||||
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
|
||||
---
|
||||
ibrcommon/ibrcommon/ssl/HMacStream.cpp | 11 +++---
|
||||
ibrcommon/ibrcommon/ssl/HMacStream.h | 2 +-
|
||||
ibrcommon/ibrcommon/ssl/RSASHA256Stream.cpp | 28 +++++++------
|
||||
ibrcommon/ibrcommon/ssl/RSASHA256Stream.h | 2 +-
|
||||
ibrcommon/ibrcommon/ssl/iostreamBIO.cpp | 44 ++++++++++++++++-----
|
||||
ibrcommon/ibrcommon/ssl/openssl_compat.h | 38 ++++++++++++++++++
|
||||
6 files changed, 95 insertions(+), 30 deletions(-)
|
||||
create mode 100644 ibrcommon/ibrcommon/ssl/openssl_compat.h
|
||||
|
||||
diff --git a/ibrcommon/ssl/HMacStream.cpp b/ibrcommon/ssl/HMacStream.cpp
|
||||
index e5d317e3..66d8ce42 100644
|
||||
--- a/ibrcommon/ssl/HMacStream.cpp
|
||||
+++ b/ibrcommon/ssl/HMacStream.cpp
|
||||
@@ -20,29 +20,30 @@
|
||||
*/
|
||||
|
||||
#include "ibrcommon/ssl/HMacStream.h"
|
||||
+#include "openssl_compat.h"
|
||||
|
||||
namespace ibrcommon
|
||||
{
|
||||
HMacStream::HMacStream(const unsigned char * const key, const int key_size)
|
||||
: HashStream(EVP_MAX_MD_SIZE, BUFF_SIZE), key_(key), key_size_(key_size)
|
||||
{
|
||||
- HMAC_CTX_init(&ctx_);
|
||||
- HMAC_Init_ex(&ctx_, key_, key_size_, EVP_sha1(), NULL);
|
||||
+ ctx_ = HMAC_CTX_new();
|
||||
+ HMAC_Init_ex(ctx_, key_, key_size_, EVP_sha1(), NULL);
|
||||
}
|
||||
|
||||
HMacStream::~HMacStream()
|
||||
{
|
||||
- HMAC_CTX_cleanup(&ctx_);
|
||||
+ HMAC_CTX_free(ctx_);
|
||||
}
|
||||
|
||||
void HMacStream::update(char *buf, const size_t size)
|
||||
{
|
||||
// hashing
|
||||
- HMAC_Update(&ctx_, (unsigned char*)buf, size);
|
||||
+ HMAC_Update(ctx_, (unsigned char*)buf, size);
|
||||
}
|
||||
|
||||
void HMacStream::finalize(char * hash, unsigned int &size)
|
||||
{
|
||||
- HMAC_Final(&ctx_, (unsigned char*)hash, &size);
|
||||
+ HMAC_Final(ctx_, (unsigned char*)hash, &size);
|
||||
}
|
||||
}
|
||||
diff --git a/ibrcommon/ssl/HMacStream.h b/ibrcommon/ssl/HMacStream.h
|
||||
index 7dcea168..d04bceb8 100644
|
||||
--- a/ibrcommon/ssl/HMacStream.h
|
||||
+++ b/ibrcommon/ssl/HMacStream.h
|
||||
@@ -44,7 +44,7 @@ namespace ibrcommon
|
||||
const unsigned char * const key_;
|
||||
const int key_size_;
|
||||
|
||||
- HMAC_CTX ctx_;
|
||||
+ HMAC_CTX* ctx_;
|
||||
};
|
||||
}
|
||||
|
||||
diff --git a/ibrcommon/ssl/RSASHA256Stream.cpp b/ibrcommon/ssl/RSASHA256Stream.cpp
|
||||
index d94430ed..d25c5d2f 100644
|
||||
--- a/ibrcommon/ssl/RSASHA256Stream.cpp
|
||||
+++ b/ibrcommon/ssl/RSASHA256Stream.cpp
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "ibrcommon/ssl/RSASHA256Stream.h"
|
||||
#include "ibrcommon/Logger.h"
|
||||
+#include "openssl_compat.h"
|
||||
#include <openssl/err.h>
|
||||
|
||||
namespace ibrcommon
|
||||
@@ -30,11 +31,11 @@ namespace ibrcommon
|
||||
{
|
||||
// Initialize get pointer. This should be zero so that underflow is called upon first read.
|
||||
setp(&out_buf_[0], &out_buf_[BUFF_SIZE - 1]);
|
||||
- EVP_MD_CTX_init(&_ctx);
|
||||
+ _ctx = EVP_MD_CTX_new();
|
||||
|
||||
if (!_verify)
|
||||
{
|
||||
- if (!EVP_SignInit_ex(&_ctx, EVP_sha256(), NULL))
|
||||
+ if (!EVP_SignInit_ex(_ctx, EVP_sha256(), NULL))
|
||||
{
|
||||
IBRCOMMON_LOGGER_TAG("RSASHA256Stream", critical) << "failed to initialize the signature function" << IBRCOMMON_LOGGER_ENDL;
|
||||
ERR_print_errors_fp(stderr);
|
||||
@@ -42,7 +43,7 @@ namespace ibrcommon
|
||||
}
|
||||
else
|
||||
{
|
||||
- if (!EVP_VerifyInit_ex(&_ctx, EVP_sha256(), NULL))
|
||||
+ if (!EVP_VerifyInit_ex(_ctx, EVP_sha256(), NULL))
|
||||
{
|
||||
IBRCOMMON_LOGGER_TAG("RSASHA256Stream", critical) << "failed to initialize the verification function" << IBRCOMMON_LOGGER_ENDL;
|
||||
ERR_print_errors_fp(stderr);
|
||||
@@ -52,18 +53,19 @@ namespace ibrcommon
|
||||
|
||||
RSASHA256Stream::~RSASHA256Stream()
|
||||
{
|
||||
- EVP_MD_CTX_cleanup(&_ctx);
|
||||
+ EVP_MD_CTX_free(_ctx);
|
||||
}
|
||||
|
||||
void RSASHA256Stream::reset()
|
||||
{
|
||||
- EVP_MD_CTX_cleanup(&_ctx);
|
||||
-
|
||||
- EVP_MD_CTX_init(&_ctx);
|
||||
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
+ EVP_MD_CTX_cleanup(_ctx);
|
||||
+#endif
|
||||
+ EVP_MD_CTX_init(_ctx);
|
||||
|
||||
if (!_verify)
|
||||
{
|
||||
- if (!EVP_SignInit_ex(&_ctx, EVP_sha256(), NULL))
|
||||
+ if (!EVP_SignInit_ex(_ctx, EVP_sha256(), NULL))
|
||||
{
|
||||
IBRCOMMON_LOGGER_TAG("RSASHA256Stream", critical) << "failed to initialize the signature function" << IBRCOMMON_LOGGER_ENDL;
|
||||
ERR_print_errors_fp(stderr);
|
||||
@@ -71,7 +73,7 @@ namespace ibrcommon
|
||||
}
|
||||
else
|
||||
{
|
||||
- if (!EVP_VerifyInit_ex(&_ctx, EVP_sha256(), NULL))
|
||||
+ if (!EVP_VerifyInit_ex(_ctx, EVP_sha256(), NULL))
|
||||
{
|
||||
IBRCOMMON_LOGGER_TAG("RSASHA256Stream", critical) << "failed to initialize the verfication function" << IBRCOMMON_LOGGER_ENDL;
|
||||
ERR_print_errors_fp(stderr);
|
||||
@@ -91,7 +93,7 @@ namespace ibrcommon
|
||||
std::vector<unsigned char> sign(EVP_PKEY_size(_pkey));
|
||||
unsigned int size = EVP_PKEY_size(_pkey);
|
||||
|
||||
- _return_code = EVP_SignFinal(&_ctx, &sign[0], &size, _pkey);
|
||||
+ _return_code = EVP_SignFinal(_ctx, &sign[0], &size, _pkey);
|
||||
|
||||
_sign = std::string((const char*)&sign[0], size);
|
||||
|
||||
@@ -107,7 +109,7 @@ namespace ibrcommon
|
||||
if (!_sign_valid)
|
||||
{
|
||||
sync();
|
||||
- _return_code = EVP_VerifyFinal(&_ctx, reinterpret_cast<const unsigned char *>(their_sign.c_str()), static_cast<unsigned int>(their_sign.size()), _pkey);
|
||||
+ _return_code = EVP_VerifyFinal(_ctx, reinterpret_cast<const unsigned char *>(their_sign.c_str()), static_cast<unsigned int>(their_sign.size()), _pkey);
|
||||
_sign_valid = true;
|
||||
}
|
||||
return _return_code;
|
||||
@@ -145,7 +147,7 @@ namespace ibrcommon
|
||||
if (!_verify)
|
||||
// hashing
|
||||
{
|
||||
- if (!EVP_SignUpdate(&_ctx, &out_buf_[0], iend - ibegin))
|
||||
+ if (!EVP_SignUpdate(_ctx, &out_buf_[0], iend - ibegin))
|
||||
{
|
||||
IBRCOMMON_LOGGER_TAG("RSASHA256Stream", critical) << "failed to feed data into the signature function" << IBRCOMMON_LOGGER_ENDL;
|
||||
ERR_print_errors_fp(stderr);
|
||||
@@ -153,7 +155,7 @@ namespace ibrcommon
|
||||
}
|
||||
else
|
||||
{
|
||||
- if (!EVP_VerifyUpdate(&_ctx, &out_buf_[0], iend - ibegin))
|
||||
+ if (!EVP_VerifyUpdate(_ctx, &out_buf_[0], iend - ibegin))
|
||||
{
|
||||
IBRCOMMON_LOGGER_TAG("RSASHA256Stream", critical) << "failed to feed data into the verification function" << IBRCOMMON_LOGGER_ENDL;
|
||||
ERR_print_errors_fp(stderr);
|
||||
diff --git a/ibrcommon/ssl/RSASHA256Stream.h b/ibrcommon/ssl/RSASHA256Stream.h
|
||||
index 344f8e10..6f3a1168 100644
|
||||
--- a/ibrcommon/ssl/RSASHA256Stream.h
|
||||
+++ b/ibrcommon/ssl/RSASHA256Stream.h
|
||||
@@ -106,7 +106,7 @@ namespace ibrcommon
|
||||
|
||||
/** the context in which the streamed data will be feed into for
|
||||
calculation of the hash/signature */
|
||||
- EVP_MD_CTX _ctx;
|
||||
+ EVP_MD_CTX * _ctx;
|
||||
|
||||
/** tells if the context needs to be finalized to get a valid signature or
|
||||
verification */
|
||||
diff --git a/ibrcommon/ssl/iostreamBIO.cpp b/ibrcommon/ssl/iostreamBIO.cpp
|
||||
index 18c1b55c..ea6c63eb 100644
|
||||
--- a/ibrcommon/ssl/iostreamBIO.cpp
|
||||
+++ b/ibrcommon/ssl/iostreamBIO.cpp
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "ibrcommon/Logger.h"
|
||||
|
||||
+#include "openssl_compat.h"
|
||||
#include <openssl/err.h>
|
||||
|
||||
namespace ibrcommon
|
||||
@@ -42,7 +43,20 @@ static int create(BIO *bio);
|
||||
//static int destroy(BIO *bio);
|
||||
//static long (*callback_ctrl)(BIO *, int, bio_info_cb *);
|
||||
|
||||
-
|
||||
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
|
||||
+BIO_METHOD * BIO_iostream_method()
|
||||
+{
|
||||
+ static BIO_METHOD *iostream_method = NULL;
|
||||
+ if (iostream_method) {
|
||||
+ iostream_method = BIO_meth_new(iostreamBIO::type, iostreamBIO::name);
|
||||
+ BIO_meth_set_write(iostream_method, bwrite);
|
||||
+ BIO_meth_set_read(iostream_method, bread);
|
||||
+ BIO_meth_set_ctrl(iostream_method, ctrl);
|
||||
+ BIO_meth_set_create(iostream_method, create);
|
||||
+ }
|
||||
+ return iostream_method;
|
||||
+}
|
||||
+#else
|
||||
static BIO_METHOD iostream_method =
|
||||
{
|
||||
iostreamBIO::type,
|
||||
@@ -56,12 +70,17 @@ static BIO_METHOD iostream_method =
|
||||
NULL,//destroy,
|
||||
NULL//callback_ctrl
|
||||
};
|
||||
+BIO_METHOD * BIO_iostream_method()
|
||||
+{
|
||||
+ return &iostream_method;
|
||||
+}
|
||||
+#endif
|
||||
|
||||
iostreamBIO::iostreamBIO(iostream *stream)
|
||||
: _stream(stream)
|
||||
{
|
||||
/* create BIO */
|
||||
- _bio = BIO_new(&iostream_method);
|
||||
+ _bio = BIO_new(BIO_iostream_method());
|
||||
if(!_bio){
|
||||
/* creation failed, throw exception */
|
||||
char err_buf[ERR_BUF_SIZE];
|
||||
@@ -72,7 +91,7 @@ iostreamBIO::iostreamBIO(iostream *stream)
|
||||
}
|
||||
|
||||
/* save the iostream in the bio object */
|
||||
- _bio->ptr = stream;
|
||||
+ BIO_set_data(_bio, (void *) stream);
|
||||
}
|
||||
|
||||
BIO * iostreamBIO::getBIO(){
|
||||
@@ -81,10 +100,10 @@ BIO * iostreamBIO::getBIO(){
|
||||
|
||||
static int create(BIO *bio)
|
||||
{
|
||||
- bio->ptr = NULL;
|
||||
- /* (from openssl memory bio) */
|
||||
- bio->shutdown=1;
|
||||
- bio->init=1;
|
||||
+ BIO_set_data(bio, NULL);
|
||||
+ BIO_set_shutdown(bio, 1);
|
||||
+ BIO_set_init(bio, 1);
|
||||
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
/* from bss_mem.c (openssl):
|
||||
* bio->num is used to hold the value to return on 'empty', if it is
|
||||
* 0, should_retry is not set
|
||||
@@ -93,6 +112,7 @@ static int create(BIO *bio)
|
||||
* it is set to 0 since the underlying stream is blocking
|
||||
*/
|
||||
bio->num= 0;
|
||||
+#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -102,7 +122,7 @@ static int create(BIO *bio)
|
||||
static long ctrl(BIO *bio, int cmd, long num, void *)
|
||||
{
|
||||
long ret;
|
||||
- iostream *stream = reinterpret_cast<iostream*>(bio->ptr);
|
||||
+ iostream *stream = reinterpret_cast<iostream*>(BIO_get_data(bio));
|
||||
|
||||
IBRCOMMON_LOGGER_DEBUG_TAG("iostreamBIO", 90) << "ctrl called, cmd: " << cmd << ", num: " << num << "." << IBRCOMMON_LOGGER_ENDL;
|
||||
|
||||
@@ -147,8 +167,12 @@ static long ctrl(BIO *bio, int cmd, long num, void *)
|
||||
|
||||
static int bread(BIO *bio, char *buf, int len)
|
||||
{
|
||||
- iostream *stream = reinterpret_cast<iostream*>(bio->ptr);
|
||||
+ iostream *stream = reinterpret_cast<iostream*>(BIO_get_data(bio));
|
||||
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
|
||||
+ int num_bytes = 0;
|
||||
+#else
|
||||
int num_bytes = bio->num;
|
||||
+#endif
|
||||
|
||||
try{
|
||||
/* make sure to read at least 1 byte and then read as much as we can */
|
||||
@@ -170,7 +194,7 @@ static int bwrite(BIO *bio, const char *buf, int len)
|
||||
if(len == 0){
|
||||
return 0;
|
||||
}
|
||||
- iostream *stream = reinterpret_cast<iostream*>(bio->ptr);
|
||||
+ iostream *stream = reinterpret_cast<iostream*>(BIO_get_data(bio));
|
||||
|
||||
/* write the data */
|
||||
try{
|
||||
diff --git a/ibrcommon/ssl/openssl_compat.h b/ibrcommon/ssl/openssl_compat.h
|
||||
new file mode 100644
|
||||
index 00000000..e491677f
|
||||
--- /dev/null
|
||||
+++ b/ibrcommon/ssl/openssl_compat.h
|
||||
@@ -0,0 +1,38 @@
|
||||
+#ifndef OPENSSL_COMPAT_H
|
||||
+#define OPENSSL_COMPAT_H
|
||||
+
|
||||
+#include <openssl/crypto.h>
|
||||
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
+
|
||||
+#include <openssl/evp.h>
|
||||
+#include <openssl/hmac.h>
|
||||
+
|
||||
+static inline EVP_MD_CTX * EVP_MD_CTX_new()
|
||||
+{
|
||||
+ EVP_MD_CTX *ctx;
|
||||
+
|
||||
+ ctx = (EVP_MD_CTX *) OPENSSL_malloc(sizeof(EVP_MD_CTX));
|
||||
+ EVP_MD_CTX_init(ctx);
|
||||
+ return ctx;
|
||||
+}
|
||||
+#define EVP_MD_CTX_free(c) if (c != NULL) OPENSSL_free(c)
|
||||
+
|
||||
+static inline HMAC_CTX * HMAC_CTX_new()
|
||||
+{
|
||||
+ HMAC_CTX *ctx;
|
||||
+
|
||||
+ ctx = (HMAC_CTX *) OPENSSL_malloc(sizeof(HMAC_CTX));
|
||||
+ HMAC_CTX_init(ctx);
|
||||
+ return ctx;
|
||||
+}
|
||||
+#define HMAC_CTX_free(c) if (c != NULL) OPENSSL_free(c)
|
||||
+
|
||||
+#define BIO_get_data(b) b->ptr
|
||||
+#define BIO_set_data(b, v) b->ptr=v
|
||||
+#define BIO_set_shutdown(b, v) b->shutdown=v
|
||||
+#define BIO_set_init(b, v) b->init=v
|
||||
+
|
||||
+#endif /* OPENSSL_VERSION_NUMBER */
|
||||
+
|
||||
+#endif /* OPENSSL_COMPAT_H */
|
||||
+
|
||||
--
|
||||
2.18.0
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
From 8118c43a53271ba2dd31ce3913a3cd21bc7dcca7 Mon Sep 17 00:00:00 2001
|
||||
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
Date: Sat, 16 Feb 2019 11:58:34 +0100
|
||||
Subject: [PATCH] ibrcommon/ssl/gcm: fix static build with openssl
|
||||
|
||||
gf_mul is already defined in libcrypto (openssl) so rename it into
|
||||
ibrdtn_gf_mul to fix following build failure:
|
||||
|
||||
/home/buildroot/autobuild/instance-3/output/host/bin/../arm-buildroot-uclinux-uclibcgnueabi/sysroot/usr/lib/libcrypto.a(f_impl.o): In function `gf_mul':
|
||||
f_impl.c:(.text+0x0): multiple definition of `gf_mul'
|
||||
/home/buildroot/autobuild/instance-3/output/host/arm-buildroot-uclinux-uclibcgnueabi/sysroot/usr/lib/libibrcommon.a(gf128mul.o):gf128mul.cpp:(.text+0x30): first defined here
|
||||
collect2: error: ld returned 1 exit status
|
||||
Makefile:560: recipe for target 'dtnd' failed
|
||||
|
||||
Fixes:
|
||||
- http://autobuild.buildroot.org/results/1d3b4b6cf043a3e185ce758b617a0a18c3d36cdb
|
||||
|
||||
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
[Upstream status: https://github.com/ibrdtn/ibrdtn/pull/269]
|
||||
---
|
||||
ibrcommon/ibrcommon/ssl/gcm/gcm.cpp | 10 +++++-----
|
||||
ibrcommon/ibrcommon/ssl/gcm/gf128mul.cpp | 2 +-
|
||||
ibrcommon/ibrcommon/ssl/gcm/gf128mul.h | 2 +-
|
||||
3 files changed, 7 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/ibrcommon/ssl/gcm/gcm.cpp b/ibrcommon/ssl/gcm/gcm.cpp
|
||||
index 8a5745b4..6097b43e 100644
|
||||
--- a/ibrcommon/ssl/gcm/gcm.cpp
|
||||
+++ b/ibrcommon/ssl/gcm/gcm.cpp
|
||||
@@ -89,7 +89,7 @@ ret_type gcm_init_and_key( /* initialise mode and set key
|
||||
#elif defined( TABLES_256 )
|
||||
#define gf_mul_hh(a, ctx, scr) gf_mul_256(a, ctx->gf_t256, scr)
|
||||
#else
|
||||
-#define gf_mul_hh(a, ctx, scr) gf_mul(a, ui8_ptr(ctx->ghash_h))
|
||||
+#define gf_mul_hh(a, ctx, scr) ibrdtn_gf_mul(a, ui8_ptr(ctx->ghash_h))
|
||||
#endif
|
||||
|
||||
ret_type gcm_init_message( /* initialise a new message */
|
||||
@@ -334,9 +334,9 @@ ret_type gcm_compute_tag( /* compute authentication tag
|
||||
memcpy(tbuf, ctx->ghash_h, BLOCK_SIZE);
|
||||
for( ; ; )
|
||||
{
|
||||
- if(ln & 1) gf_mul(ui8_ptr(ctx->hdr_ghv), tbuf);
|
||||
+ if(ln & 1) ibrdtn_gf_mul(ui8_ptr(ctx->hdr_ghv), tbuf);
|
||||
if(!(ln >>= 1)) break;
|
||||
- gf_mul(tbuf, tbuf);
|
||||
+ ibrdtn_gf_mul(tbuf, tbuf);
|
||||
}
|
||||
}
|
||||
#else /* this one seems slower on x86 and x86_64 :-( */
|
||||
@@ -348,12 +348,12 @@ ret_type gcm_compute_tag( /* compute authentication tag
|
||||
tbuf[0] = 0x80;
|
||||
while(i)
|
||||
{
|
||||
- gf_mul(tbuf, tbuf);
|
||||
+ ibrdtn_gf_mul(tbuf, tbuf);
|
||||
if(i & ln)
|
||||
gf_mul_hh(tbuf, ctx, scratch);
|
||||
i >>= 1;
|
||||
}
|
||||
- gf_mul(ui8_ptr(ctx->hdr_ghv), tbuf);
|
||||
+ ibrdtn_gf_mul(ui8_ptr(ctx->hdr_ghv), tbuf);
|
||||
}
|
||||
#endif
|
||||
i = BLOCK_SIZE; ln = (uint_32t)(ctx->txt_acnt << 3);
|
||||
diff --git a/ibrcommon/ssl/gcm/gf128mul.cpp b/ibrcommon/ssl/gcm/gf128mul.cpp
|
||||
index a553a044..d0c460c3 100644
|
||||
--- a/ibrcommon/ssl/gcm/gf128mul.cpp
|
||||
+++ b/ibrcommon/ssl/gcm/gf128mul.cpp
|
||||
@@ -103,7 +103,7 @@
|
||||
|
||||
const unsigned short gf_tab[256] = gf_dat(xda);
|
||||
|
||||
-void gf_mul(void *a, const void* b)
|
||||
+void ibrdtn_gf_mul(void *a, const void* b)
|
||||
{ uint_32t r[GF_BYTE_LEN >> 2], p[8][GF_BYTE_LEN >> 2];
|
||||
int i;
|
||||
|
||||
diff --git a/ibrcommon/ssl/gcm/gf128mul.h b/ibrcommon/ssl/gcm/gf128mul.h
|
||||
index 4645c7fe..65fba54b 100644
|
||||
--- a/ibrcommon/ssl/gcm/gf128mul.h
|
||||
+++ b/ibrcommon/ssl/gcm/gf128mul.h
|
||||
@@ -619,7 +619,7 @@ gf_inline void mul_x(void *r, const void *x)
|
||||
|
||||
/* A slow generic version of gf_mul (a = a * b) */
|
||||
|
||||
-void gf_mul(void *a, const void* b);
|
||||
+void ibrdtn_gf_mul(void *a, const void* b);
|
||||
|
||||
/* This version uses 64k bytes of table space on the stack.
|
||||
A 16 byte buffer has to be multiplied by a 16 byte key
|
||||
--
|
||||
2.14.1
|
||||
|
||||
13
package/ibrcommon/Config.in
Normal file
13
package/ibrcommon/Config.in
Normal file
@@ -0,0 +1,13 @@
|
||||
config BR2_PACKAGE_IBRCOMMON
|
||||
bool "ibrcommon"
|
||||
depends on BR2_INSTALL_LIBSTDCPP
|
||||
depends on BR2_TOOLCHAIN_HAS_THREADS
|
||||
help
|
||||
IBR-DTN is a small dtn application that supports:
|
||||
Bundle Protocol RFC 5050
|
||||
Bundle Security Protocol RFC 6257
|
||||
|
||||
http://trac.ibr.cs.tu-bs.de/project-cm-2012-ibrdtn
|
||||
|
||||
comment "ibrcommon needs a toolchain w/ C++, threads"
|
||||
depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS
|
||||
4
package/ibrcommon/ibrcommon.hash
Normal file
4
package/ibrcommon/ibrcommon.hash
Normal file
@@ -0,0 +1,4 @@
|
||||
# Locally calculated
|
||||
sha256 9c457c1ebc01e6216524636628c647bef34ab11bd96f0e0788be8749374fdc20 ibrcommon-1.0.1.tar.gz
|
||||
sha256 1a0b57773a46d9d4cc2f0d1780a17acc38af506bb1e0234aaa85f8ccd6dc0b92 COPYING
|
||||
sha256 9b8a430c2136ebcf76bd37f50da7d7a80ede413ec6604cc4694ea536e779854c README
|
||||
35
package/ibrcommon/ibrcommon.mk
Normal file
35
package/ibrcommon/ibrcommon.mk
Normal file
@@ -0,0 +1,35 @@
|
||||
################################################################################
|
||||
#
|
||||
# ibrcommon
|
||||
#
|
||||
################################################################################
|
||||
|
||||
IBRCOMMON_VERSION = 1.0.1
|
||||
IBRCOMMON_SITE = https://www.ibr.cs.tu-bs.de/projects/ibr-dtn/releases
|
||||
IBRCOMMON_INSTALL_STAGING = YES
|
||||
IBRCOMMON_LICENSE = Apache-2.0
|
||||
IBRCOMMON_LICENSE_FILES = COPYING README
|
||||
IBRCOMMON_DEPENDENCIES = host-pkgconf
|
||||
|
||||
ifeq ($(BR2_PACKAGE_OPENSSL),y)
|
||||
IBRCOMMON_DEPENDENCIES += openssl
|
||||
IBRCOMMON_CONF_OPTS += --with-openssl
|
||||
else
|
||||
IBRCOMMON_CONF_OPTS += --without-openssl
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_LIBNL),y)
|
||||
IBRCOMMON_DEPENDENCIES += libnl
|
||||
IBRCOMMON_CONF_OPTS += --with-lowpan
|
||||
else
|
||||
IBRCOMMON_CONF_OPTS += --without-lowpan
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_LIBXML2),y)
|
||||
IBRCOMMON_DEPENDENCIES += libxml2
|
||||
IBRCOMMON_CONF_OPTS += --with-xml
|
||||
else
|
||||
IBRCOMMON_CONF_OPTS += --without-xml
|
||||
endif
|
||||
|
||||
$(eval $(autotools-package))
|
||||
Reference in New Issue
Block a user