| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 |
| 16 | #include <openssl/ssl.h> |
| 17 |
| 18 | #include <assert.h> |
| 19 |
| 20 | #include "internal.h" |
| 21 |
| 22 |
| 23 | const char *SSL_state_string_long(const SSL *ssl) { |
| 24 | if (ssl->s3->hs == nullptr) { |
| 25 | return "SSL negotiation finished successfully"; |
| 26 | } |
| 27 |
| 28 | return ssl->server ? ssl_server_handshake_state(ssl->s3->hs.get()) |
| 29 | : ssl_client_handshake_state(ssl->s3->hs.get()); |
| 30 | } |
| 31 |
| 32 | const char *SSL_state_string(const SSL *ssl) { return "!!!!!!"; } |
| 33 |
| 34 | const char *SSL_alert_type_string_long(int value) { |
| 35 | value >>= 8; |
| 36 | if (value == SSL3_AL_WARNING) { |
| 37 | return "warning"; |
| 38 | } else if (value == SSL3_AL_FATAL) { |
| 39 | return "fatal"; |
| 40 | } |
| 41 |
| 42 | return "unknown"; |
| 43 | } |
| 44 |
| 45 | const char *SSL_alert_type_string(int value) { return "!"; } |
| 46 |
| 47 | const char *SSL_alert_desc_string(int value) { return "!!"; } |
| 48 |
| 49 | const char *SSL_alert_desc_string_long(int value) { |
| 50 | switch (value & 0xff) { |
| 51 | case SSL3_AD_CLOSE_NOTIFY: |
| 52 | return "close notify"; |
| 53 |
| 54 | case SSL3_AD_UNEXPECTED_MESSAGE: |
| 55 | return "unexpected_message"; |
| 56 |
| 57 | case SSL3_AD_BAD_RECORD_MAC: |
| 58 | return "bad record mac"; |
| 59 |
| 60 | case SSL3_AD_DECOMPRESSION_FAILURE: |
| 61 | return "decompression failure"; |
| 62 |
| 63 | case SSL3_AD_HANDSHAKE_FAILURE: |
| 64 | return "handshake failure"; |
| 65 |
| 66 | case SSL3_AD_NO_CERTIFICATE: |
| 67 | return "no certificate"; |
| 68 |
| 69 | case SSL3_AD_BAD_CERTIFICATE: |
| 70 | return "bad certificate"; |
| 71 |
| 72 | case SSL3_AD_UNSUPPORTED_CERTIFICATE: |
| 73 | return "unsupported certificate"; |
| 74 |
| 75 | case SSL3_AD_CERTIFICATE_REVOKED: |
| 76 | return "certificate revoked"; |
| 77 |
| 78 | case SSL3_AD_CERTIFICATE_EXPIRED: |
| 79 | return "certificate expired"; |
| 80 |
| 81 | case SSL3_AD_CERTIFICATE_UNKNOWN: |
| 82 | return "certificate unknown"; |
| 83 |
| 84 | case SSL3_AD_ILLEGAL_PARAMETER: |
| 85 | return "illegal parameter"; |
| 86 |
| 87 | case TLS1_AD_DECRYPTION_FAILED: |
| 88 | return "decryption failed"; |
| 89 |
| 90 | case TLS1_AD_RECORD_OVERFLOW: |
| 91 | return "record overflow"; |
| 92 |
| 93 | case TLS1_AD_UNKNOWN_CA: |
| 94 | return "unknown CA"; |
| 95 |
| 96 | case TLS1_AD_ACCESS_DENIED: |
| 97 | return "access denied"; |
| 98 |
| 99 | case TLS1_AD_DECODE_ERROR: |
| 100 | return "decode error"; |
| 101 |
| 102 | case TLS1_AD_DECRYPT_ERROR: |
| 103 | return "decrypt error"; |
| 104 |
| 105 | case TLS1_AD_EXPORT_RESTRICTION: |
| 106 | return "export restriction"; |
| 107 |
| 108 | case TLS1_AD_PROTOCOL_VERSION: |
| 109 | return "protocol version"; |
| 110 |
| 111 | case TLS1_AD_INSUFFICIENT_SECURITY: |
| 112 | return "insufficient security"; |
| 113 |
| 114 | case TLS1_AD_INTERNAL_ERROR: |
| 115 | return "internal error"; |
| 116 |
| 117 | case SSL3_AD_INAPPROPRIATE_FALLBACK: |
| 118 | return "inappropriate fallback"; |
| 119 |
| 120 | case TLS1_AD_USER_CANCELLED: |
| 121 | return "user canceled"; |
| 122 |
| 123 | case TLS1_AD_NO_RENEGOTIATION: |
| 124 | return "no renegotiation"; |
| 125 |
| 126 | case TLS1_AD_MISSING_EXTENSION: |
| 127 | return "missing extension"; |
| 128 |
| 129 | case TLS1_AD_UNSUPPORTED_EXTENSION: |
| 130 | return "unsupported extension"; |
| 131 |
| 132 | case TLS1_AD_CERTIFICATE_UNOBTAINABLE: |
| 133 | return "certificate unobtainable"; |
| 134 |
| 135 | case TLS1_AD_UNRECOGNIZED_NAME: |
| 136 | return "unrecognized name"; |
| 137 |
| 138 | case TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE: |
| 139 | return "bad certificate status response"; |
| 140 |
| 141 | case TLS1_AD_BAD_CERTIFICATE_HASH_VALUE: |
| 142 | return "bad certificate hash value"; |
| 143 |
| 144 | case TLS1_AD_UNKNOWN_PSK_IDENTITY: |
| 145 | return "unknown PSK identity"; |
| 146 |
| 147 | case TLS1_AD_CERTIFICATE_REQUIRED: |
| 148 | return "certificate required"; |
| 149 |
| 150 | case TLS1_AD_NO_APPLICATION_PROTOCOL: |
| 151 | return "no application protocol"; |
| 152 |
| 153 | case TLS1_AD_ECH_REQUIRED: |
| 154 | return "ECH required"; |
| 155 |
| 156 | default: |
| 157 | return "unknown"; |
| 158 | } |
| 159 | } |
| 160 |