Skip to content

Commit 6d8e3c3

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 6871e23 commit 6d8e3c3

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
@@ -849,6 +849,13 @@ OvpnCryptoNewKey(OvpnCryptoContext* cryptoContext, POVPN_CRYPTO_DATA_V2 cryptoDa
849849
TraceLoggingValue(cryptoData->KeyId, "KeyId"), TraceLoggingValue(cryptoData->PeerId, "PeerId"));
850850
}
851851
else if (cryptoData->CipherAlg == OVPN_CIPHER_ALG_NONE) {
852+
OvpnCryptoEpochUninitSlot(keySlot);
853+
854+
keySlot->KeyId = cryptoData->KeyId;
855+
keySlot->PeerId = cryptoData->PeerId;
856+
857+
RtlZeroMemory(&cryptoContext->Options, sizeof(cryptoContext->Options));
858+
852859
cryptoContext->Encrypt = OvpnCryptoEncryptNone;
853860
cryptoContext->Decrypt = OvpnCryptoDecryptNone;
854861

0 commit comments

Comments
 (0)