Skip to content

Commit

Permalink
clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
i110 committed Feb 22, 2024
1 parent eb013f7 commit 28da922
Show file tree
Hide file tree
Showing 8 changed files with 248 additions and 322 deletions.
2 changes: 1 addition & 1 deletion lib/chacha20poly1305.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ static void chacha20poly1305_set_iv(ptls_aead_context_t *_ctx, const void *iv)
struct chacha20poly1305_context_t *ctx = (struct chacha20poly1305_context_t *)_ctx;

memcpy(ctx->static_iv, iv, sizeof(ctx->static_iv));
}
}

static int chacha20poly1305_setup_crypto(ptls_aead_context_t *_ctx, int is_enc, const void *key, const void *iv,
ptls_cipher_algorithm_t *chacha,
Expand Down
24 changes: 10 additions & 14 deletions lib/cifra.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,20 @@
#include "picotls.h"
#include "picotls/minicrypto.h"

ptls_cipher_suite_t *ptls_minicrypto_cipher_suites[] = {// ciphers used with sha512 and sha384 (must be first)
&ptls_minicrypto_aes256gcmsha384,
ptls_cipher_suite_t *ptls_minicrypto_cipher_suites[] = { // ciphers used with sha512 and sha384 (must be first)
&ptls_minicrypto_aes256gcmsha384,

// ciphers used with sha256
&ptls_minicrypto_aes128gcmsha256,
&ptls_minicrypto_chacha20poly1305sha256,
NULL};
// ciphers used with sha256
&ptls_minicrypto_aes128gcmsha256, &ptls_minicrypto_chacha20poly1305sha256, NULL};

ptls_cipher_suite_t *ptls_minicrypto_cipher_suites_all[] = {// ciphers used with sha512 and sha384 (must be first)
ptls_cipher_suite_t *ptls_minicrypto_cipher_suites_all[] = { // ciphers used with sha512 and sha384 (must be first)
#ifdef PTLS_HAVE_AEGIS
&ptls_minicrypto_aegis256sha512,
&ptls_minicrypto_aegis256sha512,
#endif
&ptls_minicrypto_aes256gcmsha384,
&ptls_minicrypto_aes256gcmsha384,

// ciphers used with sha256
// ciphers used with sha256
#ifdef PTLS_HAVE_AEGIS
&ptls_minicrypto_aegis128lsha256,
&ptls_minicrypto_aegis128lsha256,
#endif
&ptls_minicrypto_aes128gcmsha256,
&ptls_minicrypto_chacha20poly1305sha256,
NULL};
&ptls_minicrypto_aes128gcmsha256, &ptls_minicrypto_chacha20poly1305sha256, NULL};
4 changes: 2 additions & 2 deletions lib/cifra/libaegis.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ptls_aead_algorithm_t ptls_minicrypto_aegis128l = {"AEGIS-128L",
PTLS_AEGIS128L_KEY_SIZE,
PTLS_AEGIS128L_IV_SIZE,
PTLS_AEGIS128L_TAG_SIZE,
{ 0, 0 },
{0, 0},
0,
0,
sizeof(struct aegis128l_context_t),
Expand All @@ -49,7 +49,7 @@ ptls_aead_algorithm_t ptls_minicrypto_aegis256 = {"AEGIS-256",
PTLS_AEGIS256_KEY_SIZE,
PTLS_AEGIS256_IV_SIZE,
PTLS_AEGIS256_TAG_SIZE,
{ 0, 0 },
{0, 0},
0,
0,
sizeof(struct aegis256_context_t),
Expand Down
12 changes: 8 additions & 4 deletions lib/libaegis.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ static size_t aegis128l_encrypt_update(ptls_aead_context_t *_ctx, void *output,
struct aegis128l_context_t *ctx = (struct aegis128l_context_t *)_ctx;
size_t written;

aegis128l_state_encrypt_update(&ctx->st, (uint8_t *)output, inlen + aegis128l_TAILBYTES_MAX, &written, (const uint8_t *)input, inlen);
aegis128l_state_encrypt_update(&ctx->st, (uint8_t *)output, inlen + aegis128l_TAILBYTES_MAX, &written, (const uint8_t *)input,
inlen);

return written;
}
Expand All @@ -73,7 +74,8 @@ static size_t aegis128l_encrypt_final(ptls_aead_context_t *_ctx, void *output)
struct aegis128l_context_t *ctx = (struct aegis128l_context_t *)_ctx;
size_t written;

aegis128l_state_encrypt_final(&ctx->st, (uint8_t *)output, aegis128l_TAILBYTES_MAX + PTLS_AEGIS128L_TAG_SIZE, &written, PTLS_AEGIS128L_TAG_SIZE);
aegis128l_state_encrypt_final(&ctx->st, (uint8_t *)output, aegis128l_TAILBYTES_MAX + PTLS_AEGIS128L_TAG_SIZE, &written,
PTLS_AEGIS128L_TAG_SIZE);

return written;
}
Expand Down Expand Up @@ -177,7 +179,8 @@ static size_t aegis256_encrypt_update(ptls_aead_context_t *_ctx, void *output, c
struct aegis256_context_t *ctx = (struct aegis256_context_t *)_ctx;
size_t written;

aegis256_state_encrypt_update(&ctx->st, (uint8_t *)output, inlen + aegis256_TAILBYTES_MAX, &written, (const uint8_t *)input, inlen);
aegis256_state_encrypt_update(&ctx->st, (uint8_t *)output, inlen + aegis256_TAILBYTES_MAX, &written, (const uint8_t *)input,
inlen);

return written;
}
Expand All @@ -187,7 +190,8 @@ static size_t aegis256_encrypt_final(ptls_aead_context_t *_ctx, void *output)
struct aegis256_context_t *ctx = (struct aegis256_context_t *)_ctx;
size_t written;

aegis256_state_encrypt_final(&ctx->st, (uint8_t *)output, aegis256_TAILBYTES_MAX + PTLS_AEGIS256_TAG_SIZE, &written, PTLS_AEGIS256_TAG_SIZE);
aegis256_state_encrypt_final(&ctx->st, (uint8_t *)output, aegis256_TAILBYTES_MAX + PTLS_AEGIS256_TAG_SIZE, &written,
PTLS_AEGIS256_TAG_SIZE);

return written;
}
Expand Down
Loading

0 comments on commit 28da922

Please sign in to comment.