2009/7/18 Dave Korn <dave.korn.cyg...@googlemail.com>: > Kai Tietz wrote: >> Hello, >> >> I noticed, while trying to build libjava for x64 windows, that the >> configure script fails to generate link to >> 'libjava/gnu/java/security/jce/prng/natVMSecureRandomWin32.cc'. This >> file isn't existing. Is there a fix for this? >> >> Thanks in advance for the answer, >> Kai >> > > You probably want to post this to the main list rather than -patches! Also > the java list, I would suppose. The bug is strange. I get nothing from "grep > -R SecureRandomWin32 libjava/*" in my sandbox (but I'm still on r.149334 from > 07/07).
Yes, I missed to add java maintainer and the patch here. I noticed, while trying to build libjava for x64 windows, that the configure script fails to generate link to 'libjava/gnu/java/security/jce/prng/natVMSecureRandomWin32.cc'. This file isn't existing. The attached patch fixes this. The implementation is straight forward, but works for win32 api. The random value generation could be improved here. ChangeLog 2009-07-18 Kai Tietz <kai.ti...@onevision.com> * gnu/java/security/jce/prng/natVMSecureRandomWin32.cc: Implementation for native win32. Tested for x86 and x64 mingw targets. Ok for apply? Cheers, Kai -- | (\_/) This is Bunny. Copy and paste | (='.'=) Bunny into your signature to help | (")_(") him gain world domination
Index: gcc/libjava/gnu/java/security/jce/prng/natVMSecureRandomWin32.cc =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ gcc/libjava/gnu/java/security/jce/prng/natVMSecureRandomWin32.cc 2009-07-18 14:35:14.102884300 +0200 @@ -0,0 +1,44 @@ +// natVMSecureRandomPosix.cc - Native part of VMSecureRandom class for POSIX. + +/* Copyright (C) 2009 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +#include <config.h> + +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> + +#include <gcj/cni.h> +#include <java/lang/InternalError.h> +#include <gnu/java/security/jce/prng/VMSecureRandom.h> + +jint +gnu::java::security::jce::prng::VMSecureRandom::natGenerateSeed(jbyteArray byte_array, jint offset, jint length) +{ + static int was_init = 0; + int a; + jbyte *bytes = elements (byte_array); + ssize_t count = 0; + + if (!was_init) + { + srand (256); + was_init = 1; + } + for (a = 0; a < offset; ++a) + bytes++; + for (a = 0; a < length; a++, count++) + *bytes++= (jbyte) rand (); + + return count; +} +