mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-10-18 20:49:28 +00:00
28 lines
808 B
C
28 lines
808 B
C
/* Provenance: openssl/openssl sm2_plaintext_size (fixed).
|
|||
|
|
* repo: openssl/openssl
|
||
|
|
* commit: 59f5e75f3bced8fc0e130d72a3f582cf7b480b46
|
||
|
|
* parent: 8c74c9d1ade0fbdab5b815ddb747351b8b839641
|
||
|
|
* commit_url: https://github.com/openssl/openssl/commit/59f5e75f3bced8fc0e130d72a3f582cf7b480b46
|
||
|
|
* cve: CVE-2021-3711
|
||
|
|
* license: OpenSSL License
|
||
|
|
* function: sm2_plaintext_size
|
||
|
|
* relpath: crypto/sm2/sm2_crypt.c
|
||
|
|
*/
|
||
|
|
|
||
|
|
int sm2_plaintext_size(const unsigned char *ct, size_t ct_size, size_t *pt_size)
|
||
|
|
{
|
||
|
|
struct SM2_Ciphertext_st *sm2_ctext = NULL;
|
||
|
|
|
||
|
|
sm2_ctext = d2i_SM2_Ciphertext(NULL, &ct, ct_size);
|
||
|
|
|
||
|
|
if (sm2_ctext == NULL) {
|
||
|
|
SM2err(SM2_F_SM2_PLAINTEXT_SIZE, SM2_R_INVALID_ENCODING);
|
||
|
|
return 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
*pt_size = sm2_ctext->C2->length;
|
||
|
|
SM2_Ciphertext_free(sm2_ctext);
|
||
|
|
|
||
|
|
return 1;
|
||
|
|
}
|