-
- Downloads
crypto: algapi - use common mechanism for inheriting flags
The flag CRYPTO_ALG_ASYNC is "inherited" in the sense that when a template is instantiated, the template will have CRYPTO_ALG_ASYNC set if any of the algorithms it uses has CRYPTO_ALG_ASYNC set. We'd like to add a second flag (CRYPTO_ALG_ALLOCATES_MEMORY) that gets "inherited" in the same way. This is difficult because the handling of CRYPTO_ALG_ASYNC is hardcoded everywhere. Address this by: - Add CRYPTO_ALG_INHERITED_FLAGS, which contains the set of flags that have these inheritance semantics. - Add crypto_algt_inherited_mask(), for use by template ->create() methods. It returns any of these flags that the user asked to be unset and thus must be passed in the 'mask' to crypto_grab_*(). - Also modify crypto_check_attr_type() to handle computing the 'mask' so that most templates can just use this. - Make crypto_grab_*() propagate these flags to the template instance being created so that templates don't have to do this themselves. Make crypto/simd.c propagate these flags too, since it "wraps" another algorithm, similar to a template. Based on a patch by Mikulas Patocka <mpatocka@redhat.com> (https://lore.kernel.org/r/alpine.LRH.2.02.2006301414580.30526@file01.intranet.prod.int.rdu2.redhat.com ). Signed-off-by:Eric Biggers <ebiggers@google.com> Signed-off-by:
Herbert Xu <herbert@gondor.apana.org.au>
Showing
- crypto/adiantum.c 3 additions, 11 deletionscrypto/adiantum.c
- crypto/algapi.c 20 additions, 1 deletioncrypto/algapi.c
- crypto/authenc.c 3 additions, 11 deletionscrypto/authenc.c
- crypto/authencesn.c 3 additions, 11 deletionscrypto/authencesn.c
- crypto/ccm.c 10 additions, 23 deletionscrypto/ccm.c
- crypto/chacha20poly1305.c 3 additions, 11 deletionscrypto/chacha20poly1305.c
- crypto/cmac.c 3 additions, 2 deletionscrypto/cmac.c
- crypto/cryptd.c 30 additions, 29 deletionscrypto/cryptd.c
- crypto/ctr.c 5 additions, 14 deletionscrypto/ctr.c
- crypto/cts.c 3 additions, 10 deletionscrypto/cts.c
- crypto/essiv.c 8 additions, 3 deletionscrypto/essiv.c
- crypto/gcm.c 9 additions, 31 deletionscrypto/gcm.c
- crypto/geniv.c 3 additions, 11 deletionscrypto/geniv.c
- crypto/hmac.c 3 additions, 2 deletionscrypto/hmac.c
- crypto/lrw.c 3 additions, 10 deletionscrypto/lrw.c
- crypto/pcrypt.c 5 additions, 9 deletionscrypto/pcrypt.c
- crypto/rsa-pkcs1pad.c 3 additions, 10 deletionscrypto/rsa-pkcs1pad.c
- crypto/simd.c 4 additions, 2 deletionscrypto/simd.c
- crypto/skcipher.c 5 additions, 10 deletionscrypto/skcipher.c
- crypto/vmac.c 3 additions, 2 deletionscrypto/vmac.c
Loading
Please register or sign in to comment