Project

General

Profile

aqbanking-sign-2.patch

thbe, 09/10/2019 08:36 AM

Download (1.96 KB)

View differences:

src/libs/plugins/backends/aqhbci/msglayer/msgcrypt_rxh_common.c
672 672
    AH_OPMODE opMode;
673 673
    uint8_t  *digestPtr;
674 674
    unsigned int digestSize;
675
    const char *tokenType = AH_User_GetTokenType(su);
676
    uint8_t doSHA256inSW = 0;
675 677

  
676 678
    if (secProfile > 2) {
677 679
      hashAlg = rxh_parameter->hashAlgD;
......
682 684
      opMode= rxh_parameter->opmodSignS;
683 685
    }
684 686

  
685
    //uint8_t hash1[32];
687
    // https://www.aquamaniac.de/rdm/issues/41
688
    if(tokenType && !strcasecmp(tokenType, "ohbci"))
689
      doSHA256inSW = 1;
686 690

  
687 691
    /* hash sighead + data */
688 692
    switch (hashAlg) {
......
716 720
        GWEN_Buffer_free(hbuf);
717 721
        return rv;
718 722
      }
719
      else {
720
        digestPtr=GWEN_MDigest_GetDigestPtr(md);
721
        digestSize=GWEN_MDigest_GetDigestSize(md);
723
      if((hashAlg == AH_HashAlg_Sha256Sha256) && doSHA256inSW)
724
      {
725
        DBG_NOTICE(AQHBCI_LOGDOMAIN, "%s(): doSHA256inSW (2nd).", __FUNCTION__);
726
        rv = GWEN_MDigest_Begin(md);
727
        if(rv == 0)
728
        {
729
          uint8_t h[32];
730
          memcpy(h, GWEN_MDigest_GetDigestPtr(md), 32);
731
          rv = GWEN_MDigest_Update(md, h, 32);
732
          if(rv == 0)
733
            rv = GWEN_MDigest_End(md);
734
        }
735
        if(rv < 0)
736
        {
737
          DBG_ERROR(AQHBCI_LOGDOMAIN, "Hash error round 2 (%d)", rv);
738
          GWEN_MDigest_free(md);
739
          GWEN_Buffer_free(sigbuf);
740
          GWEN_Buffer_free(hbuf);
741
          return rv;
742
        }
722 743
      }
744
      digestPtr=GWEN_MDigest_GetDigestPtr(md);
745
      digestSize=GWEN_MDigest_GetDigestSize(md);
723 746
    }
724 747
    else {
725 748
      digestPtr=(uint8_t *)GWEN_Buffer_GetStart(hbuf);