From 59161dbdf4da5b82b27402f93d7007a11b2d1cc1 Mon Sep 17 00:00:00 2001 From: beck <> Date: Thu, 26 Jan 2017 10:40:21 +0000 Subject: Send the error function codes to rot in the depths of hell where they belong We leave a single funciton code (0xFFF) to say "SSL_internal" so the public API will not break, and we replace all internal use of the two argument SSL_err() with the internal only SSL_error() that only takes a reason code. ok jsing@ --- src/lib/libssl/ssl_both.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/lib/libssl/ssl_both.c') diff --git a/src/lib/libssl/ssl_both.c b/src/lib/libssl/ssl_both.c index 9d0dadef83..707feb6d09 100644 --- a/src/lib/libssl/ssl_both.c +++ b/src/lib/libssl/ssl_both.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_both.c,v 1.2 2017/01/26 06:32:58 jsing Exp $ */ +/* $OpenBSD: ssl_both.c,v 1.3 2017/01/26 10:40:21 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -244,7 +244,7 @@ ssl3_get_finished(SSL *s, int a, int b) /* If this occurs, we have missed a message */ if (!S3I(s)->change_cipher_spec) { al = SSL_AD_UNEXPECTED_MESSAGE; - SSLerr(SSL_F_SSL3_GET_FINISHED, SSL_R_GOT_A_FIN_BEFORE_A_CCS); + SSLerror(SSL_R_GOT_A_FIN_BEFORE_A_CCS); goto f_err; } S3I(s)->change_cipher_spec = 0; @@ -253,7 +253,7 @@ ssl3_get_finished(SSL *s, int a, int b) if (n < 0) { al = SSL_AD_DECODE_ERROR; - SSLerr(SSL_F_SSL3_GET_FINISHED, SSL_R_BAD_DIGEST_LENGTH); + SSLerror(SSL_R_BAD_DIGEST_LENGTH); goto f_err; } @@ -262,13 +262,13 @@ ssl3_get_finished(SSL *s, int a, int b) if (S3I(s)->tmp.peer_finish_md_len != md_len || CBS_len(&cbs) != md_len) { al = SSL_AD_DECODE_ERROR; - SSLerr(SSL_F_SSL3_GET_FINISHED, SSL_R_BAD_DIGEST_LENGTH); + SSLerror(SSL_R_BAD_DIGEST_LENGTH); goto f_err; } if (!CBS_mem_equal(&cbs, S3I(s)->tmp.peer_finish_md, CBS_len(&cbs))) { al = SSL_AD_DECRYPT_ERROR; - SSLerr(SSL_F_SSL3_GET_FINISHED, SSL_R_DIGEST_CHECK_FAILED); + SSLerror(SSL_R_DIGEST_CHECK_FAILED); goto f_err; } @@ -365,7 +365,7 @@ ssl3_output_cert_chain(SSL *s, CBB *cbb, X509 *x) if (!X509_STORE_CTX_init(&xs_ctx, s->ctx->cert_store, x, NULL)) { - SSLerr(SSL_F_SSL3_OUTPUT_CERT_CHAIN, + SSLerror( ERR_R_X509_LIB); goto err; } @@ -420,7 +420,7 @@ ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok) S3I(s)->tmp.reuse_message = 0; if ((mt >= 0) && (S3I(s)->tmp.message_type != mt)) { al = SSL_AD_UNEXPECTED_MESSAGE; - SSLerr(SSL_F_SSL3_GET_MESSAGE, + SSLerror( SSL_R_UNEXPECTED_MESSAGE); goto f_err; } @@ -473,7 +473,7 @@ ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok) if ((mt >= 0) && (*p != mt)) { al = SSL_AD_UNEXPECTED_MESSAGE; - SSLerr(SSL_F_SSL3_GET_MESSAGE, + SSLerror( SSL_R_UNEXPECTED_MESSAGE); goto f_err; } @@ -481,19 +481,19 @@ ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok) CBS_init(&cbs, p, 4); if (!CBS_get_u8(&cbs, &u8) || !CBS_get_u24(&cbs, &l)) { - SSLerr(SSL_F_SSL3_GET_MESSAGE, ERR_R_BUF_LIB); + SSLerror(ERR_R_BUF_LIB); goto err; } S3I(s)->tmp.message_type = u8; if (l > (unsigned long)max) { al = SSL_AD_ILLEGAL_PARAMETER; - SSLerr(SSL_F_SSL3_GET_MESSAGE, + SSLerror( SSL_R_EXCESSIVE_MESSAGE_SIZE); goto f_err; } if (l && !BUF_MEM_grow_clean(s->internal->init_buf, l + 4)) { - SSLerr(SSL_F_SSL3_GET_MESSAGE, ERR_R_BUF_LIB); + SSLerror(ERR_R_BUF_LIB); goto err; } S3I(s)->tmp.message_size = l; @@ -684,7 +684,7 @@ ssl3_setup_read_buffer(SSL *s) return 1; err: - SSLerr(SSL_F_SSL3_SETUP_READ_BUFFER, ERR_R_MALLOC_FAILURE); + SSLerror(ERR_R_MALLOC_FAILURE); return 0; } @@ -717,7 +717,7 @@ ssl3_setup_write_buffer(SSL *s) return 1; err: - SSLerr(SSL_F_SSL3_SETUP_WRITE_BUFFER, ERR_R_MALLOC_FAILURE); + SSLerror(ERR_R_MALLOC_FAILURE); return 0; } -- cgit v1.2.3-55-g6feb