Building OpenSSL with Emscripten

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Building OpenSSL with Emscripten

Sunghyun Park
Nice to meet you all :)

I faced a problem while building assembly code in OpenSSL (e.g., crypto/x86_64cpuid.s) with Emscripten. 
Since Emscripten does not support compilation for assembly code (As far as I know), I'm wondering if there is any version of OpenSSL that does not require compiling assembly code.
Or, if there is anyone who experienced the similar problem, please share your experience. 

Thank you!

--
Best, Sung
Reply | Threaded
Open this post in threaded view
|

Re: Building OpenSSL with Emscripten

Dr Paul Dale
Configure with the _no-asm_ option.

It will be a **lot** slower.


Pauli
-- 
Dr Paul Dale | Cryptographer | Network Security & Encryption 
Phone +61 7 3031 7217
Oracle Australia



On 10 May 2019, at 3:33 pm, Sunghyun Park <[hidden email]> wrote:

Nice to meet you all :)

I faced a problem while building assembly code in OpenSSL (e.g., crypto/x86_64cpuid.s) with Emscripten. 
Since Emscripten does not support compilation for assembly code (As far as I know), I'm wondering if there is any version of OpenSSL that does not require compiling assembly code.
Or, if there is anyone who experienced the similar problem, please share your experience. 

Thank you!

--
Best, Sung

Reply | Threaded
Open this post in threaded view
|

Re: Building OpenSSL with Emscripten

OpenSSL - User mailing list
By the way, has anyone worked on a feature or patch to use browser
provided crypto functions (WebCrypto etc.) when compiled to
pseudo-javascript via EmScripten or WebAssembly?

On 10/05/2019 07:43, Dr Paul Dale wrote:

> Configure with the _no-asm_ option.
>
> It will be a **lot** slower.
>
>
>> On 10 May 2019, at 3:33 pm, Sunghyun Park <[hidden email]
>> <mailto:[hidden email]>> wrote:
>>
>> Nice to meet you all :)
>>
>> I faced a problem while building assembly code in OpenSSL (e.g.,
>> crypto/x86_64cpuid.s) with Emscripten.
>> Since Emscripten does not support compilation for assembly code (As
>> far as I know), I'm wondering if there is any version of OpenSSL that
>> does not require compiling assembly code.
>> Or, if there is anyone who experienced the similar problem, please
>> share your experience.
>>
>>

Enjoy

Jakob
--
Jakob Bohm, CIO, Partner, WiseMo A/S.  https://www.wisemo.com
Transformervej 29, 2860 Søborg, Denmark.  Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded

Reply | Threaded
Open this post in threaded view
|

Re: Building OpenSSL with Emscripten

Sunghyun Park
In reply to this post by Dr Paul Dale
I realized I made a mistake when I tried that option before.
Now it works great. Thank you! :)

On Thu, May 9, 2019 at 10:43 PM Dr Paul Dale <[hidden email]> wrote:
Configure with the _no-asm_ option.

It will be a **lot** slower.


Pauli
-- 
Dr Paul Dale | Cryptographer | Network Security & Encryption 
Phone +61 7 3031 7217
Oracle Australia



On 10 May 2019, at 3:33 pm, Sunghyun Park <[hidden email]> wrote:

Nice to meet you all :)

I faced a problem while building assembly code in OpenSSL (e.g., crypto/x86_64cpuid.s) with Emscripten. 
Since Emscripten does not support compilation for assembly code (As far as I know), I'm wondering if there is any version of OpenSSL that does not require compiling assembly code.
Or, if there is anyone who experienced the similar problem, please share your experience. 

Thank you!

--
Best, Sung



--
Best, Sung
Reply | Threaded
Open this post in threaded view
|

Re: Building OpenSSL with Emscripten

Sunghyun Park
In reply to this post by Dr Paul Dale
Hi, all. Thanks for your help, I could finish compilation to the end. 
However, athough I successfully compiled with _no-asm_ options, I found a problem when loading the compiled library in the 3rd party code base.
When looking into the source code, the definition of some function seems to require a specific preprocessor to be compiled. 
(For example, PEM_write_bio_DSAPrivateKey needs '#define OPENSSL_FIPS'.)
I installed openssl-1.0.2r.tar.gz and only provided no-asm for configuration.
Am I missing some dependencies or necessary options?
The error I'm facing is as follows:

