diff options
author | Matthew Xie <mattx@google.com> | 2012-09-18 16:14:30 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-09-18 16:14:30 -0700 |
commit | ad2d45b15aae80ba254277c3d1fa036207d8b926 (patch) | |
tree | 27ebefd16a44995abb1b16e5c279a1bd169cf0f5 /stack/smp/smp_cmac.c | |
parent | cc914cffd521b2e6e1be804c82aea2388b843ebf (diff) | |
download | external_bluetooth_bluedroid-ad2d45b15aae80ba254277c3d1fa036207d8b926.zip external_bluetooth_bluedroid-ad2d45b15aae80ba254277c3d1fa036207d8b926.tar.gz external_bluetooth_bluedroid-ad2d45b15aae80ba254277c3d1fa036207d8b926.tar.bz2 |
Revert "Header file and whitespace cleanups"
This reverts commit cc914cffd521b2e6e1be804c82aea2388b843ebf
More changes in the original CL after my cherry-pick.
Change-Id: Ic144dba96aeb8a60611baac7565c9f628ab8f9eb
Diffstat (limited to 'stack/smp/smp_cmac.c')
-rw-r--r-- | stack/smp/smp_cmac.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/stack/smp/smp_cmac.c b/stack/smp/smp_cmac.c index d31930b..d72c3b5 100644 --- a/stack/smp/smp_cmac.c +++ b/stack/smp/smp_cmac.c @@ -26,7 +26,7 @@ typedef struct UINT16 len; UINT16 round; }tCMAC_CB; - + tCMAC_CB cmac_cb; /* Rb for AES-128 as block cipher, LSB as [0] */ @@ -45,8 +45,8 @@ void print128(BT_OCTET16 x, const UINT8 *key_name) for (i = 0; i < 4; i ++) { - SMP_TRACE_WARNING4("%02x %02x %02x %02x", - p[BT_OCTET16_LEN - i*4 -1], p[BT_OCTET16_LEN - i*4 -2], + SMP_TRACE_WARNING4("%02x %02x %02x %02x", + p[BT_OCTET16_LEN - i*4 -1], p[BT_OCTET16_LEN - i*4 -2], p[BT_OCTET16_LEN - i*4 -3], p[BT_OCTET16_LEN - i*4 -4]); } #endif @@ -56,11 +56,11 @@ void print128(BT_OCTET16 x, const UINT8 *key_name) ** ** Function padding ** -** Description utility function to padding the given text to be a 128 bits +** Description utility function to padding the given text to be a 128 bits ** data. The parameter dest is input and output parameter, it ** must point to a BT_OCTET16_LEN memory space; where include ** length bytes valid data. -** +** ** Returns void ** *******************************************************************************/ @@ -76,7 +76,7 @@ static void padding ( BT_OCTET16 dest, UINT8 length ) ** Function leftshift_onebit ** ** Description utility function to left shift one bit for a 128 bits value. -** +** ** Returns void ** *******************************************************************************/ @@ -98,12 +98,12 @@ static void leftshift_onebit(UINT8 *input, UINT8 *output) ** Function cmac_aes_cleanup ** ** Description clean up function for AES_CMAC algorithm. -** +** ** Returns void ** *******************************************************************************/ static void cmac_aes_cleanup(void) -{ +{ if (cmac_cb.text != NULL) { GKI_freebuf(cmac_cb.text); @@ -116,7 +116,7 @@ static void cmac_aes_cleanup(void) ** Function cmac_aes_k_calculate ** ** Description This function is the calculation of block cipher using AES-128. -** +** ** Returns void ** *******************************************************************************/ @@ -138,7 +138,7 @@ static BOOLEAN cmac_aes_k_calculate(BT_OCTET16 key, UINT8 *p_signature, UINT16 t err = 1; break; } - + memcpy(x, output.param_buf, BT_OCTET16_LEN); i ++; } @@ -149,9 +149,9 @@ static BOOLEAN cmac_aes_k_calculate(BT_OCTET16 key, UINT8 *p_signature, UINT16 t memcpy(p_signature, p_mac, tlen); SMP_TRACE_DEBUG2("tlen = %d p_mac = %d", tlen, p_mac); - SMP_TRACE_DEBUG4("p_mac[0] = 0x%02x p_mac[1] = 0x%02x p_mac[2] = 0x%02x p_mac[3] = 0x%02x", + SMP_TRACE_DEBUG4("p_mac[0] = 0x%02x p_mac[1] = 0x%02x p_mac[2] = 0x%02x p_mac[3] = 0x%02x", *p_mac, *(p_mac + 1), *(p_mac + 2), *(p_mac + 3)); - SMP_TRACE_DEBUG4("p_mac[4] = 0x%02x p_mac[5] = 0x%02x p_mac[6] = 0x%02x p_mac[7] = 0x%02x", + SMP_TRACE_DEBUG4("p_mac[4] = 0x%02x p_mac[5] = 0x%02x p_mac[6] = 0x%02x p_mac[7] = 0x%02x", *(p_mac + 4), *(p_mac + 5), *(p_mac + 6), *(p_mac + 7)); return TRUE; @@ -166,7 +166,7 @@ static BOOLEAN cmac_aes_k_calculate(BT_OCTET16 key, UINT8 *p_signature, UINT16 t ** ** Description This function proceeed to prepare the last block of message ** Mn depending on the size of the message. -** +** ** Returns void ** *******************************************************************************/ @@ -197,7 +197,7 @@ static void cmac_prepare_last_block (BT_OCTET16 k1, BT_OCTET16 k2) ** Function cmac_subkey_cont ** ** Description This is the callback function when CIPHk(0[128]) is completed. -** +** ** Returns void ** *******************************************************************************/ @@ -242,9 +242,9 @@ static void cmac_subkey_cont(tSMP_ENC *p) ** Function cmac_generate_subkey ** ** Description This is the function to generate the two subkeys. -** +** ** Parameters key - CMAC key, expect SRK when used by SMP. -** +** ** Returns void ** *******************************************************************************/ @@ -269,13 +269,13 @@ static BOOLEAN cmac_generate_subkey(BT_OCTET16 key) ** Function AES_CMAC ** ** Description This is the AES-CMAC Generation Function with tlen implemented. -** +** ** Parameters key - CMAC key in little endian order, expect SRK when used by SMP. ** input - text to be signed in little endian byte order. ** length - length of the input in byte. ** tlen - lenth of mac desired ** p_signature - data pointer to where signed data to be stored, tlen long. -** +** ** Returns void ** *******************************************************************************/ @@ -288,7 +288,7 @@ BOOLEAN AES_CMAC ( BT_OCTET16 key, UINT8 *input, UINT16 length, SMP_TRACE_EVENT0 ("AES_CMAC "); - if (n == 0) n = 1; + if (n == 0) n = 1; len = n * BT_OCTET16_LEN; SMP_TRACE_WARNING1("AES128_CMAC started, allocate buffer size = %d", len); @@ -314,7 +314,7 @@ BOOLEAN AES_CMAC ( BT_OCTET16 key, UINT8 *input, UINT16 length, /* start calculation */ ret = cmac_aes_k_calculate(key, p_signature, tlen); } - /* clean up */ + /* clean up */ cmac_aes_cleanup(); } else @@ -322,7 +322,7 @@ BOOLEAN AES_CMAC ( BT_OCTET16 key, UINT8 *input, UINT16 length, ret = FALSE; SMP_TRACE_ERROR0("No resources"); } - + return ret; } |