refinements from peer review for #6303.

This commit is contained in:
Daniel Pouzzner 2023-04-17 22:51:55 -05:00
parent 193919a276
commit a4aef0e55d
4 changed files with 5 additions and 11 deletions

View File

@ -10405,7 +10405,7 @@ static WC_INLINE void InitKeyWrapCounter(byte* inOutCtr, word32 value)
bytes = sizeof(word32);
for (i = 0; i < sizeof(word32); i++) {
inOutCtr[i+sizeof(word32)] = (value >> ((bytes - 1) * 8)) & 0xFF;
inOutCtr[i+sizeof(word32)] = (byte)(value >> ((bytes - 1) * 8));
bytes--;
}
}

View File

@ -2944,7 +2944,7 @@ int wc_DhGenerateParams(WC_RNG *rng, int modSz, DhKey *dh)
/* force magnitude */
buf[0] |= 0xC0;
/* force even */
buf[bufSz - 1] &= (byte)~1U;
buf[bufSz - 1] &= 0xfe;
if (mp_init_multi(tmp, tmp2, &dh->p, &dh->q, &dh->g, 0)
!= MP_OKAY) {

View File

@ -411,7 +411,7 @@ int wc_CryptKey(const char* password, int passwordSz, byte* salt,
WOLFSSL_ENTER("wc_CryptKey");
if (length < 0)
ret = BAD_LENGTH_E;
return BAD_LENGTH_E;
switch (id) {
#ifndef NO_DES3

View File

@ -1085,10 +1085,7 @@ size_t wc_strlcat(char *dst, const char *src, size_t dstSize)
int wc_strcasecmp(const char *s1, const char *s2)
{
char c1, c2;
for (;
;
++s1, ++s2)
{
for (;;++s1, ++s2) {
c1 = *s1;
if ((c1 >= 'a') && (c1 <= 'z'))
c1 -= ('a' - 'A');
@ -1106,10 +1103,7 @@ int wc_strcasecmp(const char *s1, const char *s2)
int wc_strncasecmp(const char *s1, const char *s2, size_t n)
{
char c1, c2;
for (c1 = 0, c2 = 0;
n > 0;
--n, ++s1, ++s2)
{
for (c1 = 0, c2 = 0; n > 0; --n, ++s1, ++s2) {
c1 = *s1;
if ((c1 >= 'a') && (c1 <= 'z'))
c1 -= ('a' - 'A');