Skip to content
  • Eric Biggers's avatar
    crypto: algapi - use common mechanism for inheriting flags · 7bcb2c99
    Eric Biggers authored
    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 ...
    7bcb2c99