-/* $OpenBSD: tls.c,v 1.102 2024/03/26 08:54:48 joshua Exp $ */
+/* $OpenBSD: tls.c,v 1.103 2024/03/27 07:35:30 joshua Exp $ */
/*
* Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
*
return (0);
if (len > INT_MAX) {
- tls_set_errorx(ctx, TLS_ERROR_UNKNOWN,
+ tls_set_errorx(ctx, TLS_ERROR_INVALID_ARGUMENT,
ctx->config->use_fake_private_key ?
- "cert too long" : "key too long");
+ "certificate too long" : "key too long");
goto err;
}
if (keypair->cert_mem != NULL) {
if (keypair->cert_len > INT_MAX) {
- tls_set_errorx(ctx, TLS_ERROR_UNKNOWN,
+ tls_set_errorx(ctx, TLS_ERROR_INVALID_ARGUMENT,
"certificate too long");
goto err;
}
if (ca_mem != NULL) {
if (ca_len > INT_MAX) {
- tls_set_errorx(ctx, TLS_ERROR_UNKNOWN, "ca too long");
+ tls_set_errorx(ctx, TLS_ERROR_INVALID_ARGUMENT,
+ "ca too long");
goto err;
}
if (SSL_CTX_load_verify_mem(ssl_ctx, ca_mem, ca_len) != 1) {
if (crl_mem != NULL) {
if (crl_len > INT_MAX) {
- tls_set_errorx(ctx, TLS_ERROR_UNKNOWN, "crl too long");
+ tls_set_errorx(ctx, TLS_ERROR_INVALID_ARGUMENT,
+ "crl too long");
goto err;
}
if ((bio = BIO_new_mem_buf(crl_mem, crl_len)) == NULL) {
}
if (buflen > INT_MAX) {
- tls_set_errorx(ctx, TLS_ERROR_UNKNOWN,
+ tls_set_errorx(ctx, TLS_ERROR_INVALID_ARGUMENT,
"buflen too long");
goto out;
}
}
if (buflen > INT_MAX) {
- tls_set_errorx(ctx, TLS_ERROR_UNKNOWN,
+ tls_set_errorx(ctx, TLS_ERROR_INVALID_ARGUMENT,
"buflen too long");
goto out;
}
-/* $OpenBSD: tls.h,v 1.65 2024/03/26 08:54:48 joshua Exp $ */
+/* $OpenBSD: tls.h,v 1.66 2024/03/27 07:35:30 joshua Exp $ */
/*
* Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
*
#define TLS_ERROR_UNKNOWN 0x0000
#define TLS_ERROR_OUT_OF_MEMORY 0x1000
#define TLS_ERROR_INVALID_CONTEXT 0x2000
+#define TLS_ERROR_INVALID_ARGUMENT 0x2001
#endif
struct tls;
-/* $OpenBSD: tls_config.c,v 1.68 2024/03/26 06:24:52 joshua Exp $ */
+/* $OpenBSD: tls_config.c,v 1.69 2024/03/27 07:35:30 joshua Exp $ */
/*
* Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
*
q = s;
while ((p = strsep(&q, ",")) != NULL) {
if ((len = strlen(p)) == 0) {
- tls_config_set_errorx(config, TLS_ERROR_UNKNOWN,
+ tls_config_set_errorx(config, TLS_ERROR_INVALID_ARGUMENT,
"alpn protocol with zero length");
goto err;
}
if (len > 255) {
- tls_config_set_errorx(config, TLS_ERROR_UNKNOWN,
+ tls_config_set_errorx(config, TLS_ERROR_INVALID_ARGUMENT,
"alpn protocol too long");
goto err;
}