diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/ec/ec_convert.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/lib/libcrypto/ec/ec_convert.c b/src/lib/libcrypto/ec/ec_convert.c index f2410c163c..b48fc85315 100644 --- a/src/lib/libcrypto/ec/ec_convert.c +++ b/src/lib/libcrypto/ec/ec_convert.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec_convert.c,v 1.12 2024/12/12 10:00:15 tb Exp $ */ | 1 | /* $OpenBSD: ec_convert.c,v 1.13 2024/12/16 06:11:26 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Originally written by Bodo Moeller for the OpenSSL project. | 3 | * Originally written by Bodo Moeller for the OpenSSL project. |
| 4 | */ | 4 | */ |
| @@ -360,15 +360,11 @@ ec_point_to_octets(const EC_GROUP *group, const EC_POINT *point, int form, | |||
| 360 | 360 | ||
| 361 | *out_len = 0; | 361 | *out_len = 0; |
| 362 | 362 | ||
| 363 | if (out_buf != NULL && *out_buf != NULL) | 363 | if (out_buf == NULL || *out_buf != NULL) |
| 364 | goto err; | 364 | goto err; |
| 365 | 365 | ||
| 366 | if ((len = EC_POINT_point2oct(group, point, form, NULL, 0, ctx)) == 0) | 366 | if ((len = EC_POINT_point2oct(group, point, form, NULL, 0, ctx)) == 0) |
| 367 | goto err; | 367 | goto err; |
| 368 | |||
| 369 | if (out_buf == NULL) | ||
| 370 | goto done; | ||
| 371 | |||
| 372 | if ((buf = calloc(1, len)) == NULL) | 368 | if ((buf = calloc(1, len)) == NULL) |
| 373 | goto err; | 369 | goto err; |
| 374 | if (EC_POINT_point2oct(group, point, form, buf, len, ctx) != len) | 370 | if (EC_POINT_point2oct(group, point, form, buf, len, ctx) != len) |
| @@ -376,9 +372,8 @@ ec_point_to_octets(const EC_GROUP *group, const EC_POINT *point, int form, | |||
| 376 | 372 | ||
| 377 | *out_buf = buf; | 373 | *out_buf = buf; |
| 378 | buf = NULL; | 374 | buf = NULL; |
| 379 | |||
| 380 | done: | ||
| 381 | *out_len = len; | 375 | *out_len = len; |
| 376 | len = 0; | ||
| 382 | 377 | ||
| 383 | ret = 1; | 378 | ret = 1; |
| 384 | 379 | ||
