X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=ssl%2Fssl_cert.c;h=ce4a09fad50e581fb54ce1587fcec298ed92eadc;hp=d7f6602d50baa7184f56c4d3fda72cbea3be90fc;hb=cd933ebd578d7ec77e1905250a4afbc65750bef4;hpb=aa8f3d76fcf1502586435631be16faa1bef3cdf7 diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c index d7f6602d50..ce4a09fad5 100644 --- a/ssl/ssl_cert.c +++ b/ssl/ssl_cert.c @@ -24,6 +24,7 @@ #include #include #include "ssl_locl.h" +#include "ssl_cert_table.h" #include "internal/thread_once.h" static int ssl_security_default_callback(const SSL *s, const SSL_CTX *ctx, @@ -976,3 +977,28 @@ int ssl_ctx_security(const SSL_CTX *ctx, int op, int bits, int nid, void *other) return ctx->cert->sec_cb(NULL, ctx, op, bits, nid, other, ctx->cert->sec_ex); } + +const SSL_CERT_LOOKUP *ssl_cert_lookup_by_pkey(const EVP_PKEY *pk, size_t *pidx) +{ + int nid = EVP_PKEY_id(pk); + size_t i; + + if (nid == NID_undef) + return NULL; + + for (i = 0; i < OSSL_NELEM(ssl_cert_info); i++) { + if (ssl_cert_info[i].nid == nid) { + if (pidx != NULL) + *pidx = i; + return &ssl_cert_info[i]; + } + } + return NULL; +} + +const SSL_CERT_LOOKUP *ssl_cert_lookup_by_idx(size_t idx) +{ + if (idx >= OSSL_NELEM(ssl_cert_info)) + return 0; + return &ssl_cert_info[idx]; +}