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

ascon128 misaligned load #162

Closed
rogerbinns opened this issue Jun 2, 2024 · 2 comments
Closed

ascon128 misaligned load #162

rogerbinns opened this issue Jun 2, 2024 · 2 comments

Comments

@rogerbinns
Copy link

Use a sanitizer.

import apsw

con = apsw.Connection("testdb")
print(f"{con.pragma("cipher", "ascon128")=}")
print(f"{con.pragma("key", "hello")=}")
con.execute("create table x(y); insert into x values(randomblob(32768))")

Results

con.pragma("cipher", "ascon128")='ascon128'
con.pragma("key", "hello")='ok'
/space/mc/sqlite3/sqlite3.c:280144:16: runtime error: load of misaligned address 0x53100005184c for type 'uint64_t', which requires 8 byte alignment
0x53100005184c: note: pointer points here
  00 00 00 00 ef ed 7a 53  7b 6d 43 a3 f2 a4 9c 75  4f 91 56 27 00 00 00 00  00 00 00 00 00 00 00 00
              ^ 

The alignment error is reported ~16 times for ~3 different addresses

@utelle
Copy link
Owner

utelle commented Jun 2, 2024

/space/mc/sqlite3/sqlite3.c:280144:16: runtime error: load of misaligned address 0x53100005184c for type 'uint64_t', which requires 8 byte alignment

The alignment error is reported ~16 times for ~3 different addresses

For the implementation of the Ascon algorithms I use mostly the code from the Ascon repository. I just checked the repository and found out that the alignment issue was addressed in April 2024.

I will adjust SQLite3MC's Ascon code.

utelle added a commit that referenced this issue Jun 3, 2024
- #158: add check to verify compatibility of source and target database in backup operation
- #160: fix accessing memory out of array bounds
- #162: fix loading/storing misaligned data
@utelle
Copy link
Owner

utelle commented Jun 3, 2024

I applied the necessary modifications. The issue should now be fixed.

@utelle utelle closed this as completed Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants