diff options
| author | joshua <> | 2024-03-28 02:08:24 +0000 |
|---|---|---|
| committer | joshua <> | 2024-03-28 02:08:24 +0000 |
| commit | a7dd7b8d74e7f7e9f77b865ade3204f7e1c26188 (patch) | |
| tree | 68d2bd5bb82df1ffa21f205015f36ee3940c6b8b /src | |
| parent | ec21b0ca38803c02b86ff3aa3362fce09f349c32 (diff) | |
| download | openbsd-a7dd7b8d74e7f7e9f77b865ade3204f7e1c26188.tar.gz openbsd-a7dd7b8d74e7f7e9f77b865ade3204f7e1c26188.tar.bz2 openbsd-a7dd7b8d74e7f7e9f77b865ade3204f7e1c26188.zip | |
Use TLS_ERROR_OUT_OF_MEMORY error code for calloc errors in libtls
ok jsing
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libtls/tls_signer.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/lib/libtls/tls_signer.c b/src/lib/libtls/tls_signer.c index 5eb3707454..95a3640d7a 100644 --- a/src/lib/libtls/tls_signer.c +++ b/src/lib/libtls/tls_signer.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tls_signer.c,v 1.10 2024/03/26 06:24:52 joshua Exp $ */ | 1 | /* $OpenBSD: tls_signer.c,v 1.11 2024/03/28 02:08:24 joshua Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2021 Eric Faurot <eric@openbsd.org> | 3 | * Copyright (c) 2021 Eric Faurot <eric@openbsd.org> |
| 4 | * | 4 | * |
| @@ -128,8 +128,8 @@ tls_signer_add_keypair_mem(struct tls_signer *signer, const uint8_t *cert, | |||
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | if ((skey = calloc(1, sizeof(*skey))) == NULL) { | 130 | if ((skey = calloc(1, sizeof(*skey))) == NULL) { |
| 131 | tls_error_set(&signer->error, TLS_ERROR_UNKNOWN, | 131 | tls_error_set(&signer->error, TLS_ERROR_OUT_OF_MEMORY, |
| 132 | "failed to create key entry"); | 132 | "out of memory"); |
| 133 | goto err; | 133 | goto err; |
| 134 | } | 134 | } |
| 135 | skey->hash = hash; | 135 | skey->hash = hash; |
| @@ -214,7 +214,8 @@ tls_sign_rsa(struct tls_signer *signer, struct tls_signer_key *skey, | |||
| 214 | return (-1); | 214 | return (-1); |
| 215 | } | 215 | } |
| 216 | if ((signature = calloc(1, rsa_size)) == NULL) { | 216 | if ((signature = calloc(1, rsa_size)) == NULL) { |
| 217 | tls_error_set(&signer->error, TLS_ERROR_UNKNOWN, "RSA signature"); | 217 | tls_error_set(&signer->error, TLS_ERROR_OUT_OF_MEMORY, |
| 218 | "out of memory"); | ||
| 218 | return (-1); | 219 | return (-1); |
| 219 | } | 220 | } |
| 220 | 221 | ||
| @@ -261,8 +262,8 @@ tls_sign_ecdsa(struct tls_signer *signer, struct tls_signer_key *skey, | |||
| 261 | return (-1); | 262 | return (-1); |
| 262 | } | 263 | } |
| 263 | if ((signature = calloc(1, signature_len)) == NULL) { | 264 | if ((signature = calloc(1, signature_len)) == NULL) { |
| 264 | tls_error_set(&signer->error, TLS_ERROR_UNKNOWN, | 265 | tls_error_set(&signer->error, TLS_ERROR_OUT_OF_MEMORY, |
| 265 | "ECDSA signature"); | 266 | "out of memory"); |
| 266 | return (-1); | 267 | return (-1); |
| 267 | } | 268 | } |
| 268 | 269 | ||
