30
30
* together, if there are similar patterns the compression will succeed.
31
31
*
32
32
* 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
38
36
* to ensure all characters will be transmitted correctly.
39
37
*/
40
38
43
41
#include " utest/utest.h"
44
42
#include " hal/trng_api.h"
45
43
#include " base64b.h"
46
- #include " nvstore.h"
47
44
#include " pithy.h"
48
45
#include < stdio.h>
49
46
67
64
68
65
#define RESULT_SUCCESS 0
69
66
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
-
76
67
using namespace utest ::v1;
77
68
78
69
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)
116
107
input_buf = new uint8_t [BUFFER_LEN * 4 ];
117
108
temp_buf = new uint8_t [BUFFER_LEN * 2 ];
118
109
119
- #if NVSTORE_RESET
120
- NVStore& nvstore = NVStore::get_instance ();
121
- #endif
122
-
123
110
/* At the begining of step 2 load trng buffer from step 1*/
124
111
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
130
112
/* Using base64 to decode data sent from host*/
131
-
132
113
uint32_t lengthWritten = 0 ;
133
114
uint32_t charsProcessed = 0 ;
134
115
result = trng_DecodeNBase64 ((const char *)value,
@@ -138,7 +119,6 @@ static void compress_and_compare(char *key, char *value)
138
119
&lengthWritten,
139
120
&charsProcessed);
140
121
TEST_ASSERT_EQUAL (0 , result);
141
- #endif
142
122
memcpy (input_buf, buffer, BUFFER_LEN);
143
123
}
144
124
@@ -186,10 +166,6 @@ static void compress_and_compare(char *key, char *value)
186
166
/* At the end of step 1 store trng buffer and reset the device*/
187
167
if (strcmp (key, MSG_TRNG_TEST_STEP1) == 0 ) {
188
168
int result = 0 ;
189
- #if NVSTORE_RESET
190
- result = nvstore.set (NVKEY, BUFFER_LEN, buffer);
191
- TEST_ASSERT_EQUAL (RESULT_SUCCESS, result);
192
- #else
193
169
/* Using base64 to encode data sending from host*/
194
170
result = trng_EncodeBase64 (buffer,
195
171
BUFFER_LEN,
@@ -198,7 +174,6 @@ static void compress_and_compare(char *key, char *value)
198
174
TEST_ASSERT_EQUAL (RESULT_SUCCESS, result);
199
175
200
176
greentea_send_kv (MSG_TRNG_BUFFER, (const char *)out_comp_buf);
201
- #endif
202
177
}
203
178
204
179
delete[] out_comp_buf;
0 commit comments