Skip to content

Commit a1b6442

Browse files
authored
Merge pull request #8759 from anhu/index_idx
Rename variable index to idx to avoid conflicting declaration.
2 parents 63c3c54 + a814683 commit a1b6442

9 files changed

Lines changed: 73 additions & 73 deletions

File tree

doc/dox_comments/header_files-ja/ssl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2189,7 +2189,7 @@ int wolfSSL_GetSessionIndex(WOLFSSL* ssl);
21892189
\sa LockMutex
21902190
\sa wolfSSL_GetSessionIndex
21912191
*/
2192-
int wolfSSL_GetSessionAtIndex(int index, WOLFSSL_SESSION* session);
2192+
int wolfSSL_GetSessionAtIndex(int idx, WOLFSSL_SESSION* session);
21932193

21942194
/*!
21952195
\ingroup IO

doc/dox_comments/header_files/kdf.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
\param [in] salt Random non-secret value.
1717
\param [in] saltSz Size of random in bytes.
1818
\param [in] kdrIdx Key derivation rate. kdr = 0 when -1, otherwise kdr = 2^kdrIdx.
19-
\param [in] index Index value to XOR in.
19+
\param [in] idx Index value to XOR in.
2020
\param [out] key1 First key. Label value of 0x00.
2121
\param [in] key1Sz Size of first key in bytes.
2222
\param [out] key2 Second key. Label value of 0x01.
@@ -29,14 +29,14 @@
2929
\code
3030
unsigned char key[16] = { ... };
3131
unsigned char salt[14] = { ... };
32-
unsigned char index[6] = { ... };
32+
unsigned char idx[6] = { ... };
3333
unsigned char keyE[16];
3434
unsigned char keyA[20];
3535
unsigned char keyS[14];
3636
int kdrIdx = 0; // Use all of index
3737
int ret;
3838
39-
ret = wc_SRTP_KDF(key, sizeof(key), salt, sizeof(salt), kdrIdx, index,
39+
ret = wc_SRTP_KDF(key, sizeof(key), salt, sizeof(salt), kdrIdx, idx,
4040
keyE, sizeof(keyE), keyA, sizeof(keyA), keyS, sizeof(keyS));
4141
if (ret != 0) {
4242
WOLFSSL_MSG("wc_SRTP_KDF failed");
@@ -49,7 +49,7 @@
4949
\sa wc_SRTP_KDF_kdr_to_idx
5050
*/
5151
int wc_SRTP_KDF(const byte* key, word32 keySz, const byte* salt, word32 saltSz,
52-
int kdrIdx, const byte* index, byte* key1, word32 key1Sz, byte* key2,
52+
int kdrIdx, const byte* idx, byte* key1, word32 key1Sz, byte* key2,
5353
word32 key2Sz, byte* key3, word32 key3Sz);
5454

