Skip to content

Commit 447f826

Browse files
committed
Return S2N_ERR_CIPHER_TYPE for unknown types
Not an error case that's being exercised right now, but we need to have s2n_errno set for all -1 return values.
1 parent c7f68d1 commit 447f826

File tree

4 files changed

+4
-2
lines changed

4 files changed

+4
-2
lines changed

error/s2n_errno.c

+1
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ struct s2n_error_translation EN[] = {
107107
{S2N_ERR_NON_EMPTY_RENEGOTIATION_INFO, "renegotiation_info should be empty"},
108108
{S2N_ERR_SEND_SIZE, "Retried s2n_send() size is invalid"},
109109
{S2N_ERR_PRIVATE_KEY_CHECK, "Error calling RSA_check_key()"},
110+
{S2N_ERR_CIPHER_TYPE, "Unknown cipher type used"},
110111
};
111112

112113
const char *s2n_strerror(int error, const char *lang)

error/s2n_errno.h

+1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ typedef enum {
105105
S2N_ERR_DRBG,
106106
S2N_ERR_DRBG_REQUEST_SIZE,
107107
S2N_ERR_PRIVATE_KEY_CHECK,
108+
S2N_ERR_CIPHER_TYPE,
108109
/* S2N_ERR_T_USAGE */
109110
S2N_ERR_NO_ALERT = S2N_ERR_T_USAGE_START,
110111
S2N_ERR_CLIENT_MODE,

tls/s2n_record_read.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ int s2n_record_parse(struct s2n_connection *conn)
210210
GUARD(cipher_suite->cipher->io.aead.decrypt(session_key, &iv, &aad, &en, &en));
211211
break;
212212
default:
213-
return -1;
213+
S2N_ERROR(S2N_ERR_CIPHER_TYPE);
214214
break;
215215
}
216216

tls/s2n_record_write.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ int s2n_record_write(struct s2n_connection *conn, uint8_t content_type, struct s
250250
GUARD(cipher_suite->cipher->io.aead.encrypt(session_key, &iv, &aad, &en, &en));
251251
break;
252252
default:
253-
return -1;
253+
S2N_ERROR(S2N_ERR_CIPHER_TYPE);
254254
break;
255255
}
256256

0 commit comments

Comments
 (0)