@@ -22659,7 +22659,7 @@ static int DecodeCertReq(DecodedCert* cert, int* criticalExt)
2265922659{
2266022660 DECL_ASNGETDATA(dataASN, certReqASN_Length);
2266122661 int ret = 0;
22662- byte version;
22662+ byte version = 0 ;
2266322663 word32 idx;
2266422664
2266522665 CALLOC_ASNGETDATA(dataASN, certReqASN_Length, ret, cert->heap);
@@ -23552,7 +23552,7 @@ int wc_CertGetPubKey(const byte* cert, word32 certSz,
2355223552 const unsigned char** pubKey, word32* pubKeySz)
2355323553{
2355423554 int ret = 0;
23555- int l;
23555+ int l = 0 ;
2355623556 word32 o = 0;
2355723557 int i;
2355823558 static DecodeInstr ops[] = {
@@ -27841,7 +27841,7 @@ static int SetCertificatePolicies(byte *output,
2784127841 byte oid[MAX_OID_SZ];
2784227842 word32 oidSz;
2784327843 word32 sz = 0;
27844- int piSz;
27844+ int piSz = 0 ;
2784527845
2784627846 if ((input == NULL) || (nb_certpol > MAX_CERTPOL_NB)) {
2784727847 ret = BAD_FUNC_ARG;
@@ -30399,8 +30399,8 @@ int AddSignature(byte* buf, int bodySz, const byte* sig, int sigSz,
3039930399 return (int)(idx + seqSz);
3040030400#else
3040130401 DECL_ASNSETDATA(dataASN, sigASN_Length);
30402- word32 seqSz;
30403- int sz;
30402+ word32 seqSz = 0 ;
30403+ int sz = 0 ;
3040430404 int ret = 0;
3040530405
3040630406 CALLOC_ASNSETDATA(dataASN, sigASN_Length, ret, NULL);
@@ -35106,6 +35106,7 @@ int wc_BuildEccKeyDer(ecc_key* key, byte* output, word32 *inLen,
3510635106
3510735107/* Write a Private ecc key, including public to DER format,
3510835108 * length on success else < 0 */
35109+ /* Note: use wc_EccKeyDerSize to get length only */
3510935110WOLFSSL_ABI
3511035111int wc_EccKeyToDer(ecc_key* key, byte* output, word32 inLen)
3511135112{
@@ -35117,10 +35118,7 @@ int wc_EccKeyToDer(ecc_key* key, byte* output, word32 inLen)
3511735118int wc_EccKeyDerSize(ecc_key* key, int pub)
3511835119{
3511935120 word32 sz = 0;
35120- int ret;
35121-
35122- ret = wc_BuildEccKeyDer(key, NULL, &sz, pub, 1);
35123-
35121+ int ret = wc_BuildEccKeyDer(key, NULL, &sz, pub, 1);
3512435122 if (ret != WC_NO_ERR_TRACE(LENGTH_ONLY_E)) {
3512535123 return ret;
3512635124 }
@@ -35131,7 +35129,11 @@ int wc_EccKeyDerSize(ecc_key* key, int pub)
3513135129 * length on success else < 0 */
3513235130int wc_EccPrivateKeyToDer(ecc_key* key, byte* output, word32 inLen)
3513335131{
35134- return wc_BuildEccKeyDer(key, output, &inLen, 0, 1);
35132+ int ret = wc_BuildEccKeyDer(key, output, &inLen, 0, 1);
35133+ if (ret == WC_NO_ERR_TRACE(LENGTH_ONLY_E)) {
35134+ return (int)inLen;
35135+ }
35136+ return ret;
3513535137}
3513635138
3513735139#ifdef HAVE_PKCS8
@@ -35673,7 +35675,7 @@ int SetAsymKeyDer(const byte* privKey, word32 privKeyLen,
3567335675 word32 idx = 0, seqSz, verSz, algoSz, privSz, pubSz = 0, sz;
3567435676#else
3567535677 DECL_ASNSETDATA(dataASN, edKeyASN_Length);
35676- int sz;
35678+ int sz = 0 ;
3567735679#endif
3567835680
3567935681 /* validate parameters */
0 commit comments