* [edk2-devel] Dependency on CryptoLib increases my module size by 600Kb, being apparently too big for integration
@ 2024-02-06 11:24 CrossedCarpet
2024-02-06 15:21 ` Laszlo Ersek
0 siblings, 1 reply; 3+ messages in thread
From: CrossedCarpet @ 2024-02-06 11:24 UTC (permalink / raw)
To: devel
[-- Attachment #1: Type: text/plain, Size: 981 bytes --]
Greetings everyone ,
Integration of my module into a motherboard bricks the computer.
The integrator informed me that this might be happening due to the size of the module given that 600kB is too big and as such the code will be truncated once flashed.
I find this suspicious given that this would render CryptoLib hard to use and I can also find modules like TlsDxe with sizes above 1Mb.
Perhaps there are other ways to call this library that don't include static linking?
Where can I read more about this module size hard limit?
Can someone give me any insight or tip on this subject?
Best regards,
C.C.
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115155): https://edk2.groups.io/g/devel/message/115155
Mute This Topic: https://groups.io/mt/104195858/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
[-- Attachment #2: Type: text/html, Size: 1438 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [edk2-devel] Dependency on CryptoLib increases my module size by 600Kb, being apparently too big for integration
2024-02-06 11:24 [edk2-devel] Dependency on CryptoLib increases my module size by 600Kb, being apparently too big for integration CrossedCarpet
@ 2024-02-06 15:21 ` Laszlo Ersek
2024-02-14 7:29 ` CrossedCarpet
0 siblings, 1 reply; 3+ messages in thread
From: Laszlo Ersek @ 2024-02-06 15:21 UTC (permalink / raw)
To: devel, crossedcarpet
On 2/6/24 12:24, CrossedCarpet wrote:
> Greetings everyone ,
> Integration of my module into a motherboard bricks the computer.
> The integrator informed me that this might be happening due to the size
> of the module given that 600kB is too big and as such the code will be
> truncated once flashed.
> I find this suspicious given that this would render CryptoLib hard to
> use and I can also find modules like TlsDxe with sizes above 1Mb.
> Perhaps there are other ways to call this library that don't include
> static linking?
> Where can I read more about this module size hard limit?
> Can someone give me any insight or tip on this subject?
(1) There are multiple instances of BaseCryptLib and OpensslLib.
For example, consider
"CryptoPkg/Library/BaseCryptLibOnProtocolPpi/DxeCryptLib.inf":
"Implements the BaseCryptLib and TlsLib using the services of the EDK II
Crypto Protocol".
(2) Which leads me to: "CryptoPkg/Driver/CryptoDxe.inf": "Produces the
EDK II Crypto Protocol using the library services from BaseCryptLib and
TlsLib. PcdCryptoServiceFamilyEnable is used to enable the subset of
available services."
Refer to "CryptoPkg/Readme.md" on CryptoDxe configuration.
So, you may be able to (a) choose BaseCryptLib and/or OpensslLib
instances for linking statically into your module that contain the
actual crypto stuff, but a "trimmed" set of APIs (hopefully just what
you need), or (b) use such a cryptlib instance that actually consumes a
protocol and delegates the actual work to the CryptoDxe driver. Option
(b) however requires your platform integrator to include / expose
CryptoDxe, and then they need to configure the feature set of CryptoDxe
very carefully (see CryptoPkg/Readme.md), lest a crypto primitive proves
missing only at runtime. (With static linking and LTO, you have
build-time symbol resolution and just the required feature set included;
the problem is duplication across modules. With protocol / PPI
abstraction, modules can share the crypto logic, but determining the
*smallest sufficient* feature set for runtime, at build time, is a
challenge. AIUI.)
Laszlo
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115173): https://edk2.groups.io/g/devel/message/115173
Mute This Topic: https://groups.io/mt/104195858/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [edk2-devel] Dependency on CryptoLib increases my module size by 600Kb, being apparently too big for integration
2024-02-06 15:21 ` Laszlo Ersek
@ 2024-02-14 7:29 ` CrossedCarpet
0 siblings, 0 replies; 3+ messages in thread
From: CrossedCarpet @ 2024-02-14 7:29 UTC (permalink / raw)
To: Laszlo Ersek, devel
[-- Attachment #1: Type: text/plain, Size: 626 bytes --]
Thank you Laszlo,
Your hand lead me in the right direction since I hadn't noticed all other CryptoLib implementations available.
Using either DxeCryptLib or BaseCryptLibMbedTls/BaseCryptLib.inf I was able to cut down my module by 600kB.
My regards,
C.C.
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115430): https://edk2.groups.io/g/devel/message/115430
Mute This Topic: https://groups.io/mt/104195858/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
[-- Attachment #2: Type: text/html, Size: 1058 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-14 7:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-06 11:24 [edk2-devel] Dependency on CryptoLib increases my module size by 600Kb, being apparently too big for integration CrossedCarpet
2024-02-06 15:21 ` Laszlo Ersek
2024-02-14 7:29 ` CrossedCarpet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox