)]}'
{
  "commit": "d8056594b1198fc41d73e5d0cdd57bec264c79c8",
  "tree": "b78c9fc8a26a07058c61e428690e8445ee94fbc2",
  "parents": [
    "f9a05a8636d25e07218d8e443b849b981138e515"
  ],
  "author": {
    "name": "Ben Collins",
    "email": "bcollins@libjwt.io",
    "time": "Mon Jun 15 09:45:37 2026 -0400"
  },
  "committer": {
    "name": "Ben Collins",
    "email": "bcollins@libjwt.io",
    "time": "Mon Jun 15 09:45:37 2026 -0400"
  },
  "message": "mbedtls: migrate the native backend to the PSA Crypto API (closes #267)\n\nMbedTLS 4.x (TF-PSA-Crypto) split the crypto core out, made the classic\nlow-level API (mbedtls_rsa_*, mbedtls_ecp_*, mbedtls_gcm_*, ...) private\nunder mbedtls/private/, removed the low-level mbedtls_ecdh_* primitives\nentirely, and reworked even some public APIs (mbedtls_md HMAC, nist_kw)\ntoward PSA. Reaching into the private headers would just re-break on the\nnext release, so move the whole native backend onto the public PSA Crypto\nAPI (psa/crypto.h). PSA is also stable in MbedTLS 3.6 LTS, so this is a\nsingle code path for both lines with no version #ifdefs; the CMake floor\nstays mbedcrypto \u003e\u003d 3.6.0.\n\nKey model: a parsed JWK now holds PSA-importable material (RSA PKCS#1 DER\nbuilt via the public asn1write.h; EC/OKP-X curve family + raw point/scalar)\nrather than a native key object. Each operation imports a short-lived\nvolatile PSA key with exactly the policy it needs, then destroys it. This\nsidesteps PSA\u0027s single-policy-per-key model and keeps RSA parse-time\nleniency.\n\n  - sign/verify: psa_sign_message/psa_verify_message (RSA PSS/PKCS1v15,\n    ECDSA); HMAC via PSA MAC. Strict signature-size checks preserved.\n  - JWE: GCM via PSA AEAD, CBC via PSA cipher + truncated-MAC HMAC,\n    RSA-OAEP via PSA, RNG via psa_generate_random, ECDH via\n    psa_raw_key_agreement, and RFC 3394 AES-KW hand-rolled on PSA AES-ECB\n    (nist_kw changed shape in 4.x). EdDSA stays unsupported.\n  - EC keys are validated at parse via a throwaway PSA import; item-\u003ebits\n    is computed at parse.\n\nTwo PSA constraints handled: psa_generate_key cannot produce Montgomery\npairs (X25519/X448 ephemerals generate a random scalar and import it), and\nsecp256k1 is rejected for ECDH-ES (PSA would otherwise allow it).\n\nPSA caps RSA at PSA_VENDOR_RSA_MAX_KEY_BITS (4096 by default), which the\nclassic API did not. Oversize RSA keys are now rejected at parse with a\nclear message; the keyring and flip-flop tests skip the 8192-bit key on\nthe MbedTLS backend, mirroring the existing EdDSA skip.\n\nVerified against MbedTLS 4.1: full suite passes (mbedtls-only and the\nOpenSSL+GnuTLS+MbedTLS+libcurl combo) with no new uncovered lines.\n\nCo-Authored-By: Claude Opus 4.8 (1M context) \u003cnoreply@anthropic.com\u003e\nSigned-off-by: Ben Collins \u003cbcollins@libjwt.io\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "591e3c1b409ae0b431d13c13173752d8b83c4cf3",
      "old_mode": 33188,
      "old_path": "libjwt/mbedtls/jwe.c",
      "new_id": "6bd2a4d176499901badef5080a93b9b6278a2c90",
      "new_mode": 33188,
      "new_path": "libjwt/mbedtls/jwe.c"
    },
    {
      "type": "modify",
      "old_id": "e6c1727f1d97eeb12f182b34fbe652e2d0712013",
      "old_mode": 33188,
      "old_path": "libjwt/mbedtls/jwk-parse.c",
      "new_id": "704f2068dee922eb8aa55ffc720dc286921e2c8f",
      "new_mode": 33188,
      "new_path": "libjwt/mbedtls/jwk-parse.c"
    },
    {
      "type": "modify",
      "old_id": "7ac39fbf25d068320ed3f279b364f1eca210cbb2",
      "old_mode": 33188,
      "old_path": "libjwt/mbedtls/jwt-mbedtls.h",
      "new_id": "4a83939a2bf37b1a80388af6e0a843cdd051e779",
      "new_mode": 33188,
      "new_path": "libjwt/mbedtls/jwt-mbedtls.h"
    },
    {
      "type": "modify",
      "old_id": "1c1bb2bb663dc6802903929545b1967a0b407caa",
      "old_mode": 33188,
      "old_path": "libjwt/mbedtls/sign-verify.c",
      "new_id": "e3f2bb8fac74c6d88d7a002ac8f9d0f91b860efa",
      "new_mode": 33188,
      "new_path": "libjwt/mbedtls/sign-verify.c"
    },
    {
      "type": "modify",
      "old_id": "bc07b366895570da818d6a61aa27f3a2ba500a21",
      "old_mode": 33188,
      "old_path": "tests/jwt_flipflop.c",
      "new_id": "9c3ece45f231ded1edb7dc6a241d7aa620834f96",
      "new_mode": 33188,
      "new_path": "tests/jwt_flipflop.c"
    },
    {
      "type": "modify",
      "old_id": "606003e0817f1b2485df39e835a9ab6d7e7c2ae2",
      "old_mode": 33188,
      "old_path": "tests/jwt_jwks.c",
      "new_id": "c0971c480ef12059e1d63be58a6e34b93a10fc7f",
      "new_mode": 33188,
      "new_path": "tests/jwt_jwks.c"
    }
  ]
}