error: undefined symbol: AES_ctr128_encrypt
warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
error: undefined symbol: AES_set_encrypt_key
error: undefined symbol: BIO_ctrl
error: undefined symbol: BIO_free
error: undefined symbol: BIO_new
error: undefined symbol: BIO_s_mem
error: undefined symbol: BN_bn2bin
error: undefined symbol: BN_free
error: undefined symbol: BN_is_bit_set
error: undefined symbol: BN_new
error: undefined symbol: BN_num_bits
error: undefined symbol: BN_set_word
error: undefined symbol: CRYPTO_free
error: undefined symbol: CRYPTO_malloc
error: undefined symbol: DSA_free
error: undefined symbol: DSA_generate_key
error: undefined symbol: DSA_generate_parameters_ex
error: undefined symbol: DSA_new
error: undefined symbol: EC_KEY_free
error: undefined symbol: EC_KEY_generate_key
error: undefined symbol: EC_KEY_get0_group
error: undefined symbol: EC_KEY_get0_public_key
error: undefined symbol: EC_KEY_new_by_curve_name
error: undefined symbol: EC_KEY_set_asn1_flag
error: undefined symbol: EC_POINT_point2oct
....

Any advice would be a great help!
Thank you.


On Thu, May 9, 2019 at 10:43 PM Dr Paul Dale <[hidden email]> wrote:
Configure with the _no-asm_ option.

It will be a **lot** slower.


Pauli
-- 
Dr Paul Dale | Cryptographer | Network Security & Encryption 
Phone +61 7 3031 7217
Oracle Australia



On 10 May 2019, at 3:33 pm, Sunghyun Park <[hidden email]> wrote:

Nice to meet you all :)

I faced a problem while building assembly code in OpenSSL (e.g., crypto/x86_64cpuid.s) with Emscripten. 
Since Emscripten does not support compilation for assembly code (As far as I know), I'm wondering if there is any version of OpenSSL that does not require compiling assembly code.
Or, if there is anyone who experienced the similar problem, please share your experience. 

Thank you!

--
Best, Sung



--
Best, Sung
Reply | Threaded
Open this post in threaded view
|

Re: Building OpenSSL with Emscripten

Richard Levitte - VMS Whacker-2
The issue isn't with any defined or not so defined macro, but most
probably rather with how you're loading the library in the 3rd party
code base.  Could it be that you're linking with libssl only?

Cheers,
Richard

On Fri, 10 May 2019 22:29:36 +0200,
Sunghyun Park wrote:

>
> Hi, all. Thanks for your help, I could finish compilation to the end. 
> However, athough I successfully compiled with _no-asm_ options, I found a problem when loading the
> compiled library in the 3rd party code base.
> When looking into the source code, the definition of some function seems to require a specific
> preprocessor to be compiled. 
> (For example, PEM_write_bio_DSAPrivateKey needs '#define OPENSSL_FIPS'.)
> I installed openssl-1.0.2r.tar.gz and only provided no-asm for configuration.
> Am I missing some dependencies or necessary options?
> The error I'm facing is as follows:
>
>     error: undefined symbol: AES_ctr128_encrypt
>     warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
>     error: undefined symbol: AES_set_encrypt_key
>     error: undefined symbol: BIO_ctrl
>     error: undefined symbol: BIO_free
>     error: undefined symbol: BIO_new
>     error: undefined symbol: BIO_s_mem
>     error: undefined symbol: BN_bn2bin
>     error: undefined symbol: BN_free
>     error: undefined symbol: BN_is_bit_set
>     error: undefined symbol: BN_new
>     error: undefined symbol: BN_num_bits
>     error: undefined symbol: BN_set_word
>     error: undefined symbol: CRYPTO_free
>     error: undefined symbol: CRYPTO_malloc
>     error: undefined symbol: DSA_free
>     error: undefined symbol: DSA_generate_key
>     error: undefined symbol: DSA_generate_parameters_ex
>     error: undefined symbol: DSA_new
>     error: undefined symbol: EC_KEY_free
>     error: undefined symbol: EC_KEY_generate_key
>     error: undefined symbol: EC_KEY_get0_group
>     error: undefined symbol: EC_KEY_get0_public_key
>     error: undefined symbol: EC_KEY_new_by_curve_name
>     error: undefined symbol: EC_KEY_set_asn1_flag
>     error: undefined symbol: EC_POINT_point2oct
>
>     ....
>
> Any advice would be a great help!
> Thank you.
>
> On Thu, May 9, 2019 at 10:43 PM Dr Paul Dale <[hidden email]> wrote:
>
>     Configure with the _no-asm_ option.
>    
>     It will be a **lot** slower.
>
>     Pauli
>     -- 
>     Dr Paul Dale | Cryptographer | Network Security & Encryption 
>     Phone +61 7 3031 7217
>     Oracle Australia
>
>         On 10 May 2019, at 3:33 pm, Sunghyun Park <[hidden email]> wrote:
>        
>         Nice to meet you all :)
>        
>         I faced a problem while building assembly code in OpenSSL (e.g., crypto/x86_64cpuid.s)
>         with Emscripten. 
>         Since Emscripten does not support compilation for assembly code (As far as I know), I'm
>         wondering if there is any version of OpenSSL that does not require compiling assembly
>         code.
>         Or, if there is anyone who experienced the similar problem, please share your experience. 
>        
>         Thank you!
>        
>         --
>         Best, Sung
>
> --
> Best, Sung
>
>
--
Richard Levitte         [hidden email]
OpenSSL Project         http://www.openssl.org/~levitte/
Reply | Threaded
Open this post in threaded view
|

