Fix accessing way to data.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
@@ -18,7 +18,9 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "stdlib.h"
|
#include "stdlib.h"
|
||||||
|
#ifndef ENABLE_EMULATION
|
||||||
#include "pico/stdlib.h"
|
#include "pico/stdlib.h"
|
||||||
|
#endif
|
||||||
#include "kek.h"
|
#include "kek.h"
|
||||||
#include "crypto_utils.h"
|
#include "crypto_utils.h"
|
||||||
#include "random.h"
|
#include "random.h"
|
||||||
@@ -54,14 +56,14 @@ int load_mkek(uint8_t *mkek) {
|
|||||||
const uint8_t *pin = NULL;
|
const uint8_t *pin = NULL;
|
||||||
if (pin == NULL && has_session_pin == true) {
|
if (pin == NULL && has_session_pin == true) {
|
||||||
file_t *tf = search_by_fid(EF_MKEK, NULL, SPECIFY_EF);
|
file_t *tf = search_by_fid(EF_MKEK, NULL, SPECIFY_EF);
|
||||||
if (tf) {
|
if (file_has_data(tf)) {
|
||||||
memcpy(mkek, file_get_data(tf), MKEK_SIZE);
|
memcpy(mkek, file_get_data(tf), MKEK_SIZE);
|
||||||
pin = session_pin;
|
pin = session_pin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pin == NULL && has_session_sopin == true) {
|
if (pin == NULL && has_session_sopin == true) {
|
||||||
file_t *tf = search_by_fid(EF_MKEK_SO, NULL, SPECIFY_EF);
|
file_t *tf = search_by_fid(EF_MKEK_SO, NULL, SPECIFY_EF);
|
||||||
if (tf) {
|
if (file_has_data(tf)) {
|
||||||
memcpy(mkek, file_get_data(tf), MKEK_SIZE);
|
memcpy(mkek, file_get_data(tf), MKEK_SIZE);
|
||||||
pin = session_sopin;
|
pin = session_sopin;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user