Return type is int, but we often use it in contexts
where we expect size_t. So just cast it. Nothing else
to do really.
Change-Id: I22b93c807f1be99fab450708f686fce4aa6d5cef
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1133
Message-Id: <20250922204059.23226-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59237213/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
| ... | ... |
@@ -1273,7 +1273,7 @@ hmac_ctx_init(hmac_ctx_t *ctx, const uint8_t *key, const char *mdname) |
| 1273 | 1273 |
|
| 1274 | 1274 |
/* We need to make a copy of the key since the OSSL parameters |
| 1275 | 1275 |
* only reference it */ |
| 1276 |
- memcpy(ctx->key, key, EVP_MD_size(kt)); |
|
| 1276 |
+ memcpy(ctx->key, key, (size_t)EVP_MD_size(kt)); |
|
| 1277 | 1277 |
|
| 1278 | 1278 |
/* Lookup/setting of parameters in OpenSSL 3.0 are string based |
| 1279 | 1279 |
* |
| ... | ... |
@@ -1282,7 +1282,7 @@ hmac_ctx_init(hmac_ctx_t *ctx, const uint8_t *key, const char *mdname) |
| 1282 | 1282 |
* the constness away here. |
| 1283 | 1283 |
*/ |
| 1284 | 1284 |
ctx->params[0] = OSSL_PARAM_construct_utf8_string("digest", (char *)EVP_MD_get0_name(kt), 0);
|
| 1285 |
- ctx->params[1] = OSSL_PARAM_construct_octet_string("key", ctx->key, EVP_MD_size(kt));
|
|
| 1285 |
+ ctx->params[1] = OSSL_PARAM_construct_octet_string("key", ctx->key, (size_t)EVP_MD_size(kt));
|
|
| 1286 | 1286 |
ctx->params[2] = OSSL_PARAM_construct_end(); |
| 1287 | 1287 |
|
| 1288 | 1288 |
if (!EVP_MAC_init(ctx->ctx, NULL, 0, ctx->params)) |
| ... | ... |
@@ -341,7 +341,7 @@ struct buffer |
| 341 | 341 |
x509_get_sha1_fingerprint(X509 *cert, struct gc_arena *gc) |
| 342 | 342 |
{
|
| 343 | 343 |
const EVP_MD *sha1 = EVP_sha1(); |
| 344 |
- struct buffer hash = alloc_buf_gc(EVP_MD_size(sha1), gc); |
|
| 344 |
+ struct buffer hash = alloc_buf_gc((size_t)EVP_MD_size(sha1), gc); |
|
| 345 | 345 |
X509_digest(cert, EVP_sha1(), BPTR(&hash), NULL); |
| 346 | 346 |
ASSERT(buf_inc_len(&hash, EVP_MD_size(sha1))); |
| 347 | 347 |
return hash; |
| ... | ... |
@@ -351,7 +351,7 @@ struct buffer |
| 351 | 351 |
x509_get_sha256_fingerprint(X509 *cert, struct gc_arena *gc) |
| 352 | 352 |
{
|
| 353 | 353 |
const EVP_MD *sha256 = EVP_sha256(); |
| 354 |
- struct buffer hash = alloc_buf_gc(EVP_MD_size(sha256), gc); |
|
| 354 |
+ struct buffer hash = alloc_buf_gc((size_t)EVP_MD_size(sha256), gc); |
|
| 355 | 355 |
X509_digest(cert, EVP_sha256(), BPTR(&hash), NULL); |
| 356 | 356 |
ASSERT(buf_inc_len(&hash, EVP_MD_size(sha256))); |
| 357 | 357 |
return hash; |
| ... | ... |
@@ -351,7 +351,7 @@ encode_pkcs1(unsigned char *enc, size_t *enc_len, const char *mdname, const unsi |
| 351 | 351 |
} |
| 352 | 352 |
} |
| 353 | 353 |
|
| 354 |
- if (tbslen != EVP_MD_size(EVP_get_digestbyname(mdname))) |
|
| 354 |
+ if (tbslen != (size_t)EVP_MD_size(EVP_get_digestbyname(mdname))) |
|
| 355 | 355 |
{
|
| 356 | 356 |
msg(M_WARN, "Error: encode_pkcs11: invalid input length <%zu>", tbslen); |
| 357 | 357 |
goto done; |