kopia lustrzana https://github.com/solokeys/solo1
add rk delete implementations
rodzic
98bcf647c4
commit
d677f8c346
|
@ -185,6 +185,21 @@ __attribute__((weak)) void ctap_store_rk(int index, CTAP_residentKey * rk)
|
|||
|
||||
}
|
||||
|
||||
__attribute__((weak)) void ctap_delete_rk(int index)
|
||||
{
|
||||
CTAP_residentKey rk;
|
||||
|
||||
if (index < RK_NUM)
|
||||
{
|
||||
memmove(RK_STORE.rks + index, &rk, sizeof(CTAP_residentKey));
|
||||
}
|
||||
else
|
||||
{
|
||||
printf1(TAG_ERR,"Out of bounds for delete_rk\r\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
__attribute__((weak)) void ctap_load_rk(int index, CTAP_residentKey * rk)
|
||||
{
|
||||
memmove(rk, RK_STORE.rks + index, sizeof(CTAP_residentKey));
|
||||
|
|
|
@ -140,6 +140,13 @@ uint32_t ctap_rk_size();
|
|||
*/
|
||||
void ctap_store_rk(int index,CTAP_residentKey * rk);
|
||||
|
||||
/** Delete a resident key from an index.
|
||||
* @param index to delete resident key from. Has no effect if no RK exists at index.
|
||||
*
|
||||
* *Optional*, if not implemented, operates on non-persistant RK's.
|
||||
*/
|
||||
void ctap_delete_rk(int index);
|
||||
|
||||
/** Read a resident key from an index into memory
|
||||
* @param index to read resident key from.
|
||||
* @param rk pointer to resident key structure to write into with RK.
|
||||
|
|
|
@ -449,6 +449,12 @@ void ctap_store_rk(int index, CTAP_residentKey * rk)
|
|||
|
||||
}
|
||||
|
||||
void ctap_delete_rk(int index)
|
||||
{
|
||||
CTAP_residentKey rk;
|
||||
memset(&rk, 0xff, sizeof(CTAP_residentKey));
|
||||
memmove(RK_STORE.rks + index, &rk, sizeof(CTAP_residentKey));
|
||||
}
|
||||
|
||||
void ctap_load_rk(int index, CTAP_residentKey * rk)
|
||||
{
|
||||
|
|
|
@ -793,6 +793,13 @@ void ctap_store_rk(int index,CTAP_residentKey * rk)
|
|||
ctap_overwrite_rk(index, rk);
|
||||
}
|
||||
|
||||
void ctap_delete_rk(int index)
|
||||
{
|
||||
CTAP_residentKey rk;
|
||||
memset(&rk, 0xff, sizeof(CTAP_residentKey));
|
||||
ctap_overwrite_rk(index, &rk);
|
||||
}
|
||||
|
||||
void ctap_load_rk(int index,CTAP_residentKey * rk)
|
||||
{
|
||||
int byte_offset_into_page = (sizeof(CTAP_residentKey) * (index % (PAGE_SIZE/sizeof(CTAP_residentKey))));
|
||||
|
|
Ładowanie…
Reference in New Issue