Adjust tests to "ECDSA raw/asn1 signature conversion methods" 92/307092/1
authorDariusz Michaluk <d.michaluk@samsung.com>
Mon, 4 Mar 2024 16:51:01 +0000 (17:51 +0100)
committerDariusz Michaluk <d.michaluk@samsung.com>
Mon, 4 Mar 2024 17:07:40 +0000 (18:07 +0100)
If the ECDSA signature is presented in asn1 format, the first byte is always asn1 metadata,
it's better to change the last byte, which will always be signature data.

Change-Id: I6ec694dc17598f5931ef12ab15701c15138755f0

src/ckm/unprivileged/sign-verify.cpp

index b0f7317ccd7b436e5aff88512f5d6f7f2236f7df..088e1322e4572061cc9f8e16e792e671a328ae7a 100644 (file)
@@ -295,7 +295,7 @@ void signVerify(const KeyAliasPair& aliasPair,
     verifyExpect(CKMC_ERROR_NONE, aliasPair.pub, pw, message, hash, padding, signature);
 
     // modify 1 bit of the signature
-    signature->data[0] ^= 0x01;
+    signature->data[signature->size-1] ^= 0x01;
 
     // expect verification failure
     verifyExpect(CKMC_ERROR_VERIFICATION_FAILED,