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

Define legacy error codes as aliases for PSA error codes #9629

Open
wants to merge 8 commits into
base: development
Choose a base branch
from

Commits on Sep 15, 2024

  1. Use MBEDTLS_ERROR_ADD instead of explicit addition: simple cases

    Replace obvious additions of an `MBEDTLS_ERR_xxx` constant by a call to
    `MBEDTLS_ERROR_ADD`.
    
    Skip `case` statements since `MBEDTLS_ERROR_ADD(pp_constant)` is not a
    preprocessor constant.
    
    This commit does not replace additions split over lines. Those will be
    handled in a subsequent commit.
    
    ```
    git ls-files '*.h' '*.c' '*.function' '*.data' |
    xargs perl -i -pe '
        next if /\bcase\b/;
        s/\b(MBEDTLS_ERR_\w+)\s*\+\s*(\w+)\b/MBEDTLS_ERROR_ADD($1, $2)/g;
        s/\b(\w+)\s*\+\s*(MBEDTLS_ERR_\w+)\b/MBEDTLS_ERROR_ADD($1, $2)/g'
    ```
    
    Signed-off-by: Gilles Peskine <[email protected]>
    gilles-peskine-arm committed Sep 15, 2024
    Configuration menu
    Copy the full SHA
    aa1757e View commit details
    Browse the repository at this point in the history
  2. Use MBEDTLS_ERROR_ADD instead of explicit addition: enforcement

    Reject direct additions of error constants (regex-based approximation).
    
    Fix the lone straggler.
    
    Signed-off-by: Gilles Peskine <[email protected]>
    gilles-peskine-arm committed Sep 15, 2024
    Configuration menu
    Copy the full SHA
    c393aca View commit details
    Browse the repository at this point in the history
  3. Include "error.h" for MBEDTLS_ERROR_ADD

    Signed-off-by: Gilles Peskine <[email protected]>
    gilles-peskine-arm committed Sep 15, 2024
    Configuration menu
    Copy the full SHA
    65ce989 View commit details
    Browse the repository at this point in the history

Commits on Sep 16, 2024

  1. Always use the low-level error code

    What could possibly go wrong...
    
    Signed-off-by: Gilles Peskine <[email protected]>
    gilles-peskine-arm committed Sep 16, 2024
    Configuration menu
    Copy the full SHA
    71e1ff7 View commit details
    Browse the repository at this point in the history
  2. Have a low-level error code override any high-level one

    We mostly use MBEDTLS_ERROR_ADD with both a low-level and a high-level
    error, but we also occasionally use it with a low-level code that can be 0.
    
    Signed-off-by: Gilles Peskine <[email protected]>
    gilles-peskine-arm committed Sep 16, 2024
    Configuration menu
    Copy the full SHA
    bccd656 View commit details
    Browse the repository at this point in the history
  3. Don't expect added error codes

    Signed-off-by: Gilles Peskine <[email protected]>
    gilles-peskine-arm committed Sep 16, 2024
    Configuration menu
    Copy the full SHA
    715fec2 View commit details
    Browse the repository at this point in the history

Commits on Sep 24, 2024

  1. Configuration menu
    Copy the full SHA
    c02dd77 View commit details
    Browse the repository at this point in the history
  2. Change MBEDTLS_ERR_ERROR_xxx to use PSA values

    Signed-off-by: Gilles Peskine <[email protected]>
    gilles-peskine-arm committed Sep 24, 2024
    Configuration menu
    Copy the full SHA
    d15a785 View commit details
    Browse the repository at this point in the history