~ubuntu-branches/ubuntu/quantal/nspr/quantal-security

« back to all changes in this revision

Viewing changes to mozilla/nsprpub/pr/src/md/unix/uxrng.c

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Sack, Fabien Tassin, Alexander Sack
  • Date: 2009-01-11 13:50:07 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20090111135007-butxlx6upwjcakod
Tags: 4.7.3-0ubuntu1
* New upstream version: 4.7.3 from NSPR_4_7_3_RTM tag

[ Fabien Tassin <fta@ubuntu.com> ]
* LP: #269188 - use /dev/urandom for better entropy on LTSP environments
* update diverged patches:
  - update debian/patches/30_pkgconfig.patch
  - update debian/patches/81_sonames.patch
  - update debian/patches/99_configure.patch

[ Alexander Sack <asac@ubuntu.com> ]
Drop debian soname patch for full upstream compatibility
* eliminate soname patch
  - delete debian/patches/81_sonames.patch
  - update debian/patches/series
* refresh configure patch to reflect dropped soname patch
  - update debian/patches/99_configure.patch
* install unversioned .so files
  - update debian/libnspr4-0d.install
* .so.0d links are not created without the soname patch. we create
  backlinks to the unversioned .so libs using debhelper; also we
  cannot dh_install the .0d versioned libs anymore and we drop
  them from .install accordingly
  - add debian/libnspr4-0d.links
  - update debian/libnspr4-0d.install
* implement link shuffeling transition (with abort cases) in
  maintainer scripts; affected libs: libnspr4.so libplc4.so libplds4.so
  - add debian/libnspr4-0d.postinst
  - add debian/libnspr4-0d.postrm
  - add debian/libnspr4-0d.preinst
  - add debian/libnspr4-0d.prerm
* drop soname version suffix from symbol files and reflect this fact by
  adjusting minimum version to this package version (4.7.3-0ubuntu1~)
  - update debian/libnspr4-0d.symbols
  - update debian/libnspr4-0d.symbols.amd64
  - update debian/libnspr4-0d.symbols.i386
  - update debian/libnspr4-0d.symbols.ia64
  - update debian/libnspr4-0d.symbols.lpia
  - update debian/libnspr4-0d.symbols.powerpc
* bump lower shlibs version constraint to 4.7.1+1.9-0ubuntu5~
  - update debian/rules
* rerun autoconf2.13 to apply dropped 81_sonames.patch to configure
  - update debian/patches/99_configure.patch
* explitly define libnspr4_0d_EXPORTED_LIBS and pass those manually
  to dpkg-gensymbols to workaround uncommon SONAME used by nspr libs
  - update debian/rules
* don't pretend to create shlibs-control file anymore; add binary
  lintian override for that
  - update debian/rules
* add #DEBHELPER# token to maintainer scripts
  - update debian/libnspr4-0d.postinst
  - update debian/libnspr4-0d.postrm
  - update debian/libnspr4-0d.preinst
  - update debian/libnspr4-0d.prerm

Show diffs side-by-side

added added

removed removed

Lines of Context:
139
139
}
140
140
 
141
141
#elif (defined(LINUX) || defined(FREEBSD) || defined(__FreeBSD_kernel__) \
142
 
    || defined(NETBSD) || defined(__NetBSD_kernel__) || defined(OPENBSD))
 
142
    || defined(NETBSD) || defined(__NetBSD_kernel__) || defined(OPENBSD) \
 
143
    || defined(SYMBIAN))
143
144
#include <sys/types.h>
144
145
#include <sys/stat.h>
145
146
#include <fcntl.h>
146
147
 
147
 
static int      fdDevRandom;
148
 
static PRCallOnceType coOpenDevRandom;
 
148
static int      fdDevURandom;
 
149
static PRCallOnceType coOpenDevURandom;
149
150
 
150
 
static PRStatus OpenDevRandom( void )
 
151
static PRStatus OpenDevURandom( void )
151
152
{
152
 
    fdDevRandom = open( "/dev/random", O_RDONLY );
153
 
    return((-1 == fdDevRandom)? PR_FAILURE : PR_SUCCESS );
154
 
} /* end OpenDevRandom() */
 
153
    fdDevURandom = open( "/dev/urandom", O_RDONLY );
 
154
    return((-1 == fdDevURandom)? PR_FAILURE : PR_SUCCESS );
 
155
} /* end OpenDevURandom() */
155
156
 
156
 
static size_t GetDevRandom( void *buf, size_t size )
 
157
static size_t GetDevURandom( void *buf, size_t size )
157
158
{
158
159
    int bytesIn;
159
160
    int rc;
160
161
 
161
 
    rc = PR_CallOnce( &coOpenDevRandom, OpenDevRandom );
 
162
    rc = PR_CallOnce( &coOpenDevURandom, OpenDevURandom );
162
163
    if ( PR_FAILURE == rc ) {
163
164
        _PR_MD_MAP_OPEN_ERROR( errno );
164
165
        return(0);
165
166
    }
166
167
 
167
 
    bytesIn = read( fdDevRandom, buf, size );
 
168
    bytesIn = read( fdDevURandom, buf, size );
168
169
    if ( -1 == bytesIn ) {
169
170
        _PR_MD_MAP_READ_ERROR( errno );
170
171
        return(0);
171
172
    }
172
173
 
173
174
    return( bytesIn );
174
 
} /* end GetDevRandom() */
 
175
} /* end GetDevURandom() */
175
176
 
176
177
static size_t
177
178
GetHighResClock(void *buf, size_t maxbytes)
178
179
{             
179
 
    return(GetDevRandom( buf, maxbytes ));
 
180
    return(GetDevURandom( buf, maxbytes ));
180
181
}
181
182
 
182
183
#elif defined(NCR)