Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions crypto/fipsmodule/kem/kem.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ const KEM *KEM_KEY_get0_kem(KEM_KEY* key) {
}

int KEM_KEY_set_raw_public_key(KEM_KEY *key, const uint8_t *in) {
OPENSSL_free(key->public_key);
key->public_key = OPENSSL_memdup(in, key->kem->public_key_len);
if (key->public_key == NULL) {
return 0;
Expand All @@ -281,6 +282,7 @@ int KEM_KEY_set_raw_public_key(KEM_KEY *key, const uint8_t *in) {
}

int KEM_KEY_set_raw_secret_key(KEM_KEY *key, const uint8_t *in) {
OPENSSL_free(key->secret_key);
key->secret_key = OPENSSL_memdup(in, key->kem->secret_key_len);
if (key->secret_key == NULL) {
return 0;
Expand All @@ -291,6 +293,8 @@ int KEM_KEY_set_raw_secret_key(KEM_KEY *key, const uint8_t *in) {

int KEM_KEY_set_raw_key(KEM_KEY *key, const uint8_t *in_public,
const uint8_t *in_secret) {
OPENSSL_free(key->public_key);
OPENSSL_free(key->secret_key);
key->public_key = OPENSSL_memdup(in_public, key->kem->public_key_len);
key->secret_key = OPENSSL_memdup(in_secret, key->kem->secret_key_len);
if (key->public_key == NULL || key->secret_key == NULL) {
Expand Down
Loading