Commit 6dbd9e97 authored by Jude Taylor's avatar Jude Taylor Committed by Facebook Github Bot

codemod: ASN1_STRING_data -> ASN1_STRING_get0_data

Reviewed By: anirudhvr

Differential Revision: D4830205

fbshipit-source-id: 55f34c3bddead8a73174c403f76572248c541a10
parent 44ce72fd
...@@ -83,7 +83,11 @@ const char* SSL_SESSION_get0_hostname(const SSL_SESSION* s) { ...@@ -83,7 +83,11 @@ const char* SSL_SESSION_get0_hostname(const SSL_SESSION* s) {
return s->tlsext_hostname; return s->tlsext_hostname;
} }
EVP_MD_CTX* EVP_MD_CTX_new() { unsigned char* ASN1_STRING_get0_data(const ASN1_STRING* x) {
return ASN1_STRING_data((ASN1_STRING*)x);
}
EVP_MD_CTX* EVP_MD_CTX_new(void) {
EVP_MD_CTX* ctx = (EVP_MD_CTX*)OPENSSL_malloc(sizeof(EVP_MD_CTX)); EVP_MD_CTX* ctx = (EVP_MD_CTX*)OPENSSL_malloc(sizeof(EVP_MD_CTX));
if (!ctx) { if (!ctx) {
throw std::runtime_error("Cannot allocate EVP_MD_CTX"); throw std::runtime_error("Cannot allocate EVP_MD_CTX");
......
...@@ -116,6 +116,7 @@ int BIO_meth_set_read(BIO_METHOD* biom, int (*read)(BIO*, char*, int)); ...@@ -116,6 +116,7 @@ int BIO_meth_set_read(BIO_METHOD* biom, int (*read)(BIO*, char*, int));
int BIO_meth_set_write(BIO_METHOD* biom, int (*write)(BIO*, const char*, int)); int BIO_meth_set_write(BIO_METHOD* biom, int (*write)(BIO*, const char*, int));
const char* SSL_SESSION_get0_hostname(const SSL_SESSION* s); const char* SSL_SESSION_get0_hostname(const SSL_SESSION* s);
unsigned char* ASN1_STRING_get0_data(const ASN1_STRING* x);
EVP_MD_CTX* EVP_MD_CTX_new(); EVP_MD_CTX* EVP_MD_CTX_new();
void EVP_MD_CTX_free(EVP_MD_CTX* ctx); void EVP_MD_CTX_free(EVP_MD_CTX* ctx);
......
...@@ -43,7 +43,7 @@ Optional<std::string> OpenSSLCertUtils::getCommonName(X509& x509) { ...@@ -43,7 +43,7 @@ Optional<std::string> OpenSSLCertUtils::getCommonName(X509& x509) {
return none; return none;
} }
auto cnData = reinterpret_cast<const char*>(ASN1_STRING_data(cnAsn)); auto cnData = reinterpret_cast<const char*>(ASN1_STRING_get0_data(cnAsn));
auto cnLen = ASN1_STRING_length(cnAsn); auto cnLen = ASN1_STRING_length(cnAsn);
if (!cnData || cnLen <= 0) { if (!cnData || cnLen <= 0) {
return none; return none;
...@@ -69,8 +69,8 @@ std::vector<std::string> OpenSSLCertUtils::getSubjectAltNames(X509& x509) { ...@@ -69,8 +69,8 @@ std::vector<std::string> OpenSSLCertUtils::getSubjectAltNames(X509& x509) {
if (!genName || genName->type != GEN_DNS) { if (!genName || genName->type != GEN_DNS) {
continue; continue;
} }
auto nameData = auto nameData = reinterpret_cast<const char*>(
reinterpret_cast<const char*>(ASN1_STRING_data(genName->d.dNSName)); ASN1_STRING_get0_data(genName->d.dNSName));
auto nameLen = ASN1_STRING_length(genName->d.dNSName); auto nameLen = ASN1_STRING_length(genName->d.dNSName);
if (!nameData || nameLen <= 0) { if (!nameData || nameLen <= 0) {
continue; continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment