Skip to content

Commit 780d9c6

Browse files
theamirocohenYossi Levy
authored andcommitted
Remove NVstore unused mechanism
1 parent b2b14ca commit 780d9c6

File tree

1 file changed

+3
-28
lines changed

1 file changed

+3
-28
lines changed

TESTS/mbed_hal/trng/main.cpp

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,9 @@
3030
* together, if there are similar patterns the compression will succeed.
3131
*
3232
* We need to store and load the first part data before and after reset, the mechanism
33-
* we chose is NVstore, mainly because its simplicity and the fact it is not platform
34-
* dependent, in case a specific board does not support NVstore we will use the
35-
* mbed greentea platform for sending and receving the data from the device to the
36-
* host running the test and back, the problem with this mechanism is that it doesn't handle
37-
* well certain characters, especially non ASCII ones, so we used the base64 algorithm
33+
* we will use is the mbed greentea platform for sending and receving the data from the device
34+
* to the host running the test and back, the problem with this mechanism is that it doesn't
35+
* handle well certain characters, especially non ASCII ones, so we use the base64 algorithm
3836
* to ensure all characters will be transmitted correctly.
3937
*/
4038

@@ -43,7 +41,6 @@
4341
#include "utest/utest.h"
4442
#include "hal/trng_api.h"
4543
#include "base64b.h"
46-
#include "nvstore.h"
4744
#include "pithy.h"
4845
#include <stdio.h>
4946

@@ -67,12 +64,6 @@
6764

6865
#define RESULT_SUCCESS 0
6966

70-
#define NVKEY 1 //NVstore key for storing and loading data
71-
72-
/*there are some issues with nvstore and greentea reset, so for now nvstore is disabled,
73-
*When solved delete current define and replace all NVSTORE_RESET with NVSTORE_ENABLED*/
74-
#define NVSTORE_RESET (NVSTORE_ENABLED & 0)
75-
7667
using namespace utest::v1;
7768

7869
static int fill_buffer_trng(uint8_t *buffer, trng_t *trng_obj, size_t trng_len)
@@ -116,19 +107,9 @@ static void compress_and_compare(char *key, char *value)
116107
input_buf = new uint8_t[BUFFER_LEN * 4];
117108
temp_buf = new uint8_t[BUFFER_LEN * 2];
118109

119-
#if NVSTORE_RESET
120-
NVStore& nvstore = NVStore::get_instance();
121-
#endif
122-
123110
/*At the begining of step 2 load trng buffer from step 1*/
124111
if (strcmp(key, MSG_TRNG_TEST_STEP2) == 0) {
125-
#if NVSTORE_RESET
126-
uint16_t actual = 0;
127-
result = nvstore.get(NVKEY, BUFFER_LEN, buffer, actual);
128-
TEST_ASSERT_EQUAL(RESULT_SUCCESS, result);
129-
#else
130112
/*Using base64 to decode data sent from host*/
131-
132113
uint32_t lengthWritten = 0;
133114
uint32_t charsProcessed = 0;
134115
result = trng_DecodeNBase64((const char *)value,
@@ -138,7 +119,6 @@ static void compress_and_compare(char *key, char *value)
138119
&lengthWritten,
139120
&charsProcessed);
140121
TEST_ASSERT_EQUAL(0, result);
141-
#endif
142122
memcpy(input_buf, buffer, BUFFER_LEN);
143123
}
144124

@@ -186,10 +166,6 @@ static void compress_and_compare(char *key, char *value)
186166
/*At the end of step 1 store trng buffer and reset the device*/
187167
if (strcmp(key, MSG_TRNG_TEST_STEP1) == 0) {
188168
int result = 0;
189-
#if NVSTORE_RESET
190-
result = nvstore.set(NVKEY, BUFFER_LEN, buffer);
191-
TEST_ASSERT_EQUAL(RESULT_SUCCESS, result);
192-
#else
193169
/*Using base64 to encode data sending from host*/
194170
result = trng_EncodeBase64(buffer,
195171
BUFFER_LEN,
@@ -198,7 +174,6 @@ static void compress_and_compare(char *key, char *value)
198174
TEST_ASSERT_EQUAL(RESULT_SUCCESS, result);
199175

200176
greentea_send_kv(MSG_TRNG_BUFFER, (const char *)out_comp_buf);
201-
#endif
202177
}
203178

204179
delete[] out_comp_buf;

0 commit comments

Comments
 (0)