Program: 52440
Project: 52440
Buggy source:
public void performTest(){
  RSAKeyParameters pubParameters=new RSAKeyParameters(false,mod,pubExp);
  RSAKeyParameters privParameters=new RSAPrivateCrtKeyParameters(mod,pubExp,privExp,p,q,pExp,qExp,crtCoef);
  byte[] data=Hex.decode(edgeInput);
  AsymmetricBlockCipher eng=new RSAEngine();
  eng.init(true,pubParameters);
  try {
    data=eng.processBlock(data,0,data.length);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.toString(),e);
  }
  eng.init(false,privParameters);
  try {
    data=eng.processBlock(data,0,data.length);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.toString(),e);
  }
  if (!edgeInput.equals(new String(Hex.encode(data)))) {
    fail("String_Node_Str");
  }
  data=Hex.decode(input);
  eng.init(true,pubParameters);
  try {
    data=eng.processBlock(data,0,data.length);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.toString(),e);
  }
  eng.init(false,privParameters);
  try {
    data=eng.processBlock(data,0,data.length);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.toString(),e);
  }
  if (!input.equals(new String(Hex.encode(data)))) {
    fail("String_Node_Str");
  }
  eng=new PKCS1Encoding(eng);
  eng.init(true,pubParameters);
  if (eng.getOutputBlockSize() != ((PKCS1Encoding)eng).getUnderlyingCipher().getOutputBlockSize()) {
    fail("String_Node_Str");
  }
  try {
    data=eng.processBlock(data,0,data.length);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.toString(),e);
  }
  eng.init(false,privParameters);
  try {
    data=eng.processBlock(data,0,data.length);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.toString(),e);
  }
  if (!input.equals(new String(Hex.encode(data)))) {
    fail("String_Node_Str");
  }
  eng=new PKCS1Encoding(((PKCS1Encoding)eng).getUnderlyingCipher());
  eng.init(true,privParameters);
  try {
    data=eng.processBlock(data,0,data.length);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.toString(),e);
  }
  eng.init(false,pubParameters);
  try {
    data=eng.processBlock(data,0,data.length);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.toString(),e);
  }
  if (!input.equals(new String(Hex.encode(data)))) {
    fail("String_Node_Str");
  }
  zeroBlockTest(pubParameters,privParameters);
  zeroBlockTest(privParameters,pubParameters);
  RSAKeyPairGenerator pGen=new RSAKeyPairGenerator();
  RSAKeyGenerationParameters genParam=new RSAKeyGenerationParameters(BigInteger.valueOf(0x11),new SecureRandom(),768,25);
  pGen.init(genParam);
  AsymmetricCipherKeyPair pair=pGen.generateKeyPair();
  eng=new RSAEngine();
  if (((RSAKeyParameters)pair.getPublic()).getModulus().bitLength() < 768) {
    fail("String_Node_Str");
  }
  eng.init(true,pair.getPublic());
  try {
    data=eng.processBlock(data,0,data.length);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.toString(),e);
  }
  eng.init(false,pair.getPrivate());
  try {
    data=eng.processBlock(data,0,data.length);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.toString(),e);
  }
  if (!input.equals(new String(Hex.encode(data)))) {
    fail("String_Node_Str");
  }
  genParam=new RSAKeyGenerationParameters(BigInteger.valueOf(0x11),new SecureRandom(),1024,25);
  pGen.init(genParam);
  pair=pGen.generateKeyPair();
  eng.init(true,pair.getPublic());
  if (((RSAKeyParameters)pair.getPublic()).getModulus().bitLength() < 1024) {
    fail("String_Node_Str");
  }
  try {
    data=eng.processBlock(data,0,data.length);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.toString(),e);
  }
  eng.init(false,pair.getPrivate());
  try {
    data=eng.processBlock(data,0,data.length);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.toString(),e);
  }
  if (!input.equals(new String(Hex.encode(data)))) {
    fail("String_Node_Str");
  }
  genParam=new RSAKeyGenerationParameters(BigInteger.valueOf(0x11),new SecureRandom(),128,25);
  pGen.init(genParam);
  for (int i=0; i < 100; ++i) {
    pair=pGen.generateKeyPair();
    RSAPrivateCrtKeyParameters privKey=(RSAPrivateCrtKeyParameters)pair.getPrivate();
    BigInteger pqDiff=privKey.getP().subtract(privKey.getQ()).abs();
    if (pqDiff.bitLength() < 42) {
      fail("String_Node_Str");
    }
  }
  testOAEP(pubParameters,privParameters);
  testStrictPKCS1Length(pubParameters,privParameters);
  testDudPKCS1Block(pubParameters,privParameters);
  testMissingDataPKCS1Block(pubParameters,privParameters);
  testTruncatedPKCS1Block(pubParameters,privParameters);
  testWrongPaddingPKCS1Block(pubParameters,privParameters);
  try {
    new RSAEngine().processBlock(new byte[]{1},0,1);
    fail("String_Node_Str");
  }
 catch (  IllegalStateException e) {
  }
}

