Skip to content

Commit

Permalink
Fixed immediate redeclaration of values and added spotbugs files.
Browse files Browse the repository at this point in the history
  • Loading branch information
mwcw committed Aug 27, 2018
1 parent df98e3e commit b3df024
Show file tree
Hide file tree
Showing 4 changed files with 159 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public GMSSLeaf(Digest digest, byte[][] otsIndex, int[] numLeafs)
* The constructor precomputes some needed variables for distributed leaf
* calculation
*
* @param digest an array of strings, containing the digest of the used hash
* @param digest an array of strings, containing the digest of the used hash
* function and PRNG and the digest of the corresponding
* provider
* @param w the winterniz parameter of that tree the leaf is computed
Expand Down Expand Up @@ -231,7 +231,7 @@ GMSSLeaf nextLeaf()
*/
private void updateLeafCalc()
{
byte[] buf = new byte[messDigestOTS.getDigestSize()];
byte[] buf = new byte[messDigestOTS.getDigestSize()];

// steps times do
// TODO: this really needs to be looked at, the 10000 has been added as
Expand Down Expand Up @@ -273,7 +273,7 @@ else if (i == 0 || j == two_power_w - 1)
}
}

throw new IllegalStateException("unable to updateLeaf in steps: " + steps + " " + i + " " + j);
throw new IllegalStateException("unable to updateLeaf in steps: " + steps + " " + i + " " + j);
}

/**
Expand All @@ -292,7 +292,7 @@ public byte[] getLeaf()
*
* @param intValue an integer
* @return The least integer greater or equal to the logarithm to the base 2
* of <code>intValue</code>
* of <code>intValue</code>
*/
private int getLog(int intValue)
{
Expand All @@ -315,10 +315,6 @@ public byte[][] getStatByte()
{

byte[][] statByte = new byte[4][];
statByte[0] = new byte[mdsize];
statByte[1] = new byte[mdsize];
statByte[2] = new byte[mdsize * keysize];
statByte[3] = new byte[mdsize];
statByte[0] = privateKeyOTS;
statByte[1] = seed;
statByte[2] = concHashs;
Expand Down
68 changes: 68 additions & 0 deletions spotbugs.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}

dependencies {
classpath "gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:1.6.2"
classpath "net.saliman:gradle-cobertura-plugin:2.2.8"
}

}




allprojects {
apply plugin: 'java'
apply plugin: "com.github.spotbugs"
apply plugin: 'net.saliman.cobertura'

repositories {
mavenCentral()
}

dependencies {

}

compileJava {
options.debug = true
}

spotbugs {
toolVersion = '3.1.6'
}

tasks.withType(com.github.spotbugs.SpotBugsTask) {
reports {
xml.enabled = false
html.enabled = true
}
}

spotbugs {
excludeFilter = file("${rootDir}/spotbugs/excludeFilter.xml");
}

}

test {
exclude('**/*')
}

subprojects {
apply plugin: 'eclipse'
sourceCompatibility = 1.5
targetCompatibility = 1.5
}








84 changes: 84 additions & 0 deletions spotbugs/excludefilter.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>

<FindBugsFilter>
<Match>
<!-- clone calls copy constructor -->
<Class name="org.bouncycastle.jcajce.PKIXCertStoreSelector"/>
<Method name="clone"/>
<Bug code="CN"/>
</Match>

<Match>
<!-- $$ Needs review, clone returns this, need reason. -->
<Class name="org.bouncycastle.jcajce.PKIXCRLStoreSelector"/>
<Method name="clone"/>
<Bug code="CN"/>
</Match>

<Match>
<!-- $$ Needs review, clone returns this, need reason. -->
<Class name="org.bouncycastle.jcajce.PKIXExtendedParameters"/>
<Method name="clone"/>
<Bug code="CN"/>
</Match>

<Match>
<!-- $$ Needs review, clone returns this, need reason. -->
<Class name="org.bouncycastle.jcajce.PKIXExtendedBuilderParameters"/>
<Method name="clone"/>
<Bug code="CN"/>
</Match>

<Match>
<Class name="org.bouncycastle.asn1.x500.X500Name"/>
<Method name="equals"/>
</Match>


<Match>

<!-- Per: FI_FINALIZER_ONLY_NULLS_FIELDS: Finalizer only nulls fields
This finalizer does nothing except null out fields.
This is completely pointless, and requires that the object be garbage collected, finalized, and then garbage collected again.
You should just remove the finalize method.
-->

<Class name="org.bouncycastle.crypto.general.ElGamalPrivateKeyParameters"/>
<Method name="finalize"/>
<Bug code="FI"/>
</Match>


<Match>
<!-- Nm: The class name org.bouncycastle.util.Iterable shadows the simple name of implemented interface java.lang.Iterable -->
<!-- Suggests a rename but I fear that may break some peoples code. -->
<Class name="org.bouncycastle.util.Iterable"/>
</Match>


<!-- Fixed: Added close in finally block to org.bouncycastle.asn1.ASN1Primitive.fromByteArray(byte[]) -->
<!--- Fixed: Added close in finally block to: org.bouncycastle.jcajce.provider.ProvJKS$JKSKeyStoreSpi.engineLoad(InputStream, char[]) -->
<!-- Added try / finally close blocks to streams. org.bouncycastle.jcajce.provider ProvPKCS12 -->

<!-- Added transient to fields in BouncyCastleFipsProvider -->


<Match>
<!-- Complaining about a transient 'this' -->

<Class name="org.bouncycastle.jcajce.provider.ProvRandom$1$1"/>
<Class name="org.bouncycastle.jcajce.provider.ProvRandom$2$1"/>
</Match>


<!-- removed unnecessary condition statement from org.bouncycastle.asn1.ASN1ApplicationSpecific.replaceTagNumber(int, byte[]) @212 -->
<!-- commented out if statement as it cannot fire: org.bouncycastle.crypto.fips.BaseKDFBytesGenerator.generateBytes(byte[], int, int) @87 -->

<Match>
<Class name="org.bouncycastle.asn1.ASN1OctetString"/>
<Method name="getOctets()"/>
</Match>


</FindBugsFilter>

3 changes: 3 additions & 0 deletions spotbugs_settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include "core","mail","pg","pkix","prov","tls"

rootProject.buildFileName = 'spotbugs.gradle'

0 comments on commit b3df024

Please sign in to comment.