Indentation adjustments.
authorGeorgios Kontaxis <redacted>
Tue, 15 May 2018 22:41:31 +0000 (15:41 -0700)
committerGeorgios Kontaxis <redacted>
Tue, 15 May 2018 22:50:30 +0000 (15:50 -0700)
scan/src/aux.h
scan/src/ciphersuites.h
scan/src/smtp.c
scan/src/tls.c
scan/src/tls.h
scan/src/tls_api.h

index bb57978b67251e776db34ee4ec7f8ac246324640..b3251b1317256deaa6f3ccb8099c99f4b0be97a3 100644 (file)
  */
 ssize_t read_bytes(int fd, void *buf, size_t count)
 {
-  size_t i = 0;
-  ssize_t r;
+       size_t i = 0;
+       ssize_t r;
 
-  while (i < count) {
-    r = read(fd, buf + i, count - i);
-    if (r == 0 || r == -1) {
+       while (i < count) {
+               r = read(fd, buf + i, count - i);
+               if (r == 0 || r == -1) {
                        if (r == 0) {
 #if __DEBUG__
                                fprintf(stderr, "EOF or peer has performed socket shutdown.\n");
 #endif
                        } else {
-             perror("read");
+                               perror("read");
                        }
-      return r;
-    }
-    i += r;
-  }
+                       return r;
+               }
+               i += r;
+       }
 
-  return count;
+       return count;
 }
 
 #endif
index 240c115b073b88f3bf51f79aa5259229300fcac1..64b3dcd3e6d7674723d9a643875ff403254773cd 100644 (file)
 
 /* Fallback to TLS 1.2 */
 #if NO(__SSL_3_0__) &&\
-    NO(__TLS_1_0__) &&\
+               NO(__TLS_1_0__) &&\
                NO(__RFC2712__) &&\
                NO(__RFC3268__) &&\
                NO(__DFTXP56__) &&\
                NO(__RFC4132__) &&\
                NO(__RFC4162__) &&\
                NO(__RFC4279__) &&\
-    NO(__TLS_1_1__) &&\
+               NO(__TLS_1_1__) &&\
                NO(__RFC4492__) &&\
                NO(__RFC5054__) &&\
-    NO(__TLS_1_2__) &&\
+               NO(__TLS_1_2__) &&\
                NO(__RFC5288__) &&\
                NO(__RFC5289__) &&\
                NO(__RFC5932__) &&\
 
 /* Version-specific definitions */
 /* SSL 3.0 */
-#if   YES(__SSL_3_0__) &&\
-       NO(__TLS_1_0__) &&\
-       NO(__TLS_1_1__) &&\
-       NO(__TLS_1_2__)
+#if YES(__SSL_3_0__) &&\
+                NO(__TLS_1_0__) &&\
+                NO(__TLS_1_1__) &&\
+                NO(__TLS_1_2__)
        #undef  PROTOCOLMAJOR
        #undef  PROTOCOLMINOR
        #define PROTOCOLMAJOR 3
        #define CIPHERSUITEMANDATORY 0x0000 /* TLS_NULL_WITH_NULL_NULL */
 /* TLS 1.0 */
 #elif  NO(__SSL_3_0__) &&\
-      YES(__TLS_1_0__) &&\
-       NO(__TLS_1_1__) &&\
-       NO(__TLS_1_2__)
+                       YES(__TLS_1_0__) &&\
+                        NO(__TLS_1_1__) &&\
+                        NO(__TLS_1_2__)
        #undef  PROTOCOLMAJOR
        #undef  PROTOCOLMINOR
        #define PROTOCOLMAJOR 3
        #define CIPHERSUITEMANDATORY 0x0013 /* TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA */
 /* TLS 1.1 */
 #elif  NO(__SSL_3_0__) &&\
-       NO(__TLS_1_0__) &&\
-      YES(__TLS_1_1__) &&\
-       NO(__TLS_1_2__)
+                        NO(__TLS_1_0__) &&\
+                       YES(__TLS_1_1__) &&\
+                        NO(__TLS_1_2__)
        #undef  PROTOCOLMAJOR
        #undef  PROTOCOLMINOR
        #define PROTOCOLMAJOR 3
        #define CIPHERSUITEMANDATORY 0x000A /* TLS_RSA_WITH_3DES_EDE_CBC_SHA */
 /* TLS 1.2 */
 #elif  NO(__SSL_3_0__) &&\