Fixed version (ground truth):
public void performTest(){
  RSAKeyParameters pubParameters=new RSAKeyParameters(false,mod,pubExp);
  RSAKeyParameters privParameters=new RSAPrivateCrtKeyParameters(mod,pubExp,privExp,p,q,pExp,qExp,crtCoef);
  byte[] data=Hex.decode(edgeInput);
  AsymmetricBlockCipher eng=new RSAEngine();
  eng.init(true,pubParameters);
  try {
    data=eng.processBlock(data,0,data.length);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.toString(),e);
  }
  eng.init(false,privParameters);
  try {
    data=eng.processBlock(data,0,data.length);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.toString(),e);
  }
  if (!edgeInput.equals(new String(Hex.encode(data)))) {
    fail("String_Node_Str");
  }
  data=Hex.decode(input);
  eng.init(true,pubParameters);
  try {
    data=eng.processBlock(data,0,data.length);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.toString(),e);
  }
  eng.init(false,privParameters);
  try {
    data=eng.processBlock(data,0,data.length);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.toString(),e);
  }
  if (!input.equals(new String(Hex.encode(data)))) {
    fail("String_Node_Str");
  }
  eng=new PKCS1Encoding(eng);
  eng.init(true,pubParameters);
  if (eng.getOutputBlockSize() != ((PKCS1Encoding)eng).getUnderlyingCipher().getOutputBlockSize()) {
    fail("String_Node_Str");
  }
  try {
    data=eng.processBlock(data,0,data.length);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.toString(),e);
  }
  eng.init(false,privParameters);
  byte[] plainData=null;
  try {
    plainData=eng.processBlock(data,0,data.length);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.toString(),e);
  }
  if (!input.equals(Hex.toHexString(plainData))) {
    fail("String_Node_Str");
  }
  PKCS1Encoding fEng=new PKCS1Encoding(new RSAEngine(),input.length() / 2);
  fEng.init(false,new ParametersWithRandom(privParameters,new SecureRandom()));
  try {
    plainData=fEng.processBlock(data,0,data.length);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.toString(),e);
  }
  if (!input.equals(Hex.toHexString(plainData))) {
    fail("String_Node_Str");
  }
  fEng=new PKCS1Encoding(new RSAEngine(),input.length());
  fEng.init(false,new ParametersWithRandom(privParameters,new SecureRandom()));
  try {
    data=fEng.processBlock(data,0,data.length);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.toString(),e);
  }
  if (input.equals(Hex.toHexString(data))) {
    fail("String_Node_Str");
  }
  data=plainData;
  eng=new PKCS1Encoding(((PKCS1Encoding)eng).getUnderlyingCipher());
  eng.init(true,privParameters);
  try {
    data=eng.processBlock(plainData,0,plainData.length);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.toString(),e);
  }
  eng.init(false,pubParameters);
  try {
    data=eng.processBlock(data,0,data.length);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.toString(),e);
  }
  if (!input.equals(Hex.toHexString(data))) {
    fail("String_Node_Str");
  }
  zeroBlockTest(pubParameters,privParameters);
  zeroBlockTest(privParameters,pubParameters);
  RSAKeyPairGenerator pGen=new RSAKeyPairGenerator();
  RSAKeyGenerationParameters genParam=new RSAKeyGenerationParameters(BigInteger.valueOf(0x11),new SecureRandom(),768,25);
  pGen.init(genParam);
  AsymmetricCipherKeyPair pair=pGen.generateKeyPair();
  eng=new RSAEngine();
  if (((RSAKeyParameters)pair.getPublic()).getModulus().bitLength() < 768) {
    fail("String_Node_Str");
  }
  eng.init(true,pair.getPublic());
  try {
    data=eng.processBlock(data,0,data.length);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.toString(),e);
  }
  eng.init(false,pair.getPrivate());
  try {
    data=eng.processBlock(data,0,data.length);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.toString(),e);
  }
  if (!input.equals(new String(Hex.encode(data)))) {
    fail("String_Node_Str");
  }
  genParam=new RSAKeyGenerationParameters(BigInteger.valueOf(0x11),new SecureRandom(),1024,25);
  pGen.init(genParam);
  pair=pGen.generateKeyPair();
  eng.init(true,pair.getPublic());
  if (((RSAKeyParameters)pair.getPublic()).getModulus().bitLength() < 1024) {
    fail("String_Node_Str");
  }
  try {
    data=eng.processBlock(data,0,data.length);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.toString(),e);
  }
  eng.init(false,pair.getPrivate());
  try {
    data=eng.processBlock(data,0,data.length);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.toString(),e);
  }
  if (!input.equals(new String(Hex.encode(data)))) {
    fail("String_Node_Str");
  }
  genParam=new RSAKeyGenerationParameters(BigInteger.valueOf(0x11),new SecureRandom(),128,25);
  pGen.init(genParam);
  for (int i=0; i < 100; ++i) {
    pair=pGen.generateKeyPair();
    RSAPrivateCrtKeyParameters privKey=(RSAPrivateCrtKeyParameters)pair.getPrivate();
    BigInteger pqDiff=privKey.getP().subtract(privKey.getQ()).abs();
    if (pqDiff.bitLength() < 42) {
      fail("String_Node_Str");
    }
  }
  testOAEP(pubParameters,privParameters);
  testStrictPKCS1Length(pubParameters,privParameters);
  testDudPKCS1Block(pubParameters,privParameters);
  testMissingDataPKCS1Block(pubParameters,privParameters);
  testTruncatedPKCS1Block(pubParameters,privParameters);
  testWrongPaddingPKCS1Block(pubParameters,privParameters);
  try {
    new RSAEngine().processBlock(new byte[]{1},0,1);
    fail("String_Node_Str");
  }
 catch (  IllegalStateException e) {
  }
}