| 77 | } |
| 78 | |
| 79 | int |
| 80 | SSL_CTX_set_max_proto_version(SSL_CTX *ctx, int version) |
| 81 | { |
| 82 | int ssl_options = 0; |
| 83 | |
| 84 | AssertArg(version != 0); |
| 85 | |
| 86 | /* |
| 87 | * Some OpenSSL versions define TLS*_VERSION macros but not the |
| 88 | * corresponding SSL_OP_NO_* macro, so in those cases we have to return |
| 89 | * unsuccessfully here. |
| 90 | */ |
| 91 | #ifdef TLS1_1_VERSION |
| 92 | if (version < TLS1_1_VERSION) |
| 93 | { |
| 94 | #ifdef SSL_OP_NO_TLSv1_1 |
| 95 | ssl_options |= SSL_OP_NO_TLSv1_1; |
| 96 | #else |
| 97 | return 0; |
| 98 | #endif |
| 99 | } |
| 100 | #endif |
| 101 | #ifdef TLS1_2_VERSION |
| 102 | if (version < TLS1_2_VERSION) |
| 103 | { |
| 104 | #ifdef SSL_OP_NO_TLSv1_2 |
| 105 | ssl_options |= SSL_OP_NO_TLSv1_2; |
| 106 | #else |
| 107 | return 0; |
| 108 | #endif |
| 109 | } |
| 110 | #endif |
| 111 | |
| 112 | SSL_CTX_set_options(ctx, ssl_options); |
| 113 | |
| 114 | return 1; /* success */ |
| 115 | } |
| 116 | |
| 117 | #endif /* !SSL_CTX_set_min_proto_version */ |
no outgoing calls
no test coverage detected