Skip to content

Restore correct registers in aarch64 AES-CTR code#26469

Closed
julian-klode wants to merge 1 commit intoopenssl:masterfrom
julian-klode:fix-d14-d15-aes-ctr-restore
Closed

Restore correct registers in aarch64 AES-CTR code#26469
julian-klode wants to merge 1 commit intoopenssl:masterfrom
julian-klode:fix-d14-d15-aes-ctr-restore

Conversation

@julian-klode
Copy link
Contributor

@julian-klode julian-klode commented Jan 18, 2025

Commit 1d1ca79 introduced save and restore for the registers, saving them as

stp		d8,d9,[sp, #16]
stp		d10,d11,[sp, #32]
stp		d12,d13,[sp, #48]
stp		d14,d15,[sp, #64]

But the restore code was inadvertently typoed:

ldp		d8,d9,[sp, #16]
ldp		d10,d11,[sp, #32]
ldp		d12,d13,[sp, #48]
ldp		d15,d16,[sp, #64]

Restoring [sp, #64] into d15,d16 instead of d14,d15.

Fixes: #26466

Checklist

@openssl-machine openssl-machine added the hold: cla required The contributor needs to submit a license agreement label Jan 18, 2025
@julian-klode julian-klode force-pushed the fix-d14-d15-aes-ctr-restore branch from 439a93b to fe7b532 Compare January 18, 2025 20:17
@openssl-machine openssl-machine removed the hold: cla required The contributor needs to submit a license agreement label Jan 18, 2025
Commit 1d1ca79 introduced
save and restore for the registers, saving them as

	stp		d8,d9,[sp, openssl#16]
	stp		d10,d11,[sp, openssl#32]
	stp		d12,d13,[sp, openssl#48]
	stp		d14,d15,[sp, openssl#64]

But the restore code was inadvertently typoed:

	ldp		d8,d9,[sp, openssl#16]
	ldp		d10,d11,[sp, openssl#32]
	ldp		d12,d13,[sp, openssl#48]
	ldp		d15,d16,[sp, openssl#64]

Restoring [sp, openssl#64] into d15,d16 instead of d14,d15.

Fixes: openssl#26466

CLA: trivial
@github-actions github-actions bot added the severity: fips change The pull request changes FIPS provider sources label Jan 18, 2025
@julian-klode
Copy link
Contributor Author

The cmac test failure is surprising, it's possible something after the restore is accidentally working with the wrong values only or something, I'll need to have a closer look at that but it's getting late, I'll leave that for the following day(s).

Copy link
Contributor

@paulidale paulidale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CMAC problem is likely the same as #26458.

@paulidale paulidale added approval: done This pull request has the required number of approvals branch: master Applies to master branch labels Jan 19, 2025
@t8m t8m added branch: 3.3 Applies to openssl-3.3 branch: 3.4 Applies to openssl-3.4 triaged: bug The issue/pr is/fixes a bug tests: exempted The PR is exempt from requirements for testing labels Jan 20, 2025
Copy link
Member

@t8m t8m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to go all the way into 3.4 and 3.3 branches.

@t8m
Copy link
Member

t8m commented Jan 20, 2025

@paulidale @kroeckx please confirm you're OK with backporting to 3.3 and 3.4.

@paulidale
Copy link
Contributor

Fine with backporting.

@kroeckx
Copy link
Member

kroeckx commented Jan 20, 2025 via email

@openssl-machine
Copy link
Collaborator

24 hours has passed since 'approval: done' was set, but as this PR has been updated in that time the label 'approval: ready to merge' is not being automatically set. Please review the updates and set the label manually.

@paulidale paulidale added approval: ready to merge The 24 hour grace period has passed, ready to merge and removed approval: done This pull request has the required number of approvals labels Jan 20, 2025
@t8m
Copy link
Member

t8m commented Jan 21, 2025

Merged to the master, 3.4 and 3.3 branches. Thank you for your contribution.

@t8m t8m closed this Jan 21, 2025
openssl-machine pushed a commit that referenced this pull request Jan 21, 2025
Commit 1d1ca79 introduced
save and restore for the registers, saving them as

	stp		d8,d9,[sp, #16]
	stp		d10,d11,[sp, #32]
	stp		d12,d13,[sp, #48]
	stp		d14,d15,[sp, #64]

But the restore code was inadvertently typoed:

	ldp		d8,d9,[sp, #16]
	ldp		d10,d11,[sp, #32]
	ldp		d12,d13,[sp, #48]
	ldp		d15,d16,[sp, #64]

Restoring [sp, #64] into d15,d16 instead of d14,d15.

Fixes: #26466

CLA: trivial

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #26469)
openssl-machine pushed a commit that referenced this pull request Jan 21, 2025
Commit 1d1ca79 introduced
save and restore for the registers, saving them as

	stp		d8,d9,[sp, #16]
	stp		d10,d11,[sp, #32]
	stp		d12,d13,[sp, #48]
	stp		d14,d15,[sp, #64]

But the restore code was inadvertently typoed:

	ldp		d8,d9,[sp, #16]
	ldp		d10,d11,[sp, #32]
	ldp		d12,d13,[sp, #48]
	ldp		d15,d16,[sp, #64]

Restoring [sp, #64] into d15,d16 instead of d14,d15.

Fixes: #26466

CLA: trivial

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #26469)

(cherry picked from commit 5261f3c)
openssl-machine pushed a commit that referenced this pull request Jan 21, 2025
Commit 1d1ca79 introduced
save and restore for the registers, saving them as

	stp		d8,d9,[sp, #16]
	stp		d10,d11,[sp, #32]
	stp		d12,d13,[sp, #48]
	stp		d14,d15,[sp, #64]

But the restore code was inadvertently typoed:

	ldp		d8,d9,[sp, #16]
	ldp		d10,d11,[sp, #32]
	ldp		d12,d13,[sp, #48]
	ldp		d15,d16,[sp, #64]

Restoring [sp, #64] into d15,d16 instead of d14,d15.

Fixes: #26466

CLA: trivial

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #26469)

(cherry picked from commit 5261f3c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval: ready to merge The 24 hour grace period has passed, ready to merge branch: master Applies to master branch branch: 3.3 Applies to openssl-3.3 branch: 3.4 Applies to openssl-3.4 severity: fips change The pull request changes FIPS provider sources tests: exempted The PR is exempt from requirements for testing triaged: bug The issue/pr is/fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rand_new_drbg() clobbers d15 on Graviton/armv8

5 participants