1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-08 17:42:09 +03:00

corrected code style

Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
This commit is contained in:
Ben Taylor
2025-06-10 07:47:13 +01:00
parent a4915abc56
commit 98ecfdb440
2 changed files with 9 additions and 10 deletions

View File

@@ -1035,9 +1035,10 @@ static int psk_callback(void *p_info, mbedtls_ssl_context *ssl,
memcmp(name, cur->name, name_len) == 0) { memcmp(name, cur->name, name_len) == 0) {
if (MBEDTLS_SVC_KEY_ID_GET_KEY_ID(cur->slot) != 0) { if (MBEDTLS_SVC_KEY_ID_GET_KEY_ID(cur->slot) != 0) {
return mbedtls_ssl_set_hs_psk_opaque(ssl, cur->slot); return mbedtls_ssl_set_hs_psk_opaque(ssl, cur->slot);
} else } else {
return mbedtls_ssl_set_hs_psk(ssl, cur->key, cur->key_len); return mbedtls_ssl_set_hs_psk(ssl, cur->key, cur->key_len);
} }
}
cur = cur->next; cur = cur->next;
} }
@@ -1936,8 +1937,7 @@ usage:
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */ #endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
else if (strcmp(p, "psk") == 0) { else if (strcmp(p, "psk") == 0) {
opt.psk = q; opt.psk = q;
} } else if (strcmp(p, "psk_opaque") == 0) {
else if (strcmp(p, "psk_opaque") == 0) {
opt.psk_opaque = atoi(q); opt.psk_opaque = atoi(q);
} else if (strcmp(p, "psk_list_opaque") == 0) { } else if (strcmp(p, "psk_list_opaque") == 0) {
opt.psk_list_opaque = atoi(q); opt.psk_list_opaque = atoi(q);
@@ -1953,8 +1953,7 @@ usage:
opt.psk_list = q; opt.psk_list = q;
} else if (strcmp(p, "ecjpake_pw") == 0) { } else if (strcmp(p, "ecjpake_pw") == 0) {
opt.ecjpake_pw = q; opt.ecjpake_pw = q;
} } else if (strcmp(p, "ecjpake_pw_opaque") == 0) {
else if (strcmp(p, "ecjpake_pw_opaque") == 0) {
opt.ecjpake_pw_opaque = atoi(q); opt.ecjpake_pw_opaque = atoi(q);
} }
else if (strcmp(p, "force_ciphersuite") == 0) { else if (strcmp(p, "force_ciphersuite") == 0) {
@@ -3358,8 +3357,7 @@ reset:
goto exit; goto exit;
} }
mbedtls_printf("using opaque password\n"); mbedtls_printf("using opaque password\n");
} else } else {
{
if ((ret = mbedtls_ssl_set_hs_ecjpake_password(&ssl, if ((ret = mbedtls_ssl_set_hs_ecjpake_password(&ssl,
(const unsigned char *) opt.ecjpake_pw, (const unsigned char *) opt.ecjpake_pw,
strlen(opt.ecjpake_pw))) != 0) { strlen(opt.ecjpake_pw))) != 0) {

View File

@@ -551,8 +551,9 @@ void x509_crt_check(char *subject_key_file, char *subject_pwd,
// go into the MBEDTLS_ERR_ASN1_BUF_TOO_SMALL error case // go into the MBEDTLS_ERR_ASN1_BUF_TOO_SMALL error case
if (issuer_key_type != MBEDTLS_PK_RSA) { if (issuer_key_type != MBEDTLS_PK_RSA) {
der_len /= 2; der_len /= 2;
} else } else {
der_len -= 1; der_len -= 1;
}
ret = mbedtls_x509write_crt_der(&crt, buf, (size_t) (der_len)); ret = mbedtls_x509write_crt_der(&crt, buf, (size_t) (der_len));
TEST_ASSERT(ret == MBEDTLS_ERR_ASN1_BUF_TOO_SMALL); TEST_ASSERT(ret == MBEDTLS_ERR_ASN1_BUF_TOO_SMALL);