@@ -81,7 +81,7 @@ ReturnValue BleApiTest_UnknownINS(pBleDevice dev)
8181
8282 /* check reply */
8383 CHECK_EQ (replyLength, 2 );
84- CHECK_EQ (FIDO_RESP_INVALID_INSTRUCTION, b2s (reply, 0 ));
84+ CHECK_EQ (FIDO_RESP_INVALID_INSTRUCTION, bytes2short (reply, 0 ));
8585
8686 return BLEAPI_ERROR_SUCCESS;
8787}
@@ -104,7 +104,7 @@ ReturnValue BleApiTest_BadCLA(pBleDevice dev)
104104
105105 /* check reply */
106106 CHECK_EQ (replyLength, 2 );
107- CHECK_EQ (FIDO_RESP_CLA_NOT_SUPPORTED, b2s (reply, 0 ));
107+ CHECK_EQ (FIDO_RESP_CLA_NOT_SUPPORTED, bytes2short (reply, 0 ));
108108
109109 return BLEAPI_ERROR_SUCCESS;
110110}
@@ -127,7 +127,7 @@ ReturnValue BleApiTest_VersionWrongLength(pBleDevice dev)
127127
128128 /* check reply */
129129 CHECK_EQ (replyLength, 2 );
130- CHECK_EQ (FIDO_RESP_WRONG_LENGTH, b2s (reply, 0 ));
130+ CHECK_EQ (FIDO_RESP_WRONG_LENGTH, bytes2short (reply, 0 ));
131131
132132 return BLEAPI_ERROR_SUCCESS;
133133}
@@ -152,7 +152,7 @@ ReturnValue BleApiTest_RegisterWrongLength(pBleDevice dev)
152152
153153 /* check reply */
154154 CHECK_EQ (replyLength, 2 );
155- CHECK_EQ (FIDO_RESP_WRONG_LENGTH, b2s (reply, 0 ));
155+ CHECK_EQ (FIDO_RESP_WRONG_LENGTH, bytes2short (reply, 0 ));
156156
157157 return BLEAPI_ERROR_SUCCESS;
158158}
@@ -202,14 +202,14 @@ ReturnValue BleApiTest_Enroll(pBleDevice dev, int expectedSW12)
202202 CHECK_EQ (retval, BLEAPI_ERROR_SUCCESS);
203203
204204 if (expectedSW12 != FIDO_RESP_SUCCESS) {
205- CHECK_EQ (expectedSW12, b2s (reply, replyLength - 2 ));
205+ CHECK_EQ (expectedSW12, bytes2short (reply, replyLength - 2 ));
206206 CHECK_EQ (replyLength, 2 );
207207 return BLEAPI_ERROR_SUCCESS;
208208 }
209209
210210 /* check reply */
211211 CHECK_EQ (replyCmd, FIDO_BLE_CMD_MSG);
212- CHECK_EQ (FIDO_RESP_SUCCESS, b2s (reply, replyLength - 2 ));
212+ CHECK_EQ (FIDO_RESP_SUCCESS, bytes2short (reply, replyLength - 2 ));
213213 CHECK_NE (replyLength, 2 );
214214
215215 CHECK_LE (replyLength - 2 , sizeof (U2F_REGISTER_RESP));
@@ -227,15 +227,15 @@ ReturnValue BleApiTest_Enroll(pBleDevice dev, int expectedSW12)
227227 // Check crypto of enroll response.
228228 std::string cert;
229229 CHECK_EQ (getCertificate (regRsp, &cert), true );
230- INFO << " cert: " << b2a (cert);
230+ INFO << " cert: " << bytes2ascii (cert);
231231
232232 std::string pk;
233233 CHECK_EQ (getSubjectPublicKey (cert, &pk), true );
234- INFO << " pk : " << b2a (pk);
234+ INFO << " pk : " << bytes2ascii (pk);
235235
236236 std::string sig;
237- CHECK_EQ (getSignature (regRsp, &sig), true );
238- INFO << " sig : " << b2a (sig);
237+ CHECK_EQ (getSignature (regRsp, cert. size (), &sig), true );
238+ INFO << " sig : " << bytes2ascii (sig);
239239
240240 // Parse signature into two integers.
241241 p256_int sig_r, sig_s;
@@ -256,7 +256,7 @@ ReturnValue BleApiTest_Enroll(pBleDevice dev, int expectedSW12)
256256 hash = SHA256_final (&sha);
257257 p256_from_bin (hash, &h);
258258
259- INFO << " hash : " << b2a ( hash, 32 );
259+ INFO << " hash : " << bytes2ascii (( char *) hash, 32 );
260260
261261 // Parse subject public key into two integers.
262262 CHECK_EQ (pk.size (), P256_POINT_SIZE);
@@ -317,13 +317,13 @@ uint32_t BleApiTest_Sign(pBleDevice dev, int expectedSW12, bool checkOnly,
317317 CHECK_EQ (retval, BLEAPI_ERROR_SUCCESS);
318318
319319 if (expectedSW12 != FIDO_RESP_SUCCESS) {
320- CHECK_EQ (expectedSW12, b2s (reply, replyLength - 2 ));
320+ CHECK_EQ (expectedSW12, bytes2short (reply, replyLength - 2 ));
321321 CHECK_EQ (replyLength, 2 );
322322 return BLEAPI_ERROR_SUCCESS;
323323 }
324324
325325 CHECK_EQ (replyCmd, FIDO_BLE_CMD_MSG);
326- CHECK_EQ (FIDO_RESP_SUCCESS, b2s (reply, replyLength - 2 ));
326+ CHECK_EQ (FIDO_RESP_SUCCESS, bytes2short (reply, replyLength - 2 ));
327327 CHECK_NE (replyLength, 2 );
328328 CHECK_LE (replyLength - 2 , sizeof (U2F_AUTHENTICATE_RESP));
329329
@@ -379,7 +379,7 @@ ReturnValue BleApiTest_TestEncodingShortAnyLength(pBleDevice dev)
379379 if (retval != BLEAPI_ERROR_SUCCESS)
380380 return retval;
381381
382- CHECK_EQ (FIDO_RESP_SUCCESS, b2s (reply, replyLength - 2 ));
382+ CHECK_EQ (FIDO_RESP_SUCCESS, bytes2short (reply, replyLength - 2 ));
383383
384384 /* drop reply status code. */
385385 reply[replyLength - 2 ] = ' \0 ' ;
@@ -408,7 +408,7 @@ ReturnValue BleApiTest_TestEncodingShortExactLength(pBleDevice dev)
408408 if (retval != BLEAPI_ERROR_SUCCESS)
409409 return retval;
410410
411- CHECK_EQ (FIDO_RESP_SUCCESS, b2s (reply, replyLength - 2 ));
411+ CHECK_EQ (FIDO_RESP_SUCCESS, bytes2short (reply, replyLength - 2 ));
412412
413413 /* drop reply status code. */
414414 reply[replyLength - 2 ] = ' \0 ' ;
@@ -439,7 +439,7 @@ ReturnValue BleApiTest_TestEncodingShortWrongLength(pBleDevice dev)
439439
440440 /* check U2F Protocol version */
441441 CHECK_EQ (replyLength, 2 );
442- CHECK_EQ (FIDO_RESP_WRONG_LENGTH, b2s (reply, 0 ));
442+ CHECK_EQ (FIDO_RESP_WRONG_LENGTH, bytes2short (reply, 0 ));
443443
444444 return BLEAPI_ERROR_SUCCESS;
445445}
@@ -461,7 +461,7 @@ ReturnValue BleApiTest_TestEncodingLongAnyLength(pBleDevice dev)
461461 if (retval != BLEAPI_ERROR_SUCCESS)
462462 return retval;
463463
464- CHECK_EQ (FIDO_RESP_SUCCESS, b2s (reply, replyLength - 2 ));
464+ CHECK_EQ (FIDO_RESP_SUCCESS, bytes2short (reply, replyLength - 2 ));
465465
466466 /* drop reply status code. */
467467 reply[replyLength - 2 ] = ' \0 ' ;
@@ -490,7 +490,7 @@ ReturnValue BleApiTest_TestEncodingLongExactLength(pBleDevice dev)
490490 if (retval != BLEAPI_ERROR_SUCCESS)
491491 return retval;
492492
493- CHECK_EQ (FIDO_RESP_SUCCESS, b2s (reply, replyLength - 2 ));
493+ CHECK_EQ (FIDO_RESP_SUCCESS, bytes2short (reply, replyLength - 2 ));
494494
495495 /* drop reply status code. */
496496 reply[replyLength - 2 ] = ' \0 ' ;
@@ -521,7 +521,7 @@ ReturnValue BleApiTest_TestEncodingLongWrongLength(pBleDevice dev)
521521
522522 /* check U2F Protocol version */
523523 CHECK_EQ (replyLength, 2 );
524- CHECK_EQ (FIDO_RESP_WRONG_LENGTH, b2s (reply, 0 ));
524+ CHECK_EQ (FIDO_RESP_WRONG_LENGTH, bytes2short (reply, 0 ));
525525
526526 return BLEAPI_ERROR_SUCCESS;
527527}
@@ -567,7 +567,7 @@ ReturnValue BleApiTest_TestEncodingLongDataAnyLength(pBleDevice dev)
567567 CHECK_EQ (retval, BLEAPI_ERROR_SUCCESS);
568568
569569 CHECK_EQ (replyCmd, FIDO_BLE_CMD_MSG);
570- CHECK_EQ (FIDO_RESP_SUCCESS, b2s (reply, replyLength - 2 ));
570+ CHECK_EQ (FIDO_RESP_SUCCESS, bytes2short (reply, replyLength - 2 ));
571571 CHECK_NE (replyLength, 2 );
572572 CHECK_LE (replyLength - 2 , sizeof (U2F_AUTHENTICATE_RESP));
573573
@@ -616,7 +616,7 @@ ReturnValue BleApiTest_TestEncodingLongDataExactLength(pBleDevice dev)
616616 CHECK_EQ (retval, BLEAPI_ERROR_SUCCESS);
617617
618618 CHECK_EQ (replyCmd, FIDO_BLE_CMD_MSG);
619- CHECK_EQ (FIDO_RESP_SUCCESS, b2s (reply, replyLength - 2 ));
619+ CHECK_EQ (FIDO_RESP_SUCCESS, bytes2short (reply, replyLength - 2 ));
620620 CHECK_NE (replyLength, 2 );
621621 CHECK_LE (replyLength - 2 , sizeof (U2F_AUTHENTICATE_RESP));
622622
@@ -665,7 +665,7 @@ ReturnValue BleApiTest_TestEncodingLongDataWrongLength(pBleDevice dev)
665665
666666 /* check U2F Protocol version */
667667 CHECK_EQ (replyLength, 2 );
668- CHECK_EQ (FIDO_RESP_WRONG_LENGTH, b2s (reply, 0 ));
668+ CHECK_EQ (FIDO_RESP_WRONG_LENGTH, bytes2short (reply, 0 ));
669669
670670 return BLEAPI_ERROR_SUCCESS;
671671}
0 commit comments