mbox series

[v2,0/6] crypto: remove old way of allocating and freeing instances

Message ID 20200103040440.12375-1-ebiggers@kernel.org (mailing list archive)
Headers show
Series crypto: remove old way of allocating and freeing instances | expand

Message

Eric Biggers Jan. 3, 2020, 4:04 a.m. UTC
This series makes all crypto templates use the new way of freeing
instances where a ->free() method is installed to the instance struct
itself.  This replaces the weakly-typed method crypto_template::free().

skcipher and akcipher were already using the new way, while aead was
mostly but not always using the new way.  shash and ahash were using the
old way.  This series eliminates this inconsistency (and the redundant
code associated with it) by making everyone use the new way.

The last patch adds registration-time checks which verify that all
instances really have a ->free() method.

This series is an internal cleanup only; there are no changes for users
of the crypto API.

This series is based on top of my other series
"[PATCH v2 00/28] crypto: template instantiation cleanup".

Changed v1 => v2:

  - Rebased onto v2 of the other series.

Eric Biggers (6):
  crypto: hash - add support for new way of freeing instances
  crypto: geniv - convert to new way of freeing instances
  crypto: cryptd - convert to new way of freeing instances
  crypto: shash - convert shash_free_instance() to new style
  crypto: algapi - remove crypto_template::{alloc,free}()
  crypto: algapi - enforce that all instances have a ->free() method

 crypto/aead.c                   |  8 +++----
 crypto/ahash.c                  | 11 +++++++++
 crypto/akcipher.c               |  2 ++
 crypto/algapi.c                 |  5 ----
 crypto/algboss.c                | 12 +---------
 crypto/ccm.c                    |  5 ++--
 crypto/cmac.c                   |  5 ++--
 crypto/cryptd.c                 | 42 ++++++++++++++++-----------------
 crypto/echainiv.c               | 20 ++++------------
 crypto/geniv.c                  | 15 ++++++------
 crypto/hmac.c                   |  5 ++--
 crypto/seqiv.c                  | 20 ++++------------
 crypto/shash.c                  | 19 +++++++++++----
 crypto/skcipher.c               |  3 +++
 crypto/vmac.c                   |  5 ++--
 crypto/xcbc.c                   |  5 ++--
 include/crypto/algapi.h         |  2 --
 include/crypto/internal/geniv.h |  1 -
 include/crypto/internal/hash.h  |  4 +++-
 19 files changed, 89 insertions(+), 100 deletions(-)

Comments

Herbert Xu Jan. 9, 2020, 5:15 a.m. UTC | #1
Eric Biggers <ebiggers@kernel.org> wrote:
> This series makes all crypto templates use the new way of freeing
> instances where a ->free() method is installed to the instance struct
> itself.  This replaces the weakly-typed method crypto_template::free().
> 
> skcipher and akcipher were already using the new way, while aead was
> mostly but not always using the new way.  shash and ahash were using the
> old way.  This series eliminates this inconsistency (and the redundant
> code associated with it) by making everyone use the new way.
> 
> The last patch adds registration-time checks which verify that all
> instances really have a ->free() method.
> 
> This series is an internal cleanup only; there are no changes for users
> of the crypto API.
> 
> This series is based on top of my other series
> "[PATCH v2 00/28] crypto: template instantiation cleanup".
> 
> Changed v1 => v2:
> 
>  - Rebased onto v2 of the other series.
> 
> Eric Biggers (6):
>  crypto: hash - add support for new way of freeing instances
>  crypto: geniv - convert to new way of freeing instances
>  crypto: cryptd - convert to new way of freeing instances
>  crypto: shash - convert shash_free_instance() to new style
>  crypto: algapi - remove crypto_template::{alloc,free}()
>  crypto: algapi - enforce that all instances have a ->free() method
> 
> crypto/aead.c                   |  8 +++----
> crypto/ahash.c                  | 11 +++++++++
> crypto/akcipher.c               |  2 ++
> crypto/algapi.c                 |  5 ----
> crypto/algboss.c                | 12 +---------
> crypto/ccm.c                    |  5 ++--
> crypto/cmac.c                   |  5 ++--
> crypto/cryptd.c                 | 42 ++++++++++++++++-----------------
> crypto/echainiv.c               | 20 ++++------------
> crypto/geniv.c                  | 15 ++++++------
> crypto/hmac.c                   |  5 ++--
> crypto/seqiv.c                  | 20 ++++------------
> crypto/shash.c                  | 19 +++++++++++----
> crypto/skcipher.c               |  3 +++
> crypto/vmac.c                   |  5 ++--
> crypto/xcbc.c                   |  5 ++--
> include/crypto/algapi.h         |  2 --
> include/crypto/internal/geniv.h |  1 -
> include/crypto/internal/hash.h  |  4 +++-
> 19 files changed, 89 insertions(+), 100 deletions(-)

All applied.  Thanks.