Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions RSA.xs
Original file line number Diff line number Diff line change
Expand Up @@ -293,16 +293,24 @@ SV* extractBioString(BIO* p_stringBio)
{
SV* sv;
char* datap;
long datasize = 0;
long datasize;
int error = 0;

CHECK_OPEN_SSL(BIO_flush(p_stringBio) == 1);
THROW(BIO_flush(p_stringBio) == 1);

datasize = BIO_get_mem_data(p_stringBio, &datap);
THROW(datasize > 0);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strictly speaking this should be > 0 - 0 is returned if p_stringBio is null but 299 should fail in that case

sv = newSVpv(datap, datasize);

CHECK_OPEN_SSL(BIO_set_close(p_stringBio, BIO_CLOSE) == 1);
BIO_set_close(p_stringBio, BIO_CLOSE);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We lost the success check here - should wrap probably it in a throw but the p_stringBio was successfully set and the BIO is freed next so likely okay

BIO_free(p_stringBio);
return sv;

err:
BIO_free(p_stringBio);
CHECK_OPEN_SSL(0);
return NULL; /* unreachable, CHECK_OPEN_SSL croaks */
}

EVP_PKEY* _load_rsa_key(SV* p_keyStringSv,
Expand Down
Loading