Skip to content

Commit 3bfb494

Browse files
committed
crypto: fix cipher "none" new key setup
Uninit key slot, set keId/peerId and reset crypto options. Signed-off-by: Lev Stipakov <[email protected]>
1 parent 2bd0350 commit 3bfb494

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

crypto.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,13 @@ OvpnCryptoNewKey(OvpnCryptoContext* cryptoContext, POVPN_CRYPTO_DATA_V2 cryptoDa
842842
TraceLoggingValue(cryptoData->KeyId, "KeyId"), TraceLoggingValue(cryptoData->PeerId, "PeerId"));
843843
}
844844
else if (cryptoData->CipherAlg == OVPN_CIPHER_ALG_NONE) {
845+
OvpnCryptoEpochUninitSlot(keySlot);
846+
847+
keySlot->KeyId = cryptoData->KeyId;
848+
keySlot->PeerId = cryptoData->PeerId;
849+
850+
RtlZeroMemory(&cryptoContext->Options, sizeof(cryptoContext->Options));
851+
845852
cryptoContext->Encrypt = OvpnCryptoEncryptNone;
846853
cryptoContext->Decrypt = OvpnCryptoDecryptNone;
847854

0 commit comments

Comments
 (0)