|
|
6fbbf4 |
diff -up ./nss/lib/freebl/blname.c.freebl-dyload ./nss/lib/freebl/blname.c
|
|
|
6fbbf4 |
--- ./nss/lib/freebl/blname.c.freebl-dyload 2014-11-17 15:50:32.580158978 -0800
|
|
|
6fbbf4 |
+++ ./nss/lib/freebl/blname.c 2014-11-17 15:50:32.736161778 -0800
|
|
|
6fbbf4 |
@@ -5,8 +5,13 @@
|
|
|
6fbbf4 |
* * License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
6fbbf4 |
* * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
6fbbf4 |
|
|
|
6fbbf4 |
+#if defined(FREEBL_LOWHASH)
|
|
|
6fbbf4 |
+static const char* default_name =
|
|
|
6fbbf4 |
+ SHLIB_PREFIX"freeblpriv"SHLIB_VERSION"."SHLIB_SUFFIX;
|
|
|
6fbbf4 |
+#else
|
|
|
6fbbf4 |
static const char* default_name =
|
|
|
6fbbf4 |
SHLIB_PREFIX"freebl"SHLIB_VERSION"."SHLIB_SUFFIX;
|
|
|
6fbbf4 |
+#endif
|
|
|
6fbbf4 |
|
|
|
6fbbf4 |
/* getLibName() returns the name of the library to load. */
|
|
|
6fbbf4 |
|
|
|
6fbbf4 |
diff -up ./nss/lib/freebl/freebl_hash_vector.def.freebl-dyload ./nss/lib/freebl/freebl_hash_vector.def
|
|
|
6fbbf4 |
--- ./nss/lib/freebl/freebl_hash_vector.def.freebl-dyload 2014-11-17 15:50:32.737161796 -0800
|
|
|
6fbbf4 |
+++ ./nss/lib/freebl/freebl_hash_vector.def 2014-11-17 15:50:32.737161796 -0800
|
|
|
6fbbf4 |
@@ -0,0 +1,34 @@
|
|
|
6fbbf4 |
+;+#
|
|
|
6fbbf4 |
+;+# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
6fbbf4 |
+;+# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
6fbbf4 |
+;+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
6fbbf4 |
+;+#
|
|
|
6fbbf4 |
+;+# OK, this file is meant to support SUN, LINUX, AIX and WINDOWS
|
|
|
6fbbf4 |
+;+# 1. For all unix platforms, the string ";-" means "remove this line"
|
|
|
6fbbf4 |
+;+# 2. For all unix platforms, the string " DATA " will be removed from any
|
|
|
6fbbf4 |
+;+# line on which it occurs.
|
|
|
6fbbf4 |
+;+# 3. Lines containing ";+" will have ";+" removed on SUN and LINUX.
|
|
|
6fbbf4 |
+;+# On AIX, lines containing ";+" will be removed.
|
|
|
6fbbf4 |
+;+# 4. For all unix platforms, the string ";;" will thave the ";;" removed.
|
|
|
6fbbf4 |
+;+# 5. For all unix platforms, after the above processing has taken place,
|
|
|
6fbbf4 |
+;+# all characters after the first ";" on the line will be removed.
|
|
|
6fbbf4 |
+;+# And for AIX, the first ";" will also be removed.
|
|
|
6fbbf4 |
+;+# This file is passed directly to windows. Since ';' is a comment, all UNIX
|
|
|
6fbbf4 |
+;+# directives are hidden behind ";", ";+", and ";-"
|
|
|
6fbbf4 |
+;+
|
|
|
6fbbf4 |
+;+NSSprivate_3.11 { # NSS 3.11 release
|
|
|
6fbbf4 |
+;+ global:
|
|
|
6fbbf4 |
+LIBRARY freebl3 ;-
|
|
|
6fbbf4 |
+EXPORTS ;-
|
|
|
6fbbf4 |
+FREEBL_GetVector;
|
|
|
6fbbf4 |
+;+ local:
|
|
|
6fbbf4 |
+;+ *;
|
|
|
6fbbf4 |
+;+};
|
|
|
6fbbf4 |
+;+NSSprivate_3.16 { # NSS 3.11 release
|
|
|
6fbbf4 |
+;+ global:
|
|
|
6fbbf4 |
+LIBRARY freebl3 ;-
|
|
|
6fbbf4 |
+EXPORTS ;-
|
|
|
6fbbf4 |
+NSSLOW_GetVector;
|
|
|
6fbbf4 |
+;+ local:
|
|
|
6fbbf4 |
+;+ *;
|
|
|
6fbbf4 |
+;+};
|
|
|
6fbbf4 |
diff -up ./nss/lib/freebl/ldvector.c.freebl-dyload ./nss/lib/freebl/ldvector.c
|
|
|
6fbbf4 |
--- ./nss/lib/freebl/ldvector.c.freebl-dyload 2014-11-17 15:50:32.583159032 -0800
|
|
|
6fbbf4 |
+++ ./nss/lib/freebl/ldvector.c 2014-11-17 15:50:32.737161796 -0800
|
|
|
6fbbf4 |
@@ -14,7 +14,6 @@ extern int FREEBL_InitStubs(void);
|
|
|
6fbbf4 |
#include "hmacct.h"
|
|
|
6fbbf4 |
#include "blapii.h"
|
|
|
6fbbf4 |
|
|
|
6fbbf4 |
-
|
|
|
6fbbf4 |
static const struct FREEBLVectorStr vector =
|
|
|
6fbbf4 |
{
|
|
|
6fbbf4 |
|
|
|
6fbbf4 |
@@ -292,6 +291,8 @@ static const struct FREEBLVectorStr vect
|
|
|
6fbbf4 |
/* End of Version 3.017 */
|
|
|
6fbbf4 |
};
|
|
|
6fbbf4 |
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
const FREEBLVector *
|
|
|
6fbbf4 |
FREEBL_GetVector(void)
|
|
|
6fbbf4 |
{
|
|
|
6fbbf4 |
@@ -317,3 +318,31 @@ FREEBL_GetVector(void)
|
|
|
6fbbf4 |
return &vector;
|
|
|
6fbbf4 |
}
|
|
|
6fbbf4 |
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+#ifdef FREEBL_LOWHASH
|
|
|
6fbbf4 |
+static const struct NSSLOWVectorStr nssvector =
|
|
|
6fbbf4 |
+{
|
|
|
6fbbf4 |
+ sizeof nssvector,
|
|
|
6fbbf4 |
+ NSSLOW_VERSION,
|
|
|
6fbbf4 |
+ FREEBL_GetVector,
|
|
|
6fbbf4 |
+ NSSLOW_Init,
|
|
|
6fbbf4 |
+ NSSLOW_Shutdown,
|
|
|
6fbbf4 |
+ NSSLOW_Reset,
|
|
|
6fbbf4 |
+ NSSLOWHASH_NewContext,
|
|
|
6fbbf4 |
+ NSSLOWHASH_Begin,
|
|
|
6fbbf4 |
+ NSSLOWHASH_Update,
|
|
|
6fbbf4 |
+ NSSLOWHASH_End,
|
|
|
6fbbf4 |
+ NSSLOWHASH_Destroy,
|
|
|
6fbbf4 |
+ NSSLOWHASH_Length
|
|
|
6fbbf4 |
+};
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+const NSSLOWVector *
|
|
|
6fbbf4 |
+NSSLOW_GetVector(void)
|
|
|
6fbbf4 |
+{
|
|
|
6fbbf4 |
+ SECStatus rv;
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+ /* POST check and stub init happens in FREEBL_GetVector() and
|
|
|
6fbbf4 |
+ * NSSLOW_Init() respectively */
|
|
|
6fbbf4 |
+ return &nssvector;
|
|
|
6fbbf4 |
+}
|
|
|
6fbbf4 |
+#endif
|
|
|
6fbbf4 |
diff -up ./nss/lib/freebl/loader.h.freebl-dyload ./nss/lib/freebl/loader.h
|
|
|
6fbbf4 |
--- ./nss/lib/freebl/loader.h.freebl-dyload 2014-06-24 13:45:27.000000000 -0700
|
|
|
6fbbf4 |
+++ ./nss/lib/freebl/loader.h 2014-11-17 15:50:32.738161814 -0800
|
|
|
6fbbf4 |
@@ -10,6 +10,7 @@
|
|
|
6fbbf4 |
|
|
|
6fbbf4 |
#include "blapi.h"
|
|
|
6fbbf4 |
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
#define FREEBL_VERSION 0x0311
|
|
|
6fbbf4 |
|
|
|
6fbbf4 |
struct FREEBLVectorStr {
|
|
|
6fbbf4 |
@@ -713,8 +714,43 @@ struct FREEBLVectorStr {
|
|
|
6fbbf4 |
|
|
|
6fbbf4 |
typedef struct FREEBLVectorStr FREEBLVector;
|
|
|
6fbbf4 |
|
|
|
6fbbf4 |
+#ifdef FREEBL_LOWHASH
|
|
|
6fbbf4 |
+#include "nsslowhash.h"
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+#define NSSLOW_VERSION 0x0300
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+struct NSSLOWVectorStr {
|
|
|
6fbbf4 |
+ unsigned short length; /* of this struct in bytes */
|
|
|
6fbbf4 |
+ unsigned short version; /* of this struct. */
|
|
|
6fbbf4 |
+ const FREEBLVector *(*p_FREEBL_GetVector)(void);
|
|
|
6fbbf4 |
+ NSSLOWInitContext *(*p_NSSLOW_Init)(void);
|
|
|
6fbbf4 |
+ void (*p_NSSLOW_Shutdown)(NSSLOWInitContext *context);
|
|
|
6fbbf4 |
+ void (*p_NSSLOW_Reset)(NSSLOWInitContext *context);
|
|
|
6fbbf4 |
+ NSSLOWHASHContext *(*p_NSSLOWHASH_NewContext)(
|
|
|
6fbbf4 |
+ NSSLOWInitContext *initContext,
|
|
|
6fbbf4 |
+ HASH_HashType hashType);
|
|
|
6fbbf4 |
+ void (*p_NSSLOWHASH_Begin)(NSSLOWHASHContext *context);
|
|
|
6fbbf4 |
+ void (*p_NSSLOWHASH_Update)(NSSLOWHASHContext *context,
|
|
|
6fbbf4 |
+ const unsigned char *buf,
|
|
|
6fbbf4 |
+ unsigned int len);
|
|
|
6fbbf4 |
+ void (*p_NSSLOWHASH_End)(NSSLOWHASHContext *context,
|
|
|
6fbbf4 |
+ unsigned char *buf,
|
|
|
6fbbf4 |
+ unsigned int *ret, unsigned int len);
|
|
|
6fbbf4 |
+ void (*p_NSSLOWHASH_Destroy)(NSSLOWHASHContext *context);
|
|
|
6fbbf4 |
+ unsigned int (*p_NSSLOWHASH_Length)(NSSLOWHASHContext *context);
|
|
|
6fbbf4 |
+};
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+typedef struct NSSLOWVectorStr NSSLOWVector;
|
|
|
6fbbf4 |
+#endif
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
SEC_BEGIN_PROTOS
|
|
|
6fbbf4 |
|
|
|
6fbbf4 |
+#ifdef FREEBL_LOWHASH
|
|
|
6fbbf4 |
+typedef const NSSLOWVector * NSSLOWGetVectorFn(void);
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+extern NSSLOWGetVectorFn NSSLOW_GetVector;
|
|
|
6fbbf4 |
+#endif
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
typedef const FREEBLVector * FREEBLGetVectorFn(void);
|
|
|
6fbbf4 |
|
|
|
6fbbf4 |
extern FREEBLGetVectorFn FREEBL_GetVector;
|
|
|
6fbbf4 |
diff -up ./nss/lib/freebl/lowhash_vector.c.freebl-dyload ./nss/lib/freebl/lowhash_vector.c
|
|
|
6fbbf4 |
--- ./nss/lib/freebl/lowhash_vector.c.freebl-dyload 2014-11-17 15:50:32.739161832 -0800
|
|
|
6fbbf4 |
+++ ./nss/lib/freebl/lowhash_vector.c 2014-11-17 16:56:14.683766156 -0800
|
|
|
6fbbf4 |
@@ -0,0 +1,213 @@
|
|
|
6fbbf4 |
+/*
|
|
|
6fbbf4 |
+ * loader.c - load platform dependent DSO containing freebl implementation.
|
|
|
6fbbf4 |
+ *
|
|
|
6fbbf4 |
+ * This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
6fbbf4 |
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
6fbbf4 |
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+#define _GNU_SOURCE 1
|
|
|
6fbbf4 |
+#include "loader.h"
|
|
|
6fbbf4 |
+#include "prmem.h"
|
|
|
6fbbf4 |
+#include "prerror.h"
|
|
|
6fbbf4 |
+#include "prinit.h"
|
|
|
6fbbf4 |
+#include "prenv.h"
|
|
|
6fbbf4 |
+#include "blname.c"
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+#include "prio.h"
|
|
|
6fbbf4 |
+#include "prprf.h"
|
|
|
6fbbf4 |
+#include <stdio.h>
|
|
|
6fbbf4 |
+#include "prsystem.h"
|
|
|
6fbbf4 |
+#include "nsslowhash.h"
|
|
|
6fbbf4 |
+#include <dlfcn.h>
|
|
|
6fbbf4 |
+#include "pratom.h"
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+static const char *NameOfThisSharedLib =
|
|
|
6fbbf4 |
+ SHLIB_PREFIX"freebl"SHLIB_VERSION"."SHLIB_SUFFIX;
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+static PRLibrary* blLib;
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+#define LSB(x) ((x)&0xff)
|
|
|
6fbbf4 |
+#define MSB(x) ((x)>>8)
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+static const NSSLOWVector *vector;
|
|
|
6fbbf4 |
+static const char *libraryName = NULL;
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+/* pretty much only glibc uses this, make sure we don't have any depenencies
|
|
|
6fbbf4 |
+ * on nspr.. */
|
|
|
6fbbf4 |
+#undef PORT_Alloc
|
|
|
6fbbf4 |
+#undef PORT_Free
|
|
|
6fbbf4 |
+#define PORT_Alloc malloc
|
|
|
6fbbf4 |
+#define PR_Malloc malloc
|
|
|
6fbbf4 |
+#define PORT_Free free
|
|
|
6fbbf4 |
+#define PR_Free free
|
|
|
6fbbf4 |
+#define PR_GetDirectorySeparator() '/'
|
|
|
6fbbf4 |
+#define PR_LoadLibraryWithFlags(libspec,flags) \
|
|
|
6fbbf4 |
+ (PRLibrary*)dlopen(libSpec.value.pathname,RTLD_NOW|RTLD_LOCAL)
|
|
|
6fbbf4 |
+#define PR_GetLibraryFilePathname(name,addr) \
|
|
|
6fbbf4 |
+ freebl_lowhash_getLibraryFilePath(addr)
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+static char *
|
|
|
6fbbf4 |
+freebl_lowhash_getLibraryFilePath(void *addr)
|
|
|
6fbbf4 |
+{
|
|
|
6fbbf4 |
+ Dl_info dli;
|
|
|
6fbbf4 |
+ if (dladdr(addr, &dli) == 0) {
|
|
|
6fbbf4 |
+ return NULL;
|
|
|
6fbbf4 |
+ }
|
|
|
6fbbf4 |
+ return strdup(dli.dli_fname);
|
|
|
6fbbf4 |
+}
|
|
|
6fbbf4 |
+#include "genload.c"
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+/* This function must be run only once. */
|
|
|
6fbbf4 |
+/* determine if hybrid platform, then actually load the DSO. */
|
|
|
6fbbf4 |
+static PRStatus
|
|
|
6fbbf4 |
+freebl_LoadDSO( void )
|
|
|
6fbbf4 |
+{
|
|
|
6fbbf4 |
+ PRLibrary * handle;
|
|
|
6fbbf4 |
+ const char * name = getLibName();
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+ if (!name) {
|
|
|
6fbbf4 |
+ PR_SetError(PR_LOAD_LIBRARY_ERROR, 0);
|
|
|
6fbbf4 |
+ return PR_FAILURE;
|
|
|
6fbbf4 |
+ }
|
|
|
6fbbf4 |
+ handle = loader_LoadLibrary(name);
|
|
|
6fbbf4 |
+ if (handle) {
|
|
|
6fbbf4 |
+ void *address = dlsym(handle, "NSSLOW_GetVector");
|
|
|
6fbbf4 |
+ PRStatus status;
|
|
|
6fbbf4 |
+ if (address) {
|
|
|
6fbbf4 |
+ NSSLOWGetVectorFn * getVector = (NSSLOWGetVectorFn *)address;
|
|
|
6fbbf4 |
+ const NSSLOWVector * dsoVector = getVector();
|
|
|
6fbbf4 |
+ if (dsoVector) {
|
|
|
6fbbf4 |
+ unsigned short dsoVersion = dsoVector->version;
|
|
|
6fbbf4 |
+ unsigned short myVersion = NSSLOW_VERSION;
|
|
|
6fbbf4 |
+ if (MSB(dsoVersion) == MSB(myVersion) &&
|
|
|
6fbbf4 |
+ LSB(dsoVersion) >= LSB(myVersion) &&
|
|
|
6fbbf4 |
+ dsoVector->length >= sizeof(NSSLOWVector)) {
|
|
|
6fbbf4 |
+ vector = dsoVector;
|
|
|
6fbbf4 |
+ libraryName = name;
|
|
|
6fbbf4 |
+ blLib = handle;
|
|
|
6fbbf4 |
+ return PR_SUCCESS;
|
|
|
6fbbf4 |
+ }
|
|
|
6fbbf4 |
+ }
|
|
|
6fbbf4 |
+ }
|
|
|
6fbbf4 |
+ status = dlclose(handle);
|
|
|
6fbbf4 |
+ PORT_Assert(PR_SUCCESS == status);
|
|
|
6fbbf4 |
+ }
|
|
|
6fbbf4 |
+ return PR_FAILURE;
|
|
|
6fbbf4 |
+}
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+static PRCallOnceType loadFreeBLOnce;
|
|
|
6fbbf4 |
+/* remove when NSPR pratom.h is updated. s390 has atomic intrinsics,
|
|
|
6fbbf4 |
+ * but nspr doesn't know it. */
|
|
|
6fbbf4 |
+#if defined(__s390__) || defined(__s390x__)
|
|
|
6fbbf4 |
+#undef PR_ATOMIC_SET
|
|
|
6fbbf4 |
+#define PR_ATOMIC_SET(val, newval) __sync_lock_test_and_set(val, newval)
|
|
|
6fbbf4 |
+#endif
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+static PRStatus
|
|
|
6fbbf4 |
+freebl_RunLoaderOnce( void )
|
|
|
6fbbf4 |
+{
|
|
|
6fbbf4 |
+ PRStatus status;
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+ /* Don't have NSPR, so can use the real PR_CallOnce, implement a stripped
|
|
|
6fbbf4 |
+ * down version. */
|
|
|
6fbbf4 |
+ if (loadFreeBLOnce.initialized) {
|
|
|
6fbbf4 |
+ return loadFreeBLOnce.status;
|
|
|
6fbbf4 |
+ }
|
|
|
6fbbf4 |
+ /* PR_ATOMIC_SET macro is implemented with compiler intrinsics, if we don't
|
|
|
6fbbf4 |
+ * have the intrinsic, it will be set to an NSPR PR_Atomic function, which
|
|
|
6fbbf4 |
+ * will show up as missing at build time. If we get that missing function,
|
|
|
6fbbf4 |
+ * Then we'll need to implement a PR_AtomicSet() function for that platform
|
|
|
6fbbf4 |
+ */
|
|
|
6fbbf4 |
+ if (PR_ATOMIC_SET(&loadFreeBLOnce.inProgress,1) == 0) {
|
|
|
6fbbf4 |
+ loadFreeBLOnce.status = freebl_LoadDSO();
|
|
|
6fbbf4 |
+ loadFreeBLOnce.initialized = 1;
|
|
|
6fbbf4 |
+ } else {
|
|
|
6fbbf4 |
+ /* shouldn't have a lot of takers on the else clause, which is good
|
|
|
6fbbf4 |
+ * since we don't have condition variables yet.
|
|
|
6fbbf4 |
+ * 'initialized' only ever gets set (not cleared) so we don't
|
|
|
6fbbf4 |
+ * need the traditional locks. */
|
|
|
6fbbf4 |
+ while (!loadFreeBLOnce.initialized) {
|
|
|
6fbbf4 |
+ sleep(1); /* don't have condition variables, just give up the CPU */
|
|
|
6fbbf4 |
+ }
|
|
|
6fbbf4 |
+ }
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+ return loadFreeBLOnce.status;
|
|
|
6fbbf4 |
+}
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+const FREEBLVector *FREEBL_GetVector(void)
|
|
|
6fbbf4 |
+{
|
|
|
6fbbf4 |
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
|
|
|
6fbbf4 |
+ return NULL;
|
|
|
6fbbf4 |
+ return (vector->p_FREEBL_GetVector)();
|
|
|
6fbbf4 |
+}
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+NSSLOWInitContext *NSSLOW_Init(void)
|
|
|
6fbbf4 |
+{
|
|
|
6fbbf4 |
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
|
|
|
6fbbf4 |
+ return NULL;
|
|
|
6fbbf4 |
+ return (vector->p_NSSLOW_Init)();
|
|
|
6fbbf4 |
+}
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+void NSSLOW_Shutdown(NSSLOWInitContext *context)
|
|
|
6fbbf4 |
+{
|
|
|
6fbbf4 |
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
|
|
|
6fbbf4 |
+ return;
|
|
|
6fbbf4 |
+ (vector->p_NSSLOW_Shutdown)(context);
|
|
|
6fbbf4 |
+}
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+void NSSLOW_Reset(NSSLOWInitContext *context)
|
|
|
6fbbf4 |
+{
|
|
|
6fbbf4 |
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
|
|
|
6fbbf4 |
+ return;
|
|
|
6fbbf4 |
+ (vector->p_NSSLOW_Reset)(context);
|
|
|
6fbbf4 |
+}
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+NSSLOWHASHContext *NSSLOWHASH_NewContext(
|
|
|
6fbbf4 |
+ NSSLOWInitContext *initContext,
|
|
|
6fbbf4 |
+ HASH_HashType hashType)
|
|
|
6fbbf4 |
+{
|
|
|
6fbbf4 |
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
|
|
|
6fbbf4 |
+ return NULL;
|
|
|
6fbbf4 |
+ return (vector->p_NSSLOWHASH_NewContext)(initContext, hashType);
|
|
|
6fbbf4 |
+}
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+void NSSLOWHASH_Begin(NSSLOWHASHContext *context)
|
|
|
6fbbf4 |
+{
|
|
|
6fbbf4 |
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
|
|
|
6fbbf4 |
+ return;
|
|
|
6fbbf4 |
+ (vector->p_NSSLOWHASH_Begin)(context);
|
|
|
6fbbf4 |
+}
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+void NSSLOWHASH_Update(NSSLOWHASHContext *context,
|
|
|
6fbbf4 |
+ const unsigned char *buf,
|
|
|
6fbbf4 |
+ unsigned int len)
|
|
|
6fbbf4 |
+{
|
|
|
6fbbf4 |
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
|
|
|
6fbbf4 |
+ return;
|
|
|
6fbbf4 |
+ (vector->p_NSSLOWHASH_Update)(context, buf, len);
|
|
|
6fbbf4 |
+}
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+void NSSLOWHASH_End(NSSLOWHASHContext *context,
|
|
|
6fbbf4 |
+ unsigned char *buf,
|
|
|
6fbbf4 |
+ unsigned int *ret, unsigned int len)
|
|
|
6fbbf4 |
+{
|
|
|
6fbbf4 |
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
|
|
|
6fbbf4 |
+ return;
|
|
|
6fbbf4 |
+ (vector->p_NSSLOWHASH_End)(context, buf, ret, len);
|
|
|
6fbbf4 |
+}
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+void NSSLOWHASH_Destroy(NSSLOWHASHContext *context)
|
|
|
6fbbf4 |
+{
|
|
|
6fbbf4 |
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
|
|
|
6fbbf4 |
+ return;
|
|
|
6fbbf4 |
+ (vector->p_NSSLOWHASH_Destroy)(context);
|
|
|
6fbbf4 |
+}
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+unsigned int NSSLOWHASH_Length(NSSLOWHASHContext *context)
|
|
|
6fbbf4 |
+{
|
|
|
6fbbf4 |
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
|
|
|
6fbbf4 |
+ return -1;
|
|
|
6fbbf4 |
+ return (vector->p_NSSLOWHASH_Length)(context);
|
|
|
6fbbf4 |
+}
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
diff -up ./nss/lib/freebl/Makefile.freebl-dyload ./nss/lib/freebl/Makefile
|
|
|
6fbbf4 |
--- ./nss/lib/freebl/Makefile.freebl-dyload 2014-11-17 15:50:32.684160845 -0800
|
|
|
6fbbf4 |
+++ ./nss/lib/freebl/Makefile 2014-11-17 15:50:32.739161832 -0800
|
|
|
6fbbf4 |
@@ -46,13 +46,24 @@ ifeq ($(FREEBL_NO_DEPEND),1)
|
|
|
6fbbf4 |
endif
|
|
|
6fbbf4 |
|
|
|
6fbbf4 |
ifeq ($(FREEBL_LOWHASH),1)
|
|
|
6fbbf4 |
+ DEFINES += -DFREEBL_LOWHASH
|
|
|
6fbbf4 |
LOWHASH_SRCS = nsslowhash.c
|
|
|
6fbbf4 |
LOWHASH_EXPORTS = nsslowhash.h
|
|
|
6fbbf4 |
- MAPFILE_SOURCE = freebl_hash.def
|
|
|
6fbbf4 |
+ MAPFILE_SOURCE = freebl_hash_vector.def
|
|
|
6fbbf4 |
+ FREEBL_BUILD_LOWHASH = 1
|
|
|
6fbbf4 |
else
|
|
|
6fbbf4 |
MAPFILE_SOURCE = freebl.def
|
|
|
6fbbf4 |
endif
|
|
|
6fbbf4 |
|
|
|
6fbbf4 |
+ifdef FREEBL_LOWHASH_BUILD
|
|
|
6fbbf4 |
+ CSRCS = lowhash_vector.c
|
|
|
6fbbf4 |
+ SIMPLE_OBJS = $(CSRCS:.c=$(OBJ_SUFFIX))
|
|
|
6fbbf4 |
+ OBJS = $(addprefix $(OBJDIR)/$(PROG_PREFIX), $(SIMPLE_OBJS))
|
|
|
6fbbf4 |
+ ALL_TRASH := $(TARGETS) $(OBJS) $(OBJDIR) LOGS TAGS $(GARBAGE) \
|
|
|
6fbbf4 |
+ $(NOSUCHFILE) so_locations
|
|
|
6fbbf4 |
+ MAPFILE_SOURCE = freebl_hash.def
|
|
|
6fbbf4 |
+endif
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
# FREEBL_USE_PRELINK
|
|
|
6fbbf4 |
#
|
|
|
6fbbf4 |
# Most modern version of Linux support a speed optimization scheme where an
|
|
|
6fbbf4 |
@@ -574,6 +585,17 @@ release_md libs:: $(SINGLE_SHLIB_DIR)
|
|
|
6fbbf4 |
|
|
|
6fbbf4 |
endif
|
|
|
6fbbf4 |
|
|
|
6fbbf4 |
+ifdef FREEBL_BUILD_LOWHASH
|
|
|
6fbbf4 |
+SINGLE_SHLIB_DIR = $(OBJDIR)/$(OS_TARGET)_SINGLE_SHLIB
|
|
|
6fbbf4 |
+ALL_TRASH += $(SINGLE_SHLIB_DIR)
|
|
|
6fbbf4 |
+$(SINGLE_SHLIB_DIR):
|
|
|
6fbbf4 |
+ -mkdir $(SINGLE_SHLIB_DIR)
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
+release_md libs:: $(SINGLE_SHLIB_DIR)
|
|
|
6fbbf4 |
+ $(MAKE) FREEBL_LOWHASH_BUILD=1 FREEBL_CHILD_BUILD=1 \
|
|
|
6fbbf4 |
+ OBJDIR=$(SINGLE_SHLIB_DIR) $@
|
|
|
6fbbf4 |
+endif
|
|
|
6fbbf4 |
+
|
|
|
6fbbf4 |
# multiple shared libraries
|
|
|
6fbbf4 |
|
|
|
6fbbf4 |
######################## ABI32_FPU stuff #########################
|
|
|
6fbbf4 |
diff -up ./nss/lib/freebl/manifest.mn.freebl-dyload ./nss/lib/freebl/manifest.mn
|
|
|
6fbbf4 |
--- ./nss/lib/freebl/manifest.mn.freebl-dyload 2014-11-17 15:50:32.583159032 -0800
|
|
|
6fbbf4 |
+++ ./nss/lib/freebl/manifest.mn 2014-11-17 15:50:32.739161832 -0800
|
|
|
6fbbf4 |
@@ -29,6 +29,12 @@ ifdef FREEBL_CHILD_BUILD
|
|
|
6fbbf4 |
ifdef USE_ABI64_FPU
|
|
|
6fbbf4 |
LIBRARY_NAME = freebl_64fpu
|
|
|
6fbbf4 |
endif
|
|
|
6fbbf4 |
+ ifdef FREEBL_LOWHASH
|
|
|
6fbbf4 |
+ LIBRARY_NAME = freeblpriv
|
|
|
6fbbf4 |
+ endif
|
|
|
6fbbf4 |
+ ifdef FREEBL_LOWHASH_BUILD
|
|
|
6fbbf4 |
+ LIBRARY_NAME = freebl
|
|
|
6fbbf4 |
+ endif
|
|
|
6fbbf4 |
endif
|
|
|
6fbbf4 |
|
|
|
6fbbf4 |
# if the library name contains _, we prefix the version with _
|