]> git.ipfire.org Git - thirdparty/openssl.git/blame - ssl/record/methods/tlsany_meth.c
Distinguish between fatal and non-fatal errors when creating a record layer
[thirdparty/openssl.git] / ssl / record / methods / tlsany_meth.c
CommitLineData
50023e9b
MC
1/*
2 * Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
9
10#include <openssl/evp.h>
11#include "../../ssl_local.h"
12#include "../record_local.h"
13#include "recmethod_local.h"
14
15static int tls_any_set_crypto_state(OSSL_RECORD_LAYER *rl, int level,
16 unsigned char *key, size_t keylen,
17 unsigned char *iv, size_t ivlen,
18 unsigned char *mackey, size_t mackeylen,
19 const EVP_CIPHER *ciph,
20 size_t taglen,
21 /* TODO(RECLAYER): This probably should not be an int */
22 int mactype,
23 const EVP_MD *md,
24 const SSL_COMP *comp,
25 /* TODO(RECLAYER): Remove me */
26 SSL_CONNECTION *s)
27{
28 if (level != OSSL_RECORD_PROTECTION_LEVEL_NONE) {
7c293999
MC
29 ERR_raise(ERR_LIB_SSL, ERR_R_INTERNAL_ERROR);
30 return OSSL_RECORD_RETURN_FATAL;
50023e9b
MC
31 }
32
33 /* No crypto protection at the "NONE" level so nothing to be done */
34
7c293999 35 return OSSL_RECORD_RETURN_SUCCESS;
50023e9b
MC
36}
37
38static int tls_any_cipher(OSSL_RECORD_LAYER *rl, SSL3_RECORD *recs,
39 size_t n_recs, int sending, SSL_MAC_BUF *macs,
40 size_t macsize,
41 /* TODO(RECLAYER): Remove me */ SSL_CONNECTION *s)
42{
43 return 1;
44}
45
46struct record_functions_st tls_any_funcs = {
47 tls_any_set_crypto_state,
48 tls_any_cipher,
49 NULL
50};