mirror of
https://github.com/polhenarejos/pico-keys-sdk
synced 2026-05-08 05:56:11 +02:00
Added a major refactoring to include Emulated interface.
It works in combination with virtualsmarcard module (vpcd). It properly installed, it creates a virtual reader that can be interfaced via PCSC+vcpd. At user app level, it has no difference of having a physical smart card. At this moment, it only works emulating a CCID interface. Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
@@ -15,7 +15,9 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef ENABLE_EMULATION
|
||||
#include <pico/unique_id.h>
|
||||
#endif
|
||||
#include "mbedtls/md.h"
|
||||
#include "mbedtls/sha256.h"
|
||||
#include "mbedtls/aes.h"
|
||||
@@ -34,12 +36,15 @@ void hash_multi(const uint8_t *input, size_t len, uint8_t output[32]) {
|
||||
mbedtls_sha256_context ctx;
|
||||
mbedtls_sha256_init(&ctx);
|
||||
int iters = 256;
|
||||
#ifndef ENABLE_EMULATION
|
||||
pico_unique_board_id_t unique_id;
|
||||
|
||||
pico_get_unique_board_id(&unique_id);
|
||||
|
||||
#endif
|
||||
mbedtls_sha256_starts (&ctx, 0);
|
||||
#ifndef ENABLE_EMULATION
|
||||
mbedtls_sha256_update (&ctx, unique_id.id, sizeof(unique_id.id));
|
||||
#endif
|
||||
|
||||
while (iters > len)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user