Muxed fixes after testing

This commit is contained in:
zzz
2025-05-07 11:23:03 -04:00
parent 786ba8e190
commit e3b3deac69
4 changed files with 16 additions and 10 deletions

View File

@ -48,7 +48,7 @@ final class MuxedPQEngine {
}
// PQ
// Ratchet Tag
rv = _context.eciesEngine().decryptFast(data, ecKey, keyManager.getECSKM());
rv = _context.eciesEngine().decryptFast(data, pqKey, keyManager.getPQSKM());
if (rv != null)
return rv;
if (debug)
@ -75,7 +75,7 @@ final class MuxedPQEngine {
// PQ DH
// Minimum size checks for the larger New Session message are in ECIESAEADEngine.x_decryptSlow().
rv = _context.eciesEngine().decryptSlow(data, pqKey, keyManager.getECSKM());
rv = _context.eciesEngine().decryptSlow(data, pqKey, keyManager.getPQSKM());
boolean isok = rv != null;
keyManager.reportDecryptResult(false, isok);
if (isok)

View File

@ -113,10 +113,14 @@ public class MuxedPQSKM extends SessionKeyManager {
}
/**
* EC only
* EC/PQ
*/
public RatchetEntry consumeNextAvailableTag(PublicKey target) {
return null;
EncType type = target.getType();
if (type == EncType.ECIES_X25519)
return _ec.consumeNextAvailableTag(target);
else
return _pq.consumeNextAvailableTag(target);
}
@Override
@ -182,10 +186,11 @@ public class MuxedPQSKM extends SessionKeyManager {
}
/**
* EC only
* EC only.
* One time session
* We do not support PQ one-time sessions on MuxedPQSKM.
*
* @param expire time from now
* @since 0.9.51
*/
public void tagsReceived(SessionKey key, RatchetSessionTag tag, long expire) {
_ec.tagsReceived(key, tag, expire);

View File

@ -225,7 +225,7 @@ public class RatchetSKM extends SessionKeyManager implements SessionTagListener
boolean createSession(PublicKey target, Destination d, HandshakeState state, ReplyCallback callback) {
EncType type = target.getType();
if (type != _type)
throw new IllegalArgumentException("Bad public key type " + type);
throw new IllegalArgumentException("Bad public key type " + type + " expected " + _type);
OutboundSession sess = new OutboundSession(target, d, null, state, callback);
boolean isInbound = state.getRole() == HandshakeState.RESPONDER;
if (isInbound) {
@ -271,7 +271,7 @@ public class RatchetSKM extends SessionKeyManager implements SessionTagListener
ReplyCallback callback, SplitKeys split) {
EncType type = target.getType();
if (type != _type)
throw new IllegalArgumentException("Bad public key type " + type);
throw new IllegalArgumentException("Bad public key type " + type + " expected " + _type);
boolean isInbound = state.getRole() == HandshakeState.RESPONDER;
if (isInbound) {
// we are Bob, NSR sent

View File

@ -315,7 +315,8 @@ public class GarlicMessageBuilder {
} else if (skm instanceof MuxedSKM) {
rskm = ((MuxedSKM) skm).getECSKM();
} else if (skm instanceof MuxedPQSKM) {
rskm = ((MuxedPQSKM) skm).getECSKM();
MuxedPQSKM mskm = (MuxedPQSKM) skm;
rskm = type.isPQ() ? mskm.getPQSKM() : mskm.getECSKM();
} else {
if (log.shouldWarn())
log.warn("No SKM for " + from.toBase32());
@ -342,7 +343,7 @@ public class GarlicMessageBuilder {
/**
* Encrypt from an anonymous source.
* ECIES_X25519 and PQ only.
* ECIES_X25519 only. PQ not supported.
* Called by MessageWrapper only.
*
* @param ctx scope