internal/format: require the last line of stanzas to be short

We are going to reuse the stanza format for IPC in the plugin protocol,
but in that context we need stanzas to be self-closing. Currently they
almost are, but if the body is 0 modulo 48, there is no way to know if
the stanza is over after the last line.

Now, all stanzas have to end with a short line, even if empty.

No ciphertexts generated by age in the past are affected, but 3% of the
ciphertexts generated by rage will now stop working. They are still
supported by rage going forward. If it turns out to be a common issue,
we can add an exception.
This commit is contained in:
Filippo Valsorda
2021-01-03 20:57:09 +01:00
parent 50b61862d6
commit 15df6e2cf7
4 changed files with 60 additions and 24 deletions

View File

@@ -1,6 +1,7 @@
age-encryption.org/v1
-> ssh-ed25519 o1Hudg SZISkI5Qn8YgUBmTKG/Zp/QpFjXWvAivzvB+hOcN5W8
dYfwGWYvCwpSU5EXIC1XqfXdsBvCi3kMypdqCVShrpk
-> joint-oil-hw
--- gC/27VAgqOEzAQMKHvBjih7sJ1oDKht+HNdguTIbjt8
f<EFBFBD>tAe<EFBFBD>֨&8{<7B><><EFBFBD>νcat<61><1B><><16><><EFBFBD><13>˷}<17>=<3D>C<EFBFBD><43>u
-> X25519 alRneDshIh43nwyD5+fhuTD5TReSn88f2us4hzZPyzU
pGduNK5MUhnuzMxW0qbZnC2k7mRzz69bbJpKQrRc7uc
-> A7)h-grease !,_
--- 5bA0uXjBxI6wuI5SseCRgD5/G8LkSVISRe/hnrQMb9s
<EFBFBD><EFBFBD><06>1<EFBFBD><31><EFBFBD><EFBFBD><03>6_R<5F><08>څ<EFBFBD><DA85>U<<3C>1<EFBFBD>s<EFBFBD><73>?`<60>+<><7F>$<24>H<EFBFBD>W<EFBFBD>v?w8ZW

View File

@@ -1,7 +1 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
QyNTUxOQAAACAwKgrb/LkvtI887QylSoUh5xUlKr1fb37euR6et5jHowAAAJgxqUx+MalM
fgAAAAtzc2gtZWQyNTUxOQAAACAwKgrb/LkvtI887QylSoUh5xUlKr1fb37euR6et5jHow
AAAEC7gKj74YIwaM1BT2tnODjfeZJvo8lcazvL6Uljv3+nIDAqCtv8uS+0jzztDKVKhSHn
FSUqvV9vft65Hp63mMejAAAADnJ1bm5lckBmdi1hejMyAQIDBAUGBw==
-----END OPENSSH PRIVATE KEY-----
AGE-SECRET-KEY-1TRYTV7PQS5XPUYSTAQZCD7DQCWC7Q77YJD7UVFJRMW4J82Q6930QS70MRX