summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Collard <louiscollard@chromium.org>2020-02-12 14:27:30 +0800
committerCommit Bot <commit-bot@chromium.org>2020-04-15 03:38:57 +0000
commita7e802fd92049aecc41485a79c74e06d8e376b86 (patch)
tree5843cf23e9a43d41a052a48f74048d8afa951428
parent1a4b4c25245222e546c43f1411bf60e102397a69 (diff)
downloadchrome-ec-a7e802fd92049aecc41485a79c74e06d8e376b86.tar.gz
ec: Run clang-format on u2f.h
BUG=b:123686979 TEST=make buildall -j Signed-off-by: Louis Collard <louiscollard@chromium.org> Change-Id: I646483719d5b97bf9622bbdd2f78ec3dce995d4a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2102089 Tested-by: Leo Lai <cylai@google.com> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Leo Lai <cylai@google.com>
-rw-r--r--include/u2f.h106
1 files changed, 53 insertions, 53 deletions
diff --git a/include/u2f.h b/include/u2f.h
index 0f54dfc990..99b435d9b2 100644
--- a/include/u2f.h
+++ b/include/u2f.h
@@ -5,10 +5,10 @@
#ifndef __U2F_H_INCLUDED__
#define __U2F_H_INCLUDED__
-#ifdef _MSC_VER // Windows
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
+#ifdef _MSC_VER // Windows
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+typedef unsigned int uint32_t;
typedef unsigned long int uint64_t;
#else
#include <stdint.h>
@@ -20,101 +20,101 @@ extern "C" {
// General constants
-#define U2F_EC_KEY_SIZE 32 // EC key size in bytes
-#define U2F_EC_POINT_SIZE ((U2F_EC_KEY_SIZE * 2) + 1) // Size of EC point
-#define U2F_MAX_KH_SIZE 128 // Max size of key handle
-#define U2F_MAX_ATT_CERT_SIZE 2048 // Max size of attestation certificate
-#define U2F_MAX_EC_SIG_SIZE 72 // Max size of DER coded EC signature
-#define U2F_CTR_SIZE 4 // Size of counter field
-#define U2F_APPID_SIZE 32 // Size of application id
-#define U2F_CHAL_SIZE 32 // Size of challenge
-#define U2F_MAX_ATTEST_SIZE 256 // Size of largest blob to sign
-#define U2F_P256_SIZE 32
-#define U2F_FIXED_KH_SIZE 64 // Size of fixed size key handles
+#define U2F_EC_KEY_SIZE 32 // EC key size in bytes
+#define U2F_EC_POINT_SIZE ((U2F_EC_KEY_SIZE * 2) + 1) // Size of EC point
+#define U2F_MAX_KH_SIZE 128 // Max size of key handle
+#define U2F_MAX_ATT_CERT_SIZE 2048 // Max size of attestation certificate
+#define U2F_MAX_EC_SIG_SIZE 72 // Max size of DER coded EC signature
+#define U2F_CTR_SIZE 4 // Size of counter field
+#define U2F_APPID_SIZE 32 // Size of application id
+#define U2F_CHAL_SIZE 32 // Size of challenge
+#define U2F_MAX_ATTEST_SIZE 256 // Size of largest blob to sign
+#define U2F_P256_SIZE 32
+#define U2F_FIXED_KH_SIZE 64 // Size of fixed size key handles
-#define ENC_SIZE(x) ((x + 7) & 0xfff8)
+#define ENC_SIZE(x) ((x + 7) & 0xfff8)
// EC (uncompressed) point
-#define U2F_POINT_UNCOMPRESSED 0x04 // Uncompressed point format
+#define U2F_POINT_UNCOMPRESSED 0x04 // Uncompressed point format
typedef struct {
- uint8_t pointFormat; // Point type
- uint8_t x[U2F_EC_KEY_SIZE]; // X-value
- uint8_t y[U2F_EC_KEY_SIZE]; // Y-value
+ uint8_t pointFormat; // Point type
+ uint8_t x[U2F_EC_KEY_SIZE]; // X-value
+ uint8_t y[U2F_EC_KEY_SIZE]; // Y-value
} U2F_EC_POINT;
// Request Flags.
-#define U2F_AUTH_ENFORCE 0x03 // Enforce user presence and sign
-#define U2F_AUTH_CHECK_ONLY 0x07 // Check only
-#define U2F_AUTH_FLAG_TUP 0x01 // Test of user presence set
+#define U2F_AUTH_ENFORCE 0x03 // Enforce user presence and sign
+#define U2F_AUTH_CHECK_ONLY 0x07 // Check only
+#define U2F_AUTH_FLAG_TUP 0x01 // Test of user presence set
// TODO(louiscollard): Add Descriptions.
typedef struct {
- uint8_t appId[U2F_APPID_SIZE]; // Application id
- uint8_t userSecret[U2F_P256_SIZE];
- uint8_t flags;
+ uint8_t appId[U2F_APPID_SIZE]; // Application id
+ uint8_t userSecret[U2F_P256_SIZE];
+ uint8_t flags;
} U2F_GENERATE_REQ;
typedef struct {
- U2F_EC_POINT pubKey; // Generated public key
- uint8_t keyHandle[U2F_FIXED_KH_SIZE]; // Key handle
+ U2F_EC_POINT pubKey; // Generated public key
+ uint8_t keyHandle[U2F_FIXED_KH_SIZE]; // Key handle
} U2F_GENERATE_RESP;
typedef struct {
- uint8_t appId[U2F_APPID_SIZE]; // Application id
- uint8_t userSecret[U2F_P256_SIZE];
- uint8_t keyHandle[U2F_FIXED_KH_SIZE]; // Key handle
- uint8_t hash[U2F_P256_SIZE];
- uint8_t flags;
+ uint8_t appId[U2F_APPID_SIZE]; // Application id
+ uint8_t userSecret[U2F_P256_SIZE];
+ uint8_t keyHandle[U2F_FIXED_KH_SIZE]; // Key handle
+ uint8_t hash[U2F_P256_SIZE];
+ uint8_t flags;
} U2F_SIGN_REQ;
typedef struct {
- uint8_t sig_r[U2F_P256_SIZE]; // Signature
- uint8_t sig_s[U2F_P256_SIZE]; // Signature
+ uint8_t sig_r[U2F_P256_SIZE]; // Signature
+ uint8_t sig_s[U2F_P256_SIZE]; // Signature
} U2F_SIGN_RESP;
typedef struct {
- uint8_t userSecret[U2F_P256_SIZE];
- uint8_t format;
- uint8_t dataLen;
- uint8_t data[U2F_MAX_ATTEST_SIZE];
+ uint8_t userSecret[U2F_P256_SIZE];
+ uint8_t format;
+ uint8_t dataLen;
+ uint8_t data[U2F_MAX_ATTEST_SIZE];
} U2F_ATTEST_REQ;
typedef struct {
- uint8_t sig_r[U2F_P256_SIZE];
- uint8_t sig_s[U2F_P256_SIZE];
+ uint8_t sig_r[U2F_P256_SIZE];
+ uint8_t sig_s[U2F_P256_SIZE];
} U2F_ATTEST_RESP;
// Command status responses
-#define U2F_SW_NO_ERROR 0x9000 // SW_NO_ERROR
-#define U2F_SW_WRONG_DATA 0x6A80 // SW_WRONG_DATA
+#define U2F_SW_NO_ERROR 0x9000 // SW_NO_ERROR
+#define U2F_SW_WRONG_DATA 0x6A80 // SW_WRONG_DATA
#define U2F_SW_CONDITIONS_NOT_SATISFIED 0x6985 // SW_CONDITIONS_NOT_SATISFIED
-#define U2F_SW_COMMAND_NOT_ALLOWED 0x6986 // SW_COMMAND_NOT_ALLOWED
-#define U2F_SW_INS_NOT_SUPPORTED 0x6D00 // SW_INS_NOT_SUPPORTED
+#define U2F_SW_COMMAND_NOT_ALLOWED 0x6986 // SW_COMMAND_NOT_ALLOWED
+#define U2F_SW_INS_NOT_SUPPORTED 0x6D00 // SW_INS_NOT_SUPPORTED
// Protocol extensions
// Non-standardized command status responses
-#define U2F_SW_CLA_NOT_SUPPORTED 0x6E00
-#define U2F_SW_WRONG_LENGTH 0x6700
-#define U2F_SW_WTF 0x6f00
+#define U2F_SW_CLA_NOT_SUPPORTED 0x6E00
+#define U2F_SW_WRONG_LENGTH 0x6700
+#define U2F_SW_WTF 0x6f00
// Additional flags for P1 field
-#define G2F_ATTEST 0x80 // Fixed attestation key
-#define G2F_CONSUME 0x02 // Consume presence
+#define G2F_ATTEST 0x80 // Fixed attestation key
+#define G2F_CONSUME 0x02 // Consume presence
// The key handle format was changed when support for user secrets was added.
// U2F_SIGN requests that specify this flag will first try to validate the
// key handle as a new format key handle, and if that fails, will fall back
// to treating it as a legacy key handle (without user secrets).
-#define SIGN_LEGACY_KH 0x40
+#define SIGN_LEGACY_KH 0x40
// U2F Attest format for U2F Register Response.
-#define U2F_ATTEST_FORMAT_REG_RESP 0
+#define U2F_ATTEST_FORMAT_REG_RESP 0
// Vendor command to enable/disable the extensions
#define U2F_VENDOR_MODE U2F_VENDOR_LAST
@@ -123,4 +123,4 @@ typedef struct {
}
#endif
-#endif // __U2F_H_INCLUDED__
+#endif // __U2F_H_INCLUDED__