diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /libjava/gnu/java/security/jce/prng | |
download | cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2 cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'libjava/gnu/java/security/jce/prng')
17 files changed, 721 insertions, 0 deletions
diff --git a/libjava/gnu/java/security/jce/prng/HavalRandomSpi.h b/libjava/gnu/java/security/jce/prng/HavalRandomSpi.h new file mode 100644 index 000000000..727d444e9 --- /dev/null +++ b/libjava/gnu/java/security/jce/prng/HavalRandomSpi.h @@ -0,0 +1,38 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_security_jce_prng_HavalRandomSpi__ +#define __gnu_java_security_jce_prng_HavalRandomSpi__ + +#pragma interface + +#include <gnu/java/security/jce/prng/SecureRandomAdapter.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace security + { + namespace jce + { + namespace prng + { + class HavalRandomSpi; + } + } + } + } + } +} + +class gnu::java::security::jce::prng::HavalRandomSpi : public ::gnu::java::security::jce::prng::SecureRandomAdapter +{ + +public: + HavalRandomSpi(); + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_security_jce_prng_HavalRandomSpi__ diff --git a/libjava/gnu/java/security/jce/prng/MD2RandomSpi.h b/libjava/gnu/java/security/jce/prng/MD2RandomSpi.h new file mode 100644 index 000000000..053a305aa --- /dev/null +++ b/libjava/gnu/java/security/jce/prng/MD2RandomSpi.h @@ -0,0 +1,38 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_security_jce_prng_MD2RandomSpi__ +#define __gnu_java_security_jce_prng_MD2RandomSpi__ + +#pragma interface + +#include <gnu/java/security/jce/prng/SecureRandomAdapter.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace security + { + namespace jce + { + namespace prng + { + class MD2RandomSpi; + } + } + } + } + } +} + +class gnu::java::security::jce::prng::MD2RandomSpi : public ::gnu::java::security::jce::prng::SecureRandomAdapter +{ + +public: + MD2RandomSpi(); + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_security_jce_prng_MD2RandomSpi__ diff --git a/libjava/gnu/java/security/jce/prng/MD4RandomSpi.h b/libjava/gnu/java/security/jce/prng/MD4RandomSpi.h new file mode 100644 index 000000000..0f11deb53 --- /dev/null +++ b/libjava/gnu/java/security/jce/prng/MD4RandomSpi.h @@ -0,0 +1,38 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_security_jce_prng_MD4RandomSpi__ +#define __gnu_java_security_jce_prng_MD4RandomSpi__ + +#pragma interface + +#include <gnu/java/security/jce/prng/SecureRandomAdapter.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace security + { + namespace jce + { + namespace prng + { + class MD4RandomSpi; + } + } + } + } + } +} + +class gnu::java::security::jce::prng::MD4RandomSpi : public ::gnu::java::security::jce::prng::SecureRandomAdapter +{ + +public: + MD4RandomSpi(); + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_security_jce_prng_MD4RandomSpi__ diff --git a/libjava/gnu/java/security/jce/prng/MD5RandomSpi.h b/libjava/gnu/java/security/jce/prng/MD5RandomSpi.h new file mode 100644 index 000000000..8e5cc27f8 --- /dev/null +++ b/libjava/gnu/java/security/jce/prng/MD5RandomSpi.h @@ -0,0 +1,38 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_security_jce_prng_MD5RandomSpi__ +#define __gnu_java_security_jce_prng_MD5RandomSpi__ + +#pragma interface + +#include <gnu/java/security/jce/prng/SecureRandomAdapter.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace security + { + namespace jce + { + namespace prng + { + class MD5RandomSpi; + } + } + } + } + } +} + +class gnu::java::security::jce::prng::MD5RandomSpi : public ::gnu::java::security::jce::prng::SecureRandomAdapter +{ + +public: + MD5RandomSpi(); + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_security_jce_prng_MD5RandomSpi__ diff --git a/libjava/gnu/java/security/jce/prng/RipeMD128RandomSpi.h b/libjava/gnu/java/security/jce/prng/RipeMD128RandomSpi.h new file mode 100644 index 000000000..51afaea58 --- /dev/null +++ b/libjava/gnu/java/security/jce/prng/RipeMD128RandomSpi.h @@ -0,0 +1,38 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_security_jce_prng_RipeMD128RandomSpi__ +#define __gnu_java_security_jce_prng_RipeMD128RandomSpi__ + +#pragma interface + +#include <gnu/java/security/jce/prng/SecureRandomAdapter.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace security + { + namespace jce + { + namespace prng + { + class RipeMD128RandomSpi; + } + } + } + } + } +} + +class gnu::java::security::jce::prng::RipeMD128RandomSpi : public ::gnu::java::security::jce::prng::SecureRandomAdapter +{ + +public: + RipeMD128RandomSpi(); + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_security_jce_prng_RipeMD128RandomSpi__ diff --git a/libjava/gnu/java/security/jce/prng/RipeMD160RandomSpi.h b/libjava/gnu/java/security/jce/prng/RipeMD160RandomSpi.h new file mode 100644 index 000000000..f590267fd --- /dev/null +++ b/libjava/gnu/java/security/jce/prng/RipeMD160RandomSpi.h @@ -0,0 +1,38 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_security_jce_prng_RipeMD160RandomSpi__ +#define __gnu_java_security_jce_prng_RipeMD160RandomSpi__ + +#pragma interface + +#include <gnu/java/security/jce/prng/SecureRandomAdapter.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace security + { + namespace jce + { + namespace prng + { + class RipeMD160RandomSpi; + } + } + } + } + } +} + +class gnu::java::security::jce::prng::RipeMD160RandomSpi : public ::gnu::java::security::jce::prng::SecureRandomAdapter +{ + +public: + RipeMD160RandomSpi(); + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_security_jce_prng_RipeMD160RandomSpi__ diff --git a/libjava/gnu/java/security/jce/prng/SecureRandomAdapter.h b/libjava/gnu/java/security/jce/prng/SecureRandomAdapter.h new file mode 100644 index 000000000..7495038c7 --- /dev/null +++ b/libjava/gnu/java/security/jce/prng/SecureRandomAdapter.h @@ -0,0 +1,57 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_security_jce_prng_SecureRandomAdapter__ +#define __gnu_java_security_jce_prng_SecureRandomAdapter__ + +#pragma interface + +#include <java/security/SecureRandomSpi.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace security + { + namespace jce + { + namespace prng + { + class SecureRandomAdapter; + } + } + namespace prng + { + class MDGenerator; + } + } + } + } +} + +class gnu::java::security::jce::prng::SecureRandomAdapter : public ::java::security::SecureRandomSpi +{ + +public: // actually protected + SecureRandomAdapter(::java::lang::String *); +public: + static JArray< jbyte > * getSeed(jint); + virtual JArray< jbyte > * engineGenerateSeed(jint); + virtual void engineNextBytes(JArray< jbyte > *); + virtual void engineSetSeed(JArray< jbyte > *); +private: + jboolean __attribute__((aligned(__alignof__( ::java::security::SecureRandomSpi)))) isSeeded; + ::gnu::java::security::prng::MDGenerator * adaptee; + ::java::lang::String * mdName; + static ::java::util::logging::Logger * logger; + static ::java::lang::String * SECURERANDOM_SOURCE; + static ::java::lang::String * JAVA_SECURITY_EGD; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_security_jce_prng_SecureRandomAdapter__ diff --git a/libjava/gnu/java/security/jce/prng/Sha160RandomSpi.h b/libjava/gnu/java/security/jce/prng/Sha160RandomSpi.h new file mode 100644 index 000000000..dc896ab56 --- /dev/null +++ b/libjava/gnu/java/security/jce/prng/Sha160RandomSpi.h @@ -0,0 +1,38 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_security_jce_prng_Sha160RandomSpi__ +#define __gnu_java_security_jce_prng_Sha160RandomSpi__ + +#pragma interface + +#include <gnu/java/security/jce/prng/SecureRandomAdapter.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace security + { + namespace jce + { + namespace prng + { + class Sha160RandomSpi; + } + } + } + } + } +} + +class gnu::java::security::jce::prng::Sha160RandomSpi : public ::gnu::java::security::jce::prng::SecureRandomAdapter +{ + +public: + Sha160RandomSpi(); + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_security_jce_prng_Sha160RandomSpi__ diff --git a/libjava/gnu/java/security/jce/prng/Sha256RandomSpi.h b/libjava/gnu/java/security/jce/prng/Sha256RandomSpi.h new file mode 100644 index 000000000..73e676cea --- /dev/null +++ b/libjava/gnu/java/security/jce/prng/Sha256RandomSpi.h @@ -0,0 +1,38 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_security_jce_prng_Sha256RandomSpi__ +#define __gnu_java_security_jce_prng_Sha256RandomSpi__ + +#pragma interface + +#include <gnu/java/security/jce/prng/SecureRandomAdapter.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace security + { + namespace jce + { + namespace prng + { + class Sha256RandomSpi; + } + } + } + } + } +} + +class gnu::java::security::jce::prng::Sha256RandomSpi : public ::gnu::java::security::jce::prng::SecureRandomAdapter +{ + +public: + Sha256RandomSpi(); + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_security_jce_prng_Sha256RandomSpi__ diff --git a/libjava/gnu/java/security/jce/prng/Sha384RandomSpi.h b/libjava/gnu/java/security/jce/prng/Sha384RandomSpi.h new file mode 100644 index 000000000..2f76f6903 --- /dev/null +++ b/libjava/gnu/java/security/jce/prng/Sha384RandomSpi.h @@ -0,0 +1,38 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_security_jce_prng_Sha384RandomSpi__ +#define __gnu_java_security_jce_prng_Sha384RandomSpi__ + +#pragma interface + +#include <gnu/java/security/jce/prng/SecureRandomAdapter.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace security + { + namespace jce + { + namespace prng + { + class Sha384RandomSpi; + } + } + } + } + } +} + +class gnu::java::security::jce::prng::Sha384RandomSpi : public ::gnu::java::security::jce::prng::SecureRandomAdapter +{ + +public: + Sha384RandomSpi(); + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_security_jce_prng_Sha384RandomSpi__ diff --git a/libjava/gnu/java/security/jce/prng/Sha512RandomSpi.h b/libjava/gnu/java/security/jce/prng/Sha512RandomSpi.h new file mode 100644 index 000000000..0209fec83 --- /dev/null +++ b/libjava/gnu/java/security/jce/prng/Sha512RandomSpi.h @@ -0,0 +1,38 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_security_jce_prng_Sha512RandomSpi__ +#define __gnu_java_security_jce_prng_Sha512RandomSpi__ + +#pragma interface + +#include <gnu/java/security/jce/prng/SecureRandomAdapter.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace security + { + namespace jce + { + namespace prng + { + class Sha512RandomSpi; + } + } + } + } + } +} + +class gnu::java::security::jce::prng::Sha512RandomSpi : public ::gnu::java::security::jce::prng::SecureRandomAdapter +{ + +public: + Sha512RandomSpi(); + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_security_jce_prng_Sha512RandomSpi__ diff --git a/libjava/gnu/java/security/jce/prng/TigerRandomSpi.h b/libjava/gnu/java/security/jce/prng/TigerRandomSpi.h new file mode 100644 index 000000000..238685cc6 --- /dev/null +++ b/libjava/gnu/java/security/jce/prng/TigerRandomSpi.h @@ -0,0 +1,38 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_security_jce_prng_TigerRandomSpi__ +#define __gnu_java_security_jce_prng_TigerRandomSpi__ + +#pragma interface + +#include <gnu/java/security/jce/prng/SecureRandomAdapter.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace security + { + namespace jce + { + namespace prng + { + class TigerRandomSpi; + } + } + } + } + } +} + +class gnu::java::security::jce::prng::TigerRandomSpi : public ::gnu::java::security::jce::prng::SecureRandomAdapter +{ + +public: + TigerRandomSpi(); + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_security_jce_prng_TigerRandomSpi__ diff --git a/libjava/gnu/java/security/jce/prng/VMSecureRandom.h b/libjava/gnu/java/security/jce/prng/VMSecureRandom.h new file mode 100644 index 000000000..b24c80514 --- /dev/null +++ b/libjava/gnu/java/security/jce/prng/VMSecureRandom.h @@ -0,0 +1,43 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_security_jce_prng_VMSecureRandom__ +#define __gnu_java_security_jce_prng_VMSecureRandom__ + +#pragma interface + +#include <java/lang/Object.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace security + { + namespace jce + { + namespace prng + { + class VMSecureRandom; + } + } + } + } + } +} + +class gnu::java::security::jce::prng::VMSecureRandom : public ::java::lang::Object +{ + +public: // actually package-private + VMSecureRandom(); + static jint generateSeed(JArray< jbyte > *, jint, jint); + static jint natGenerateSeed(JArray< jbyte > *, jint, jint); +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_security_jce_prng_VMSecureRandom__ diff --git a/libjava/gnu/java/security/jce/prng/VMSecureRandom.java b/libjava/gnu/java/security/jce/prng/VMSecureRandom.java new file mode 100644 index 000000000..62ff8b7aa --- /dev/null +++ b/libjava/gnu/java/security/jce/prng/VMSecureRandom.java @@ -0,0 +1,78 @@ +/* VMSecureRandom.java -- random seed generator. + Copyright (C) 2006, 2009 Free Software Foundation, Inc. + +This file is a part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +USA + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.java.security.jce.prng; + +/** + * VM-specific methods for generating real (or almost real) random + * seeds. VM implementors should write a version of this class that + * reads random bytes from some system source. + */ +final class VMSecureRandom +{ + + /** + * <p> + * Generate a random seed. Implementations are free to generate + * fewer random bytes than are requested, and leave the remaining + * bytes of the destination buffer as zeros. Implementations SHOULD, + * however, make a best-effort attempt to satisfy the request. + * </p> + * <p> + * The GCJ implementation uses a native method to read bytes from + * a system random source (e.g. /dev/random). + * </p> + * + * @param buffer The destination buffer. + * @param offset The offset in the buffer to start putting bytes. + * @param length The number of random bytes to generate. + * @return the number of bytes generated. + */ + static int generateSeed(byte[] buffer, int offset, int length) + { + if (length < 0) + throw new IllegalArgumentException("length must be nonnegative"); + if (offset < 0 || offset + length > buffer.length) + throw new IndexOutOfBoundsException(); + + return natGenerateSeed(buffer, offset, length); + } + + static native int natGenerateSeed(byte[] buffer, int offset, int length); + +}
\ No newline at end of file diff --git a/libjava/gnu/java/security/jce/prng/WhirlpoolRandomSpi.h b/libjava/gnu/java/security/jce/prng/WhirlpoolRandomSpi.h new file mode 100644 index 000000000..4d31a5e8d --- /dev/null +++ b/libjava/gnu/java/security/jce/prng/WhirlpoolRandomSpi.h @@ -0,0 +1,38 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_security_jce_prng_WhirlpoolRandomSpi__ +#define __gnu_java_security_jce_prng_WhirlpoolRandomSpi__ + +#pragma interface + +#include <gnu/java/security/jce/prng/SecureRandomAdapter.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace security + { + namespace jce + { + namespace prng + { + class WhirlpoolRandomSpi; + } + } + } + } + } +} + +class gnu::java::security::jce::prng::WhirlpoolRandomSpi : public ::gnu::java::security::jce::prng::SecureRandomAdapter +{ + +public: + WhirlpoolRandomSpi(); + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_security_jce_prng_WhirlpoolRandomSpi__ diff --git a/libjava/gnu/java/security/jce/prng/natVMSecureRandomPosix.cc b/libjava/gnu/java/security/jce/prng/natVMSecureRandomPosix.cc new file mode 100644 index 000000000..a44f3f457 --- /dev/null +++ b/libjava/gnu/java/security/jce/prng/natVMSecureRandomPosix.cc @@ -0,0 +1,54 @@ +// 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) +{ + int a, fd; + jbyte *bytes = elements (byte_array); + ssize_t count; + + for (a = 0; a < offset; ++a) + bytes++; + fd = open ("/dev/random", O_RDONLY); + + if (fd == -1) + { + jstring oserr = JvNewStringLatin1 (strerror (errno)); + throw new ::java::lang::InternalError + (JvNewStringLatin1 ("Error opening /dev/random: ")->concat(oserr)); + } + + count = read (fd, bytes, length); + close (fd); + + if (count == -1) + { + jstring oserr = JvNewStringLatin1 (strerror (errno)); + throw new ::java::lang::InternalError + (JvNewStringLatin1 ("Error reading /dev/random: ")->concat(oserr)); + } + + return count; +} + diff --git a/libjava/gnu/java/security/jce/prng/natVMSecureRandomWin32.cc b/libjava/gnu/java/security/jce/prng/natVMSecureRandomWin32.cc new file mode 100755 index 000000000..4c7c1f520 --- /dev/null +++ b/libjava/gnu/java/security/jce/prng/natVMSecureRandomWin32.cc @@ -0,0 +1,33 @@ +// natVMSecureRandomWin32.cc - Native part of VMSecureRandom class for Win32. + +/* Copyright (C) 2009, 2010 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 <java/lang/UnsupportedOperationException.h> +#include <gnu/java/security/jce/prng/VMSecureRandom.h> + +jint +gnu::java::security::jce::prng::VMSecureRandom::natGenerateSeed(jbyteArray byte_array, jint offset, jint length) +{ + if (length != 0) + throw new ::java::lang::UnsupportedOperationException ( + JvNewStringLatin1 ("natGenerateSeed is not available for Win32 target.")); + return 0; +} + |