← Commit list

a6192f347

Denys Vlasenko
Denys Vlasenko
2018-11-25
SUCCESS Duration: 291s

Subject

tls: do not leak RSA key

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

networking/tls.c+1 -0
@@ -2168,6 +2168,7 @@ void FAST_FUNC tls_handshake(tls_state_t *tls, const char *sni)
/* application data can be sent/received */
/* free handshake data */
+ psRsaKey_clear(&tls->hsd->server_rsa_pub_key);
// if (PARANOIA)
// memset(tls->hsd, 0, tls->hsd->hsd_size);
free(tls->hsd);
networking/tls_rsa.h+12 -0
@@ -13,6 +13,18 @@ typedef struct {
//bbox psPool_t *pool;
} psRsaKey_t;
+static ALWAYS_INLINE void psRsaKey_clear(psRsaKey_t *key)
+{
+ pstm_clear(&key->N);
+ pstm_clear(&key->e);
+ pstm_clear(&key->d);
+ pstm_clear(&key->p);
+ pstm_clear(&key->q);
+ pstm_clear(&key->dP);
+ pstm_clear(&key->dQ);
+ pstm_clear(&key->qP);
+}
+
#define psRsaEncryptPub(pool, key, in, inlen, out, outlen, data) \
psRsaEncryptPub( key, in, inlen, out, outlen)
int32 psRsaEncryptPub(psPool_t *pool, psRsaKey_t *key,