Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

verified Scala with Stainless #278

Merged
merged 197 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
197 commits
Select commit Hold shift + click to select a range
4f13623
WIP: startet changing types for stainless (option, none, some from st…
fschramka Oct 4, 2023
08a1fb0
added stainless Options instead of Scala Option / None / Some - patte…
fschramka Oct 5, 2023
94d1a03
fix C Tests runner for unix
ivonu Oct 9, 2023
02a00d7
added tests that failed before in a unix environment
Oct 9, 2023
5bb22cd
fix and add command as argument for C tests
ivonu Oct 9, 2023
97df2d3
Merge remote-tracking branch 'maxime-esa/master' into scala-backend
ivonu Oct 9, 2023
34315af
fix renamed github repository path in dockerfile
ivonu Oct 9, 2023
123b2ee
added verified parts of code
fschramka Oct 11, 2023
d3efe19
formatting
Oct 12, 2023
e7624c2
verification of asn1jvm.scala
Oct 12, 2023
b99f3b1
asn1jvm.scala runs through stainless
Oct 13, 2023
797417f
fix stainless_utils.scala resource
ivonu Oct 16, 2023
c73e259
introduce Option/None/Some for mutable objects
ivonu Oct 16, 2023
7bd112d
Merge remote-tracking branch 'maxime-esa/master' into scala-backend
ivonu Oct 16, 2023
d3e3aef
extern facade method for double, internal double bit string long meth
Oct 16, 2023
716a364
fixed LL bug
Oct 16, 2023
026ce33
Merge branch 'scala-backend' of https://github.com/ateleris/asn1scc i…
Oct 16, 2023
c7c4714
fix missed OptionMut
ivonu Oct 16, 2023
6c934c7
fix additional missed OptionMut
ivonu Oct 16, 2023
32fabcf
real bitstring decoding for stainless
Oct 16, 2023
42b79b0
Some changes for running Stainless on asn1jvm
mario-bucev Oct 17, 2023
3df2176
Merge pull request #9 from ateleris/stainless-first-pass
ivonu Oct 17, 2023
26c6e63
WIP: verify encoding methods
fschramka Oct 18, 2023
ba1c133
- add some requires
ivonu Oct 19, 2023
7357c4e
unsignedToByte extension for Int
ivonu Oct 19, 2023
ffbb0ec
WIP: verification
Oct 19, 2023
312f3e6
Merge branch 'scala-backend' of https://github.com/ateleris/asn1scc i…
Oct 19, 2023
5bca6a5
some verifications on BitStream_AppendNBitOne, BitStream_AppendByteArray
ivonu Oct 19, 2023
d60fadf
removed WORD_LENGTH - makes no sense on the JVM
Oct 19, 2023
a12a7f2
Merge branch 'scala-backend' of https://github.com/ateleris/asn1scc i…
Oct 19, 2023
c97a726
try to verify GetNumberOfBitsForNonNegativeInteger
Oct 19, 2023
17bbc9e
verified GetNumberOfBitsForNonNegativeInteger32
Oct 19, 2023
9756a69
better naming
Oct 19, 2023
2d87a9e
formatting comments
ivonu Oct 20, 2023
69a7289
- byte to byte shift
ivonu Oct 20, 2023
9cf9d97
validate BitStream_AppendByte0
ivonu Oct 20, 2023
0c1dac4
added Asn1Real_Equal and replaced doubleToLongBits with doubleToRawL…
fschramka Oct 20, 2023
17e6c6c
Merge branch 'scala-backend' of https://github.com/ateleris/asn1scc i…
fschramka Oct 20, 2023
c4337a2
rewrote all byte counting meths and verified them
fschramka Oct 20, 2023
f52ba3c
verifying REAL encode / dec
Oct 23, 2023
065b693
fixed real encoding problem
fschramka Oct 25, 2023
bff94ef
nan case found
fschramka Oct 25, 2023
66ffb2c
add NaN encoding (X.690-202102)
Oct 26, 2023
ed39afa
validating BitStream_AppendBitOne
ivonu Oct 26, 2023
6cbe350
validating BitStream_AppendBitZero
ivonu Oct 26, 2023
2da9ecc
validating BitStream_AppendNBitZero
ivonu Oct 26, 2023
a686589
- validating AppendX functions
ivonu Oct 26, 2023
5d0f0b4
use ensuring from Stainless
ivonu Oct 26, 2023
88b66a6
encoder done, decoder started
Oct 26, 2023
954c0ad
Merge branch 'scala-backend' of https://github.com/ateleris/asn1scc i…
Oct 26, 2023
2a31e70
wip
fschramka Oct 26, 2023
62a70e2
validate BitStream_AppendByte
ivonu Oct 27, 2023
1ef5252
typo
Oct 27, 2023
053461c
added constrains for the bitstream
Oct 27, 2023
a5f56f0
validate BitStream_AppendByte0
ivonu Oct 27, 2023
26c306c
simplify BitStream_AppendByteArray
ivonu Oct 27, 2023
466d094
verified BitStream_ReadByte, BitStream_ReadBytePure
ivonu Oct 27, 2023
fa74429
WIP verifying BitStream_ReadByteArray, BitStream_ReadPartialByte
ivonu Oct 27, 2023
fe0ff4f
WIP - tranlated first part
Oct 27, 2023
941cab2
appendbyte & appendbyte0
fschramka Oct 27, 2023
f9b0c60
add asn1jvm_Bitstream to solution
ivonu Oct 30, 2023
252c92f
adapt changed functions of bitstream in STG files
ivonu Oct 30, 2023
20d6a0c
moved to BitStream: readPartialByte, appendPartialByte, readBits, rea…
ivonu Oct 30, 2023
9fd9929
validate readPartialByte
ivonu Oct 30, 2023
d56d046
OOP refactoring & renaming
Oct 30, 2023
1e23e0a
correct indent
Oct 30, 2023
713f582
rename ACN functions
ivonu Oct 30, 2023
b94ee5b
WIP: uper codec
Oct 30, 2023
b642672
WIP: uper codec
fschramka Oct 30, 2023
cfd9353
OOP refactoring of UPER and ACN
ivonu Oct 31, 2023
e075dd1
rename some functions
ivonu Oct 31, 2023
5db22c4
clean the appendBit function
fschramka Nov 1, 2023
0e8ea57
extreme simplification of bitstream append functions
fschramka Nov 1, 2023
23d1c15
remove appendByte0 - that does that same as appendByte
Nov 2, 2023
5c6a029
removed old code // Bookmark: marios verficatiorn of the old code is …
fschramka Nov 3, 2023
145bd7a
readByte added
fschramka Nov 3, 2023
e228c8a
simplified useless array copy
Nov 3, 2023
cb91827
comment on how appendPartialByte works
fschramka Nov 3, 2023
43c99b9
simple appentPartialByte added
fschramka Nov 4, 2023
ec1b2f6
- replace Char with Byte representation
ivonu Nov 6, 2023
e98ea6e
renaming & different return vals
Nov 6, 2023
ccb308b
Merge branch 'FS_Rework_Bitstream' of https://github.com/ateleris/asn…
Nov 6, 2023
7bb82e4
remove optionMut from readBits in bitstream
Nov 6, 2023
c818a17
introduce remainingBits for BitStream
ivonu Nov 6, 2023
6d01eb5
comment
Nov 6, 2023
4d4b660
Merge branch 'FS_Rework_Bitstream' of https://github.com/ateleris/asn…
Nov 6, 2023
df18f0e
remove option from readPartialByte
ivonu Nov 6, 2023
7d0f2cb
fix readBits
ivonu Nov 6, 2023
a4ceca9
rewrote readpartialbyte
Nov 6, 2023
26b3ab5
comments added
fschramka Nov 6, 2023
4eff09c
- finish implementing BitStream access functions on Codec
ivonu Nov 7, 2023
5a0891d
some return type fixes
ivonu Nov 7, 2023
e3b2876
Verified 764 / 769
fschramka Nov 8, 2023
1e13e17
avoid direct access on bitStream currentBit/currentByte/buf
ivonu Nov 9, 2023
59e2f9e
ujujuj
Nov 9, 2023
9aa3341
docs to readbits & minor changes
Nov 9, 2023
b4d4d1f
Merge branch 'FS_Rework_Bitstream' of https://github.com/ateleris/asn…
Nov 9, 2023
6eb691c
refactor checkBitPatternPresent and readBits_nullterminated
ivonu Nov 9, 2023
78f3132
verified readBits_nullterminated
ivonu Nov 9, 2023
005d791
make currentBit, currentByte, buf of BitStream private
ivonu Nov 9, 2023
dd49cbc
remove getBuffer, and use readByteArray instead in ATCs
ivonu Nov 9, 2023
ae25ada
magic number
Nov 9, 2023
6f791c0
verify function which update the bitIndex
ivonu Nov 10, 2023
14cd794
replaced remainingBits with func, invariant holds now
Nov 10, 2023
333feac
some VC's, bit naming
Nov 10, 2023
024fc3f
checkBitPatternPresent done
Nov 10, 2023
19571e5
some changes in readBitsUntilTerminator
Nov 10, 2023
386bc16
translated missing code for BitString and IA5String
ivonu Nov 10, 2023
da5ca2e
fix in dec_String_Ascii_Null_Teminated_mult
ivonu Nov 10, 2023
35b8726
additional test cases
ivonu Nov 10, 2023
3e9ed01
translated missing code for BitString and IA5String for UPER
ivonu Nov 10, 2023
21052ed
enabled Tests for ACN/UPER Service 14 and UPER Service 12 (work for C…
ivonu Nov 13, 2023
8877f71
Address some invalid VCs
mario-bucev Nov 10, 2023
94fadc1
remove readBitsUntilTerminator
Nov 13, 2023
fa0754c
added some return values that make more sense
Nov 13, 2023
2f86a2f
Merge remote-tracking branch 'origin/address-invald' into scala-backend
Nov 16, 2023
5e0402d
finished error handling refactoring
Nov 16, 2023
2ee105d
commented unused verification
Nov 16, 2023
2d4c0b1
fix early return
Nov 27, 2023
dbbddb4
fix some String init/access stuff
ivonu Nov 13, 2023
e799725
translated some left over C code
ivonu Dec 1, 2023
5a608b5
fixed #281
Dec 1, 2023
4b61d9d
reworked alignment
Dec 1, 2023
8dbc730
use cheaper OP
Dec 4, 2023
1493b83
added proposed C implementation for comparability
Dec 4, 2023
2497798
fixed broken precondition
Dec 4, 2023
975b79d
changed from ghost to pure - meth gets accessed from non ghost contex…
Dec 4, 2023
31feeaf
removed unused real enc / dec
Dec 8, 2023
c7b4fb1
Merge remote-tracking branch 'EsaRepo/master' into scala-backend
Dec 13, 2023
d02c9a9
post enc func & post dec val
fschramka Dec 14, 2023
8b482fb
typo & some VCs
Dec 15, 2023
545ecc6
adapt scala atc to C
fschramka Dec 15, 2023
2c56ca3
fix according to 8.3
Dec 18, 2023
49bda6e
decode unconstrained whole number vcs
Dec 18, 2023
aa9ae2a
removed useless assertion
Dec 18, 2023
e4c1edf
first idea
Dec 22, 2023
0699398
fixed some VCs
fschramka Dec 22, 2023
7036d3b
Merge remote-tracking branch 'EsaRepo/master' into scala-backend
Jan 8, 2024
5ca2f3e
fixed renaming meths in templates
Jan 8, 2024
2b9d74d
fixed VC in GetBytesNeededForNegativeNumber
Jan 8, 2024
2b761f7
removed encodeConstraintPosWholeNumber - no unsigned numbers on the JVM
Jan 8, 2024
0afe294
replaced template call
fschramka Jan 10, 2024
f06db23
some VC's - some typos
fschramka Jan 10, 2024
3136fcc
some more VCs
fschramka Jan 10, 2024
b64ee07
stainless like return values
Jan 12, 2024
5a92888
fixed return value stainless problem
Jan 15, 2024
2d0c1d1
compatibility to C interop (unsigned / signed)
Jan 15, 2024
3938f37
JVM can not handle extreme numbers, numbers are valid, range is invalid
Jan 15, 2024
54e1c29
Make bitStream a field
mario-bucev Jan 3, 2024
b875e1d
use wrapping for extreme cases
fschramka Jan 17, 2024
5bfdd79
Changes to Scala backend for more suitable verification
mario-bucev Dec 7, 2023
242f9bd
Merge pull request #12 from mario-bucev/scala-changes
fschramka Jan 18, 2024
19ac41e
fix access to Option field
fschramka Jan 18, 2024
0006eab
fix acces to optional array in test cases
fschramka Jan 18, 2024
01f067a
rewert some changes
fschramka Jan 18, 2024
86e6df5
fix some preconditions after refactoring
fschramka Jan 18, 2024
f1d73e1
Fix ATC broken by #12
mario-bucev Jan 23, 2024
73e0c13
Merge pull request #13 from mario-bucev/fix-atc
fschramka Jan 24, 2024
00c954d
Merge branch 'scala-backend' into bitstream-as-field
fschramka Jan 24, 2024
353578c
Merge pull request #11 from mario-bucev/bitstream-as-field
fschramka Jan 24, 2024
9b819a8
typo
Jan 24, 2024
4d9f855
removed unnecessary cpy of arr
Jan 24, 2024
40d61dd
fixed some VCs
Jan 24, 2024
c8902ba
replaced unnessesary complicated code for bit counting
Jan 24, 2024
0890ecb
replace meth with way simpler one
Jan 25, 2024
ab80a4b
rewrote simplified, restructured, renamed integer functions
Jan 26, 2024
cbffee8
Magic numbers removed
Jan 29, 2024
4162450
Stainless-compatible Scala gen
mario-bucev Jan 29, 2024
525f181
fix compiler bug that lets you define bigger ranges than uint64.MAX i…
Jan 31, 2024
85b9f09
remove number clamping and calculate with pseudo unsigned numbers in …
Jan 31, 2024
a049b43
encodeSemiConstrainedPosWholeNumber simplified
Jan 31, 2024
3ddc65f
reworked all integer codec functions
Feb 1, 2024
2cfdc84
Merge pull request #14 from mario-bucev/stainless-acceptance
fschramka Feb 1, 2024
e86d208
Make Codec a field for ACN, UPER and PER instead of a trait
mario-bucev Feb 1, 2024
3b36dbd
Merge pull request #15 from mario-bucev/composition
fschramka Feb 2, 2024
3ca9737
Adding pre and postcondition to Scala encoding and decoding functions
mario-bucev Feb 2, 2024
c0ce486
Add opaque types for unsigned integers
mario-bucev Feb 2, 2024
bca69cc
Merge pull request #16 from mario-bucev/more-stainless
fschramka Feb 6, 2024
22bd288
removed some C like return values
Feb 6, 2024
a995fb9
Merge pull request #17 from mario-bucev/opaque-unsigned
fschramka Feb 8, 2024
e6e3640
some vcs
fschramka Feb 8, 2024
facbec5
Merge commit '8943cb1e93920f13035af42c7f5c2437b12ab027' into scala-ba…
Feb 9, 2024
4fc9e6a
fixed broken tests
Feb 12, 2024
b798eef
WIP: Broken merge - needs FIX
Feb 12, 2024
0c39cf2
WIP: Fixed Import
Feb 12, 2024
acf726c
made it compile again
Feb 13, 2024
923554e
Implement getSeqChildIsPresent
mario-bucev Feb 13, 2024
964a708
fixed UPER
Feb 13, 2024
9a3e0c2
false positives
Feb 13, 2024
769ae4c
simpler design
Feb 13, 2024
79cd600
fixed fail
Feb 13, 2024
bade67e
Fix access path for Scala
mario-bucev Feb 14, 2024
db1c37c
add sdkman & scala dependencies to docker
fschramka Feb 14, 2024
56d7ddc
runs now
fschramka Feb 15, 2024
edb3e25
no message
Feb 16, 2024
0b6aae8
single line string
Feb 16, 2024
096e448
exit 1 added
Feb 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
.metals
.vscode
.idea
.bloop
.scala-build
/.vs
/Debug
/Release
Expand Down
16 changes: 8 additions & 8 deletions ADA_RTL2/src/adaasn1rtl-encoding-acn.adb
Original file line number Diff line number Diff line change
Expand Up @@ -1428,7 +1428,7 @@ is
strVal (strVal'Last) := Standard.Ascii.NUL;
end Acn_Dec_String_Ascii_FixSize;

procedure Acn_Enc_String_Ascii_Null_Teminated
procedure Acn_Enc_String_Ascii_Null_Terminated
(bs : in out Bitstream; null_characters : OctetBuffer; strVal : String)
is
i : Integer := strVal'First;
Expand All @@ -1449,9 +1449,9 @@ is
bs.Current_Bit_Pos'Loop_Entry + (i - null_characters'First) * 8);
BitStream_AppendByte (bs, null_characters (i), False);
end loop;
end Acn_Enc_String_Ascii_Null_Teminated;
end Acn_Enc_String_Ascii_Null_Terminated;

procedure Acn_Dec_String_Ascii_Null_Teminated
procedure Acn_Dec_String_Ascii_Null_Terminated
(bs : in out Bitstream; null_characters : OctetBuffer;
strVal : in out String; Result : out ASN1_RESULT)
is
Expand Down Expand Up @@ -1519,7 +1519,7 @@ is
I := I + 1;
end loop;

end Acn_Dec_String_Ascii_Null_Teminated;
end Acn_Dec_String_Ascii_Null_Terminated;

procedure Acn_Enc_String_Ascii_Internal_Field_Determinant
(bs : in out Bitstream; asn1Min : Asn1Int;
Expand Down Expand Up @@ -1597,7 +1597,7 @@ is
end Acn_Enc_String_Ascii_External_Field_Determinant;

procedure Acn_Dec_String_Ascii_External_Field_Determinant
(bs : in out Bitstream; extSizeDeterminatFld : Asn1Int;
(bs : in out Bitstream; extSizeDeterminantFld : Asn1Int;
strVal : in out String; Result : out ASN1_RESULT)
is
I : Integer := strVal'First;
Expand All @@ -1607,7 +1607,7 @@ is
ASN1_RESULT'(Success => True, ErrorCode => ERR_INCORRECT_STREAM);

while Result.Success and then I <= strVal'Last - 1
and then I <= Integer (extSizeDeterminatFld)
and then I <= Integer (extSizeDeterminantFld)
loop
pragma Loop_Invariant
(I >= strVal'First and I <= strVal'Last and
Expand Down Expand Up @@ -1649,7 +1649,7 @@ is

procedure Acn_Dec_String_CharIndex_External_Field_Determinant
(bs : in out Bitstream; charSet : String; nCharSize : Integer;
extSizeDeterminatFld : Asn1Int; strVal : out String;
extSizeDeterminantFld : Asn1Int; strVal : out String;
Result : out ASN1_RESULT)
is
I : Integer := strVal'First;
Expand All @@ -1660,7 +1660,7 @@ is
ASN1_RESULT'(Success => True, ErrorCode => ERR_INCORRECT_STREAM);
strVal := (others => Standard.Ascii.NUL);
while Result.Success and then I <= strVal'Last - 1
and then I <= Integer (extSizeDeterminatFld)
and then I <= Integer (extSizeDeterminantFld)
loop
pragma Loop_Invariant
(I >= strVal'First and I <= strVal'Last and
Expand Down
16 changes: 8 additions & 8 deletions ADA_RTL2/src/adaasn1rtl-encoding-acn.ads
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ is
bs.Current_Bit_Pos =
bs'Old.Current_Bit_Pos + (strVal'Last - strVal'First) * 8;

procedure Acn_Enc_String_Ascii_Null_Teminated
procedure Acn_Enc_String_Ascii_Null_Terminated
(bs : in out Bitstream; null_characters : OctetBuffer;
strVal : String) with
Depends => (bs => (bs, strVal, null_characters)),
Expand All @@ -919,7 +919,7 @@ is
bs'Old.Current_Bit_Pos +
(strVal'Length - 1 + null_characters'Length) * 8;

procedure Acn_Dec_String_Ascii_Null_Teminated
procedure Acn_Dec_String_Ascii_Null_Terminated
(bs : in out Bitstream; null_characters : OctetBuffer;
strVal : in out String; Result : out ASN1_RESULT) with
Pre => null_characters'Length >= 1 and then null_characters'Length <= 10
Expand Down Expand Up @@ -996,10 +996,10 @@ is
bs'Old.Current_Bit_Pos + ((strVal'Last - strVal'First) * 8);

procedure Acn_Dec_String_Ascii_External_Field_Determinant
(bs : in out Bitstream; extSizeDeterminatFld : Asn1Int;
(bs : in out Bitstream; extSizeDeterminantFld : Asn1Int;
strVal : in out String; Result : out ASN1_RESULT) with
Pre => extSizeDeterminatFld >= 0
and then extSizeDeterminatFld <= Asn1Int (Integer'Last)
Pre => extSizeDeterminantFld >= 0
and then extSizeDeterminantFld <= Asn1Int (Integer'Last)
and then strVal'Last < Natural'Last and then strVal'Last >= strVal'First
and then strVal'Last - strVal'First < Natural'Last / 8 - 8
and then bs.Current_Bit_Pos <
Expand Down Expand Up @@ -1032,10 +1032,10 @@ is

procedure Acn_Dec_String_CharIndex_External_Field_Determinant
(bs : in out Bitstream; charSet : String; nCharSize : Integer;
extSizeDeterminatFld : Asn1Int; strVal : out String;
extSizeDeterminantFld : Asn1Int; strVal : out String;
Result : out ASN1_RESULT) with
Pre => extSizeDeterminatFld >= 0
and then extSizeDeterminatFld <= Asn1Int (Integer'Last)
Pre => extSizeDeterminantFld >= 0
and then extSizeDeterminantFld <= Asn1Int (Integer'Last)
and then nCharSize >= 1 and then nCharSize <= 8
and then strVal'Last < Natural'Last and then strVal'Last >= strVal'First
and then charSet'Last < Natural'Last
Expand Down
Loading
Loading