Skip to content

Commit

Permalink
Clang-format tests/unit/s2n_[d-k].*\.c and enforce in CI (aws#3676)
Browse files Browse the repository at this point in the history
  • Loading branch information
harrisonkaiser authored Dec 8, 2022
1 parent fefc48b commit 2f9c7a4
Show file tree
Hide file tree
Showing 45 changed files with 1,345 additions and 1,526 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci_clang_format_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- check: 'tests/testlib'
exclude: ''
- check: 'tests/unit'
exclude: "s2n_[^3a].*\\.c"
exclude: "s2n_[^3ad-k].*\\.c"
- check: 'tls'
exclude: "(tls\\/extensions)|(s2n_[a-hs-z].*\\.[ch])"
- check: 'tls/extensions'
Expand Down
31 changes: 18 additions & 13 deletions tests/unit/s2n_drain_alert_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,15 @@
* permissions and limitations under the License.
*/

#include "s2n_test.h"

#include "testlib/s2n_testlib.h"

#include <unistd.h>
#include <stdint.h>
#include <unistd.h>

#include "api/s2n.h"
#include "s2n_test.h"
#include "testlib/s2n_testlib.h"

#define ZERO_TO_THIRTY_ONE 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, \
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F
#define ZERO_TO_THIRTY_ONE 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, \
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F

#define INTERNAL_ERROR_ALERT_HEX 0x50

Expand Down Expand Up @@ -61,27 +59,34 @@ int main(int argc, char **argv)
/* Handshake message type CLIENT HELLO */
0x01,
/* Body len */
(body_len >> 16) & 0xff, (body_len >> 8) & 0xff, (body_len & 0xff),
(body_len >> 16) & 0xff,
(body_len >> 8) & 0xff,
(body_len & 0xff),
};
size_t message_len = sizeof(message_header) + body_len;
uint8_t record_header[] = {
/* Record type HANDSHAKE */
0x16,
/* Protocol version TLS 1.2 */
0x03, 0x03,
0x03,
0x03,
/* Message len */
(message_len >> 8) & 0xff, (message_len & 0xff),
(message_len >> 8) & 0xff,
(message_len & 0xff),
};

uint8_t alert_record[] = {
/* Record type ALERT */
0x15,
/* Protocol version TLS 1.2 */
0x03, 0x03,
0x03,
0x03,
/* Length */
0x00, 0x02,
0x00,
0x02,
/* Fatal alert "internal_error" */
0x02, INTERNAL_ERROR_ALERT_HEX,
0x02,
INTERNAL_ERROR_ALERT_HEX,
};

struct s2n_connection *server_conn;
Expand Down
378 changes: 187 additions & 191 deletions tests/unit/s2n_drbg_test.c

Large diffs are not rendered by default.

Loading

0 comments on commit 2f9c7a4

Please sign in to comment.