Skip to content

Commit aa65cd6

Browse files
Cleanse temporary data used to derive ECDH shared secret
1 parent 3148b28 commit aa65cd6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/modules/ecdh/main_impl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ static int ecdh_hash_function_sha256(unsigned char *output, const unsigned char
2020
secp256k1_sha256_write(&sha, x, 32);
2121
secp256k1_sha256_finalize(&sha, output);
2222

23+
SECP256K1_CLEANSE(sha);
2324
return 1;
2425
}
2526

@@ -58,9 +59,12 @@ int secp256k1_ecdh(const secp256k1_context* ctx, unsigned char *output, const se
5859
secp256k1_fe_get_b32(y, &pt.y);
5960

6061
ret = hashfp(output, x, y, data);
62+
SECP256K1_CLEANSE(x);
63+
SECP256K1_CLEANSE(y);
6164
}
6265

6366
SECP256K1_CLEANSE(s);
67+
SECP256K1_CLEANSE(pt);
6468
return ret;
6569
}
6670

0 commit comments

Comments
 (0)