blob: d61d7c1b2ded0b1c6c603bf3b61eb6d9c91402d6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#include "error/s2n_errno.h"
#include "utils/s2n_safety.h"
#include "stuffer/s2n_stuffer.h"
#include "tls/s2n_tls.h"
#include "tls/s2n_tls13.h"
#include "tls/extensions/s2n_extension_list.h"
/**
* Specified in https://tools.ietf.org/html/rfc8446#section-4.3.1
*
* In all handshakes, the server MUST send the EncryptedExtensions
* message immediately after the ServerHello message.
*
* The EncryptedExtensions message contains extensions that can be
* protected, i.e., any which are not needed to establish the
* cryptographic context but which are not associated with individual
* certificates.
**/
int s2n_encrypted_extensions_send(struct s2n_connection *conn)
{
notnull_check(conn);
ENSURE_POSIX(conn->actual_protocol_version >= S2N_TLS13, S2N_ERR_BAD_MESSAGE);
struct s2n_stuffer *out = &conn->handshake.io;
GUARD(s2n_extension_list_send(S2N_EXTENSION_LIST_ENCRYPTED_EXTENSIONS, conn, out));
return S2N_SUCCESS;
}
int s2n_encrypted_extensions_recv(struct s2n_connection *conn)
{
notnull_check(conn);
ENSURE_POSIX(conn->actual_protocol_version >= S2N_TLS13, S2N_ERR_BAD_MESSAGE);
struct s2n_stuffer *in = &conn->handshake.io;
GUARD(s2n_extension_list_recv(S2N_EXTENSION_LIST_ENCRYPTED_EXTENSIONS, conn, in));
return S2N_SUCCESS;
}
|