mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
idf: cleanups
This commit is contained in:
parent
0fbe31e00b
commit
d026f6d1b6
8 changed files with 32 additions and 23 deletions
|
@ -41,13 +41,13 @@ lws_jwe_encrypt_cbc_hs(struct lws_jwe *jwe, uint8_t *cek,
|
|||
|
||||
if (jwe->jws.map.len[LJWE_ATAG] != (unsigned int)hlen / 2) {
|
||||
lwsl_notice("%s: expected tag len %d, got %d\n", __func__,
|
||||
hlen / 2, jwe->jws.map.len[LJWE_ATAG]);
|
||||
hlen / 2, (int)jwe->jws.map.len[LJWE_ATAG]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (jwe->jws.map.len[LJWE_IV] != 16) {
|
||||
lwsl_notice("expected iv len %d, got %d\n", 16,
|
||||
jwe->jws.map.len[LJWE_IV]);
|
||||
(int)jwe->jws.map.len[LJWE_IV]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -173,13 +173,13 @@ lws_jwe_auth_and_decrypt_cbc_hs(struct lws_jwe *jwe, uint8_t *enc_cek,
|
|||
|
||||
if (jwe->jws.map.len[LJWE_ATAG] != (unsigned int)hlen / 2) {
|
||||
lwsl_notice("%s: expected tag len %d, got %d\n", __func__,
|
||||
hlen / 2, jwe->jws.map.len[LJWE_ATAG]);
|
||||
hlen / 2, (int)jwe->jws.map.len[LJWE_ATAG]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (jwe->jws.map.len[LJWE_IV] != 16) {
|
||||
lwsl_notice("expected iv len %d, got %d\n", 16,
|
||||
jwe->jws.map.len[LJWE_IV]);
|
||||
(int)jwe->jws.map.len[LJWE_IV]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -226,7 +226,7 @@ lws_jwe_auth_and_decrypt_cbc_hs(struct lws_jwe *jwe, uint8_t *enc_cek,
|
|||
|
||||
if (lws_timingsafe_bcmp(digest, jwe->jws.map.buf[LJWE_ATAG], (unsigned int)hlen / 2)) {
|
||||
lwsl_err("%s: auth failed: hmac tag (%d) != ATAG (%d)\n",
|
||||
__func__, hlen / 2, jwe->jws.map.len[LJWE_ATAG]);
|
||||
__func__, hlen / 2, (int)jwe->jws.map.len[LJWE_ATAG]);
|
||||
lwsl_hexdump_notice(jwe->jws.map.buf[LJWE_ATAG], (unsigned int)hlen / 2);
|
||||
lwsl_hexdump_notice(digest, (unsigned int)hlen / 2);
|
||||
return -1;
|
||||
|
@ -254,7 +254,7 @@ lws_jwe_auth_and_decrypt_cbc_hs(struct lws_jwe *jwe, uint8_t *enc_cek,
|
|||
jwe->jws.map.len[LJWE_CTXT] <= (unsigned char)jwe->jws.map.buf[LJWE_CTXT]
|
||||
[jwe->jws.map.len[LJWE_CTXT] - 1]) {
|
||||
lwsl_err("%s: invalid padded ciphertext length: %d. Corrupt data?\n",
|
||||
__func__, jwe->jws.map.len[LJWE_CTXT]);
|
||||
__func__, (int)jwe->jws.map.len[LJWE_CTXT]);
|
||||
return -1;
|
||||
}
|
||||
jwe->jws.map.len[LJWE_CTXT] = (uint32_t)((int)jwe->jws.map.len[LJWE_CTXT] -
|
||||
|
|
|
@ -63,13 +63,13 @@ lws_jwe_encrypt_gcm(struct lws_jwe *jwe,
|
|||
/* MUST be 128-bit for all sizes */
|
||||
if (jwe->jws.map.len[LJWE_ATAG] != LWS_AESGCM_TAG) {
|
||||
lwsl_notice("%s: AESGCM tag size must be 128b, got %d\n",
|
||||
__func__, jwe->jws.map.len[LJWE_ATAG]);
|
||||
__func__, (int)jwe->jws.map.len[LJWE_ATAG]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (jwe->jws.map.len[LJWE_IV] != LWS_AESGCM_IV) { /* MUST be 96-bit */
|
||||
lwsl_notice("%s: AESGCM IV must be 128b, got %d\n", __func__,
|
||||
jwe->jws.map.len[LJWE_IV]);
|
||||
(int)jwe->jws.map.len[LJWE_IV]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -128,13 +128,13 @@ lws_jwe_auth_and_decrypt_gcm(struct lws_jwe *jwe,
|
|||
/* Tag MUST be 128-bit for all sizes */
|
||||
if (jwe->jws.map.len[LJWE_ATAG] != LWS_AESGCM_TAG) {
|
||||
lwsl_notice("%s: AESGCM tag size must be 128b, got %d\n",
|
||||
__func__, jwe->jws.map.len[LJWE_ATAG]);
|
||||
__func__, (int)jwe->jws.map.len[LJWE_ATAG]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (jwe->jws.map.len[LJWE_IV] != LWS_AESGCM_IV) { /* MUST be 96-bit */
|
||||
lwsl_notice("%s: AESGCM IV must be 128b, got %d\n", __func__,
|
||||
jwe->jws.map.len[LJWE_IV]);
|
||||
(int)jwe->jws.map.len[LJWE_IV]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ lws_jwe_auth_and_decrypt_rsa_aes_cbc_hs(struct lws_jwe *jwe)
|
|||
|
||||
if (jwe->jws.map.len[LJWE_EKEY] < 40) {
|
||||
lwsl_err("%s: EKEY length too short %d\n", __func__,
|
||||
jwe->jws.map.len[LJWE_EKEY]);
|
||||
(int)jwe->jws.map.len[LJWE_EKEY]);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ lws_jwe_auth_and_decrypt_rsa_aes_gcm(struct lws_jwe *jwe)
|
|||
|
||||
if (jwe->jws.map.len[LJWE_EKEY] < 32) {
|
||||
lwsl_err("%s: EKEY length too short %d\n", __func__,
|
||||
jwe->jws.map.len[LJWE_EKEY]);
|
||||
(int)jwe->jws.map.len[LJWE_EKEY]);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -502,14 +502,16 @@ lws_display_list_render_line(lws_display_render_state_t *rs)
|
|||
continue;
|
||||
}
|
||||
|
||||
// lwsl_notice("%s: curr %d: %d %d %d %d\n", __func__, rs->curr, dlo->box.x.whole, dlo->box.y.whole, dlo->box.w.whole, dlo->box.h.whole);
|
||||
// lwsl_notice("%s: curr %d: %d %d %d %d\n", __func__, (int)rs->curr, (int)dlo->box.x.whole, (int)dlo->box.y.whole, (int)dlo->box.w.whole, (int)dlo->box.h.whole);
|
||||
|
||||
lws_fx_add(&co.x, &rs->st[rs->sp].co.x, &dlo->box.x);
|
||||
lws_fx_add(&co.y, &rs->st[rs->sp].co.y, &dlo->box.y);
|
||||
|
||||
co.w = dlo->box.w;
|
||||
co.h = dlo->box.h;
|
||||
|
||||
lws_fx_add(&t2, &co.y, &dlo->box.h);
|
||||
|
||||
if (rs->curr > lws_fx_roundup(&t2)) {
|
||||
d = dlo->list.next;
|
||||
rs->st[rs->sp].dlo = d ? lws_container_of(d, lws_dlo_t,
|
||||
|
@ -528,6 +530,7 @@ lws_display_list_render_line(lws_display_render_state_t *rs)
|
|||
if (rs->curr >= co.y.whole - 1) {
|
||||
|
||||
r = dlo->render(rs);
|
||||
|
||||
//rs->ic, dlo, &rs->st[rs->sp].co,
|
||||
// rs->curr, rs->line, &dlo->nle[0]);
|
||||
if (r)
|
||||
|
@ -536,12 +539,14 @@ lws_display_list_render_line(lws_display_render_state_t *rs)
|
|||
/* next sibling at this level if any */
|
||||
|
||||
d = dlo->list.next;
|
||||
|
||||
if (d)
|
||||
rs->st[rs->sp].dlo = lws_container_of(d,
|
||||
lws_dlo_t, list);
|
||||
else
|
||||
rs->st[rs->sp].dlo = NULL;
|
||||
|
||||
|
||||
/* go into any children */
|
||||
|
||||
if (dlo->children.head) {
|
||||
|
@ -565,6 +570,8 @@ lws_display_list_render_line(lws_display_render_state_t *rs)
|
|||
else
|
||||
rs->st[rs->sp].dlo = NULL;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return LWS_SRET_OK;
|
||||
|
|
|
@ -64,7 +64,7 @@ lws_genec_keypair_import(struct lws_genec_ctx *ctx, enum enum_lws_dh_side side,
|
|||
el[LWS_GENCRYPTO_EC_KEYEL_CRV].buf ?
|
||||
(char *)el[LWS_GENCRYPTO_EC_KEYEL_CRV].buf :
|
||||
"null",
|
||||
el[LWS_GENCRYPTO_EC_KEYEL_CRV].len);
|
||||
(int)el[LWS_GENCRYPTO_EC_KEYEL_CRV].len);
|
||||
return -21;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "mbedtls/ctr_drbg.h"
|
||||
#include "mbedtls/error.h"
|
||||
|
||||
|
||||
#define X509_INFO_STRING_LENGTH 8192
|
||||
|
||||
struct ssl_pm
|
||||
|
@ -121,7 +120,7 @@ int ssl_pm_new(SSL *ssl)
|
|||
size_t pers_len = sizeof(pers);
|
||||
|
||||
int endpoint;
|
||||
int version;
|
||||
//int version;
|
||||
|
||||
const SSL_METHOD *method = ssl->method;
|
||||
|
||||
|
@ -171,25 +170,28 @@ int ssl_pm_new(SSL *ssl)
|
|||
goto mbedtls_err2;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
if (TLS_ANY_VERSION != ssl->version) {
|
||||
if (TLS1_2_VERSION == ssl->version)
|
||||
version = MBEDTLS_SSL_MINOR_VERSION_3;
|
||||
version = 3;
|
||||
else if (TLS1_1_VERSION == ssl->version)
|
||||
version = 2;
|
||||
else
|
||||
version = 1;
|
||||
|
||||
mbedtls_ssl_conf_max_version(&ssl_pm->conf, MBEDTLS_SSL_MAJOR_VERSION_3, version);
|
||||
mbedtls_ssl_conf_min_version(&ssl_pm->conf, MBEDTLS_SSL_MAJOR_VERSION_3, version);
|
||||
mbedtls_ssl_conf_max_version(&ssl_pm->conf, 3, version);
|
||||
mbedtls_ssl_conf_min_version(&ssl_pm->conf, 3, version);
|
||||
} else {
|
||||
mbedtls_ssl_conf_max_version(&ssl_pm->conf, MBEDTLS_SSL_MAJOR_VERSION_3, MBEDTLS_SSL_MINOR_VERSION_3);
|
||||
mbedtls_ssl_conf_max_version(&ssl_pm->conf, 3, 3);
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
|
||||
mbedtls_ssl_conf_min_version(&ssl_pm->conf, MBEDTLS_SSL_MAJOR_VERSION_3, MBEDTLS_SSL_MINOR_VERSION_3);
|
||||
mbedtls_ssl_conf_min_version(&ssl_pm->conf, 3, 3);
|
||||
#else
|
||||
mbedtls_ssl_conf_min_version(&ssl_pm->conf, MBEDTLS_SSL_MAJOR_VERSION_3, 1);
|
||||
mbedtls_ssl_conf_min_version(&ssl_pm->conf, 3, 1);
|
||||
#endif
|
||||
}
|
||||
#endif // 0
|
||||
|
||||
mbedtls_ssl_conf_rng(&ssl_pm->conf, mbedtls_ctr_drbg_random, &ssl_pm->ctr_drbg);
|
||||
|
||||
|
|
|
@ -232,7 +232,7 @@ lws_tls_jit_trust_sort_kids(struct lws *wsi, lws_tls_kid_chain_t *ch)
|
|||
static void
|
||||
tag_to_vh_name(char *result, size_t max, uint32_t tag)
|
||||
{
|
||||
lws_snprintf(result, max, "jitt-%08X", tag);
|
||||
lws_snprintf(result, max, "jitt-%08X", (unsigned int)tag);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
Loading…
Add table
Reference in a new issue