[Cryptech-Commits] [sw/libhal] 02/03: Trailing whitespace cleanup.
git at cryptech.is
git at cryptech.is
Sat May 14 20:35:09 UTC 2016
This is an automated email from the git hooks/post-receive script.
sra at hactrn.net pushed a commit to branch rpc
in repository sw/libhal.
commit b1225c11f89dad1a749b6572e50e5e5fce5234e8
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Sat May 14 12:01:37 2016 -0400
Trailing whitespace cleanup.
---
asn1.c | 2 +-
hash.c | 10 +++++-----
ks.c | 16 ++++++++--------
ks_mmap.c | 2 +-
rpc_client.c | 6 +++---
rpc_client_loopback.c | 2 +-
rpc_client_serial.c | 4 ++--
rpc_pkey.c | 2 +-
rpc_server.c | 4 ++--
rpc_server_loopback.c | 2 +-
rpc_server_serial.c | 4 ++--
rsa.c | 2 +-
tests/test-ecdsa.py | 2 +-
tests/test-rpc_get_random.c | 4 ++--
tests/test-rpc_get_version.c | 2 +-
utils/eim_peek_poke.c | 2 +-
xdr.c | 2 +-
17 files changed, 34 insertions(+), 34 deletions(-)
diff --git a/asn1.c b/asn1.c
index 2206ec3..bbb049f 100644
--- a/asn1.c
+++ b/asn1.c
@@ -339,7 +339,7 @@ hal_error_t hal_asn1_decode_spki(const uint8_t **alg_oid, size_t *alg_oid_len,
*curve_oid = NULL;
*curve_oid_len = 0;
-
+
if (d < algid_end) {
switch (*d) {
diff --git a/hash.c b/hash.c
index daa7e3a..7ed670b 100644
--- a/hash.c
+++ b/hash.c
@@ -284,7 +284,7 @@ static inline hal_hash_state_t *alloc_static_hash_state(void)
if ((static_hash_state[i].flags & STATE_FLAG_STATE_ALLOCATED) == 0)
return &static_hash_state[i];
-#endif
+#endif
return NULL;
}
@@ -298,7 +298,7 @@ static inline hal_hmac_state_t *alloc_static_hmac_state(void)
if ((static_hmac_state[i].hash_state.flags & STATE_FLAG_STATE_ALLOCATED) == 0)
return &static_hmac_state[i];
-#endif
+#endif
return NULL;
}
@@ -317,7 +317,7 @@ static inline void swytebop(void *out_, const void * const in_, const size_t n,
/* w must be a power of two */
assert(in != out && in != NULL && out != NULL && w && !(w & (w - 1)));
-
+
switch (* (uint32_t *) order) {
case 0x01020304:
@@ -411,7 +411,7 @@ hal_error_t hal_hash_initialize(const hal_core_t *core,
state->driver = driver;
state->core = core;
state->flags = flags;
-
+
if (state_buffer == NULL)
state->flags |= STATE_FLAG_STATE_ALLOCATED;
@@ -969,7 +969,7 @@ static hal_error_t sw_hash_core_sha1(hal_hash_state_t *state)
swytebop(W, state->block, 16 * sizeof(*W), sizeof(*W));
for (int i = 16; i < 80; i++)
- W[i] = rot_l_32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1);
+ W[i] = rot_l_32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1);
for (int i = 0; i < 80; i++) {
const int a = sha1_pos(i, 0), b = sha1_pos(i, 1), c = sha1_pos(i, 2), d = sha1_pos(i, 3), e = sha1_pos(i, 4);
diff --git a/ks.c b/ks.c
index d1ce089..33d3e47 100644
--- a/ks.c
+++ b/ks.c
@@ -89,7 +89,7 @@ hal_error_t hal_ks_store(const hal_key_type_t type,
}
if (*hint < 0)
- return HAL_ERROR_NO_KEY_SLOTS_AVAILABLE;
+ return HAL_ERROR_NO_KEY_SLOTS_AVAILABLE;
hal_ks_key_t k;
memset(&k, 0, sizeof(k));
@@ -105,7 +105,7 @@ hal_error_t hal_ks_store(const hal_key_type_t type,
if (err != HAL_OK)
return err;
-
+
assert(name_len <= sizeof(k.name));
memcpy(k.name, name, name_len);
k.name_len = name_len;
@@ -152,7 +152,7 @@ hal_error_t hal_ks_exists(const hal_key_type_t type,
{
if (name == NULL || name_len == 0 || !acceptable_key_type(type))
return HAL_ERROR_BAD_ARGUMENTS;
-
+
const hal_ks_keydb_t * const db = hal_ks_get_keydb();
if (db == NULL)
@@ -173,10 +173,10 @@ hal_error_t hal_ks_fetch(const hal_key_type_t type,
{
if (name == NULL || name_len == 0 || !acceptable_key_type(type))
return HAL_ERROR_BAD_ARGUMENTS;
-
+
const hal_ks_keydb_t * const db = hal_ks_get_keydb();
int hint_ = -1;
-
+
if (db == NULL)
return HAL_ERROR_KEYSTORE_ACCESS;
@@ -225,10 +225,10 @@ hal_error_t hal_ks_delete(const hal_key_type_t type,
{
if (name == NULL || name_len == 0 || !acceptable_key_type(type))
return HAL_ERROR_BAD_ARGUMENTS;
-
+
const hal_ks_keydb_t * const db = hal_ks_get_keydb();
int hint_ = -1;
-
+
if (db == NULL)
return HAL_ERROR_KEYSTORE_ACCESS;
@@ -249,7 +249,7 @@ hal_error_t hal_ks_list(hal_pkey_info_t *result,
return HAL_ERROR_BAD_ARGUMENTS;
const hal_ks_keydb_t * const db = hal_ks_get_keydb();
-
+
if (db == NULL)
return HAL_ERROR_KEYSTORE_ACCESS;
diff --git a/ks_mmap.c b/ks_mmap.c
index 5eb2a13..e62aa46 100644
--- a/ks_mmap.c
+++ b/ks_mmap.c
@@ -85,7 +85,7 @@ const hal_ks_keydb_t *hal_ks_get_keydb(void)
fn = base;
else
strcat(strcat(strcpy(fn_, home), "/"), base);
-
+
if ((fd = open(fn, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0) {
uint8_t zeros[len];
memset(zeros, 0, sizeof(zeros));
diff --git a/rpc_client.c b/rpc_client.c
index be680ed..71dcc7c 100644
--- a/rpc_client.c
+++ b/rpc_client.c
@@ -763,7 +763,7 @@ static hal_error_t pkey_mixed_sign(const hal_session_handle_t session,
if ((err = hal_rpc_hash_finalize(hash, digest, digest_len)) != HAL_OK)
return err;
- return mixed_handle_dispatch(pkey)->sign(session, pkey, hal_hash_handle_none, digest, digest_len,
+ return mixed_handle_dispatch(pkey)->sign(session, pkey, hal_hash_handle_none, digest, digest_len,
signature, signature_len, signature_max);
}
@@ -774,7 +774,7 @@ static hal_error_t pkey_mixed_verify(const hal_session_handle_t session,
const uint8_t * const signature, const size_t signature_len)
{
if (input != NULL)
- return mixed_handle_dispatch(pkey)->verify(session, pkey, hash, input, input_len,
+ return mixed_handle_dispatch(pkey)->verify(session, pkey, hash, input, input_len,
signature, signature_len);
hal_digest_algorithm_t alg;
@@ -790,7 +790,7 @@ static hal_error_t pkey_mixed_verify(const hal_session_handle_t session,
if ((err = hal_rpc_hash_finalize(hash, digest, digest_len)) != HAL_OK)
return err;
- return mixed_handle_dispatch(pkey)->verify(session, pkey, hal_hash_handle_none,
+ return mixed_handle_dispatch(pkey)->verify(session, pkey, hal_hash_handle_none,
digest, digest_len, signature, signature_len);
}
diff --git a/rpc_client_loopback.c b/rpc_client_loopback.c
index b31bdd2..39deff9 100644
--- a/rpc_client_loopback.c
+++ b/rpc_client_loopback.c
@@ -77,7 +77,7 @@ hal_error_t hal_rpc_send(const uint8_t * const buf, const size_t len)
hal_error_t hal_rpc_recv(uint8_t * const buf, size_t * const len)
{
int ret;
-
+
if ((ret = recv(sock, buf, *len, 0)) == -1)
return HAL_ERROR_RPC_TRANSPORT;
*len = ret;
diff --git a/rpc_client_serial.c b/rpc_client_serial.c
index d6bda1d..5194793 100644
--- a/rpc_client_serial.c
+++ b/rpc_client_serial.c
@@ -52,7 +52,7 @@ static int fd = -1;
hal_error_t hal_rpc_client_transport_init(void)
{
struct termios tty;
-
+
fd = open(DEVICE, O_RDWR | O_NOCTTY | O_SYNC);
if (fd == -1)
return perror("open"), HAL_ERROR_RPC_TRANSPORT;
@@ -98,7 +98,7 @@ hal_error_t hal_rpc_send(const uint8_t * const buf, const size_t len)
hal_error_t hal_rpc_recv(uint8_t * const buf, size_t * const len)
{
int ret;
-
+
if ((ret = hal_slip_recv(buf, *len)) == -1)
return HAL_ERROR_RPC_TRANSPORT;
*len = ret;
diff --git a/rpc_pkey.c b/rpc_pkey.c
index 0838694..7455bb1 100644
--- a/rpc_pkey.c
+++ b/rpc_pkey.c
@@ -409,7 +409,7 @@ static hal_error_t delete(const hal_pkey_handle_t pkey)
hal_error_t err = hal_ks_delete(slot->type, slot->name, slot->name_len, &slot->ks_hint);
if (err == HAL_OK || err == HAL_ERROR_KEY_NOT_FOUND)
- memset(slot, 0, sizeof(*slot));
+ memset(slot, 0, sizeof(*slot));
return err;
}
diff --git a/rpc_server.c b/rpc_server.c
index 7e7a6c2..7e8e036 100644
--- a/rpc_server.c
+++ b/rpc_server.c
@@ -554,7 +554,7 @@ static hal_error_t hal_xdr_encode_pkey_info(uint8_t **optr, const uint8_t * cons
{
uint8_t *optr_orig = *optr;
hal_error_t ret;
-
+
if ((ret = hal_xdr_encode_int(optr, olimit, info->type)) != HAL_OK ||
(ret = hal_xdr_encode_int(optr, olimit, info->curve)) != HAL_OK ||
(ret = hal_xdr_encode_int(optr, olimit, info->flags)) != HAL_OK ||
@@ -703,7 +703,7 @@ void hal_rpc_server_main(void)
size_t ilen, olen;
void *opaque;
hal_error_t ret;
-
+
while (!interrupt) {
ilen = sizeof(inbuf);
ret = hal_rpc_recvfrom(inbuf, &ilen, &opaque);
diff --git a/rpc_server_loopback.c b/rpc_server_loopback.c
index 4ca7467..643d5a2 100644
--- a/rpc_server_loopback.c
+++ b/rpc_server_loopback.c
@@ -80,7 +80,7 @@ hal_error_t hal_rpc_recvfrom(uint8_t * const buf, size_t * const len, void **opa
static struct sockaddr_in sin;
socklen_t sin_len = sizeof(sin);
int ret;
-
+
if ((ret = recvfrom(fd, buf, *len, 0, (struct sockaddr *)&sin, &sin_len)) == -1)
return HAL_ERROR_RPC_TRANSPORT;
*opaque = (void *)&sin;
diff --git a/rpc_server_serial.c b/rpc_server_serial.c
index d896700..8844f3c 100644
--- a/rpc_server_serial.c
+++ b/rpc_server_serial.c
@@ -55,13 +55,13 @@ hal_error_t hal_rpc_sendto(const uint8_t * const buf, const size_t len, void *op
{
if (hal_slip_send(buf, len) == -1)
return HAL_ERROR_RPC_TRANSPORT;
- return HAL_OK;
+ return HAL_OK;
}
hal_error_t hal_rpc_recvfrom(uint8_t * const buf, size_t * const len, void **opaque)
{
int ret;
-
+
if ((ret = hal_slip_recv(buf, *len)) == -1)
return HAL_ERROR_RPC_TRANSPORT;
*len = ret;
diff --git a/rsa.c b/rsa.c
index bf52e8a..7269aa9 100644
--- a/rsa.c
+++ b/rsa.c
@@ -848,7 +848,7 @@ hal_error_t hal_rsa_public_key_from_der(hal_rsa_key_t **key_,
if (null != NULL || null_len != 0 || alg_oid == NULL ||
alg_oid_len != sizeof(oid_rsaEncryption) || memcmp(alg_oid, oid_rsaEncryption, alg_oid_len) != 0)
return HAL_ERROR_ASN1_PARSE_FAILED;
-
+
size_t len, hlen, vlen;
if ((err = hal_asn1_decode_header(ASN1_SEQUENCE, pubkey, pubkey_len, &hlen, &vlen)) != HAL_OK)
diff --git a/tests/test-ecdsa.py b/tests/test-ecdsa.py
index efd96e3..f50cf59 100644
--- a/tests/test-ecdsa.py
+++ b/tests/test-ecdsa.py
@@ -129,7 +129,7 @@ for curve in curves:
print "static const uint8_t %s[] = { /* %d bytes */" % (name, len(value))
print wrapper.fill(", ".join("0x%02x" % ord(v) for v in value))
print "};"
-
+
print
print "typedef struct {"
print " hal_curve_name_t curve;"
diff --git a/tests/test-rpc_get_random.c b/tests/test-rpc_get_random.c
index 9e9765d..e495514 100644
--- a/tests/test-rpc_get_random.c
+++ b/tests/test-rpc_get_random.c
@@ -55,11 +55,11 @@ int main(int argc, char *argv[])
len = atoi(argv[1]);
if (len <= 0) /* no arg, or bad arg */
len = DEFAULT_LEN;
-
+
uint8_t rnd[len];
#define check(op) { hal_error_t err; if ((err = (op)) != HAL_OK) { printf("%s: %s\n", #op, hal_error_string(err)); return 1; } }
-
+
check(hal_rpc_client_init());
check(hal_rpc_get_random(rnd, sizeof(rnd)));
diff --git a/tests/test-rpc_get_version.c b/tests/test-rpc_get_version.c
index ae1b745..d9041b8 100644
--- a/tests/test-rpc_get_version.c
+++ b/tests/test-rpc_get_version.c
@@ -42,7 +42,7 @@ int main(int argc, char *argv[])
uint32_t version;
#define check(op) { hal_error_t err; if ((err = (op)) != HAL_OK) { printf("%s: %s\n", #op, hal_error_string(err)); return 1; } }
-
+
check(hal_rpc_client_init());
check(hal_rpc_get_version(&version));
printf("%08x\n", version);
diff --git a/utils/eim_peek_poke.c b/utils/eim_peek_poke.c
index ab76875..ba8d8f4 100644
--- a/utils/eim_peek_poke.c
+++ b/utils/eim_peek_poke.c
@@ -61,7 +61,7 @@ static int _string_match(const char *s1, ...)
return s2 != NULL;
}
-
+
static int parse_value(const char *s, uint32_t *value)
{
if (s == NULL || value == NULL)
diff --git a/xdr.c b/xdr.c
index 299966e..fa12311 100644
--- a/xdr.c
+++ b/xdr.c
@@ -103,7 +103,7 @@ hal_error_t hal_xdr_encode_buffer(uint8_t **outbuf, const uint8_t * const limit,
hal_error_t ret;
/* arg checks */
- if (outbuf == NULL || *outbuf == NULL || limit == NULL ||
+ if (outbuf == NULL || *outbuf == NULL || limit == NULL ||
(value == NULL && len != 0))
return HAL_ERROR_BAD_ARGUMENTS;
More information about the Commits
mailing list