3 * Copyright (c) 2019 Apple Computer, Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * TLS Shim definitions. These entry points should in principle work for any TLS
18 * library, with the addition of a single shim file, for example tls-mbedtls.c.
23 // Anonymous key structure, depends on the target.
24 typedef struct srp_key srp_key_t
;
26 #ifdef SRP_CRYPTO_MBEDTLS_INTERNAL
27 #include <mbedtls/certs.h>
28 #include <mbedtls/x509.h>
29 #include <mbedtls/ssl.h>
32 struct mbedtls_ssl_context context
;
33 enum { handshake_in_progress
, handshake_complete
} state
;
35 #endif // SRP_CRYPTO_MBEDTLS_INTERNAL
38 bool srp_tls_init(void);
39 bool srp_tls_client_init(void);
40 bool srp_tls_server_init(const char *NULLABLE cacert_file
,
41 const char *NULLABLE srvcrt_file
, const char *NULLABLE server_key_file
);
42 bool srp_tls_accept_setup(comm_t
*NONNULL comm
);
43 bool srp_tls_listen_callback(comm_t
*NONNULL comm
);
44 bool srp_tls_connect_callback(comm_t
*NONNULL comm
);
45 ssize_t
srp_tls_read(comm_t
*NONNULL comm
, unsigned char *NONNULL buf
, size_t max
);
46 void srp_tls_context_free(comm_t
*NONNULL comm
);
47 ssize_t
srp_tls_write(comm_t
*NONNULL comm
, struct iovec
*NONNULL iov
, int iov_len
);
54 // c-file-style: "bsd"
57 // indent-tabs-mode: nil