hrev54288 adds 1 changeset to branch 'master'
old head: 6307201bacbd78da399f43f0bf0372d939fc4ff1
new head: 6b0e92ebd4c131c7b0cc3350ac14e55cf9062445
overview:
https://git.haiku-os.org/haiku/log/?qt=range&q=6b0e92ebd4c1+%5E6307201bacbd
----------------------------------------------------------------------------
6b0e92ebd4c1: libshared: move md5 to BPrivate namespace
Otherwise it clashes with the implementation in OpenSSL which uses the
same names but now has a different ABI.
Change-Id: I5cb3ff97d7b28de978cdcbd8a06f25f65fb53784
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2854
Reviewed-by: Kyle Ambroff-Kao <kyle@xxxxxxxxxxxxxx>
Reviewed-by: Jérôme Duval <jerome.duval@xxxxxxxxx>
[ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]
----------------------------------------------------------------------------
Revision: hrev54288
Commit: 6b0e92ebd4c131c7b0cc3350ac14e55cf9062445
URL: https://git.haiku-os.org/haiku/commit/?id=6b0e92ebd4c1
Author: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date: Sun May 31 09:53:58 2020 UTC
Committer: Adrien Destugues <pulkomandy@xxxxxxxxx>
Commit-Date: Tue Jun 2 06:51:58 2020 UTC
----------------------------------------------------------------------------
4 files changed, 12 insertions(+), 9 deletions(-)
headers/private/shared/md5.h | 8 +++-----
src/kits/network/libnetapi/HttpAuthentication.cpp | 4 ++--
src/kits/shared/Jamfile | 2 +-
src/kits/shared/{md5.c => md5.cpp} | 7 ++++++-
----------------------------------------------------------------------------
diff --git a/headers/private/shared/md5.h b/headers/private/shared/md5.h
index 23f36521a6..5ff229618b 100644
--- a/headers/private/shared/md5.h
+++ b/headers/private/shared/md5.h
@@ -25,9 +25,7 @@
#ifndef _MD5_H
#define _MD5_H
-#ifdef __cplusplus
-extern "C" {
-#endif
+namespace BPrivate {
/* Any 32-bit or wider unsigned integer data type will do */
typedef unsigned int MD5_u32plus;
@@ -43,8 +41,8 @@ extern void MD5_Init(MD5_CTX *ctx);
extern void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size);
extern void MD5_Final(unsigned char *result, MD5_CTX *ctx);
-#ifdef __cplusplus
};
-#endif
+
+using namespace BPrivate;
#endif
diff --git a/src/kits/network/libnetapi/HttpAuthentication.cpp
b/src/kits/network/libnetapi/HttpAuthentication.cpp
index ea63ecf356..30b9feeddb 100644
--- a/src/kits/network/libnetapi/HttpAuthentication.cpp
+++ b/src/kits/network/libnetapi/HttpAuthentication.cpp
@@ -21,13 +21,13 @@
#define PRINT(x)
#endif
-extern "C" {
#ifdef OPENSSL_ENABLED
+extern "C" {
#include <openssl/md5.h>
+};
#else
#include "md5.h"
#endif
-};
#ifndef MD5_DIGEST_LENGTH
#define MD5_DIGEST_LENGTH 16
diff --git a/src/kits/shared/Jamfile b/src/kits/shared/Jamfile
index 0d9fe844bc..51b0d2e4bd 100644
--- a/src/kits/shared/Jamfile
+++ b/src/kits/shared/Jamfile
@@ -50,7 +50,7 @@ for architectureObject in [ MultiArchSubDirSetup ] {
Json.cpp
Keymap.cpp
LongAndDragTrackingFilter.cpp
- md5.c
+ md5.cpp
MessageBuilder.cpp
NaturalCompare.cpp
PromptWindow.cpp
diff --git a/src/kits/shared/md5.c b/src/kits/shared/md5.cpp
similarity index 99%
rename from src/kits/shared/md5.c
rename to src/kits/shared/md5.cpp
index d91aed3193..0c62486c3f 100644
--- a/src/kits/shared/md5.c
+++ b/src/kits/shared/md5.cpp
@@ -85,6 +85,9 @@
(ctx->block[(n)])
#endif
+
+namespace BPrivate {
+
/*
* This processes one or more 64-byte data blocks, but does NOT update
* the bit counters. There are no alignment requirements.
@@ -95,7 +98,7 @@ static const void *body(MD5_CTX *ctx, const void *data,
unsigned long size)
MD5_u32plus a, b, c, d;
MD5_u32plus saved_a, saved_b, saved_c, saved_d;
- ptr = data;
+ ptr = (const unsigned char*)data;
a = ctx->a;
b = ctx->b;
@@ -291,3 +294,5 @@ void MD5_Final(unsigned char *result, MD5_CTX *ctx)
memset(ctx, 0, sizeof(*ctx));
}
+
+};