diff --git a/td/mtproto/crypto.cpp b/td/mtproto/crypto.cpp index 0b0846d1..cfbab2d0 100644 --- a/td/mtproto/crypto.cpp +++ b/td/mtproto/crypto.cpp @@ -48,18 +48,14 @@ Result RSA::from_pem(Slice pem) { BIO_free(bio); }; - auto *rsa = RSA_new(); + auto rsa = PEM_read_bio_RSAPublicKey(bio, nullptr, nullptr, nullptr); if (rsa == nullptr) { - return Status::Error("Cannot create RSA"); + return Status::Error("Error while reading rsa pubkey"); } SCOPE_EXIT { RSA_free(rsa); }; - if (!PEM_read_bio_RSAPublicKey(bio, &rsa, nullptr, nullptr)) { - return Status::Error("Error while reading rsa pubkey"); - } - if (RSA_size(rsa) != 256) { return Status::Error("RSA_size != 256"); }