From 8de6d7484f5b68988e9ad387f3a02b77ffe7ef52 Mon Sep 17 00:00:00 2001 From: levlam Date: Sat, 27 Oct 2018 02:51:27 +0300 Subject: [PATCH] Fix call to PEM_read_bio_RSAPublicKey. GitOrigin-RevId: 099e4b08a21f1d6788751222f7c98a6ab696eb49 --- td/mtproto/crypto.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/td/mtproto/crypto.cpp b/td/mtproto/crypto.cpp index 0b0846d12..cfbab2d08 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"); }