#1 2025-08-14 10:58:35

danielkuettner
Member
From: Germany
Registered: 2014-08-06
Posts: 401

regression AESSHA256Full

Hello,

under Win64/Delphi 10.4 with current mORMot2 AESSHA256Full (decrypt) results in av
  by call of MoveFast(Encryption, self, SizeOf(TAes)); //line 4294 in mormon.crypt.core.pas
  in mormot.core.base.asmx64.inc (MoveFast line 395).

With revision 9f99b38beac50b425f46420aec27a93f5d109f42 from 2025-05-13 it was still working.

https://gist.github.com/danielkuettner/ … 5ad0349de4

Last edited by danielkuettner (2025-08-14 14:15:57)

Offline

#2 2025-08-14 15:39:33

danielkuettner
Member
From: Germany
Registered: 2014-08-06
Posts: 401

Re: regression AESSHA256Full

It was the missing first line (4289):

ctx.Flags := [];

in function TAes.DecryptInitFrom(const Encryption: TAes;

Now it works.

https://github.com/synopse/mORMot2/pull/374

Last edited by danielkuettner (2025-08-16 07:05:09)

Offline

#3 2025-08-22 10:45:17

danielkuettner
Member
From: Germany
Registered: 2014-08-06
Posts: 401

Re: regression AESSHA256Full

Hi Arnaud,

https://github.com/synopse/mORMot2/pull/374 was added but later removed again.

With current mMORmot2 version AV raised again (under fpc/linux/freebsd) without that line.

Offline

#4 2025-08-22 12:29:03

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,159
Website

Re: regression AESSHA256Full

Sorry for trimming it again.

But I did not understand why "  ctx.Flags := [];  " was needed.
It is reset by both branches: TAes.EncryptInit and MoveFast().

In fact, the problem does not comes from this missing line (which fixes it only partially), but from the fact that the used TAes instance was allocated on the stack, so not zeroed (at it should e.g. when defined as a TObject field).
This seems to be the proper fix:
https://github.com/synopse/mORMot2/commit/18556d808

Offline

#5 2025-08-22 14:17:46

danielkuettner
Member
From: Germany
Registered: 2014-08-06
Posts: 401

Re: regression AESSHA256Full

Your commit works for me.

(ctx.Flags := []; was just a wild guess to help you to find a proper fix)

Offline

Board footer

Powered by FluxBB