| 1 |
/* |
| 2 |
* |
| 3 |
* Licensed to the Apache Software Foundation (ASF) under one |
| 4 |
* or more contributor license agreements. See the NOTICE file |
| 5 |
* distributed with this work for additional information |
| 6 |
* regarding copyright ownership. The ASF licenses this file |
| 7 |
* to you under the Apache License, Version 2.0 (the |
| 8 |
* "License"); you may not use this file except in compliance |
| 9 |
* with the License. You may obtain a copy of the License at |
| 10 |
* |
| 11 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 12 |
* |
| 13 |
* Unless required by applicable law or agreed to in writing, |
| 14 |
* software distributed under the License is distributed on an |
| 15 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 16 |
* KIND, either express or implied. See the License for the |
| 17 |
* specific language governing permissions and limitations |
| 18 |
* under the License. |
| 19 |
* |
| 20 |
*/ |
| 21 |
|
| 22 |
#include <proton/ssl.h> |
| 23 |
#include <proton/error.h> |
| 24 |
#include <proton/transport.h> |
| 25 |
#include "core/engine-internal.h" |
| 26 |
|
| 27 |
|
| 28 |
/** @file |
| 29 |
* SSL/TLS support API. |
| 30 |
* |
| 31 |
* This file contains stub implementations of the SSL/TLS API. This implementation is |
| 32 |
* used if there is no SSL/TLS support in the system's environment. |
| 33 |
*/ |
| 34 |
|
| 35 |
bool pn_ssl_present(void) |
| 36 |
{ |
| 37 |
return false; |
| 38 |
} |
| 39 |
|
| 40 |
pn_ssl_t *pn_ssl(pn_transport_t *transport) |
| 41 |
{ |
| 42 |
return NULL; |
| 43 |
} |
| 44 |
|
| 45 |
int pn_ssl_init(pn_ssl_t *ssl, pn_ssl_domain_t *domain, |
| 46 |
const char *session_id) |
| 47 |
{ |
| 48 |
return -1; |
| 49 |
} |
| 50 |
|
| 51 |
void pn_ssl_free(pn_transport_t *transport) |
| 52 |
{ |
| 53 |
} |
| 54 |
|
| 55 |
void pn_ssl_trace(pn_ssl_t *ssl, pn_trace_t trace) |
| 56 |
{ |
| 57 |
} |
| 58 |
|
| 59 |
ssize_t pn_ssl_input(pn_transport_t *transport, unsigned int layer, const char *bytes, size_t available) |
| 60 |
{ |
| 61 |
return PN_EOS; |
| 62 |
} |
| 63 |
|
| 64 |
ssize_t pn_ssl_output(pn_transport_t *transport, unsigned int layer, char *buffer, size_t max_size) |
| 65 |
{ |
| 66 |
return PN_EOS; |
| 67 |
} |
| 68 |
|
| 69 |
const pn_io_layer_t ssl_layer = { |
| 70 |
pn_ssl_input, |
| 71 |
pn_ssl_output, |
| 72 |
NULL, |
| 73 |
NULL |
| 74 |
}; |
| 75 |
|
| 76 |
bool pn_ssl_get_cipher_name(pn_ssl_t *ssl, char *buffer, size_t size) |
| 77 |
{ |
| 78 |
*buffer = '\0'; |
| 79 |
return false; |
| 80 |
} |
| 81 |
|
| 82 |
bool pn_ssl_get_protocol_name(pn_ssl_t *ssl, char *buffer, size_t size) |
| 83 |
{ |
| 84 |
*buffer = '\0'; |
| 85 |
return false; |
| 86 |
} |
| 87 |
|
| 88 |
pn_ssl_domain_t *pn_ssl_domain( pn_ssl_mode_t mode) |
| 89 |
{ |
| 90 |
return NULL; |
| 91 |
} |
| 92 |
|
| 93 |
void pn_ssl_domain_free( pn_ssl_domain_t *d ) |
| 94 |
{ |
| 95 |
} |
| 96 |
|
| 97 |
int pn_ssl_domain_set_credentials( pn_ssl_domain_t *domain, |
| 98 |
const char *certificate_file, |
| 99 |
const char *private_key_file, |
| 100 |
const char *password) |
| 101 |
{ |
| 102 |
return -1; |
| 103 |
} |
| 104 |
|
| 105 |
int pn_ssl_domain_set_trusted_ca_db(pn_ssl_domain_t *domain, |
| 106 |
const char *certificate_db) |
| 107 |
{ |
| 108 |
return -1; |
| 109 |
} |
| 110 |
|
| 111 |
int pn_ssl_domain_set_peer_authentication(pn_ssl_domain_t *domain, |
| 112 |
const pn_ssl_verify_mode_t mode, |
| 113 |
const char *trusted_CAs) |
| 114 |
{ |
| 115 |
return -1; |
| 116 |
} |
| 117 |
|
| 118 |
int pn_ssl_domain_allow_unsecured_client(pn_ssl_domain_t *domain) |
| 119 |
{ |
| 120 |
return -1; |
| 121 |
} |
| 122 |
|
| 123 |
int pn_ssl_domain_set_ciphers(pn_ssl_domain_t *domain, const char *ciphers) |
| 124 |
{ |
| 125 |
return -1; |
| 126 |
} |
| 127 |
|
| 128 |
int pn_ssl_domain_set_protocols(pn_ssl_domain_t* domain, const char* protocols) |
| 129 |
{ |
| 130 |
return -1; |
| 131 |
} |
| 132 |
|
| 133 |
bool pn_ssl_allow_unsecured(pn_ssl_t *ssl) |
| 134 |
{ |
| 135 |
return true; |
| 136 |
} |
| 137 |
|
| 138 |
pn_ssl_resume_status_t pn_ssl_resume_status( pn_ssl_t *s ) |
| 139 |
{ |
| 140 |
return PN_SSL_RESUME_UNKNOWN; |
| 141 |
} |
| 142 |
|
| 143 |
int pn_ssl_set_peer_hostname( pn_ssl_t *ssl, const char *hostname) |
| 144 |
{ |
| 145 |
return -1; |
| 146 |
} |
| 147 |
|
| 148 |
int pn_ssl_get_peer_hostname( pn_ssl_t *ssl, char *hostname, size_t *bufsize ) |
| 149 |
{ |
| 150 |
return -1; |
| 151 |
} |
| 152 |
|
| 153 |
const char* pn_ssl_get_remote_subject(pn_ssl_t *ssl) |
| 154 |
{ |
| 155 |
return NULL; |
| 156 |
} |
| 157 |
|
| 158 |
int pn_ssl_get_ssf(pn_ssl_t *ssl) |
| 159 |
{ |
| 160 |
return 0; |
| 161 |
} |
| 162 |
|
| 163 |
int pn_ssl_get_cert_fingerprint(pn_ssl_t *ssl0, char *fingerprint, size_t fingerprint_length, pn_ssl_hash_alg hash_alg) |
| 164 |
{ |
| 165 |
*fingerprint = '\0'; |
| 166 |
return -1; |
| 167 |
} |
| 168 |
|
| 169 |
const char* pn_ssl_get_remote_subject_subfield(pn_ssl_t *ssl0, pn_ssl_cert_subject_subfield field) |
| 170 |
{ |
| 171 |
return NULL; |
| 172 |
} |