return pkey->pkey.rsa;
}
+DSA* EVP_PKEY_get0_DSA(EVP_PKEY* pkey) {
+ if (pkey->type != EVP_PKEY_DSA) {
+ return nullptr;
+ }
+ return pkey->pkey.dsa;
+}
+
+DH* EVP_PKEY_get0_DH(EVP_PKEY* pkey) {
+ if (pkey->type != EVP_PKEY_DH) {
+ return nullptr;
+ }
+ return pkey->pkey.dh;
+}
+
EC_KEY* EVP_PKEY_get0_EC_KEY(EVP_PKEY* pkey) {
if (pkey->type != EVP_PKEY_EC) {
return nullptr;
return 1;
}
+void DH_get0_pqg(
+ const DH* dh,
+ const BIGNUM** p,
+ const BIGNUM** q,
+ const BIGNUM** g) {
+ // Based off of https://wiki.openssl.org/index.php/OpenSSL_1.1.0_Changes
+ if (p != nullptr) {
+ *p = dh->p;
+ }
+ if (q != nullptr) {
+ *q = dh->q;
+ }
+ if (g != nullptr) {
+ *g = dh->g;
+ }
+}
+
+void DH_get0_key(
+ const DH* dh,
+ const BIGNUM** pub_key,
+ const BIGNUM** priv_key) {
+ // Based off of https://wiki.openssl.org/index.php/OpenSSL_1.1.0_Changes
+ if (pub_key != nullptr) {
+ *pub_key = dh->pub_key;
+ }
+ if (priv_key != nullptr) {
+ *priv_key = dh->priv_key;
+ }
+}
+
+void DSA_get0_pqg(
+ const DSA* dsa,
+ const BIGNUM** p,
+ const BIGNUM** q,
+ const BIGNUM** g) {
+ // Based off of https://wiki.openssl.org/index.php/OpenSSL_1.1.0_Changes
+ if (p != nullptr) {
+ *p = dsa->p;
+ }
+ if (q != nullptr) {
+ *q = dsa->q;
+ }
+ if (g != nullptr) {
+ *g = dsa->g;
+ }
+}
+
+void DSA_get0_key(
+ const DSA* dsa,
+ const BIGNUM** pub_key,
+ const BIGNUM** priv_key) {
+ // Based off of https://wiki.openssl.org/index.php/OpenSSL_1.1.0_Changes
+ if (pub_key != nullptr) {
+ *pub_key = dsa->pub_key;
+ }
+ if (priv_key != nullptr) {
+ *priv_key = dsa->priv_key;
+ }
+}
+
X509* X509_STORE_CTX_get0_cert(X509_STORE_CTX* ctx) {
return ctx->cert;
}
bool RSA_set0_key(RSA* r, BIGNUM* n, BIGNUM* e, BIGNUM* d) {
// Based off of https://wiki.openssl.org/index.php/OpenSSL_1.1.0_Changes
/**
- * If the fields n and e in r are NULL, the corresponding input parameters
- * MUST be non-NULL for n and e. d may be left NULL (in case only the public
- * key is used).
+ * If the fields n and e in r are nullptr, the corresponding input parameters
+ * MUST be non-nullptr for n and e. d may be left NULL (in case only the
+ * public key is used).
*/
if ((r->n == nullptr && n == nullptr) || (r->e == nullptr && e == nullptr)) {
return false;
return true;
}
+void RSA_get0_factors(const RSA* r, const BIGNUM** p, const BIGNUM** q) {
+ // Based off of https://wiki.openssl.org/index.php/OpenSSL_1.1.0_Changes
+ if (p != nullptr) {
+ *p = r->p;
+ }
+ if (q != nullptr) {
+ *q = r->q;
+ }
+}
+
+void RSA_get0_crt_params(
+ const RSA* r,
+ const BIGNUM** dmp1,
+ const BIGNUM** dmq1,
+ const BIGNUM** iqmp) {
+ // Based off of https://wiki.openssl.org/index.php/OpenSSL_1.1.0_Changes
+ if (dmp1 != nullptr) {
+ *dmp1 = r->dmp1;
+ }
+ if (dmq1 != nullptr) {
+ *dmq1 = r->dmq1;
+ }
+ if (iqmp != nullptr) {
+ *iqmp = r->iqmp;
+ }
+}
+
#endif
}
}
const BIGNUM** e,
const BIGNUM** d);
RSA* EVP_PKEY_get0_RSA(EVP_PKEY* pkey);
+DSA* EVP_PKEY_get0_DSA(EVP_PKEY* pkey);
+DH* EVP_PKEY_get0_DH(EVP_PKEY* pkey);
EC_KEY* EVP_PKEY_get0_EC_KEY(EVP_PKEY* pkey);
#endif
unsigned long SSL_SESSION_get_ticket_lifetime_hint(const SSL_SESSION* s);
int SSL_SESSION_has_ticket(const SSL_SESSION* s);
int DH_set0_pqg(DH* dh, BIGNUM* p, BIGNUM* q, BIGNUM* g);
+void DH_get0_pqg(
+ const DH* dh,
+ const BIGNUM** p,
+ const BIGNUM** q,
+ const BIGNUM** g);
+void DH_get0_key(const DH* dh, const BIGNUM** pub_key, const BIGNUM** priv_key);
+
+void DSA_get0_pqg(
+ const DSA* dsa,
+ const BIGNUM** p,
+ const BIGNUM** q,
+ const BIGNUM** g);
+void DSA_get0_key(
+ const DSA* dsa,
+ const BIGNUM** pub_key,
+ const BIGNUM** priv_key);
X509* X509_STORE_CTX_get0_cert(X509_STORE_CTX* ctx);
STACK_OF(X509) * X509_STORE_CTX_get0_chain(X509_STORE_CTX* ctx);
STACK_OF(X509) * X509_STORE_CTX_get0_untrusted(X509_STORE_CTX* ctx);
bool RSA_set0_key(RSA* r, BIGNUM* n, BIGNUM* e, BIGNUM* d);
+void RSA_get0_factors(const RSA* r, const BIGNUM** p, const BIGNUM** q);
+void RSA_get0_crt_params(
+ const RSA* r,
+ const BIGNUM** dmp1,
+ const BIGNUM** dmq1,
+ const BIGNUM** iqmp);
#endif
#if FOLLY_OPENSSL_IS_110