Fix a typical error

When call `foo(type *ret)`,always use `type` to receive the return value.
This commit is contained in:
Zhi Guan
2022-12-29 18:13:57 +08:00
parent eb06a2e200
commit 8ff829dbcd
2 changed files with 6 additions and 5 deletions

View File

@@ -855,6 +855,7 @@ int tls13_record_get_handshake_certificate_verify(const uint8_t *record,
int type; int type;
const uint8_t *p; const uint8_t *p;
size_t len ; size_t len ;
uint16_t alg;
if (tls_record_get_handshake(record, &type, &p, &len) != 1 if (tls_record_get_handshake(record, &type, &p, &len) != 1
|| type != TLS_handshake_certificate_verify) { || type != TLS_handshake_certificate_verify) {
@@ -862,9 +863,9 @@ int tls13_record_get_handshake_certificate_verify(const uint8_t *record,
return -1; return -1;
} }
*sign_algor = 0; tls_uint16_from_bytes(&alg, &p, &len);
tls_uint16_from_bytes((uint16_t *)sign_algor, &p, &len);
tls_uint16array_from_bytes(sig, siglen, &p, &len); tls_uint16array_from_bytes(sig, siglen, &p, &len);
*sign_algor = alg;
return 1; return 1;
} }

View File

@@ -540,7 +540,7 @@ int tls_client_hello_print(FILE *fp, const uint8_t *data, size_t datalen, int fo
size_t i; size_t i;
format_print(fp, format, indent, "ClientHello\n"); indent += 4; format_print(fp, format, indent, "ClientHello\n"); indent += 4;
if (tls_uint16_from_bytes((uint16_t *)&protocol, &data, &datalen) != 1) goto end; if (tls_uint16_from_bytes(&protocol, &data, &datalen) != 1) goto end;
format_print(fp, format, indent, "Version: %s (%d.%d)\n", format_print(fp, format, indent, "Version: %s (%d.%d)\n",
tls_protocol_name(protocol), protocol >> 8, protocol & 0xff); tls_protocol_name(protocol), protocol >> 8, protocol & 0xff);
if (tls_array_from_bytes(&random, 32, &data, &datalen) != 1) goto end; if (tls_array_from_bytes(&random, 32, &data, &datalen) != 1) goto end;
@@ -892,7 +892,7 @@ int tls_handshake_print(FILE *fp, const uint8_t *handshake, size_t handshakelen,
const uint8_t *cp = handshake; const uint8_t *cp = handshake;
uint8_t type; uint8_t type;
const uint8_t *data; const uint8_t *data;
size_t datalen = 0; uint24_t datalen;
format_print(fp, format, indent, "Handshake\n"); format_print(fp, format, indent, "Handshake\n");
indent += 4; indent += 4;
@@ -902,7 +902,7 @@ int tls_handshake_print(FILE *fp, const uint8_t *handshake, size_t handshakelen,
return -1; return -1;
} }
format_print(fp, format, indent, "Type: %s (%d)\n", tls_handshake_type_name(type), type); format_print(fp, format, indent, "Type: %s (%d)\n", tls_handshake_type_name(type), type);
if (tls_uint24_from_bytes((uint24_t *)&datalen, &cp, &handshakelen) != 1) { if (tls_uint24_from_bytes(&datalen, &cp, &handshakelen) != 1) {
error_print(); error_print();
return -1; return -1;
} }