Don't dump error in case of verification failure 13/70913/3
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Mon, 23 May 2016 08:11:51 +0000 (10:11 +0200)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Fri, 27 May 2016 07:55:18 +0000 (09:55 +0200)
Change-Id: I65ea82e48c2bc6ba3fcfc4d63125c50dfa4b63b6

src/sign.c

index 2a3aed3..33a2850 100644 (file)
@@ -571,14 +571,16 @@ API int yaca_verify_final(yaca_ctx_h ctx,
        ret = EVP_DigestVerifyFinal(c->mdctx,
                                    (unsigned char *)signature,
                                    signature_len);
+
        if (ret == 1)
                return 0;
 
-       if (ret == 0)
-               ret = YACA_ERROR_DATA_MISMATCH;
-       else
-               ret = YACA_ERROR_INTERNAL;
+       if (ret == 0) {
+               ERROR_CLEAR();
+               return YACA_ERROR_DATA_MISMATCH;
+       }
 
+       ret = YACA_ERROR_INTERNAL;
        ERROR_DUMP(ret);
        return ret;
 }