diff options
author | tb <> | 2024-10-24 05:57:25 +0000 |
---|---|---|
committer | tb <> | 2024-10-24 05:57:25 +0000 |
commit | 003b53c89a3dde1cc328415812af27d2af0d09e8 (patch) | |
tree | 3cf9d3e19068199c38953987810012d4fb6f9b5f /src | |
parent | 05c228470598f93396d464b5933530fafc42823d (diff) | |
download | openbsd-003b53c89a3dde1cc328415812af27d2af0d09e8.tar.gz openbsd-003b53c89a3dde1cc328415812af27d2af0d09e8.tar.bz2 openbsd-003b53c89a3dde1cc328415812af27d2af0d09e8.zip |
Add missing error check for CBB_init_fixed()
CID 511280
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/ec/ecp_oct.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/libcrypto/ec/ecp_oct.c b/src/lib/libcrypto/ec/ecp_oct.c index 5444b5ec34..0d9a73c5b8 100644 --- a/src/lib/libcrypto/ec/ecp_oct.c +++ b/src/lib/libcrypto/ec/ecp_oct.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecp_oct.c,v 1.27 2024/10/23 13:42:50 tb Exp $ */ | 1 | /* $OpenBSD: ecp_oct.c,v 1.28 2024/10/24 05:57:25 tb Exp $ */ |
2 | /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> | 2 | /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> |
3 | * for the OpenSSL project. | 3 | * for the OpenSSL project. |
4 | * Includes code written by Bodo Moeller for the OpenSSL project. | 4 | * Includes code written by Bodo Moeller for the OpenSSL project. |
@@ -374,8 +374,9 @@ ec_GFp_simple_point2oct(const EC_GROUP *group, const EC_POINT *point, | |||
374 | return 0; | 374 | return 0; |
375 | } | 375 | } |
376 | 376 | ||
377 | CBB_init_fixed(&cbb, buf, len); | ||
378 | BN_CTX_start(ctx); | 377 | BN_CTX_start(ctx); |
378 | if (!CBB_init_fixed(&cbb, buf, len)) | ||
379 | goto err; | ||
379 | 380 | ||
380 | if (form == EC_OCT_POINT_AT_INFINITY) { | 381 | if (form == EC_OCT_POINT_AT_INFINITY) { |
381 | if (!ec_oct_add_leading_octet_cbb(&cbb, form, 0)) | 382 | if (!ec_oct_add_leading_octet_cbb(&cbb, form, 0)) |
@@ -414,8 +415,8 @@ ec_GFp_simple_point2oct(const EC_GROUP *group, const EC_POINT *point, | |||
414 | } | 415 | } |
415 | 416 | ||
416 | err: | 417 | err: |
417 | BN_CTX_end(ctx); | ||
418 | CBB_cleanup(&cbb); | 418 | CBB_cleanup(&cbb); |
419 | BN_CTX_end(ctx); | ||
419 | 420 | ||
420 | return ret; | 421 | return ret; |
421 | } | 422 | } |
@@ -430,8 +431,8 @@ ec_GFp_simple_oct2point(const EC_GROUP *group, EC_POINT *point, | |||
430 | BIGNUM *x, *y; | 431 | BIGNUM *x, *y; |
431 | int ret = 0; | 432 | int ret = 0; |
432 | 433 | ||
433 | CBS_init(&cbs, buf, len); | ||
434 | BN_CTX_start(ctx); | 434 | BN_CTX_start(ctx); |
435 | CBS_init(&cbs, buf, len); | ||
435 | 436 | ||
436 | if ((x = BN_CTX_get(ctx)) == NULL) | 437 | if ((x = BN_CTX_get(ctx)) == NULL) |
437 | goto err; | 438 | goto err; |