-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
the KEY information in gcm_data is changed to pointer reference from substance #7
Comments
Hi, The problem I see with gcm_data and the inclusion of key pointer within the structure is that 90% of gcm_data are expanded keys. Upon SA change key expansion operation has to be done. It seems natural to keep gcm_data as part of session structure. Thanks, |
In the DPDK implementation, the drivers are different between GCM and CBC, so sequence control is required on the upper AP. |
Why do you need sequence control between GCM and CBC? |
As it is L3, order management is not mandatory. In my AP implementation, in order to process IP packet processing efficiently, we adopted a design that processes multiple packets at the same time. After that, if you add AUTH_TAG at the time of decryption and a counter block at the time of CTR mode into the MB API JOB, session management becomes almost unnecessary. # It is totally unacceptable to use the packet area for AUTH_TAG validation during decoding of the DPDK implementation. |
The only scenario where I could see the order between CBC and GCM needs to be preserved is during SA re-keying where the new SA has a different algo than the old SA. I am not understanding your point regarding "GCM packet referring to the same SA". I agree that using the packet area for AUTH_TAG validation is not the best approach, but could you provide more details as to why it is totally unacceptable? We could submit a request to change the DPDK approach. |
Thank you for your advice. However, since we released the product directly using the MB library, there is a concern that performance will degrade when passing through DPDK. We will consider switching when chained mbuf supports CBC etc. The problem with AUTH_TAG is that it is impossible to communicate with myself in the size of the MTU.Tunnel MTU needs to be considered up to the outside of AP management. I decided to implement AUTH_TAG on MB JOB and compare it when I completed HASH. |
There is obviously some overhead of going through DPDK Cryptodev layer, that's the price to pay for a common API. Re AUTH_TAG, thanks for the additional information. I think I understand your concern which is absolutely legitimate. With the current DPDK approach we could hit corner cases where there is not enough space left in the existing mbuf to store the AUTH_TAG and we would fail to process the packet (I said corner cases because it would depend on the application mbuf size and MTU). This is something that we should change in DPDK. Back to your issue/proposal, Tomasz already mentioned that ~90% of the gcm_data is key related material, so your proposal would have a performance penalty:
|
Ok. The KEY is just changed to pointer reference, and is there impact in performance? POC code which makes GCM MB API was made. It seemed good as POC in make, so it's proposed order. |
The essence of my argument is that mapping GCM contexts to SAs is not acceptable. However, I think that it is not a problem if it is smaller than extended AES KEY + HMAC KEY (specifically 512 bytes). |
Hi deadcafe, To me, the proposed change would only make sense if multiple SA's use the same keys. Then same expanded keys could be re-used for memory conservation purpose. This perhaps could be also achieved with multiple SA's pointing to the same gcm_data with expanded keys inside. Such solution shouldn't require code re-work - if this approach cannot be used then please explain why. (after briefly looking into the pull request) Another potential benefit I see here is: if expanded keys and shifted_hkeyX structures are decoupled from gcm_data then one may avoid expanding keys when switching between AES modes (with the same key size and gcm needs enc keys only). However, I don't think this operation is critical enough to justify the change. Thanks, |
Hi, Since it seems to be efficient at the time of GMAC, I tried to separate HASH KEY from AES KEY, but that is not my Issue. I want to handle CONTEXT separately from const KEY. #At the moment gcm_data is integrated into the MB API as it is. |
why not link SA with the gcm_data structure through a pointer? app could also define own structure with the key and gcm_data inside in order to keep it separate from the rest of SA. This would't require any library API changes. |
struct SA { Is it required to map CRYPTO CONTEXT here? I prefer not to reserve CRYPTO CONTEXT and keys in continuous area, but reduce SA size. How does the MB API correspond to chained buffers? I think that CRYPTO REQUEST will only be executed if all buffers are available, even in the case of chain buffers. Therefore, I believe that CRYPTO CONTEXT is not essential to SA. #Since we are using hyperthreading, we need to save huge pages to avoid TLB misses. However, if the key and CONTEXT are contiguous areas and the majority of the performance contributes, we abandon this proposal as a cost. |
Looking into least invasive but elegant solution to this problem. A few solutions possible. I'll come back with some proposals. |
Considered options:
Option 2 only makes sense if porting existing code to new API (extra pointer) would be problematic. deadcafe, you need new API for your application so the old one is not important to you. Is it correct? Thanks, |
Yes it is correct. For me preserve old API is not important. |
Me too, old API is unnecessary. |
No, it is not important to preserve the old API. |
Many thanks for your replies. I am currently working on GCM optimizations which change GCM algorithmic code. It would be much easier to commit optimizations first and then apply the API change (~2 weeks time). deadcafe, as to wrapping GCM under JOB_AES_HMAC API, since you applied this change in your fork could you measure performance degradation vs direct API model? This data would be helpful in taking the right decision here. Thanks, |
OK, but now I am busy with private affairs and may take time. |
Sure, take your time. Perhaps, LibPerfApp code will come handy in measuring both API's - it reports cycles per buffer size. ipsec_diff_tool.py can be used then to translate this data into linear equation which makes comparing bit easier. |
Hi tkanteck, It seems to be somewhat slow as it passes parameters with JOB structure. |
Hi deadcafe, |
Thanks for your inputs. GCM API has been modified to decouple extended keys from the context. I am still due to run tests for code wrapping AES-GCM under job API. In the meantime, one question about IV in AES-GCM. There was an idea to remove need for an application to allocate 16 bytes for IV and pad from 12 to 16. GCM_INIT would automatically extend it to 16 bytes. Any cons against this idea? Would it break any of the use cases? Thanks, |
Hi deadcafe, As to wrapping GCM under job API. This what I see on one of my test systems using your fork: NO ARCH CIPHER DIR HASH KEYSZ SLOPE A INTERCEPT A SLOPE B INTERCEPT B Legend:
I expected to see increase in intercept but unfortunately increase in slope is seen (cost per byte). It is also quite substantial. ~100 cycles increase in intercept sounds reasonable to me having in mind that job structure has to be filled in, validated and then dispatched. Thanks, |
ok |
Hi tkanteck, I also tried it(ipsec_perf --no-avx512 --shani-off on E5-2697v3). 589 SSE GCM ENCRYPT GCM AES-128 1.20788 218.80770 1.19862 293.48376 |
Hi deadcafe, This data looks reasonable to me. Did you change anything? or were my measurements simply off? Thanks, |
Hi tkanteck, I fixed the following "PoC/LibPerfApp". The previous code is buggy. I'm sorry. |
Let me close this issue as GCM key data has been separated and added under JOB API. |
Hi
I am using this library for DPDK APP, but there are some problems.
CBC mode, CTR mode and GCM are intermingled and are used at the same time in IPsec.
So an abstraction layer is being prepared by APP and MB API and GCM API are being used appropriately.
The gcm_data has substance of KEY information.Therefore it's necessary to copy KEY information in gcm_data from IPsec SA and eliminate after use.
If the KEY information in gcm_data is changed to pointer reference from substance, it becomes easier to use.
It's an ideal that GCM is also integrated into MB API, but that makes that a different issue about that.
The text was updated successfully, but these errors were encountered: