propagate from branch 'i2p.i2p' (head fea8e3400c114ad820bf3f0eb7d18336b85027cb)

to branch 'i2p.i2p.slumlord' (head 472429fc9d4d273e0d05de5ae0c075c5ebfca45f)
This commit is contained in:
slumlord
2018-08-27 06:30:31 +00:00
197 changed files with 61415 additions and 51928 deletions

View File

@ -109,8 +109,8 @@ public class FortunaStandalone extends BasePRNGStandalone implements Serializabl
int pool;
int pool0Count;
int reseedCount;
static long refillCount = 0;
static long lastRefill = System.currentTimeMillis();
//static long refillCount = 0;
//static long lastRefill = System.currentTimeMillis();
public static final String SEED = "gnu.crypto.prng.fortuna.seed";
@ -126,10 +126,13 @@ public class FortunaStandalone extends BasePRNGStandalone implements Serializabl
pool0Count = 0;
allocBuffer();
}
/** Unused, see AsyncFortunaStandalone */
protected void allocBuffer() {
buffer = new byte[4*1024*1024]; //256]; // larger buffer to reduce churn
}
/** Unused, see AsyncFortunaStandalone */
public void seed(byte val[]) {
Map<String, byte[]> props = Collections.singletonMap(SEED, val);
init(props);
@ -145,9 +148,10 @@ public class FortunaStandalone extends BasePRNGStandalone implements Serializabl
generator.init(attributes);
}
/** Unused, see AsyncFortunaStandalone */
public void fillBlock()
{
long start = System.currentTimeMillis();
//long start = System.currentTimeMillis();
if (pool0Count >= MIN_POOL_SIZE
&& System.currentTimeMillis() - lastReseed > 100)
{
@ -162,11 +166,11 @@ public class FortunaStandalone extends BasePRNGStandalone implements Serializabl
lastReseed = System.currentTimeMillis();
}
generator.nextBytes(buffer);
long now = System.currentTimeMillis();
long diff = now-lastRefill;
lastRefill = now;
long refillTime = now-start;
System.out.println("Refilling " + (++refillCount) + " after " + diff + " for the PRNG took " + refillTime);
//long now = System.currentTimeMillis();
//long diff = now-lastRefill;
//lastRefill = now;
//long refillTime = now-start;
//System.out.println("Refilling " + (++refillCount) + " after " + diff + " for the PRNG took " + refillTime);
}
@Override

View File

@ -935,8 +935,8 @@ checkLongOption()
// +option or -option
else
{
Object[] msgArgs = { progname, new
Character(argv[optind-1].charAt(0)).toString(),
Object[] msgArgs = { progname,
Character.toString(argv[optind-1].charAt(0)),
pfound.name };
System.err.println(MessageFormat.format(
_messages.getString("getopt.arguments2"),
@ -1138,8 +1138,8 @@ getopt()
}
else
{
Object[] msgArgs = { progname, new
Character(argv[optind].charAt(0)).toString(),
Object[] msgArgs = { progname,
Character.toString(argv[optind].charAt(0)),
nextchar };
System.err.println(MessageFormat.format(
_messages.getString("getopt.unrecognized2"),
@ -1176,15 +1176,15 @@ getopt()
if (posixly_correct)
{
// 1003.2 specifies the format of this message
Object[] msgArgs = { progname, new
Character((char)c).toString() };
Object[] msgArgs = { progname,
Character.toString((char)c) };
System.err.println(MessageFormat.format(
_messages.getString("getopt.illegal"), msgArgs));
}
else
{
Object[] msgArgs = { progname, new
Character((char)c).toString() };
Object[] msgArgs = { progname,
Character.toString((char)c) };
System.err.println(MessageFormat.format(
_messages.getString("getopt.invalid"), msgArgs));
}
@ -1208,8 +1208,8 @@ getopt()
if (opterr)
{
// 1003.2 specifies the format of this message.
Object[] msgArgs = { progname, new
Character((char)c).toString() };
Object[] msgArgs = { progname,
Character.toString((char)c) };
System.err.println(MessageFormat.format(
_messages.getString("getopt.requires2"), msgArgs));
}
@ -1270,8 +1270,8 @@ getopt()
if (opterr)
{
// 1003.2 specifies the format of this message
Object[] msgArgs = { progname, new
Character((char)c).toString() };
Object[] msgArgs = { progname,
Character.toString((char)c) };
System.err.println(MessageFormat.format(
_messages.getString("getopt.requires2"), msgArgs));
}
@ -1300,8 +1300,8 @@ getopt()
if (opterr)
{
// 1003.2 specifies the format of this message
Object[] msgArgs = { progname, new
Character((char)c).toString() };
Object[] msgArgs = { progname,
Character.toString((char)c) };
System.err.println(MessageFormat.format(
_messages.getString("getopt.requires2"), msgArgs));
}

View File

@ -127,7 +127,7 @@ LongOpt(String name, int has_arg,
if ((has_arg != NO_ARGUMENT) && (has_arg != REQUIRED_ARGUMENT)
&& (has_arg != OPTIONAL_ARGUMENT))
{
Object[] msgArgs = { new Integer(has_arg).toString() };
Object[] msgArgs = { Integer.toString(has_arg) };
throw new IllegalArgumentException(MessageFormat.format(
_messages.getString("getopt.invalidValue"), msgArgs));
}

View File

@ -148,7 +148,7 @@ public abstract class GettextResource extends ResourceBundle {
String[] pluralforms = (String[])localValue;
long i = 0;
try {
i = ((Long) pluralEvalMethod.invoke(catalog, new Object[] { new Long(n) })).longValue();
i = ((Long) pluralEvalMethod.invoke(catalog, new Object[] { Long.valueOf(n) })).longValue();
if (!(i >= 0 && i < pluralforms.length))
i = 0;
} catch (IllegalAccessException e) {

View File

@ -18,7 +18,7 @@ public class CoreVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = "0.9.35";
public final static String VERSION = "0.9.36";
/**
* For Vuze.

View File

@ -387,8 +387,9 @@ class I2CPMessageProducer {
Properties newprops = new Properties();
newprops.putAll(props);
props = newprops;
props.setProperty("inbound.quantity", "" + tunnels);
props.setProperty("outbound.quantity", "" + tunnels);
String stunnels = Integer.toString(tunnels);
props.setProperty("inbound.quantity", stunnels);
props.setProperty("outbound.quantity", stunnels);
props.setProperty("inbound.backupQuantity", "0");
props.setProperty("outbound.backupQuantity", "0");
}

View File

@ -213,7 +213,7 @@ public class MetaNamingService extends DummyNamingService {
*/
public void export(Writer out, Properties options) throws IOException {
for (NamingService ns : _services) {
export(out, options);
ns.export(out, options);
}
}

View File

@ -44,7 +44,7 @@ import net.i2p.util.SystemVersion;
*/
public final class KeyStoreUtil {
public static boolean _blacklistLogged;
private static boolean _blacklistLogged;
public static final String DEFAULT_KEYSTORE_PASSWORD = "changeit";
private static final String DEFAULT_KEY_ALGORITHM = "RSA";
@ -1331,8 +1331,8 @@ public final class KeyStoreUtil {
String alias = args[2];
String pw = args[3];
boolean ok = createKeys(ksf, DEFAULT_KEYSTORE_PASSWORD, alias, "test cname", "test ou",
//DEFAULT_KEY_VALID_DAYS, "EdDSA", 256, pw);
DEFAULT_KEY_VALID_DAYS, "ElGamal", 2048, pw);
DEFAULT_KEY_VALID_DAYS, "EdDSA", 256, pw);
//DEFAULT_KEY_VALID_DAYS, "ElGamal", 2048, pw);
System.out.println("genkey ok? " + ok);
}

View File

@ -324,7 +324,7 @@ public class SU3File {
try {
_signerPubkey = ring.getKey(_signer, _contentType.getName(), _sigType);
} catch (GeneralSecurityException gse) {
IOException ioe = new IOException("keystore error");
IOException ioe = new IOException("Certificate error for " + _signer + ": " + gse);
ioe.initCause(gse);
throw ioe;
}
@ -338,7 +338,7 @@ public class SU3File {
try {
_signerPubkey = ring.getKey(_signer, _contentType.getName(), _sigType);
} catch (GeneralSecurityException gse) {
IOException ioe = new IOException("keystore error");
IOException ioe = new IOException("Certificate error for " + _signer + ": " + gse);
ioe.initCause(gse);
throw ioe;
}

View File

@ -829,10 +829,11 @@ riCe6OlAEiNpcc6mMyIYYWFICbrDFTrDR3wXqwc/Jkcx6L5VVWoagpSzbo3yGhc=
* @since 0.7.12
*/
public String verifyAndGetSigner(File signedFile) {
for (SigningPublicKey signingPublicKey : _trustedKeys.keySet()) {
for (Map.Entry<SigningPublicKey, String> e : _trustedKeys.entrySet()) {
SigningPublicKey signingPublicKey = e.getKey();
boolean isValidSignature = verify(signedFile, signingPublicKey);
if (isValidSignature)
return _trustedKeys.get(signingPublicKey);
return e.getValue();
}
return null;
}

View File

@ -20,6 +20,8 @@ public final class I2PProvider extends Provider {
* <code>Security.addProvider()</code> mechanism.
*/
public I2PProvider() {
// following constructor deprecated in Java 9,
// replaced by (String,String,String) added in Java 9
super(PROVIDER_NAME, 0.1, INFO);
AccessController.doPrivileged(new PrivilegedAction<Void>() {

View File

@ -557,7 +557,7 @@ public class EepGet {
System.out.println("** " + new Date());
System.out.println("** Attempt " + currentAttempt + " of " + url + " failed");
System.out.println("** Transfered " + bytesTransferred
+ " with " + (bytesRemaining < 0 ? "unknown" : ""+bytesRemaining) + " remaining");
+ " with " + (bytesRemaining < 0 ? "unknown" : Long.toString(bytesRemaining)) + " remaining");
System.out.println("** " + cause.getMessage());
_previousWritten += _written;
_written = 0;
@ -566,7 +566,7 @@ public class EepGet {
System.out.println("== " + new Date());
System.out.println("== Transfer of " + url + " failed after " + currentAttempt + " attempts");
System.out.println("== Transfer size: " + bytesTransferred + " with "
+ (bytesRemaining < 0 ? "unknown" : ""+bytesRemaining) + " remaining");
+ (bytesRemaining < 0 ? "unknown" : Long.toString(bytesRemaining)) + " remaining");
long timeToSend = _context.clock().now() - _startedOn;
System.out.println("== Transfer time: " + DataHelper.formatDuration(timeToSend));
double kbps = (timeToSend > 0 ? (1000.0d*(bytesTransferred)/(timeToSend*1024.0d)) : 0);

View File

@ -71,7 +71,7 @@ public final class SimpleByteCache {
}
private SimpleByteCache(int maxCachedEntries, int entrySize) {
_available = new TryCache(new ByteArrayFactory(entrySize), maxCachedEntries);
_available = new TryCache<byte[]>(new ByteArrayFactory(entrySize), maxCachedEntries);
_entrySize = entrySize;
}