-       NO(__TLS_1_0__) &&\
-       NO(__TLS_1_1__) &&\
-      YES(__TLS_1_2__)
+                        NO(__TLS_1_0__) &&\
+                        NO(__TLS_1_1__) &&\
+                       YES(__TLS_1_2__)
        #undef  PROTOCOLMAJOR
        #undef  PROTOCOLMINOR
        #define PROTOCOLMAJOR 3
index d84a6ec3ef8733dce5aa4aca7e7a987ed583a26d..eb06e94ede2bb2dcdc032286552c6d8112a6ee47 100644 (file)
@@ -332,23 +332,23 @@ int open_dump_file (char * opt_dump_dir, uint16_t suite)
        }
 
        /* Open file descriptor to dump entire TLS conversation */
-  char *s = strdup(tls_suite_name(suite));
-  for (r = strlen(s) - 1; r >= 0 && isspace(s[r]); r--) {
-    s[r] = '\0';
-  }
-  char tls_out_filename[0xFFFF]; /* should be enough :D */
-  snprintf(tls_out_filename, sizeof(tls_out_filename),
-    "%s/%s.%u.%u.0x%04x_%s", opt_dump_dir, "ssl",
+       char *s = strdup(tls_suite_name(suite));
+       for (r = strlen(s) - 1; r >= 0 && isspace(s[r]); r--) {
+               s[r] = '\0';
+       }
+       char tls_out_filename[0xFFFF]; /* should be enough :D */
+       snprintf(tls_out_filename, sizeof(tls_out_filename),
+               "%s/%s.%u.%u.0x%04x_%s", opt_dump_dir, "ssl",
                (uint8_t) tls_suite_version_major(),
-    (uint8_t) tls_suite_version_minor(), (uint16_t) suite, s);
-  if (s) {
-    free(s);
-  }
+               (uint8_t) tls_suite_version_minor(), (uint16_t) suite, s);
+       if (s) {
+               free(s);
+       }
 
        if ((r = open(tls_out_filename, O_CREAT | O_RDWR | O_TRUNC,
-      S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) == -1) {
-      perror("open");
-  }
+                       S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) == -1) {
+                       perror("open");
+       }
 
        return r;
 }
@@ -571,7 +571,7 @@ int main(int argc, char**argv)
 
        /* If specific ciphersuites have been specified, do only use those. 
         * Else, go over all ciphersuites assuming the target supports STARTTLS.
-   * Abort on SMTP error. */
+        * Abort on SMTP error. */
        for (x = 0; x < CipherSuite_count; x++) {
                /* Set ciphersuite(s) to be used */
                tls_init();
index af593f6f74b1e0bdf50970b9b70dadeeb3f8a246..ec41340874d68ffc4a451c99cefcf859cc2e5ce4 100644 (file)
@@ -84,7 +84,7 @@ int tls_process_Handshake_ClientHello()
        must_read_bytes = n24toh32(tls_Handshake_header.Handshake__length);
 
        /* Read up to the session ID length byte. Since the session ID
-   * is of variable length we need to figure out how much to read as such. */
+        * is of variable length we need to figure out how much to read as such. */
 
        if (read_bytes(tls_in, &tls_ClientHello_intro,
                sizeof(tls_ClientHello_intro)) <= 0) {
@@ -141,7 +141,7 @@ int tls_process_Handshake_ClientHello()
                }
        }
 
-  /* Now we know we must read session_id_length bytes */
+       /* Now we know we must read session_id_length bytes */
 
        assert(tls_ClientHello_session.session_id_length <=
                sizeof(tls_ClientHello_session.session_id));
@@ -391,7 +391,7 @@ int tls_process_Handshake_ServerHello()
        must_read_bytes = n24toh32(tls_Handshake_header.Handshake__length);
 
        /* Read up to the session ID length byte. Since the session ID
-   * is of variable length we need to figure out how much to read as such. */
+        * is of variable length we need to figure out how much to read as such. */
 
        if (read_bytes(tls_in, &tls_ServerHello_intro,
                sizeof(tls_ServerHello_intro)) <= 0) {
@@ -453,7 +453,7 @@ int tls_process_Handshake_ServerHello()
                }
        }
 
-  /* Now we know we must read session_id_length bytes */
+       /* Now we know we must read session_id_length bytes */
 
        assert(tls_ServerHello_session.session_id_length <=
                sizeof(tls_ServerHello_session.session_id));
@@ -1004,10 +1004,10 @@ int _tls()
                                                n24toh32(tls_Handshake_header.Handshake__length));
 #endif
 
-          /* The record layer fragments information blocks (e.g., handshake
+                                       /* The record layer fragments information blocks (e.g., handshake
                                         * messages or application data) into TLSPlaintext records carrying
                                         * data in chunks of 2^14 bytes or less.*/
-          assert(ntohs(tls_TLSPlaintext_header.TLSPlaintext__length) <= 0x4000);
+                                       assert(ntohs(tls_TLSPlaintext_header.TLSPlaintext__length) <= 0x4000);
 
 #if 1
                                        /* We can't handle fragmentation right now.
@@ -1528,14 +1528,14 @@ int tls_error()
 
 void tls_print_suites()
 {
-  uint16_t i;
-
-  for (i = 0; i < CIPHERSUITES; i++) {
-    fprintf(stderr,
-      "%3u CipherSuite %s = { 0x%02X,0x%02X };\n",
-      CipherSuites[i], CIPHER_TXT(CipherSuites[i]),
-      CipherSuites[i] >> 8, CipherSuites[i] & 0xFF);
-  }
+       uint16_t i;
+
+       for (i = 0; i < CIPHERSUITES; i++) {
+               fprintf(stderr,
+                       "%3u CipherSuite %s = { 0x%02X,0x%02X };\n",
+                       CipherSuites[i], CIPHER_TXT(CipherSuites[i]),
+                       CipherSuites[i] >> 8, CipherSuites[i] & 0xFF);
+       }
 }
 
 CipherSuite * tls_suites()
@@ -1555,9 +1555,9 @@ const char * tls_suite_name(uint16_t n)
 
 void tls_print_version()
 {
-  fprintf(stderr, "SSL/TLS protocol_version:%u.%u\n",
-    PROTOCOLMAJOR, PROTOCOLMINOR);
-  fprintf(stderr, "Available cipher_suites:%u\n", CIPHERSUITES);
+       fprintf(stderr, "SSL/TLS protocol_version:%u.%u\n",
+               PROTOCOLMAJOR, PROTOCOLMINOR);
+       fprintf(stderr, "Available cipher_suites:%u\n", CIPHERSUITES);
 }
 
 uint8_t tls_stat_flags (void)
index 666fcfac344580dc42dc44d2db7ec5a8febc409b..2cddcd7a1d168368c2d92e9a7bc09dc837a2f5df 100644 (file)
@@ -285,7 +285,7 @@ const char * tls_HashAlgorithmNames[TLS_HASH_ALGORITHMS_MAX + 1] = {
 };
 
 #define TLS_HASH_ALGORITHM_TXT(n) \
-  (((n) >= 0 && (n) <= TLS_HASH_ALGORITHMS_MAX) ? \
+       (((n) >= 0 && (n) <= TLS_HASH_ALGORITHMS_MAX) ? \
                tls_HashAlgorithmNames[(n)] : "ERR_NOT_IMPLEMENTED")
 
 #define TLS_SIGNATURE_ALGORITHMS_MAX 3
@@ -298,7 +298,7 @@ const char * tls_SignatureAlgorithmNames[TLS_SIGNATURE_ALGORITHMS_MAX + 1] = {
 };
 
 #define TLS_SIGNATURE_ALGORITHM_TXT(n) \
-  (((n) >= 0 && (n) <= TLS_SIGNATURE_ALGORITHMS_MAX) ? \
+       (((n) >= 0 && (n) <= TLS_SIGNATURE_ALGORITHMS_MAX) ? \
                tls_SignatureAlgorithmNames[(n)] : "ERR_NOT_IMPLEMENTED")
 
 struct __attribute__((__packed__))
index 37311aecbdf4ca47a218de2eb93f4d2f3222f044..9bb78b7e9ead00a26bf07ed45b453735ca157fb8 100644 (file)
@@ -45,13 +45,13 @@ struct __attribute__((__packed__)) Signature {
 #define SERVER_KEYEXCHANGE_UNKNOWN  0x0
 #define SERVER_KEYEXCHANGE_DHPARAMS 0x7
 struct __attribute__((__packed__)) ServerKeyExchange_DHparams {
-  struct ServerDHParams  *params;
+       struct ServerDHParams  *params;
 };
 #define SERVER_KEYEXCHANGE_DHPARAMS_SIGNATURE (\
        0x3 | SERVER_KEYEXCHANGE_DHPARAMS)
 struct __attribute__((__packed__)) ServerKeyExchange_DHparams_signature {
-  struct ServerDHParams  *params;
-  struct DigitallySigned *signed_params;
+       struct ServerDHParams  *params;
+       struct DigitallySigned *signed_params;
 };
 int tls_set_callback_handshake_server_key_exchange (int (*handler)(
        uint8_t *ServerKeyExchange, uint32_t ServerKeyExchangeType));
git clone https://git.99rst.org/PROJECT