Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sys/psa_crypto: Add generic HMAC implementation #20758

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Commits on Aug 22, 2024

  1. sys/psa_crypto: Fix missing usage flags when creating new keys

    The PSA crypto specification states that when creating keys,
    the usage flags PSA_KEY_USAGE_SIGN_HASH/PSA_KEY_USAGE_VERIFY_HASH
    automatically set the usage flags
    PSA_KEY_USAGE_SIGN_MESSAGE/PSA_KEY_USAGE_VERIFY_MESSAGE on the key.
    
    Signed-off-by: Armin Wolf <W_Armin@gmx.de>
    Wer-Wolf committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    c151184 View commit details
    Browse the repository at this point in the history
  2. sys/psa_crypto: Wire-up multi-part MAC dispatcher

    Prepare to support the multi-part MAC API by creating appropriate
    dispatchers for both algorithm and location backends.
    
    Since there are no supported backends at the moment, the dispatcher
    always returns PSA_ERROR_NOT_SUPPORTED for now.
    
    Signed-off-by: Armin Wolf <W_Armin@gmx.de>
    Wer-Wolf committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    c790119 View commit details
    Browse the repository at this point in the history
  3. sys/psa_crypto: Implement PSA_HASH_BLOCK_LENGTH()

    The initial implementation was inspired by MbedTLS, with the
    addition of the MD2 and MD4 algorithms.
    
    Signed-off-by: Armin Wolf <W_Armin@gmx.de>
    Wer-Wolf committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    95400a7 View commit details
    Browse the repository at this point in the history
  4. sys/psa_crypto: Implement PSA_MAC_MAX_SIZE()

    This support macro will be needed by the generic hmac
    implementation.
    
    Signed-off-by: Armin Wolf <W_Armin@gmx.de>
    Wer-Wolf committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    92fc1de View commit details
    Browse the repository at this point in the history
  5. sys/psa_crypto: Add PSA_HMAC_BLOCK_MAX_SIZE()

    This additional macro will be used by the generic hmac
    implementation to calculate the size of the internal
    buffers.
    
    Signed-off-by: Armin Wolf <W_Armin@gmx.de>
    Wer-Wolf committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    b54214a View commit details
    Browse the repository at this point in the history
  6. sys/psa_crypto: Add generic HMAC implementation

    Add a generic HMAC implementation based on the PSA hashing API.
    In order to support a specific HMAC algorithm, all what has to be
    implemented is a backend for the PSA hashing API.
    
    Signed-off-by: Armin Wolf <W_Armin@gmx.de>
    Wer-Wolf committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    476719c View commit details
    Browse the repository at this point in the history
  7. sys/psa_crypto: Wire-up generic HMAC with the dispatcher

    The generic HMAC implementation can only be used by going through
    the dispatcher. Do the necessary wire-up so that applications using
    the PSA crypto API can use the generic HMAC implementation.
    
    Signed-off-by: Armin Wolf <W_Armin@gmx.de>
    Wer-Wolf committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    b1a6cff View commit details
    Browse the repository at this point in the history
  8. sys/psa_crypto: Replace old SHA256 HMAC implemenation with generic HMAC

    The old HMAC implementation only supported the SHA256 hashing algorithm
    and only implemented the single-part MAC function.
    Replace it with the generic HMAC implementation which supports all
    hashing algorithms and is already used for the multi-part MAC functions.
    
    A side effect of this commit is that the cryptocell HMAC implementation
    is not used anymore. This will be fixed in a later commit which
    introduces broad hardare-acceleration for HMAC.
    
    Signed-off-by: Armin Wolf <W_Armin@gmx.de>
    Wer-Wolf committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    ab0ce26 View commit details
    Browse the repository at this point in the history
  9. sys/psa_crypto: Implement psa_mac_verify()

    Implement the PSA MAC verification API. Currently only the generic
    HMAC backend is available for MAC verification, but hardware-accelerated
    backends can be added later.
    
    Signed-off-by: Armin Wolf <W_Armin@gmx.de>
    Wer-Wolf committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    3573476 View commit details
    Browse the repository at this point in the history
  10. sys/psa_crypto: Document the generic HMAC implementation

    Add some documentation regarding the steps for adding support
    for new HMAC algorithms to the generic HMAC implementation.
    
    Signed-off-by: Armin Wolf <W_Armin@gmx.de>
    Wer-Wolf committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    5ccb81d View commit details
    Browse the repository at this point in the history
  11. tests/sys/psa_crypto_mac: Add tests for generic HMAC implementations

    Add tests for the generic HMAC implementation.
    
    Authored-by: Daria Zatokovenko <daria.zatokovenko@gmail.com>
    Signed-off-by: Armin Wolf <W_Armin@gmx.de>
    daria-gauster authored and Wer-Wolf committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    3606e9b View commit details
    Browse the repository at this point in the history