/* Provenance: openssl/openssl sm2_asym_decrypt (fixed). * repo: openssl/openssl * commit: 36cf45ef3ba71e44a8be06ee81cb31aa02cb0010 * parent: 4b8a8bb75229b64d1c7598d845fdc3c7e7d7eee2 * commit_url: https://github.com/openssl/openssl/commit/36cf45ef3ba71e44a8be06ee81cb31aa02cb0010 * cve: CVE-2021-3711 * license: OpenSSL License * function: sm2_asym_decrypt * relpath: providers/implementations/asymciphers/sm2_enc.c */ static int sm2_asym_decrypt(void *vpsm2ctx, unsigned char *out, size_t *outlen, size_t outsize, const unsigned char *in, size_t inlen) { PROV_SM2_CTX *psm2ctx = (PROV_SM2_CTX *)vpsm2ctx; const EVP_MD *md = sm2_get_md(psm2ctx); if (md == NULL) return 0; if (out == NULL) { if (!ossl_sm2_plaintext_size(in, inlen, outlen)) return 0; return 1; } return ossl_sm2_decrypt(psm2ctx->key, md, in, inlen, out, outlen); }