@@ -27682,7 +27682,7 @@ int CreateDevPrivateKey(void** pkey, byte* data, word32 length, int hsType,
2768227682 * length The length of a signature.
2768327683 * returns 0 on success, otherwise failure.
2768427684 */
27685- int DecodePrivateKey(WOLFSSL *ssl, word16 * length)
27685+ int DecodePrivateKey(WOLFSSL *ssl, word32 * length)
2768627686{
2768727687 int ret = BAD_FUNC_ARG;
2768827688 int keySz;
@@ -27697,7 +27697,7 @@ int DecodePrivateKey(WOLFSSL *ssl, word16* length)
2769727697 || wolfSSL_CTX_IsPrivatePkSet(ssl->ctx)
2769827698 #endif
2769927699 ) {
27700- *length = (word16) GetPrivateKeySigSize(ssl);
27700+ *length = GetPrivateKeySigSize(ssl);
2770127701 return 0;
2770227702 }
2770327703 else
@@ -27747,7 +27747,7 @@ int DecodePrivateKey(WOLFSSL *ssl, word16* length)
2774727747 }
2774827748
2774927749 /* Return the maximum signature length. */
27750- *length = (word16) ssl->buffers.keySz;
27750+ *length = ssl->buffers.keySz;
2775127751 }
2775227752 #else
2775327753 ret = NOT_COMPILED_IN;
@@ -27773,7 +27773,7 @@ int DecodePrivateKey(WOLFSSL *ssl, word16* length)
2777327773 }
2777427774
2777527775 /* Return the maximum signature length. */
27776- *length = (word16) wc_ecc_sig_size_calc(ssl->buffers.keySz);
27776+ *length = wc_ecc_sig_size_calc(ssl->buffers.keySz);
2777727777 }
2777827778 #else
2777927779 ret = NOT_COMPILED_IN;
@@ -27808,7 +27808,7 @@ int DecodePrivateKey(WOLFSSL *ssl, word16* length)
2780827808 }
2780927809
2781027810 /* Return the maximum signature length. */
27811- *length = (word16) wc_falcon_sig_size((falcon_key*)ssl->hsKey);
27811+ *length = wc_falcon_sig_size((falcon_key*)ssl->hsKey);
2781227812 }
2781327813 #else
2781427814 ret = NOT_COMPILED_IN;
@@ -27847,7 +27847,7 @@ int DecodePrivateKey(WOLFSSL *ssl, word16* length)
2784727847 }
2784827848
2784927849 /* Return the maximum signature length. */
27850- *length = (word16) wc_dilithium_sig_size(
27850+ *length = wc_dilithium_sig_size(
2785127851 (dilithium_key*)ssl->hsKey);
2785227852 }
2785327853 #else
@@ -27901,7 +27901,7 @@ int DecodePrivateKey(WOLFSSL *ssl, word16* length)
2790127901 }
2790227902
2790327903 /* Return the maximum signature length. */
27904- *length = (word16) keySz;
27904+ *length = keySz;
2790527905
2790627906 goto exit_dpk;
2790727907 }
@@ -27961,7 +27961,7 @@ int DecodePrivateKey(WOLFSSL *ssl, word16* length)
2796127961 }
2796227962
2796327963 /* Return the maximum signature length. */
27964- *length = (word16) wc_ecc_sig_size((ecc_key*)ssl->hsKey);
27964+ *length = wc_ecc_sig_size((ecc_key*)ssl->hsKey);
2796527965
2796627966 goto exit_dpk;
2796727967 }
@@ -28238,7 +28238,7 @@ int DecodePrivateKey(WOLFSSL *ssl, word16* length)
2823828238/* This is just like the above, but only consider RSA, ECC, Falcon and
2823928239 * Dilthium; Furthermore, use the alternative key, not the native key.
2824028240 */
28241- int DecodeAltPrivateKey(WOLFSSL *ssl, word16 * length)
28241+ int DecodeAltPrivateKey(WOLFSSL *ssl, word32 * length)
2824228242{
2824328243 int ret = BAD_FUNC_ARG;
2824428244 int keySz;
@@ -28289,7 +28289,7 @@ int DecodeAltPrivateKey(WOLFSSL *ssl, word16* length)
2828928289 }
2829028290
2829128291 /* Return the maximum signature length. */
28292- *length = (word16) ssl->buffers.altKeySz;
28292+ *length = ssl->buffers.altKeySz;
2829328293 }
2829428294 #else
2829528295 ret = NOT_COMPILED_IN;
@@ -28315,7 +28315,7 @@ int DecodeAltPrivateKey(WOLFSSL *ssl, word16* length)
2831528315 }
2831628316
2831728317 /* Return the maximum signature length. */
28318- *length = (word16) wc_ecc_sig_size_calc(ssl->buffers.altKeySz);
28318+ *length = wc_ecc_sig_size_calc(ssl->buffers.altKeySz);
2831928319 }
2832028320 #else
2832128321 ret = NOT_COMPILED_IN;
@@ -28350,8 +28350,7 @@ int DecodeAltPrivateKey(WOLFSSL *ssl, word16* length)
2835028350 }
2835128351
2835228352 /* Return the maximum signature length. */
28353- *length = (word16)
28354- wc_falcon_sig_size((falcon_key*)ssl->hsAltKey);
28353+ *length = wc_falcon_sig_size((falcon_key*)ssl->hsAltKey);
2835528354 }
2835628355 #else
2835728356 ret = NOT_COMPILED_IN;
@@ -28393,7 +28392,7 @@ int DecodeAltPrivateKey(WOLFSSL *ssl, word16* length)
2839328392 }
2839428393
2839528394 /* Return the maximum signature length. */
28396- *length = (word16) wc_dilithium_sig_size(
28395+ *length = wc_dilithium_sig_size(
2839728396 (dilithium_key*)ssl->hsAltKey);
2839828397 }
2839928398 #else
@@ -28448,7 +28447,7 @@ int DecodeAltPrivateKey(WOLFSSL *ssl, word16* length)
2844828447 }
2844928448
2845028449 /* Return the maximum signature length. */
28451- *length = (word16) keySz;
28450+ *length = keySz;
2845228451
2845328452 goto exit_dapk;
2845428453 }
@@ -28509,7 +28508,7 @@ int DecodeAltPrivateKey(WOLFSSL *ssl, word16* length)
2850928508 }
2851028509
2851128510 /* Return the maximum signature length. */
28512- *length = (word16) wc_ecc_sig_size((ecc_key*)ssl->hsAltKey);
28511+ *length = wc_ecc_sig_size((ecc_key*)ssl->hsAltKey);
2851328512
2851428513 goto exit_dapk;
2851528514 }
@@ -28828,7 +28827,7 @@ static int HashSkeData(WOLFSSL* ssl, enum wc_HashType hashType,
2882828827 int sendSz;
2882928828 int idSz;
2883028829 int ret;
28831- word16 extSz = 0;
28830+ word32 extSz = 0;
2883228831 const Suites* suites;
2883328832
2883428833 if (ssl == NULL) {
@@ -32636,7 +32635,7 @@ typedef struct ScvArgs {
3263632635 word32 sigSz;
3263732636 int sendSz;
3263832637 int inputSz;
32639- word16 length;
32638+ word32 length;
3264032639 byte sigAlgo;
3264132640} ScvArgs;
3264232641
@@ -32855,7 +32854,7 @@ int SendCertificateVerify(WOLFSSL* ssl)
3285532854 }
3285632855
3285732856 /* prepend hdr */
32858- c16toa(args->length, args->verify + args->extraSz);
32857+ c16toa((word16) args->length, args->verify + args->extraSz);
3285932858 }
3286032859 #ifdef WC_RSA_PSS
3286132860 else if (args->sigAlgo == rsa_pss_sa_algo) {
@@ -32865,7 +32864,7 @@ int SendCertificateVerify(WOLFSSL* ssl)
3286532864 args->sigSz = ENCRYPT_LEN;
3286632865
3286732866 /* prepend hdr */
32868- c16toa(args->length, args->verify + args->extraSz);
32867+ c16toa((word16) args->length, args->verify + args->extraSz);
3286932868 }
3287032869 #endif
3287132870 #endif /* !NO_RSA */
@@ -33044,7 +33043,7 @@ int SendCertificateVerify(WOLFSSL* ssl)
3304433043 #endif
3304533044 args->length = (word16)ssl->buffers.sig.length;
3304633045 /* prepend hdr */
33047- c16toa(args->length, args->verify + args->extraSz);
33046+ c16toa((word16) args->length, args->verify + args->extraSz);
3304833047 XMEMCPY(args->verify + args->extraSz + VERIFY_HEADER,
3304933048 ssl->buffers.sig.buffer, ssl->buffers.sig.length);
3305033049 break;
@@ -34462,7 +34461,7 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
3446234461 #endif
3446334462 case rsa_sa_algo:
3446434463 {
34465- word16 keySz;
34464+ word32 keySz;
3446634465
3446734466 ssl->buffers.keyType = rsa_sa_algo;
3446834467 ret = DecodePrivateKey(ssl, &keySz);
@@ -34480,7 +34479,7 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
3448034479 #endif
3448134480 case ecc_dsa_sa_algo:
3448234481 {
34483- word16 keySz;
34482+ word32 keySz;
3448434483
3448534484 ssl->buffers.keyType = ecc_dsa_sa_algo;
3448634485 ret = DecodePrivateKey(ssl, &keySz);
@@ -34495,7 +34494,7 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
3449534494 #ifdef HAVE_ED25519
3449634495 case ed25519_sa_algo:
3449734496 {
34498- word16 keySz;
34497+ word32 keySz;
3449934498
3450034499 ssl->buffers.keyType = ed25519_sa_algo;
3450134500 ret = DecodePrivateKey(ssl, &keySz);
@@ -34511,7 +34510,7 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
3451134510 #ifdef HAVE_ED448
3451234511 case ed448_sa_algo:
3451334512 {
34514- word16 keySz;
34513+ word32 keySz;
3451534514
3451634515 ssl->buffers.keyType = ed448_sa_algo;
3451734516 ret = DecodePrivateKey(ssl, &keySz);
@@ -34714,7 +34713,7 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
3471434713 preSigSz = args->length;
3471534714
3471634715 if (!ssl->options.usingAnon_cipher) {
34717- word16 keySz = 0;
34716+ word32 keySz = 0;
3471834717
3471934718 /* sig length */
3472034719 args->length += LENGTH_SZ;
@@ -38962,7 +38961,7 @@ static int DefTicketEncCb(WOLFSSL* ssl, byte key_name[WOLFSSL_TICKET_NAME_SZ],
3896238961 #ifndef NO_RSA
3896338962 case rsa_kea:
3896438963 {
38965- word16 keySz;
38964+ word32 keySz;
3896638965
3896738966 ssl->buffers.keyType = rsa_sa_algo;
3896838967 ret = DecodePrivateKey(ssl, &keySz);
@@ -39082,7 +39081,7 @@ static int DefTicketEncCb(WOLFSSL* ssl, byte key_name[WOLFSSL_TICKET_NAME_SZ],
3908239081 if (ssl->specs.static_ecdh &&
3908339082 ssl->ecdhCurveOID != ECC_X25519_OID &&
3908439083 ssl->ecdhCurveOID != ECC_X448_OID) {
39085- word16 keySz;
39084+ word32 keySz;
3908639085
3908739086 ssl->buffers.keyType = ecc_dsa_sa_algo;
3908839087 ret = DecodePrivateKey(ssl, &keySz);
0 commit comments