#1 2023-09-10 12:23:13

lfyey121
Member
From: china
Registered: 2022-08-25
Posts: 58

mormot2tests fails to compile when the option USE_OPENSSL is set

mormot2tests project, when setting the compilation option USE_OPENSSL; FORCE_OPENSSL, the project could not compile, indicating that many open_SSL-related variables could not be found.


FPC 3.2.2 ,lazarus 2.2.6

FPC 3.3.1,lazarus 3.99

I've tested the above versions and they don't work.

Also, I found that lazarus.lpk does not contain the file mormot.crypt.x509

Offline

#2 2023-09-10 14:17:04

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,264
Website

Re: mormot2tests fails to compile when the option USE_OPENSSL is set

mormot.crypt.x509 is not finished nor working yet, so is not included in the package.

I am not able to reproduce your issue.
No problem of compiling with those conditionals.

But of course, you need to define those conditionals also at the mormot2.lpk package level too, otherwise the functions are not available.

Offline

#3 2023-09-11 12:23:27

lfyey121
Member
From: china
Registered: 2022-08-25
Posts: 58

Re: mormot2tests fails to compile when the option USE_OPENSSL is set

Is my problem, add compile parameter -dUSE_OPENSSL; FORCE_OPENSSL, needs to be recompiled, I am running directly.

Offline

#4 2023-09-11 12:32:22

lfyey121
Member
From: china
Registered: 2022-08-25
Posts: 58

Re: mormot2tests fails to compile when the option USE_OPENSSL is set

I'm testing this because I got a run-time error when I was using mormot.net.acme saying that X509-es256 is not supported, and acme relies on openssl, so I'm testing to see if openssl has errors

Offline

#5 2023-09-11 12:42:00

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,264
Website

Re: mormot2tests fails to compile when the option USE_OPENSSL is set

Are you sure the OpenSSL library is properly loaded?

Offline

#6 2023-09-12 02:18:59

lfyey121
Member
From: china
Registered: 2022-08-25
Posts: 58

Re: mormot2tests fails to compile when the option USE_OPENSSL is set

After introducing the mormot.crypt.openssl unit and calling registerOpenSsl, the issue of x509-es256 not being supported was resolved. But a memory conflict occurred again. When I traced the call to the getClient part of the getClientLocked method in mormot.net.acme, the value of the servername parameter passed changed to an invalid string, causing an error when the FindPropName method was called.

Offline

#7 2023-09-12 02:27:03

lfyey121
Member
From: china
Registered: 2022-08-25
Posts: 58

Re: mormot2tests fails to compile when the option USE_OPENSSL is set

Error is in the call:
  AcmeLetsEncryptServer. Redirect (' xxxx.com ', 'https://www.xxxx.com');

Offline

#8 2023-09-12 06:09:19

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,264
Website

Re: mormot2tests fails to compile when the option USE_OPENSSL is set

Sorry but I don't understand what happens.

Please ensure you did set the compilation into -O0 optimization level mode so that the Lazarus debugger is not showing you wrong variable values.

Offline

#9 2023-09-12 08:24:01

lfyey121
Member
From: china
Registered: 2022-08-25
Posts: 58

Re: mormot2tests fails to compile when the option USE_OPENSSL is set

this is my code:
  registerOpenSsl;
  gAcmeLetsEncryptServer:=TAcmeLetsEncryptServer.create(TsynLog, TacmeDaemonSettings(settings).keyStoreFolder,
      ACME_LETSENCRYPT_URL,'','abcdefg',-1,'8084');
  gAcmeLetsEncryptServer.LoadFromKeyStoreFolder;
  gAcmeLetsEncryptServer.Redirect('xxxx.com','https://www.xxxx.com');
  gAcmeLetsEncryptServer.Redirect('www.xxxx.com','https://www.xxxx.com');   

the “AcmeLetsEncryptServer.Redirect ” has an error at runtime:
  Project acmeDaemon raised exception class 'External:ACCESS VIOLATION' with message:Access violation reading from address $7331322D.
  in file 'mormot.core.base.pas' at line 4819:if PStrLen(p1-_STRLEN)^=len then

This error is in the execution TAcmeLetsEncrypt. GetClient statements,

Offline

#10 2023-09-12 09:32:40

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,264
Website

Re: mormot2tests fails to compile when the option USE_OPENSSL is set

You are right.
There was a regression from a few weeks ago, when we changed the subjects storage from TRawUtf8DynArray to a CSV RawUtf8.

Please try https://github.com/synopse/mORMot2/commit/2eb35d66

Sorry for the issue.

Offline

#11 2023-09-12 09:55:13

lfyey121
Member
From: china
Registered: 2022-08-25
Posts: 58

Re: mormot2tests fails to compile when the option USE_OPENSSL is set

Thank you for your quick response.

The program is running normally.

Thank you again for your contributions to the world of pascal

Offline

Board footer

Powered by FluxBB