1 1.1 christos /* tls-macos.h 2 1.1 christos * 3 1.1 christos * Copyright (c) 2020-2021 Apple Inc. All rights reserved. 4 1.1 christos * 5 1.1 christos * Licensed under the Apache License, Version 2.0 (the "License"); 6 1.1 christos * you may not use this file except in compliance with the License. 7 1.1 christos * You may obtain a copy of the License at 8 1.1 christos * 9 1.1 christos * https://www.apache.org/licenses/LICENSE-2.0 10 1.1 christos * 11 1.1 christos * Unless required by applicable law or agreed to in writing, software 12 1.1 christos * distributed under the License is distributed on an "AS IS" BASIS, 13 1.1 christos * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 1.1 christos * See the License for the specific language governing permissions and 15 1.1 christos * limitations under the License. 16 1.1 christos * 17 1.1 christos * Definitions for getting TLS certificate and setting TLS. 18 1.1 christos */ 19 1.1 christos 20 1.1 christos #ifndef __DNSSD_PROXY_TLS_APPLE_H__ 21 1.1 christos #define __DNSSD_PROXY_TLS_APPLE_H__ 22 1.1 christos 23 1.1 christos #include <stdio.h> 24 1.1 christos #include <Security/SecKey.h> 25 1.1 christos #include <Network/Network.h> 26 1.1 christos #include <CoreUtils/CoreUtils.h> // For OSStatus. 27 1.1 christos 28 1.1 christos //====================================================================================================================== 29 1.1 christos // MARK: - Structures 30 1.1 christos 31 1.1 christos typedef struct tls_config_context tls_config_context_t; 32 1.1 christos struct tls_config_context { 33 1.1 christos nw_protocol_options_t tls_options; 34 1.1 christos dispatch_queue_t queue; 35 1.1 christos }; 36 1.1 christos 37 1.1 christos //====================================================================================================================== 38 1.1 christos // MARK: - Function Declarations 39 1.1 christos 40 1.1 christos /*! 41 1.1 christos * @brief 42 1.1 christos * Get identity (the combination of private key and certificate) from keychain, or generate a new one if there is no existing identity in keychain. 43 1.1 christos * 44 1.1 christos * @result 45 1.1 christos * Returns true if identity is fetched successfully. 46 1.1 christos * 47 1.1 christos * @discussion 48 1.1 christos * The certificate being generated is a self-signed one, which means there will be no CA to veriry this trustworthiness of certificate. 49 1.1 christos */ 50 1.1 christos bool 51 1.1 christos srp_tls_init(void); 52 1.1 christos 53 1.1 christos #endif /* #ifndef __DNSSD_PROXY_TLS_APPLE_H__ */ 54