From 3620689ea0acb4a92f148e3161d316cb2535229c Mon Sep 17 00:00:00 2001 From: joshua Date: Thu, 28 Mar 2024 02:08:24 +0000 Subject: [PATCH] Use TLS_ERROR_OUT_OF_MEMORY error code for calloc errors in libtls ok jsing --- lib/libtls/tls_signer.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/libtls/tls_signer.c b/lib/libtls/tls_signer.c index 5eb37074544..95a3640d7af 100644 --- a/lib/libtls/tls_signer.c +++ b/lib/libtls/tls_signer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tls_signer.c,v 1.10 2024/03/26 06:24:52 joshua Exp $ */ +/* $OpenBSD: tls_signer.c,v 1.11 2024/03/28 02:08:24 joshua Exp $ */ /* * Copyright (c) 2021 Eric Faurot * @@ -128,8 +128,8 @@ tls_signer_add_keypair_mem(struct tls_signer *signer, const uint8_t *cert, } if ((skey = calloc(1, sizeof(*skey))) == NULL) { - tls_error_set(&signer->error, TLS_ERROR_UNKNOWN, - "failed to create key entry"); + tls_error_set(&signer->error, TLS_ERROR_OUT_OF_MEMORY, + "out of memory"); goto err; } skey->hash = hash; @@ -214,7 +214,8 @@ tls_sign_rsa(struct tls_signer *signer, struct tls_signer_key *skey, return (-1); } if ((signature = calloc(1, rsa_size)) == NULL) { - tls_error_set(&signer->error, TLS_ERROR_UNKNOWN, "RSA signature"); + tls_error_set(&signer->error, TLS_ERROR_OUT_OF_MEMORY, + "out of memory"); return (-1); } @@ -261,8 +262,8 @@ tls_sign_ecdsa(struct tls_signer *signer, struct tls_signer_key *skey, return (-1); } if ((signature = calloc(1, signature_len)) == NULL) { - tls_error_set(&signer->error, TLS_ERROR_UNKNOWN, - "ECDSA signature"); + tls_error_set(&signer->error, TLS_ERROR_OUT_OF_MEMORY, + "out of memory"); return (-1); } -- 2.20.1