nsprpub/pr/src/misc/prrng.c

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #include "primpl.h"
michael@0 7
michael@0 8 /*
michael@0 9 * We were not including <string.h> in optimized builds. On AIX this
michael@0 10 * caused libnspr4.so to export memcpy and some binaries linked with
michael@0 11 * libnspr4.so resolved their memcpy references with libnspr4.so. To
michael@0 12 * be backward compatible with old libnspr4.so binaries, we do not
michael@0 13 * include <string.h> in optimized builds for AIX. (bug 200561)
michael@0 14 */
michael@0 15 #if !(defined(AIX) && !defined(DEBUG))
michael@0 16 #include <string.h>
michael@0 17 #endif
michael@0 18
michael@0 19 PRSize _pr_CopyLowBits(
michael@0 20 void *dst,
michael@0 21 PRSize dstlen,
michael@0 22 void *src,
michael@0 23 PRSize srclen )
michael@0 24 {
michael@0 25 if (srclen <= dstlen) {
michael@0 26 memcpy(dst, src, srclen);
michael@0 27 return srclen;
michael@0 28 }
michael@0 29 #if defined IS_BIG_ENDIAN
michael@0 30 memcpy(dst, (char*)src + (srclen - dstlen), dstlen);
michael@0 31 #else
michael@0 32 memcpy(dst, src, dstlen);
michael@0 33 #endif
michael@0 34 return dstlen;
michael@0 35 }
michael@0 36
michael@0 37 PR_IMPLEMENT(PRSize) PR_GetRandomNoise(
michael@0 38 void *buf,
michael@0 39 PRSize size
michael@0 40 )
michael@0 41 {
michael@0 42 return( _PR_MD_GET_RANDOM_NOISE( buf, size ));
michael@0 43 } /* end PR_GetRandomNoise() */
michael@0 44 /* end prrng.c */

mercurial