blob: 8fbcd36ccaf23f9d229441a99f7e1687ff4af274 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
/* ISC license. */
#include <bearssl.h>
#include <skalibs/bytestr.h>
#include <s6-networking/sbearssl.h>
void sbearssl_skey_wipe (sbearssl_skey *key, char *s)
{
switch (key->type)
{
case BR_KEYTYPE_RSA :
byte_zzero(s + key->data.rsa.p, key->data.rsa.plen) ;
byte_zzero(s + key->data.rsa.q, key->data.rsa.qlen) ;
byte_zzero(s + key->data.rsa.dp, key->data.rsa.dplen) ;
byte_zzero(s + key->data.rsa.dq, key->data.rsa.dqlen) ;
byte_zzero(s + key->data.rsa.iq, key->data.rsa.iqlen) ;
break ;
case BR_KEYTYPE_EC :
byte_zzero(s + key->data.ec.x, key->data.ec.xlen) ;
break ;
default : break ;
}
byte_zzero((char *)key, sizeof(sbearssl_skey)) ;
}
|