diff --git a/tests/api/test_asn.c b/tests/api/test_asn.c index 520150a8f..9bc236e19 100644 --- a/tests/api/test_asn.c +++ b/tests/api/test_asn.c @@ -179,7 +179,7 @@ int test_SetShortInt(void) } -int test_IndexSequenceOf(void) +int test_wc_IndexSequenceOf(void) { EXPECT_DECLS; @@ -200,23 +200,23 @@ int test_IndexSequenceOf(void) const byte * element; word32 elementSz; - ExpectIntEQ(IndexSequenceOf(int_seq, sizeof(int_seq), 0U, &element, &elementSz), 0); + ExpectIntEQ(wc_IndexSequenceOf(int_seq, sizeof(int_seq), 0U, &element, &elementSz), 0); ExpectPtrEq(element, &int_seq[2]); ExpectIntEQ(elementSz, 3); - ExpectIntEQ(IndexSequenceOf(int_seq, sizeof(int_seq), 1U, &element, &elementSz), 0); + ExpectIntEQ(wc_IndexSequenceOf(int_seq, sizeof(int_seq), 1U, &element, &elementSz), 0); ExpectPtrEq(element, &int_seq[5]); ExpectIntEQ(elementSz, 4); - ExpectIntEQ(IndexSequenceOf(int_seq, sizeof(int_seq), 2U, &element, &elementSz), 0); + ExpectIntEQ(wc_IndexSequenceOf(int_seq, sizeof(int_seq), 2U, &element, &elementSz), 0); ExpectPtrEq(element, &int_seq[9]); ExpectIntEQ(elementSz, 3); - ExpectIntEQ(IndexSequenceOf(int_seq, sizeof(int_seq), 3U, &element, &elementSz), WC_NO_ERR_TRACE(BAD_INDEX_E)); + ExpectIntEQ(wc_IndexSequenceOf(int_seq, sizeof(int_seq), 3U, &element, &elementSz), WC_NO_ERR_TRACE(BAD_INDEX_E)); - ExpectIntEQ(IndexSequenceOf(bad_seq, sizeof(bad_seq), 0U, &element, &elementSz), WC_NO_ERR_TRACE(ASN_PARSE_E)); + ExpectIntEQ(wc_IndexSequenceOf(bad_seq, sizeof(bad_seq), 0U, &element, &elementSz), WC_NO_ERR_TRACE(ASN_PARSE_E)); - ExpectIntEQ(IndexSequenceOf(empty_seq, sizeof(empty_seq), 0U, &element, &elementSz), WC_NO_ERR_TRACE(BAD_INDEX_E)); + ExpectIntEQ(wc_IndexSequenceOf(empty_seq, sizeof(empty_seq), 0U, &element, &elementSz), WC_NO_ERR_TRACE(BAD_INDEX_E)); #endif return EXPECT_RESULT(); diff --git a/tests/api/test_asn.h b/tests/api/test_asn.h index b73da7bb2..aeea0f735 100644 --- a/tests/api/test_asn.h +++ b/tests/api/test_asn.h @@ -25,10 +25,10 @@ #include int test_SetShortInt(void); -int test_IndexSequenceOf(void); +int test_wc_IndexSequenceOf(void); #define TEST_ASN_DECLS \ TEST_DECL_GROUP("asn", test_SetShortInt), \ - TEST_DECL_GROUP("asn", test_IndexSequenceOf) + TEST_DECL_GROUP("asn", test_wc_IndexSequenceOf) #endif /* WOLFCRYPT_TEST_ASN_H */ diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index 1e9d3369e..000c8923a 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -2586,7 +2586,7 @@ int GetSequence_ex(const byte* input, word32* inOutIdx, int* len, * @return BAD_INDEX_E when the given seqIndex is out of range. * @return ASN_PARSE_E when the seqOf is not in the expected format. */ -int IndexSequenceOf(byte const * seqOf, word32 seqOfSz, size_t seqIndex, +int wc_IndexSequenceOf(byte const * seqOf, word32 seqOfSz, size_t seqIndex, byte const ** out, word32 * outSz) { int length; diff --git a/wolfcrypt/src/pkcs7.c b/wolfcrypt/src/pkcs7.c index 6866ac152..ad5918597 100644 --- a/wolfcrypt/src/pkcs7.c +++ b/wolfcrypt/src/pkcs7.c @@ -15335,8 +15335,8 @@ static int wc_PKCS7_DecodeSymmetricKeyPackage(const byte * skp, word32 skpSz, } else { /* sKeyPkgAttrs is present at &skp[skpIndex], length in length */ - return IndexSequenceOf(&skp[skpIndex], (word32)length, index, out, - outSz); + return wc_IndexSequenceOf(&skp[skpIndex], (word32)length, index, + out, outSz); } } @@ -15346,7 +15346,8 @@ static int wc_PKCS7_DecodeSymmetricKeyPackage(const byte * skp, word32 skpSz, } /* sKeys is present at &skp[skpIndex]. */ - return IndexSequenceOf(&skp[skpIndex], skpSz - skpIndex, index, out, outSz); + return wc_IndexSequenceOf(&skp[skpIndex], skpSz - skpIndex, index, + out, outSz); } int wc_PKCS7_DecodeSymmetricKeyPackageAttribute(const byte * skp, @@ -15384,7 +15385,7 @@ int wc_PKCS7_DecodeOneSymmetricKeyAttribute(const byte * osk, } /* Index the sKeyAttrs SEQUENCE OF object with the given index. */ - return IndexSequenceOf(&osk[oskIndex], oskSz - oskIndex, index, attr, + return wc_IndexSequenceOf(&osk[oskIndex], oskSz - oskIndex, index, attr, attrSz); } diff --git a/wolfssl/wolfcrypt/asn.h b/wolfssl/wolfcrypt/asn.h index 79089227a..cb335e57a 100644 --- a/wolfssl/wolfcrypt/asn.h +++ b/wolfssl/wolfcrypt/asn.h @@ -2219,7 +2219,7 @@ WOLFSSL_LOCAL int GetSequence(const byte* input, word32* inOutIdx, int* len, word32 maxIdx); WOLFSSL_LOCAL int GetSequence_ex(const byte* input, word32* inOutIdx, int* len, word32 maxIdx, int check); -WOLFSSL_TEST_VIS int IndexSequenceOf(byte const * seqOf, word32 seqOfSz, +WOLFSSL_TEST_VIS int wc_IndexSequenceOf(byte const * seqOf, word32 seqOfSz, size_t seqIndex, byte const ** out, word32 * outSz); WOLFSSL_LOCAL int GetOctetString(const byte* input, word32* inOutIdx, int* len, word32 maxIdx);