Skip to content

Commit 39814aa

Browse files
committed
MCU8MASS-348 MCU8MASS-942 Load ciphers directly into the string used for the command
1 parent fcc1f9e commit 39814aa

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

examples/provision/provision.ino

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ PGM_P const cipher_values[NUMBER_OF_CIPHERS] PROGMEM = {
139139
cipher42, cipher43, cipher44, cipher45, cipher46, cipher47, cipher48,
140140
cipher49, cipher50, cipher51, cipher52, cipher53, cipher54, cipher55,
141141
cipher56, cipher57, cipher58, cipher59, cipher60, cipher61, cipher62,
142-
cipher63,
142+
cipher63
143143
};
144144

145145
// clang-format off
@@ -1073,6 +1073,7 @@ void provisionMqtt() {
10731073
}
10741074
}
10751075

1076+
10761077
char line[82] = "";
10771078
bool has_chosen_psk_cipher = false;
10781079
size_t cipher_count = 0;
@@ -1083,15 +1084,9 @@ void provisionMqtt() {
10831084

10841085
if (ciphers_chosen[i]) {
10851086

1086-
char* cipher;
1087-
strcpy_P(cipher, (PGM_P)pgm_read_word(&(cipher_values[i])));
1088-
10891087
// Append the cipher to the string which will be passed with the
10901088
// command to the modem
1091-
memcpy(&ciphers[cipher_character_index],
1092-
cipher,
1093-
CIPHER_VALUE_LENGTH);
1094-
1089+
strcpy_P(&ciphers[cipher_character_index], (PGM_P)pgm_read_word(&(cipher_values[i])));
10951090
cipher_character_index += CIPHER_VALUE_LENGTH;
10961091
cipher_count++;
10971092

@@ -1102,6 +1097,7 @@ void provisionMqtt() {
11021097

11031098
// Load from progmem before checking for PSK cipher
11041099
char cipher_text_value[CIPHER_TEXT_MAX_LENGTH] = "";
1100+
11051101
strcpy_P(cipher_text_value,
11061102
(PGM_P)pgm_read_word(&(cipher_text_values[i])));
11071103

0 commit comments

Comments
 (0)