Changeset 5405
- Timestamp:
- 03/15/08 09:30:40 (7 months ago)
- Files:
-
- libwired/trunk/libwired/net/wi-socket.c (modified) (3 diffs)
- libwired/trunk/libwired/net/wi-socket.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
libwired/trunk/libwired/net/wi-socket.c
r5393 r5405 228 228 229 229 230 wi_socket_tls_t * wi_socket_tls_init(wi_socket_tls_t *tls) { 231 return tls; 232 } 233 234 235 236 static void _wi_socket_tls_dealloc(wi_runtime_instance_t *instance) { 237 #ifdef WI_SSL 238 wi_socket_tls_t *tls = instance; 239 240 if(tls->ssl_ctx) 241 SSL_CTX_free(tls->ssl_ctx); 242 243 if(tls->dh) 244 DH_free(tls->dh); 245 #endif 246 } 247 248 249 250 #pragma mark - 251 252 wi_boolean_t wi_socket_tls_set_type(wi_socket_tls_t *tls, wi_socket_tls_type_t type) { 253 #ifdef WI_SSL 254 SSL_METHOD *method = NULL; 230 wi_socket_tls_t * wi_socket_tls_init_with_type(wi_socket_tls_t *tls, wi_socket_tls_type_t type) { 231 #ifdef WI_SSL 232 SSL_METHOD *method; 255 233 256 234 switch(type) { 235 default: 257 236 case WI_SOCKET_TLS_CLIENT: 258 237 method = TLSv1_client_method(); … … 269 248 wi_error_set_openssl_error(); 270 249 271 return false; 250 wi_release(NULL); 251 252 return NULL; 272 253 } 273 254 … … 275 256 SSL_CTX_set_quiet_shutdown(tls->ssl_ctx, 1); 276 257 277 return t rue;258 return tls; 278 259 #else 279 260 wi_error_set_libwired_error(WI_ERROR_SOCKET_NOSSL); 280 261 281 return false; 282 #endif 283 } 284 285 262 return NULL; 263 #endif 264 } 265 266 267 268 static void _wi_socket_tls_dealloc(wi_runtime_instance_t *instance) { 269 #ifdef WI_SSL 270 wi_socket_tls_t *tls = instance; 271 272 if(tls->ssl_ctx) 273 SSL_CTX_free(tls->ssl_ctx); 274 275 if(tls->dh) 276 DH_free(tls->dh); 277 #endif 278 } 279 280 281 282 #pragma mark - 286 283 287 284 wi_boolean_t wi_socket_tls_set_certificate(wi_socket_tls_t *tls, wi_x509_t *x509) { libwired/trunk/libwired/net/wi-socket.h
r5401 r5405 76 76 77 77 WI_EXPORT wi_socket_tls_t * wi_socket_tls_alloc(void); 78 WI_EXPORT wi_socket_tls_t * wi_socket_tls_init (wi_socket_tls_t *);78 WI_EXPORT wi_socket_tls_t * wi_socket_tls_init_with_type(wi_socket_tls_t *, wi_socket_tls_type_t); 79 79 80 WI_EXPORT wi_boolean_t wi_socket_tls_set_type(wi_socket_tls_t *, wi_socket_tls_type_t);81 80 WI_EXPORT wi_boolean_t wi_socket_tls_set_certificate(wi_socket_tls_t *, wi_x509_t *); 82 81 WI_EXPORT wi_boolean_t wi_socket_tls_set_private_key(wi_socket_tls_t *, wi_rsa_t *);
