Program: 52442
Project: 52442
Buggy source:
protected void engineInit(Key key,AlgorithmParameterSpec params) throws InvalidKeyException, InvalidAlgorithmParameterException {
  CipherParameters param;
  if (key == null) {
    throw new InvalidKeyException("String_Node_Str");
  }
  if (key instanceof PKCS12Key) {
    SecretKey k;
    PBEParameterSpec pbeSpec;
    try {
      k=(SecretKey)key;
    }
 catch (    Exception e) {
      throw new InvalidKeyException("String_Node_Str");
    }
    try {
      pbeSpec=(PBEParameterSpec)params;
    }
 catch (    Exception e) {
      throw new InvalidAlgorithmParameterException("String_Node_Str");
    }
    if (k instanceof PBEKey && pbeSpec == null) {
      pbeSpec=new PBEParameterSpec(((PBEKey)k).getSalt(),((PBEKey)k).getIterationCount());
    }
    int digest=SHA1;
    int keySize=160;
    if (macEngine.getAlgorithmName().startsWith("String_Node_Str")) {
      digest=GOST3411;
      keySize=256;
    }
 else     if (macEngine.getAlgorithmName().startsWith("String_Node_Str")) {
      digest=SHA256;
      keySize=256;
    }
    param=PBE.Util.makePBEMacParameters(k,PKCS12,digest,keySize,pbeSpec);
  }
 else   if (key instanceof BCPBEKey) {
    BCPBEKey k=(BCPBEKey)key;
    if (k.getParam() != null) {
      param=k.getParam();
    }
 else     if (params instanceof PBEParameterSpec) {
      param=PBE.Util.makePBEMacParameters(k,params);
    }
 else {
      throw new InvalidAlgorithmParameterException("String_Node_Str");
    }
  }
 else   if (params instanceof IvParameterSpec) {
    param=new ParametersWithIV(new KeyParameter(key.getEncoded()),((IvParameterSpec)params).getIV());
  }
 else   if (params instanceof RC2ParameterSpec) {
    param=new ParametersWithIV(new RC2Parameters(key.getEncoded(),((RC2ParameterSpec)params).getEffectiveKeyBits()),((RC2ParameterSpec)params).getIV());
  }
 else   if (params instanceof SkeinParameterSpec) {
    param=new SkeinParameters.Builder(copyMap(((SkeinParameterSpec)params).getParameters())).setKey(key.getEncoded()).build();
  }
 else   if (gcmSpecClass != null && gcmSpecClass.isAssignableFrom(params.getClass())) {
    try {
      Method tLen=gcmSpecClass.getDeclaredMethod("String_Node_Str",new Class[0]);
      Method iv=gcmSpecClass.getDeclaredMethod("String_Node_Str",new Class[0]);
      KeyParameter keyParam=new KeyParameter(key.getEncoded());
      param=new AEADParameters(keyParam,((Integer)tLen.invoke(params,new Object[0])).intValue(),(byte[])iv.invoke(params,new Object[0]));
    }
 catch (    Exception e) {
      throw new InvalidAlgorithmParameterException("String_Node_Str");
    }
  }
 else   if (params == null) {
    param=new KeyParameter(key.getEncoded());
  }
 else {
    throw new InvalidAlgorithmParameterException("String_Node_Str" + params.getClass().getName());
  }
  macEngine.init(param);
}

Fixed version (ground truth):
protected void engineInit(Key key,AlgorithmParameterSpec params) throws InvalidKeyException, InvalidAlgorithmParameterException {
  CipherParameters param;
  if (key == null) {
    throw new InvalidKeyException("String_Node_Str");
  }
  if (key instanceof PKCS12Key) {
    SecretKey k;
    PBEParameterSpec pbeSpec;
    try {
      k=(SecretKey)key;
    }
 catch (    Exception e) {
      throw new InvalidKeyException("String_Node_Str");
    }
    try {
      pbeSpec=(PBEParameterSpec)params;
    }
 catch (    Exception e) {
      throw new InvalidAlgorithmParameterException("String_Node_Str");
    }
    if (k instanceof PBEKey && pbeSpec == null) {
      pbeSpec=new PBEParameterSpec(((PBEKey)k).getSalt(),((PBEKey)k).getIterationCount());
    }
    int digest=SHA1;
    int keySize=160;
    if (macEngine.getAlgorithmName().startsWith("String_Node_Str")) {
      digest=GOST3411;
      keySize=256;
    }
 else     if (macEngine.getAlgorithmName().startsWith("String_Node_Str")) {
      digest=SHA256;
      keySize=256;
    }
    param=PBE.Util.makePBEMacParameters(k,PKCS12,digest,keySize,pbeSpec);
  }
 else   if (key instanceof BCPBEKey) {
    BCPBEKey k=(BCPBEKey)key;
    if (k.getParam() != null) {
      param=k.getParam();
    }
 else     if (params instanceof PBEParameterSpec) {
      param=PBE.Util.makePBEMacParameters(k,params);
    }
 else {
      throw new InvalidAlgorithmParameterException("String_Node_Str");
    }
  }
 else   if (params instanceof IvParameterSpec) {
    param=new ParametersWithIV(new KeyParameter(key.getEncoded()),((IvParameterSpec)params).getIV());
  }
 else   if (params instanceof RC2ParameterSpec) {
    param=new ParametersWithIV(new RC2Parameters(key.getEncoded(),((RC2ParameterSpec)params).getEffectiveKeyBits()),((RC2ParameterSpec)params).getIV());
  }
 else   if (params instanceof SkeinParameterSpec) {
    param=new SkeinParameters.Builder(copyMap(((SkeinParameterSpec)params).getParameters())).setKey(key.getEncoded()).build();
  }
 else   if (params == null) {
    param=new KeyParameter(key.getEncoded());
  }
 else   if (gcmSpecClass != null && gcmSpecClass.isAssignableFrom(params.getClass())) {
    try {
      Method tLen=gcmSpecClass.getDeclaredMethod("String_Node_Str",new Class[0]);
      Method iv=gcmSpecClass.getDeclaredMethod("String_Node_Str",new Class[0]);
      KeyParameter keyParam=new KeyParameter(key.getEncoded());
      param=new AEADParameters(keyParam,((Integer)tLen.invoke(params,new Object[0])).intValue(),(byte[])iv.invoke(params,new Object[0]));
    }
 catch (    Exception e) {
      throw new InvalidAlgorithmParameterException("String_Node_Str");
    }
  }
 else {
    throw new InvalidAlgorithmParameterException("String_Node_Str" + params.getClass().getName());
  }
  macEngine.init(param);
}