diff --git a/src/internal.c b/src/internal.c index d4c9b69e8..b2047a38d 100644 --- a/src/internal.c +++ b/src/internal.c @@ -6312,6 +6312,8 @@ int InitSSL(WOLFSSL* ssl, WOLFSSL_CTX* ctx, int writeDup) ssl->protoMsgCb = ctx->protoMsgCb; ssl->protoMsgCtx = ctx->protoMsgCtx; + /* follow default behavior of setting toInfoOn similar to + * wolfSSL_set_msg_callback when the callback is set */ if (ctx->protoMsgCb != NULL) { ssl->toInfoOn = 1; } @@ -21496,10 +21498,10 @@ int PickHashSigAlgo(WOLFSSL* ssl, const byte* hashSigAlgo, word32 hashSigAlgoSz) if (ssl->protoMsgCb != NULL && sz > RECORD_HEADER_SZ) { /* version from hex to dec 16 is 16^1, 256 from 16^2 and 4096 from 16^3 */ - int version = (ssl->version.minor & 0X0F) + - (ssl->version.minor & 0xF0) * 16 + - (ssl->version.major & 0X0F) * 256 + - (ssl->version.major & 0xF0) * 4096; + int version = (ssl->version.minor & 0x0F) + + ((ssl->version.minor & 0xF0) << 4) + + ((ssl->version.major & 0x0F) << 8) + + ((ssl->version.major & 0xF0) << 12); ssl->protoMsgCb(written, version, type, (const void *)(data + RECORD_HEADER_SZ), diff --git a/tests/api.c b/tests/api.c index 9aa4156da..3d0052da9 100644 --- a/tests/api.c +++ b/tests/api.c @@ -32561,12 +32561,12 @@ static void test_wolfSSL_a2i_IPADDRESS(void) int dataSz = 0; ASN1_OCTET_STRING *st; - unsigned char ipv4_exp[] = {0x7F, 0, 0, 1}; - unsigned char ipv6_exp[] = { + const unsigned char ipv4_exp[] = {0x7F, 0, 0, 1}; + const unsigned char ipv6_exp[] = { 0x20, 0x21, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x42, 0x77, 0x77 }; - unsigned char ipv6_home[] = { + const unsigned char ipv6_home[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 };