Update style per code review comments

This commit is contained in:
Josh Holtrop
2025-07-22 14:47:22 -04:00
parent aa986a2b24
commit 77bace5010
4 changed files with 36 additions and 33 deletions

View File

@@ -734,8 +734,8 @@ int wc_PKCS7_DecodeEncryptedKeyPackage(wc_PKCS7 * pkcs7,
\param[out] attrSz Buffer in which to store the size of the requested
attribute object.
*/
int wc_PKCS7_DecodeSymmetricKeyPackageAttribute(byte const * skp,
word32 skpSz, size_t index, byte const ** attr, word32 * attrSz);
int wc_PKCS7_DecodeSymmetricKeyPackageAttribute(const byte * skp,
word32 skpSz, size_t index, const byte ** attr, word32 * attrSz);
/*!
\ingroup PKCS7
@@ -758,8 +758,8 @@ int wc_PKCS7_DecodeSymmetricKeyPackageAttribute(byte const * skp,
\param[out] keySz Buffer in which to store the size of the requested
key object.
*/
int wc_PKCS7_DecodeSymmetricKeyPackageKey(byte const * skp,
word32 skpSz, size_t index, byte const ** key, word32 * keySz);
int wc_PKCS7_DecodeSymmetricKeyPackageKey(const byte * skp,
word32 skpSz, size_t index, const byte ** key, word32 * keySz);
/*!
\ingroup PKCS7
@@ -782,8 +782,8 @@ int wc_PKCS7_DecodeSymmetricKeyPackageKey(byte const * skp,
\param[out] attrSz Buffer in which to store the size of the requested
attribute object.
*/
int wc_PKCS7_DecodeOneSymmetricKeyAttribute(byte const * osk,
word32 oskSz, size_t index, byte const ** attr, word32 * attrSz);
int wc_PKCS7_DecodeOneSymmetricKeyAttribute(const byte * osk,
word32 oskSz, size_t index, const byte ** attr, word32 * attrSz);
/*!
\ingroup PKCS7
@@ -804,5 +804,5 @@ int wc_PKCS7_DecodeOneSymmetricKeyAttribute(byte const * osk,
\param[out] keySz Buffer in which to store the size of the requested
key object.
*/
int wc_PKCS7_DecodeOneSymmetricKeyKey(byte const * osk,
word32 oskSz, byte const ** key, word32 * keySz);
int wc_PKCS7_DecodeOneSymmetricKeyKey(const byte * osk,
word32 oskSz, const byte ** key, word32 * keySz);

View File

@@ -184,20 +184,20 @@ int test_IndexSequenceOf(void)
EXPECT_DECLS;
#ifndef NO_ASN
static const byte int_seq[] = {
const byte int_seq[] = {
0x30, 0x0A,
0x02, 0x01, 0x0A,
0x02, 0x02, 0x00, 0xF0,
0x02, 0x01, 0x7F,
};
static const byte bad_seq[] = {
const byte bad_seq[] = {
0xA0, 0x01, 0x01,
};
static const byte empty_seq[] = {
const byte empty_seq[] = {
0x30, 0x00,
};
byte const * element;
const byte * element;
word32 elementSz;
ExpectIntEQ(IndexSequenceOf(int_seq, sizeof(int_seq), 0U, &element, &elementSz), 0);

View File

@@ -15305,8 +15305,8 @@ int wc_PKCS7_DecodeCompressedData(wc_PKCS7* pkcs7, byte* pkiMsg,
#endif /* HAVE_LIBZ && !NO_PKCS7_COMPRESSED_DATA */
static int wc_PKCS7_DecodeSymmetricKeyPackage(byte const * skp, word32 skpSz,
size_t index, byte const ** out, word32 * outSz, int getKey)
static int wc_PKCS7_DecodeSymmetricKeyPackage(const byte * skp, word32 skpSz,
size_t index, const byte ** out, word32 * outSz, int getKey)
{
word32 skpIndex = 0;
int length = 0;
@@ -15335,7 +15335,8 @@ static int wc_PKCS7_DecodeSymmetricKeyPackage(byte const * skp, word32 skpSz,
}
else {
/* sKeyPkgAttrs is present at &skp[skpIndex], length in length */
return IndexSequenceOf(&skp[skpIndex], (word32)length, index, out, outSz);
return IndexSequenceOf(&skp[skpIndex], (word32)length, index, out,
outSz);
}
}
@@ -15348,20 +15349,21 @@ static int wc_PKCS7_DecodeSymmetricKeyPackage(byte const * skp, word32 skpSz,
return IndexSequenceOf(&skp[skpIndex], skpSz - skpIndex, index, out, outSz);
}
int wc_PKCS7_DecodeSymmetricKeyPackageAttribute(byte const * skp,
word32 skpSz, size_t index, byte const ** attr, word32 * attrSz)
int wc_PKCS7_DecodeSymmetricKeyPackageAttribute(const byte * skp,
word32 skpSz, size_t index, const byte ** attr, word32 * attrSz)
{
return wc_PKCS7_DecodeSymmetricKeyPackage(skp, skpSz, index, attr, attrSz, 0);
return wc_PKCS7_DecodeSymmetricKeyPackage(skp, skpSz, index, attr, attrSz,
0);
}
int wc_PKCS7_DecodeSymmetricKeyPackageKey(byte const * skp,
word32 skpSz, size_t index, byte const ** key, word32 * keySz)
int wc_PKCS7_DecodeSymmetricKeyPackageKey(const byte * skp,
word32 skpSz, size_t index, const byte ** key, word32 * keySz)
{
return wc_PKCS7_DecodeSymmetricKeyPackage(skp, skpSz, index, key, keySz, 1);
}
int wc_PKCS7_DecodeOneSymmetricKeyAttribute(byte const * osk,
word32 oskSz, size_t index, byte const ** attr, word32 * attrSz)
int wc_PKCS7_DecodeOneSymmetricKeyAttribute(const byte * osk,
word32 oskSz, size_t index, const byte ** attr, word32 * attrSz)
{
word32 oskIndex = 0;
word32 tmpIndex;
@@ -15382,11 +15384,12 @@ int wc_PKCS7_DecodeOneSymmetricKeyAttribute(byte const * osk,
}
/* Index the sKeyAttrs SEQUENCE OF object with the given index. */
return IndexSequenceOf(&osk[oskIndex], oskSz - oskIndex, index, attr, attrSz);
return IndexSequenceOf(&osk[oskIndex], oskSz - oskIndex, index, attr,
attrSz);
}
int wc_PKCS7_DecodeOneSymmetricKeyKey(byte const * osk,
word32 oskSz, byte const ** key, word32 * keySz)
int wc_PKCS7_DecodeOneSymmetricKeyKey(const byte * osk,
word32 oskSz, const byte ** key, word32 * keySz)
{
word32 oskIndex = 0;
int length = 0;

View File

@@ -552,14 +552,14 @@ WOLFSSL_API int wc_PKCS7_DecodeCompressedData(wc_PKCS7* pkcs7, byte* pkiMsg,
word32 outputSz);
#endif /* HAVE_LIBZ && !NO_PKCS7_COMPRESSED_DATA */
WOLFSSL_API int wc_PKCS7_DecodeSymmetricKeyPackageAttribute(byte const * skp,
word32 skpSz, size_t index, byte const ** attr, word32 * attrSz);
WOLFSSL_API int wc_PKCS7_DecodeSymmetricKeyPackageKey(byte const * skp,
word32 skpSz, size_t index, byte const ** key, word32 * keySz);
WOLFSSL_API int wc_PKCS7_DecodeOneSymmetricKeyAttribute(byte const * osk,
word32 oskSz, size_t index, byte const ** attr, word32 * attrSz);
WOLFSSL_API int wc_PKCS7_DecodeOneSymmetricKeyKey(byte const * osk,
word32 oskSz, byte const ** key, word32 * keySz);
WOLFSSL_API int wc_PKCS7_DecodeSymmetricKeyPackageAttribute(const byte * skp,
word32 skpSz, size_t index, const byte ** attr, word32 * attrSz);
WOLFSSL_API int wc_PKCS7_DecodeSymmetricKeyPackageKey(const byte * skp,
word32 skpSz, size_t index, const byte ** key, word32 * keySz);
WOLFSSL_API int wc_PKCS7_DecodeOneSymmetricKeyAttribute(const byte * osk,
word32 oskSz, size_t index, const byte ** attr, word32 * attrSz);
WOLFSSL_API int wc_PKCS7_DecodeOneSymmetricKeyKey(const byte * osk,
word32 oskSz, const byte ** key, word32 * keySz);
#ifdef __cplusplus
} /* extern "C" */