5555
/*!
@@ -69,7 +69,7 @@ int wc_SRTP_KDF(const byte* key, word32 keySz, const byte* salt, word32 saltSz,
6969
\param [in] salt Random non-secret value.
7070
\param [in] saltSz Size of random in bytes.
7171
\param [in] kdrIdx Key derivation rate. kdr = 0 when -1, otherwise kdr = 2^kdrIdx.
72-
\param [in] index Index value to XOR in.
72+
\param [in] idx Index value to XOR in.
7373
\param [out] key1 First key. Label value of 0x00.
7474
\param [in] key1Sz Size of first key in bytes.
7575
\param [out] key2 Second key. Label value of 0x01.
@@ -82,14 +82,14 @@ int wc_SRTP_KDF(const byte* key, word32 keySz, const byte* salt, word32 saltSz,
8282
\code
8383
unsigned char key[16] = { ... };
8484
unsigned char salt[14] = { ... };
85-
unsigned char index[4] = { ... };
85+
unsigned char idx[4] = { ... };
8686
unsigned char keyE[16];
8787
unsigned char keyA[20];
8888
unsigned char keyS[14];
8989
int kdrIdx = 0; // Use all of index
9090
int ret;
9191
92-
ret = wc_SRTCP_KDF(key, sizeof(key), salt, sizeof(salt), kdrIdx, index,
92+
ret = wc_SRTCP_KDF(key, sizeof(key), salt, sizeof(salt), kdrIdx, idx,
9393
keyE, sizeof(keyE), keyA, sizeof(keyA), keyS, sizeof(keyS));
9494
if (ret != 0) {
9595
WOLFSSL_MSG("wc_SRTP_KDF failed");
@@ -102,7 +102,7 @@ int wc_SRTP_KDF(const byte* key, word32 keySz, const byte* salt, word32 saltSz,
102102
\sa wc_SRTP_KDF_kdr_to_idx
103103
*/
104104
int wc_SRTCP_KDF(const byte* key, word32 keySz, const byte* salt, word32 saltSz,
105-
int kdrIdx, const byte* index, byte* key1, word32 key1Sz, byte* key2,
105+
int kdrIdx, const byte* idx, byte* key1, word32 key1Sz, byte* key2,
106106
word32 key2Sz, byte* key3, word32 key3Sz);
107107
/*!
108108
\ingroup SrtpKdf
@@ -121,7 +121,7 @@ int wc_SRTCP_KDF(const byte* key, word32 keySz, const byte* salt, word32 saltSz,
121121
\param [in] salt Random non-secret value.
122122
\param [in] saltSz Size of random in bytes.
123123
\param [in] kdrIdx Key derivation rate. kdr = 0 when -1, otherwise kdr = 2^kdrIdx.
124-
\param [in] index Index value to XOR in.
124+
\param [in] idx Index value to XOR in.
125125
\param [in] label Label to use when deriving key.
126126
\param [out] outKey Derived key.
127127
\param [in] outKeySz Size of derived key in bytes.
@@ -131,12 +131,12 @@ int wc_SRTCP_KDF(const byte* key, word32 keySz, const byte* salt, word32 saltSz,
131131
\code
132132
unsigned char key[16] = { ... };
133133
unsigned char salt[14] = { ... };
134-
unsigned char index[6] = { ... };
134+
unsigned char idx[6] = { ... };
135135
unsigned char keyE[16];
136136
int kdrIdx = 0; // Use all of index
137137
int ret;
138138
139-
ret = wc_SRTP_KDF_label(key, sizeof(key), salt, sizeof(salt), kdrIdx, index,
139+
ret = wc_SRTP_KDF_label(key, sizeof(key), salt, sizeof(salt), kdrIdx, idx,
140140
WC_SRTP_LABEL_ENCRYPTION, keyE, sizeof(keyE));
141141
if (ret != 0) {
142142
WOLFSSL_MSG("wc_SRTP_KDF failed");
@@ -149,7 +149,7 @@ int wc_SRTCP_KDF(const byte* key, word32 keySz, const byte* salt, word32 saltSz,
149149
\sa wc_SRTP_KDF_kdr_to_idx
150150
*/
151151
int wc_SRTP_KDF_label(const byte* key, word32 keySz, const byte* salt,
152-
word32 saltSz, int kdrIdx, const byte* index, byte label, byte* outKey,
152+
word32 saltSz, int kdrIdx, const byte* idx, byte label, byte* outKey,
153153
word32 outKeySz);
154154
/*!
155155
\ingroup SrtpKdf
@@ -168,7 +168,7 @@ int wc_SRTP_KDF_label(const byte* key, word32 keySz, const byte* salt,
168168
\param [in] salt Random non-secret value.
169169
\param [in] saltSz Size of random in bytes.
170170
\param [in] kdrIdx Key derivation rate. kdr = 0 when -1, otherwise kdr = 2^kdrIdx.
171-
\param [in] index Index value to XOR in.
171+
\param [in] idx Index value to XOR in.
172172
\param [in] label Label to use when deriving key.
173173
\param [out] outKey Derived key.
174174
\param [in] outKeySz Size of derived key in bytes.
@@ -178,13 +178,13 @@ int wc_SRTP_KDF_label(const byte* key, word32 keySz, const byte* salt,
178178
\code
179179
unsigned char key[16] = { ... };
180180
unsigned char salt[14] = { ... };
181-
unsigned char index[4] = { ... };
181+
unsigned char idx[4] = { ... };
182182
unsigned char keyE[16];
183183
int kdrIdx = 0; // Use all of index
184184
int ret;
185185
186186
ret = wc_SRTCP_KDF_label(key, sizeof(key), salt, sizeof(salt), kdrIdx,
187-
index, WC_SRTCP_LABEL_ENCRYPTION, keyE, sizeof(keyE));
187+
idx, WC_SRTCP_LABEL_ENCRYPTION, keyE, sizeof(keyE));
188188
if (ret != 0) {
189189
WOLFSSL_MSG("wc_SRTP_KDF failed");
190190
}
@@ -196,7 +196,7 @@ int wc_SRTP_KDF_label(const byte* key, word32 keySz, const byte* salt,
196196
\sa wc_SRTP_KDF_kdr_to_idx
197197
*/
198198
int wc_SRTP_KDF_label(const byte* key, word32 keySz, const byte* salt,
199-
word32 saltSz, int kdrIdx, const byte* index, byte label, byte* outKey,
199+
word32 saltSz, int kdrIdx, const byte* idx, byte label, byte* outKey,
200200
word32 outKeySz);
201201
/*!
202202
\ingroup SrtpKdf

doc/dox_comments/header_files/ssl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2847,7 +2847,7 @@ int wolfSSL_GetSessionIndex(WOLFSSL* ssl);
28472847
\sa LockMutex
28482848
\sa wolfSSL_GetSessionIndex
28492849
*/
2850-
int wolfSSL_GetSessionAtIndex(int index, WOLFSSL_SESSION* session);
2850+
int wolfSSL_GetSessionAtIndex(int idx, WOLFSSL_SESSION* session);
28512851

