Skip to content

How to enable/configure BCFIPS to use AES NI for TLS data transfer #1961

Open
@vmwzhangv

Description

We are hitting a performance issue with BCFIPS when downloading files using HTTPS. Profiling reveals high cpu usage in the following call chain. This is some AES code in BCFIPS. The performance is 10x times slower than the linux wget command.
We are not sure that BCFIPS is leveraging the AES NI or not. This BCFIPS 2.0 on a Intel system.

Can you confirm/suggest ways to make BCFIPS use AES NI for TLS while keeping the FIPS compliance ? Some google search suggests to indirectly use the default java security provider for AES, but that would lose the FIPS compliance ?

org.bouncycastle.crypto.fips.AESEngine.processBlock()
org.bouncycastle.crypto.internal.modes.GCMBlockCipher.getNextCounterBlock()
org.bouncycastle.crypto.internal.modes.GCMBlockCipher.gCTRBlock()
org.bouncycastle.crypto.internal.modes.GCMBlockCipher.outputBlock()
org.bouncycastle.crypto.internal.modes.GCMBlockCipher.processBytes()
org.bouncycastle.crypto.internal.io.CipherOutputStreamImpl.write()
org.bouncycastle.crypto.UpdateOutputStream.update()
org.bouncycastle.jcajce.provider.BaseCipher.engineDoFinal()
javax.crypto.Cipher.doFinal(Cipher.java:2417)
org.bouncycastle.tls.crypto.impl.jcajce.JceAEADCipherImpl.doFinal(JceAEADCipherImpl.java:143)
org.bouncycastle.tls.crypto.impl.TlsAEADCipher.decodeCiphertext(TlsAEADCipher.java:303)
org.bouncycastle.tls.RecordStream.decodeAndVerify(RecordStream.java:255)
org.bouncycastle.tls.RecordStream.readRecord(RecordStream.java:240)
org.bouncycastle.tls.TlsProtocol.safeReadRecord(TlsProtocol.java:879)
org.bouncycastle.tls.TlsProtocol.readApplicationData(TlsProtocol.java:842)
org.bouncycastle.jsse.provider.ProvSSLSocketWrap$AppDataInput.read(ProvSSLSocketWrap.java:814)
org.apache.hc.core5.http.impl.io.SessionInputBufferImpl.read(SessionInputBufferImpl.java:195)
org.apache.hc.core5.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:173)
org.apache.hc.core5.http.io.EofSensorInputStream.read(EofSensorInputStream.java:135)
org.apache.hc.core5.http.io.EofSensorInputStream.read(EofSensorInputStream.java:148)

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions