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>
This commit is contained in:
David Benjamin 2014-09-20 12:28:58 -04:00 committed by Adam Langley
parent 5127db3b4d
commit e113608a1c
2 changed files with 7 additions and 8 deletions

View File

@ -172,6 +172,13 @@ SSL3_ENC_METHOD ssl3_undef_enc_method={
int use_context)) ssl_undefined_function, 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) int SSL_clear(SSL *s)
{ {

View File

@ -17,14 +17,6 @@
#include "openssl/ssl.h" #include "openssl/ssl.h"
int main(void) { 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"); printf("PASS\n");
return 0; return 0;
} }