28522852
/*!
28532853
\ingroup IO

src/sniffer.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3269,25 +3269,25 @@ static int ProcessClientKeyExchange(const byte* input, int* sslBytes,
32693269
static int ProcessKeyShare(KeyShareInfo* info, const byte* input, int len,
32703270
word16 filter_group)
32713271
{
3272-
int index = 0;
3273-
while (index < len) {
3272+
int idx = 0;
3273+
while (idx < len) {
32743274
/* clear info (reset dh_key_bits and curve_id) */
32753275
XMEMSET(info, 0, sizeof(KeyShareInfo));
32763276

32773277
/* Named group and public key */
3278-
info->named_group = (word16)((input[index] << 8) | input[index+1]);
3279-
index += OPAQUE16_LEN;
3278+
info->named_group = (word16)((input[idx] << 8) | input[idx+1]);
3279+
idx += OPAQUE16_LEN;
32803280
info->key_len = 0;
32813281
info->key = NULL;
32823282
/* If key was provided... (a hello_retry_request will not send a key) */
3283-
if (index + 2 <= len) {
3284-
info->key_len = (word16)((input[index] << 8) | input[index+1]);
3285-
index += OPAQUE16_LEN;
3286-
if (info->key_len == 0 || info->key_len > len - index) {
3283+
if (idx + 2 <= len) {
3284+
info->key_len = (word16)((input[idx] << 8) | input[idx+1]);
3285+
idx += OPAQUE16_LEN;
3286+
if (info->key_len == 0 || info->key_len > len - idx) {
32873287
return WOLFSSL_FATAL_ERROR;
32883288
}
3289-
info->key = &input[index];
3290-
index += info->key_len;
3289+
info->key = &input[idx];
3290+
idx += info->key_len;
32913291
}
32923292

32933293
switch (info->named_group) {
@@ -7295,7 +7295,7 @@ static int addSecretNode(unsigned char* clientRandom,
72957295
unsigned char* secret,
72967296
char* error)
72977297
{
7298-
int index = 0;
7298+
int idx = 0;
72997299
int ret = 0;
73007300
SecretNode* node = NULL;
73017301

@@ -7305,8 +7305,8 @@ static int addSecretNode(unsigned char* clientRandom,
73057305

73067306
LOCK_SECRET_LIST();
73077307

7308-
index = secretHashFunction(clientRandom);
7309-
node = secretHashTable[index];
7308+
idx = secretHashFunction(clientRandom);
7309+
node = secretHashTable[idx];
73107310

73117311
while(node) {
73127312
/* Node already exists, so just add the requested secret */
@@ -7349,12 +7349,12 @@ static unsigned char* findSecret(unsigned char* clientRandom, int type)
73497349
{
73507350
unsigned char* secret = NULL;
73517351
SecretNode* node = NULL;
7352-
unsigned int index = 0;
7352+
unsigned int idx = 0;
73537353

73547354
LOCK_SECRET_LIST();
73557355

7356-
index = secretHashFunction(clientRandom);
7357-
node = secretHashTable[index];
7356+
idx = secretHashFunction(clientRandom);
7357+
node = secretHashTable[idx];
73587358

73597359
while (node != NULL) {
73607360
if (XMEMCMP(node->clientRandom,

wolfcrypt/benchmark/benchmark.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8633,7 +8633,7 @@ void bench_srtpkdf(void)
86338633
const byte *key = bench_key_buf;
86348634
const byte salt[14] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
86358635
0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e };
8636-
const byte index[6] = { 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA };
8636+
const byte idx[6] = { 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA };
86378637
int kdrIdx = 0;
86388638
int i;
86398639
DECLARE_MULTI_VALUE_STATS_VARS()
@@ -8643,7 +8643,7 @@ void bench_srtpkdf(void)
86438643
do {
86448644
for (i = 0; i < numBlocks * 1000; i++) {
86458645
ret = wc_SRTP_KDF(key, AES_128_KEY_SIZE, salt, sizeof(salt),
8646-
kdrIdx, index, keyE, AES_128_KEY_SIZE, keyA, sizeof(keyA),
8646+
kdrIdx, idx, keyE, AES_128_KEY_SIZE, keyA, sizeof(keyA),
86478647
keyS, sizeof(keyS));
86488648
RECORD_MULTI_VALUE_STATS();
86498649
}
@@ -8666,7 +8666,7 @@ void bench_srtpkdf(void)
86668666
do {
86678667
for (i = 0; i < numBlocks * 1000; i++) {
86688668
ret = wc_SRTP_KDF(key, AES_256_KEY_SIZE, salt, sizeof(salt),
8669-
kdrIdx, index, keyE, AES_256_KEY_SIZE, keyA, sizeof(keyA),
8669+
kdrIdx, idx, keyE, AES_256_KEY_SIZE, keyA, sizeof(keyA),
86708670
keyS, sizeof(keyS));
86718671
RECORD_MULTI_VALUE_STATS();
86728672
}
@@ -8689,7 +8689,7 @@ void bench_srtpkdf(void)
86898689
do {
86908690
for (i = 0; i < numBlocks * 1000; i++) {
86918691
ret = wc_SRTCP_KDF(key, AES_128_KEY_SIZE, salt, sizeof(salt),
8692-
kdrIdx, index, keyE, AES_128_KEY_SIZE, keyA, sizeof(keyA),
8692+
kdrIdx, idx, keyE, AES_128_KEY_SIZE, keyA, sizeof(keyA),
86938693
keyS, sizeof(keyS));
86948694
RECORD_MULTI_VALUE_STATS();
86958695
}
@@ -8712,7 +8712,7 @@ void bench_srtpkdf(void)
87128712
do {
87138713
for (i = 0; i < numBlocks * 1000; i++) {
87148714
ret = wc_SRTCP_KDF(key, AES_256_KEY_SIZE, salt, sizeof(salt),
8715-
kdrIdx, index, keyE, AES_256_KEY_SIZE, keyA, sizeof(keyA),
8715+
kdrIdx, idx, keyE, AES_256_KEY_SIZE, keyA, sizeof(keyA),
87168716
keyS, sizeof(keyS));
87178717
RECORD_MULTI_VALUE_STATS();
87188718
}

0 commit comments

Comments
 (0)