Having issues with RSASSA PKCS 1v5 signature generation

Hello, I’m having issues using the PKCS 1v5 padding in 3.1.0. I had a working project with an older version, but after updating and modifying everything, I’m still having some troubles. In particular, there must be something wrong about how I use the function, cause I keep getting non-deterministic signatures, even if that shouldn’t be the case in 1v5 (as far as I know).

My code is as simple as this, but I cannot verify the signatures I obtain using a python implementation (pycryptodome).

mbedtls_sha256(rsa_plaintext, pt_len, hash, 0);
ret = mbedtls_rsa_rsassa_pkcs1_v15_sign(&rsa_ctx, rand, NULL,  MBEDTLS_MD_SHA256, 32, hash, buf);

Intrestingly enough, I have no issues doing the same with RSASSA_PSS, so I suspect I am doing something wrong with PKCS 1v5 specifically, but I can’t seem to find out what.
Thanks in advance