diff options
author | David Benjamin <davidben@chromium.org> | 2014-09-20 12:28:58 -0400 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2014-09-22 16:43:56 +0000 |
commit | e113608a1c577b46512c61c7c482ee73d52d4531 (patch) | |
tree | 5d09062ee02e5fe2cb20d301fe0ccec82f932c6f | |
parent | 5127db3b4d59066126a1f8c8f7fdf4841a8c58b9 (diff) | |
download | src-e113608a1c577b46512c61c7c482ee73d52d4531.tar.gz |
Switch the reason code check to a compile-time assert.
It's just checking some constants. Also the comment's off now.
Change-Id: I934d32b76c705758ae7c18009d867e9820a4c5a8
Reviewed-on: https://boringssl-review.googlesource.com/1800
Reviewed-by: Adam Langley <agl@google.com>
-rw-r--r-- | ssl/ssl_lib.c | 7 | ||||
-rw-r--r-- | ssl/ssl_test.c | 8 |
2 files changed, 7 insertions, 8 deletions
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index 1ad825a..ec054d2 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -172,6 +172,13 @@ SSL3_ENC_METHOD ssl3_undef_enc_method={ int use_context)) ssl_undefined_function, }; +/* Some error codes are special. Ensure the make_errors.go script + * never regresses this. */ +OPENSSL_COMPILE_ASSERT( + SSL_R_TLSV1_ALERT_NO_RENEGOTIATION == + SSL_AD_NO_RENEGOTIATION + SSL_AD_REASON_OFFSET, + ssl_alert_reason_code_mismatch); + int SSL_clear(SSL *s) { diff --git a/ssl/ssl_test.c b/ssl/ssl_test.c index 97a1967..cc63268 100644 --- a/ssl/ssl_test.c +++ b/ssl/ssl_test.c @@ -17,14 +17,6 @@ #include "openssl/ssl.h" int main(void) { - /* Some error codes are special, but the make_errors.go script doesn't know - * this. This test will catch the case where something regenerates the error - * codes with the script but doesn't fix up the special ones. */ - if (SSL_R_TLSV1_ALERT_NO_RENEGOTIATION != 100 + SSL_AD_REASON_OFFSET) { - fprintf(stderr, "SSL alert errors don't match up.\n"); - return 1; - } - printf("PASS\n"); return 0; } |