Correct tests for encryption
1. use the correct recipient structure
2. return an int because the code is doing the wrong thing.
diff --git a/test/encrypt.c b/test/encrypt.c
index 232a8f8..29a4bfd 100644
--- a/test/encrypt.c
+++ b/test/encrypt.c
@@ -88,12 +88,12 @@
if (cn != NULL && (cn->type == CN_CBOR_TRUE)) fFailBody = true;
}
- if (pRecipient2 != NULL) {
- alg = COSE_Recipient_map_get_int(pRecipient2, COSE_Header_Algorithm, COSE_BOTH, NULL);
- if ((alg != NULL) && !IsAlgorithmSupported(alg->v.sint)) fNoSupport = true;
+ if (hRecip2 != NULL) {
+ alg = COSE_Recipient_map_get_int(hRecip2, COSE_Header_Algorithm, COSE_BOTH, NULL);
+ if (!IsAlgorithmSupported(alg->v.sint)) fNoSupport = true;
}
- alg = COSE_Recipient_map_get_int(pRecipient1, COSE_Header_Algorithm, COSE_BOTH, NULL);
- if ((alg != NULL) && !IsAlgorithmSupported(alg->v.sint)) fNoSupport = true;
+ alg = COSE_Recipient_map_get_int(hRecip, COSE_Header_Algorithm, COSE_BOTH, NULL);
+ if (!IsAlgorithmSupported(alg->v.sint)) fNoSupport = true;
}
if (COSE_Enveloped_decrypt(hEnc, hRecip, NULL)) {
diff --git a/test/test.c b/test/test.c
index 4706d9b..b7e278f 100644
--- a/test/test.c
+++ b/test/test.c
@@ -127,7 +127,7 @@
return pb;
}
-bool IsAlgorithmSupported(int alg)
+int IsAlgorithmSupported(int alg)
{
switch (alg)
{