Skip to content

Commit

Permalink
Code style changes and updated code style script
Browse files Browse the repository at this point in the history
  • Loading branch information
podhrmic committed Mar 17, 2018
1 parent 5ac8784 commit 96364a1
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 108 deletions.
1 change: 1 addition & 0 deletions fix_code_style.sh
Expand Up @@ -11,6 +11,7 @@ if [ $# -eq 0 ]; then
fi

ASTYLE_VERSION=`astyle --version 2>&1| awk '{print $4}'`
ASTYLE_VERSION=${ASTYLE_VERSION:0:4}
echo "Using astyle version $ASTYLE_VERSION"

set -f
Expand Down
6 changes: 3 additions & 3 deletions sw/airborne/modules/datalink/gec/gec.c
Expand Up @@ -75,9 +75,9 @@ void gec_generate_ephemeral_keys(struct gec_privkey *sk)
for (uint16_t i = 0; i < PPRZ_KEY_LEN; i += sizeof(uint32_t)) {
uint32_t tmp = rng_wait_and_get();
sk->priv[i] = (uint8_t) tmp;
sk->priv[i + 1] = (uint8_t) (tmp >> 8);
sk->priv[i + 2] = (uint8_t) (tmp >> 16);
sk->priv[i + 3] = (uint8_t) (tmp >> 24);
sk->priv[i + 1] = (uint8_t)(tmp >> 8);
sk->priv[i + 2] = (uint8_t)(tmp >> 16);
sk->priv[i + 3] = (uint8_t)(tmp >> 24);
}
uint8_t basepoint[32] = { 0 };
basepoint[0] = 9; // default basepoint
Expand Down
32 changes: 12 additions & 20 deletions sw/airborne/modules/datalink/gec/gec.h
Expand Up @@ -21,7 +21,7 @@
/**
* @file datalink/gec/gec.h
*
* Galois embedded crypto iplementation
* Galois embedded crypto implementation
*
*/
#ifndef SPPRZ_GEC_H
Expand Down Expand Up @@ -92,41 +92,34 @@

typedef unsigned char ed25519_signature[64];

struct gec_privkey
{
struct gec_privkey {
uint8_t priv[PPRZ_KEY_LEN];
uint8_t pub[PPRZ_KEY_LEN];bool ready;
uint8_t pub[PPRZ_KEY_LEN]; bool ready;
};

struct gec_pubkey
{
uint8_t pub[PPRZ_KEY_LEN];bool ready;
struct gec_pubkey {
uint8_t pub[PPRZ_KEY_LEN]; bool ready;
};

struct gec_sym_key
{
struct gec_sym_key {
uint8_t key[PPRZ_KEY_LEN];
uint8_t nonce[PPRZ_NONCE_LEN];
uint32_t counter;bool ready;
uint32_t counter; bool ready;
};

typedef enum
{
typedef enum {
INIT, WAIT_MSG1, WAIT_MSG2, WAIT_MSG3, CRYPTO_OK,
} stage_t;

typedef enum
{
typedef enum {
INITIATOR, RESPONDER, CLIENT, INVALID_PARTY
} party_t;

typedef enum
{
typedef enum {
P_AE, P_BE, SIG,
} gec_sts_msg_type_t;

typedef enum
{
typedef enum {
ERROR_NONE,
// RESPONDER ERRORS
MSG1_TIMEOUT_ERROR,
Expand All @@ -147,8 +140,7 @@ typedef enum

// Intermediate data structure containing information relating to the stage of
// the STS protocol.
struct gec_sts_ctx
{
struct gec_sts_ctx {
struct gec_pubkey their_public_key;
struct gec_privkey my_private_key;
struct gec_pubkey their_public_ephemeral;
Expand Down

0 comments on commit 96364a1

Please sign in to comment.