There's no direct corollary to StdLib's BSD socket functions. What I'm
saying is that is you need something quick, you can isolate the openssl TLS
functions that you need, see exactly what it needs to do over the network
and make special purpose wrappers around edk2 network protocols (such as
EFI_TCP4_PROTOCOL) to get it done. Essentially you'd be making a small
subset of BSD sockets and could probably copy a lot of code from StdLib.

Openssl is portable and so it doesn't link to stdlib functions directly.
They are assigned to function pointers in a struct (BIO or something like
that), and you can just assign your own functions.

The UEFI network protocols are here...
https://github.com/tianocore/edk2/tree/master/NetworkPkg
https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Universal/Network

On Sat, May 23, 2015 at 7:29 AM, Saheb Biswas <sahebbis...@gmail.com> wrote:

> Thank you Thomas,
> Can you point me to the appropriate EDK2 network stack functions that
> should be used in place of the StdLib wrappers ?
>
> *Saheb *
>
> On Sat, May 23, 2015 at 10:03 AM, Thomas Rognon <tcrog...@gmail.com>
> wrote:
>
>> UEFI 2.5 specifices TLS protocol. I know this isn't really an answer, but
>> you could just wait for it to be implemented in edk2. Not sure when that
>> will be, but hopefully soon.
>>
>> If you need it now, you might consider assigned/defining the network
>> functions in openssl (in the BIO struct if I remember correctly?) to custom
>> wrappers around the appropriate edk2 network stack functions. No need for
>> StdLib, but will require a bit of coding to get working.
>>
>> On Fri, May 22, 2015 at 10:27 PM, Saheb Biswas <sahebbis...@gmail.com>
>> wrote:
>>
>>> Thank you Andrew,
>>>
>>> I used StdLib for it's implementation of the BSD sockets which can then
>>> be consumed by the OpenSSL library.
>>>
>>> So if not StdLib, what would provide me the raw socket in UEFI for SSL ?
>>>
>>>
>>>
>>> *Saheb *
>>> On Sat, May 23, 2015 at 1:40 AM, Andrew Fish <af...@apple.com> wrote:
>>>
>>>>
>>>> On May 22, 2015, at 6:29 AM, Saheb Biswas <sahebbis...@gmail.com>
>>>> wrote:
>>>>
>>>> hello,
>>>>
>>>> I am trying to port a simple SSL client code into UEFI and am using the
>>>> OpenSsl in CryptoPkg for this.
>>>>
>>>> The OpenSslSupport.h header in CryptoPkg include folder defines most of
>>>> the stdlib types and this causes a conflict when I attempt to use the
>>>> StdLib headers in my code.
>>>>
>>>> Following is a sample of the error messages:
>>>> c:\edk2\CryptoPkg\Include\OpenSslSupport.h(28) : error C2373: 'FILE' :
>>>> redefinition; different type modifiers
>>>>         c:\edk2\StdLib\Include\stdio.h(255) : see declaration of 'FILE'
>>>> c:\edk2\CryptoPkg\Include\OpenSslSupport.h(47) : warning C4005:
>>>> 'ENOMEM' : macro redefinition
>>>>         c:\edk2\StdLib\Include\errno.h(64) : see previous definition of
>>>> 'ENOMEM'
>>>> c:\edk2\CryptoPkg\Include\OpenSslSupport.h(48) : warning C4005:
>>>> 'EINVAL' : macro redefinition
>>>>         c:\edk2\StdLib\Include\errno.h(74) : see previous definition of
>>>> 'EINVAL'
>>>> c:\edk2\CryptoPkg\Include\OpenSslSupport.h(50) : warning C4005:
>>>> 'INT_MAX' : macro redefinition
>>>>         c:\edk2\StdLib\Include\limits.h(70) : see previous definition
>>>> of 'INT_MAX'
>>>> c:\edk2\CryptoPkg\Include\OpenSslSupport.h(51) : warning C4005:
>>>> 'INT_MIN' : macro redefinition
>>>>         c:\edk2\StdLib\Include\limits.h(67) : see previous definition
>>>> of 'INT_MIN'
>>>> c:\edk2\CryptoPkg\Include\OpenSslSupport.h(52) : warning C4005:
>>>> 'LONG_MAX' : macro redefinition
>>>>         c:\edk2\StdLib\Include\limits.h(79) : see previous definition
>>>> of 'LONG_MAX'
>>>> c:\edk2\CryptoPkg\Include\OpenSslSupport.h(53) : warning C4005:
>>>> 'LONG_MIN' : macro redefinition
>>>>         c:\edk2\StdLib\Include\limits.h(76) : see previous definition
>>>> of 'LONG_MIN'
>>>> c:\edk2\CryptoPkg\Include\OpenSslSupport.h(54) : warning C4005:
>>>> 'ULONG_MAX' : macro redefinition
>>>>         c:\edk2\StdLib\Include\limits.h(82) : see previous definition
>>>> of ‘ULONG_MAX'
>>>>
>>>> c:\edk2\CryptoPkg\Include\OpenSslSupport.h(75) : warning C4005:
>>>> 'offsetof' : macro redefinition
>>>>         c:\edk2\StdLib\Include\stddef.h(66) : see previous definition
>>>> of ‘offsetof'
>>>>
>>>>
>>>>
>>>> For issues like this in C you can use #undef
>>>>
>>>> #undef FILE
>>>> #include <OpenSslSupport.h>
>>>>
>>>>
>>>> c:\edk2\CryptoPkg\Include\OpenSslSupport.h(83) : error C2371:
>>>> '__mode_t' : redefinition; different basic types
>>>>         c:\edk2\StdLib\Include\sys/ansi.h(54) : see declaration of
>>>> ‘__mode_t'
>>>>
>>>>
>>>> __uint32_t vs. UINT16
>>>>
>>>>
>>>> c:\edk2\CryptoPkg\Include\OpenSslSupport.h(84) : warning C4142: benign
>>>> redefinition of type
>>>> c:\edk2\CryptoPkg\Include\OpenSslSupport.h(85) : error C2371: 'clock_t'
>>>> : redefinition; different basic types
>>>>         c:\edk2\StdLib\Include\sys/types.h(241) : see declaration of
>>>> ‘clock_t'
>>>>
>>>>
>>>> UINT64 vs. unsigned long
>>>>
>>>> Note: This is scary as long is different sizes on different edk2
>>>> compilers!!!!!!
>>>>
>>>> c:\edk2\CryptoPkg\Include\OpenSslSupport.h(88) : error C2371: 'ino_t' :
>>>> redefinition; different basic types
>>>>         c:\edk2\StdLib\Include\sys/types.h(169) : see declaration of
>>>> 'ino_t'
>>>>
>>>>
>>>>
>>>> uint64_t vs. UINT32
>>>>
>>>> So this is such a bad hack I feel bad mentioning it, but …..
>>>>
>>>> In OpenSslsupport.h add #ifndef <#define in StdLib for the conflicting
>>>> define>
>>>>
>>>> #ifndef _SYS_TYPES_H_
>>>> typedef unsigned long  clock_t;
>>>> #endif
>>>>
>>>>
>>>>
>>>> Any ideas ?
>>>>
>>>>
>>>> Don’t use StdLib :) would be your other option.
>>>>
>>>> Thanks,
>>>>
>>>> Andrew Fish
>>>>
>>>>
>>>> *Saheb*
>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> One dashboard for servers and applications across Physical-Virtual-Cloud
>>>> Widest out-of-the-box monitoring support with 50+ applications
>>>> Performance metrics, stats and reports that give you Actionable Insights
>>>> Deep dive visibility with transaction tracing using APM Insight.
>>>> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
>>>> _______________________________________________
>>>> edk2-devel mailing list
>>>> edk2-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>>>>
>>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> One dashboard for servers and applications across Physical-Virtual-Cloud
>>> Widest out-of-the-box monitoring support with 50+ applications
>>> Performance metrics, stats and reports that give you Actionable Insights
>>> Deep dive visibility with transaction tracing using APM Insight.
>>> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
>>> _______________________________________________
>>> edk2-devel mailing list
>>> edk2-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>>>
>>>
>>
>>
>> ------------------------------------------------------------------------------
>> One dashboard for servers and applications across Physical-Virtual-Cloud
>> Widest out-of-the-box monitoring support with 50+ applications
>> Performance metrics, stats and reports that give you Actionable Insights
>> Deep dive visibility with transaction tracing using APM Insight.
>> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>>
>>
>
>
> ------------------------------------------------------------------------------
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>
>
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to