-
-
usr/src/common/crypto/modes/ctr.c (Diff revision 1) In should probably be const as we're never going to modify it, right?
-
usr/src/common/crypto/modes/ctr.c (Diff revision 1) It seems like this can afford to be const as we should never be modifying the key from this function and this is just used for doing xor computations.
-
usr/src/common/crypto/modes/ctr.c (Diff revision 1) Why don't we just design this such that we get us to 4-byte alignment, then do 4-byte work, and then when it's not finish it up, rather than doing the architecture specific stuff. This way, even the other archs will get the benefit and x86 will perform better as well. Just because you can do unaligned access on x86 doesn't mean that it's performant to do so. I realize that we won't always be able to do this kind of stuff. But still, seems like it's kind of useful to try and phrase this towards getting us to 4-byte aligned stuff if we can.
-
usr/src/common/crypto/modes/ctr.c (Diff revision 1) in32
should probably be const as we're never going to modify it, right? Same withkey32
in this context. -
usr/src/common/crypto/modes/ctr.c (Diff revision 1) I think it would be clearer if you indicated that data and length were related to the input as part of their naming.
-
usr/src/common/crypto/modes/ctr.c (Diff revision 1) Can we use more descriptive names for these? It's weird, for example, that out_data_2 is unused. At least, naively.
-
-
usr/src/lib/pkcs11/pkcs11_softtoken/common/softAESCrypt.c (Diff revision 1) Previously we cared about pData being NULL, but now we don't care about it at all and are instead only looking at pEncryptedData for this. Does that matter?
-
usr/src/uts/common/crypto/io/aes.c (Diff revision 1) Shouldn't this have the same assert as the default case? I presume we really should move it to be treated like the default case.
-
usr/src/uts/common/crypto/io/aes.c (Diff revision 1) I'd strongly recommend making this an ASSERT3U since the other value comes from the stack.
CTR mode tries to be both a stream and block cipher and fails at both
Review Request #2458 — Created Nov. 19, 2019 and submitted
Information | |
---|---|
jbk | |
illumos-gate | |
11966 | |
Reviewers | |
general | |
CTR mode doesn't work with segment sizes other than AES_BLOCK_LEN. As it is a stream cipher, it should work with any sized input, and as a stream cipher shouldn't accumulate any input data between calls -- it should always be able to act upon an arbitrary size input and immediately produce output.
Updated crypto tests to test different segment sizes, ran updated crypto tests (with and without this change) to verify it works.
- 1
- 0
- 10
- 0
- 11
Description | From | Last Updated |
---|---|---|
Previously we cared about pData being NULL, but now we don't care about it at all and are instead only ... |
|
Diff: |
Revision 3 (+303 -272)
|
---|
Diff: |
Revision 4 (+320 -272)
|
---|
-
Thank you for the additional comments.
-
Diff: |
Revision 5 (+320 -272)
|
---|
-
I also diffed this patch against -gate vs. what is in -joyent currently, and see one of the main changes is allowing XOR-stream bits to get synched from unaligned to aligned. I saw some ASSERT->ASSERT3U, disambiguating TRY32 (it does read better the new way) as part of the synching, and some other commenting.