diff options
| author | tb <> | 2024-03-02 09:55:30 +0000 |
|---|---|---|
| committer | tb <> | 2024-03-02 09:55:30 +0000 |
| commit | 4083c1a64fc21730cb59ac92344eaeeda5fd688b (patch) | |
| tree | 1a29aa5a7674f289db524ae2d0ca6b1ffb7043b3 /src/lib/libcrypto/evp/evp.h | |
| parent | 9c25037b962e7ec9fbd5b3f3abb73f588d8d3a30 (diff) | |
| download | openbsd-4083c1a64fc21730cb59ac92344eaeeda5fd688b.tar.gz openbsd-4083c1a64fc21730cb59ac92344eaeeda5fd688b.tar.bz2 openbsd-4083c1a64fc21730cb59ac92344eaeeda5fd688b.zip | |
Fix signature and semantics of EVP_{CIPHER,MD}_CTX_init()
When the EVP_CIPHER_CTX and the EVP_MD_CTX were still expected to live
on the stack, these initialization APIs were wrappers around memset.
In OpenSSL 1.1, somebody removed them and carelessly made _init() an
alias of _reset() aka _cleanup(). As a consequence, both signature and
semantics changed.
Unsurprisingly, there is now code out there that actually uses the new
semantics, which causes leaks on LibreSSL and older OpenSSL. This aligns
our _init() with OpenSSL 1.1 semantics.
ok jsing
Diffstat (limited to 'src/lib/libcrypto/evp/evp.h')
| -rw-r--r-- | src/lib/libcrypto/evp/evp.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h index 1d867671e4..36de06f49b 100644 --- a/src/lib/libcrypto/evp/evp.h +++ b/src/lib/libcrypto/evp/evp.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: evp.h,v 1.123 2024/03/02 09:39:02 tb Exp $ */ | 1 | /* $OpenBSD: evp.h,v 1.124 2024/03/02 09:55:30 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -464,7 +464,7 @@ int EVP_Cipher(EVP_CIPHER_CTX *c, unsigned char *out, const unsigned char *in, | |||
| 464 | EVP_MD_CTX *EVP_MD_CTX_new(void); | 464 | EVP_MD_CTX *EVP_MD_CTX_new(void); |
| 465 | void EVP_MD_CTX_free(EVP_MD_CTX *ctx); | 465 | void EVP_MD_CTX_free(EVP_MD_CTX *ctx); |
| 466 | #ifndef LIBRESSL_INTERNAL | 466 | #ifndef LIBRESSL_INTERNAL |
| 467 | void EVP_MD_CTX_init(EVP_MD_CTX *ctx); | 467 | int EVP_MD_CTX_init(EVP_MD_CTX *ctx); |
| 468 | #endif | 468 | #endif |
| 469 | int EVP_MD_CTX_reset(EVP_MD_CTX *ctx); | 469 | int EVP_MD_CTX_reset(EVP_MD_CTX *ctx); |
| 470 | EVP_MD_CTX *EVP_MD_CTX_create(void); | 470 | EVP_MD_CTX *EVP_MD_CTX_create(void); |
| @@ -578,7 +578,7 @@ int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl); | |||
| 578 | int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n); | 578 | int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n); |
| 579 | 579 | ||
| 580 | #ifndef LIBRESSL_INTERNAL | 580 | #ifndef LIBRESSL_INTERNAL |
| 581 | void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a); | 581 | int EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a); |
| 582 | #endif | 582 | #endif |
| 583 | int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a); | 583 | int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a); |
| 584 | EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void); | 584 | EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void); |
