| Age | Commit message (Collapse) | Author |
|
This is needed so that we can keep the in_place assignment outside the
inner loop. Without this in pathalogical situations we can start out
having walk_out being different from walk_in, but when walk_out crosses
a page it may converge with walk_in.
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
Rather than taking a branch on the fast path, we might as well split
cbc_process into encrypt and decrypt since they don't share anything
in common.
We can get rid of the cryptfn argument too. I'll do that next.
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
Here's some more optimisations plus a bug fix for a pathological case
where in_place might not be set correctly which can't happen with any
of the current users. Here is the first one:
We have long since stopped using a null cit_iv as a means of doing null
encryption. In fact it doesn't work here anyway since we need to copy
src into dst to achieve null encryption.
No user of cbc_encrypt_iv/cbc_decrypt_iv does this either so let's just
get rid of this check which is sitting in the fast path.
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
Perform kmap once (or twice if the buffer is not aligned correctly)
per page in crypt() instead of the current code which does it once
per block. Consequently it will yield once per page instead of once
per block.
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
Only call scatterwalk_copychunks when the block straddles a page boundary.
This allows crypt() to skip the out-of-line call most of the time.
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
Move src/dst handling from crypt() into the helpers prepare_src,
prepare_dst, complete_src and complete_dst. complete_src doesn't
actually do anything at the moment but is included for completeness.
This sets the stage for further optimisations down the track without
polluting crypt() itself.
These helpers don't belong in scatterwalk.[ch] since they only help
the particular way that crypt() is walking the scatter lists.
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
Move the handling of in_place into crypt() itself. This means that we only
need two temporary buffers instead of three. It also allows us to simplify
the check in scatterwalk_samebuf.
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
scatterwalk_whichbuf is called once for each block which could be as
small as 8/16 bytes. So it makes sense to do that work inline.
It's also a bit inflexible since we may want to use the temporary buffer
even if the block doesn't cross page boundaries. In particular, we want
to do that when the source and destination are the same.
So let's replace it with scatterwalk_across_pages.
I've also simplified the check in scatterwalk_across_pages. It is
sufficient to only check len_this_page.
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
The stack allocation in crypt() is bogus as whether tmp_src/tmp_dst
is used is determined by factors unrelated to nbytes and
src->length/dst->length.
Since the condition for whether tmp_src/tmp_dst are used is very
complex, let's allocate them always instead of guessing.
This fixes a number of weird crashes including those AES crashes
that people have been seeing with the 2.4 backport + ipt_conntrack.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: James Morris <jmorris@redhat.com>
Signed-off-by: David S. Miller <davem@redhat.com>
|
|
- After calling scatterwalk_copychunks walk_in might point to the next
page which will break scatterwalk_samebuf (in this case src_p should
point to tmp_src anyway and scatterwalk_samembuf returns 0).
- scatterwalk_samebuf should also check for equal offsets inside the page
(just bad for performance in some cases).
|
|
From: Christophe Saout <christophe@saout.de>
This patch fixes the bug where in-place encryption was not detected when
the same highmem pages is mapped twice to different virtual addresses.
This adds a parameter to xxx_process to indicate whether this is an
in-place encryption and moves the responsability to the caller using a
helper function scatterwalk.h.
|
|
From: Christophe Saout <christophe@saout.de>
I've cleaned up the latest patches and adjusted the header files.
This patch moves the scatterwalk functions from cipher.c to
scatterwalk.c and adds a header file.
|
|
|
|
|
|
|
|
|
|
- Merge scatterwalk patch from Adam J. Richter <adam@yggdrasil.com>
API change: cipher methods now take in/out scatterlists and nbytes
params.
- Merge gss_krb5_crypto update from Adam J. Richter <adam@yggdrasil.com>
- Add KM_SOFTIRQn (instead of KM_CRYPTO_IN etc).
- Add asm/kmap_types.h to crypto/internal.h
- Update cipher.c credits.
- Update cipher.c documentation.
|
|
|
|
|
|
|
|
- Changed unsigned to unsigned int in algos.
- Consistent use of u32 for flags throughout api.
- Use of unsigned int rather than int for counting things which must
be positive, also replaced size_ts to keep code simpler and lessen
bloat on some archs.
- got rid of some unneeded returns.
- const correctness.
|
|
|
|
- Removed local_bh_disable() from kmap wrapper, not needed now with
two atomic kmaps.
- Nuked atomic flag, use in_softirq() instead.
- Converted crypto_kmap() and crypto_yield() to check in_softirq().
- Check CRYPTO_MAX_CIPHER_BLOCK_SIZE during alg init.
- Try to initialize as much at compile time as possible
(feedback from Christoph Hellwig).
- Clean up list handling a bit (feedback from Christoph Hellwig).
|
|
- API change: implemented simplest version of algorithm lookup
by name (feedback from Rusty Russell and Herbert Valerio Riedel).
- Now need to add the following line to to /etc/modules.conf for
dynamic module loading:
alias des3_ede des
|
|
- try_inc_mod_count() already does what crypto_alg_get() was trying to do.
(feedback from Andrew Morton).
- Moved the BUG_ON() in crypto_unregister_alg() further up, no need to
bother iterating over the list.
- Always use kmap_atomic (feedback from Andrew Morton). Implemented two
atomic kmaps, KM_USER for user context and KM_SOFTIRQ for softirq
context.
- Fixup KM_CRYPTO_ placement so Dave does not go crazy.
|
|
- s/__u/u/
- s/char/u8/
- Fixed bug in cipher.c, page remapped was off by one block
|
|
|