Re: Building OpenSSL with Emscripten

d3x0r
https://stackoverflow.com/questions/52327290/linking-openssl-with-webassembly  
Looks very similar...

'target_link_libraries(mainTest crypto) after that it all worked without warnings.'

On Mon, May 20, 2019 at 1:56 AM Richard Levitte <[hidden email]> wrote:
The issue isn't with any defined or not so defined macro, but most
probably rather with how you're loading the library in the 3rd party
code base.  Could it be that you're linking with libssl only?

Cheers,
Richard

On Fri, 10 May 2019 22:29:36 +0200,
Sunghyun Park wrote:
>
> Hi, all. Thanks for your help, I could finish compilation to the end. 
> However, athough I successfully compiled with _no-asm_ options, I found a problem when loading the
> compiled library in the 3rd party code base.
> When looking into the source code, the definition of some function seems to require a specific
> preprocessor to be compiled. 
> (For example, PEM_write_bio_DSAPrivateKey needs '#define OPENSSL_FIPS'.)
> I installed openssl-1.0.2r.tar.gz and only provided no-asm for configuration.
> Am I missing some dependencies or necessary options?
> The error I'm facing is as follows:
>
>     error: undefined symbol: AES_ctr128_encrypt
>     warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
>     error: undefined symbol: AES_set_encrypt_key
>     error: undefined symbol: BIO_ctrl
>     error: undefined symbol: BIO_free
>     error: undefined symbol: BIO_new
>     error: undefined symbol: BIO_s_mem
>     error: undefined symbol: BN_bn2bin
>     error: undefined symbol: BN_free
>     error: undefined symbol: BN_is_bit_set
>     error: undefined symbol: BN_new
>     error: undefined symbol: BN_num_bits
>     error: undefined symbol: BN_set_word
>     error: undefined symbol: CRYPTO_free
>     error: undefined symbol: CRYPTO_malloc
>     error: undefined symbol: DSA_free
>     error: undefined symbol: DSA_generate_key
>     error: undefined symbol: DSA_generate_parameters_ex
>     error: undefined symbol: DSA_new
>     error: undefined symbol: EC_KEY_free
>     error: undefined symbol: EC_KEY_generate_key
>     error: undefined symbol: EC_KEY_get0_group
>     error: undefined symbol: EC_KEY_get0_public_key
>     error: undefined symbol: EC_KEY_new_by_curve_name
>     error: undefined symbol: EC_KEY_set_asn1_flag
>     error: undefined symbol: EC_POINT_point2oct
>
>     ....
>
> Any advice would be a great help!
> Thank you.
>
> On Thu, May 9, 2019 at 10:43 PM Dr Paul Dale <[hidden email]> wrote:
>
>     Configure with the _no-asm_ option.
>   
>     It will be a **lot** slower.
>
>     Pauli
>     -- 
>     Dr Paul Dale | Cryptographer | Network Security & Encryption 
>     Phone +61 7 3031 7217
>     Oracle Australia
>
>         On 10 May 2019, at 3:33 pm, Sunghyun Park <[hidden email]> wrote:
>       
>         Nice to meet you all :)
>       
>         I faced a problem while building assembly code in OpenSSL (e.g., crypto/x86_64cpuid.s)
>         with Emscripten. 
>         Since Emscripten does not support compilation for assembly code (As far as I know), I'm
>         wondering if there is any version of OpenSSL that does not require compiling assembly
>         code.
>         Or, if there is anyone who experienced the similar problem, please share your experience. 
>       
>         Thank you!
>       
>         --
>         Best, Sung
>
> --
> Best, Sung
>
>
--
Richard Levitte         [hidden email]
OpenSSL Project         http://www.openssl.org/~levitte/