ramu11 commented on code in PR #30945:
URL: https://github.com/apache/camel/pull/30945#discussion_r4718923820
##########
components/camel-pqc/src/main/java/org/apache/camel/component/pqc/PQCProducer.java:
##########
@@ -840,58 +832,48 @@ private void generateEncapsulation(Exchange exchange)
}
KeyGenerator generator = keyGeneratorForExchange();
- SecretKeyWithEncapsulation secEnc1;
+ BouncyCastleKemSupport.EncapsulationResult secEnc1;
synchronized (PQCKemLocks.lockFor(generator, keyPair.getPublic())) {
- // initialise for creating an encapsulation and shared secret.
- generator.init(
- new KEMGenerateSpec(
- keyPair.getPublic(),
- // The mapped JCE algorithm name, as the extract
operations use: for the algorithms whose
- // enum name differs from the JCE name
(GOST3412_2015 -> GOST3412-2015, DESEDE -> DESede)
- // the raw name is not a resolvable cipher, and
the two ends of the exchange would disagree
- // on the identity of the key
-
PQCSymmetricAlgorithms.valueOf(getConfiguration().getSymmetricKeyAlgorithm()).getAlgorithm(),
-
getEndpoint().getConfiguration().getSymmetricKeyLength()),
+ secEnc1 = BouncyCastleKemSupport.encapsulate(
Review Comment:
Addressed. Removed the redundant outer `synchronized` blocks from
`PQCProducer` and `HybridKEM`. `BouncyCastleKemSupport` now owns
synchronization for the KEM operations, avoiding duplicate locking. All tests
passed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]