Add the OSSL_PROVIDER_get_capabilities() API function
[openssl.git] / crypto / provider_core.c
index f7af51a..cfaa09f 100644 (file)
@@ -70,6 +70,7 @@ struct ossl_provider_st {
     OSSL_provider_teardown_fn *teardown;
     OSSL_provider_gettable_params_fn *gettable_params;
     OSSL_provider_get_params_fn *get_params;
+    OSSL_provider_get_capabilities_fn *get_capabilities;
     OSSL_provider_query_operation_fn *query_operation;
 
     /*
@@ -543,6 +544,10 @@ static int provider_activate(OSSL_PROVIDER *prov)
             prov->get_params =
                 OSSL_get_provider_get_params(provider_dispatch);
             break;
+        case OSSL_FUNC_PROVIDER_GET_CAPABILITIES:
+            prov->get_capabilities =
+                OSSL_get_provider_get_capabilities(provider_dispatch);
+            break;
         case OSSL_FUNC_PROVIDER_QUERY_OPERATION:
             prov->query_operation =
                 OSSL_get_provider_query_operation(provider_dispatch);
@@ -820,6 +825,15 @@ int ossl_provider_get_params(const OSSL_PROVIDER *prov, OSSL_PARAM params[])
         ? 0 : prov->get_params(prov->provctx, params);
 }
 
+int ossl_provider_get_capabilities(const OSSL_PROVIDER *prov,
+                                   const char *capability,
+                                   OSSL_CALLBACK *cb,
+                                   void *arg)
+{
+    return prov->get_capabilities == NULL
+        ? 0 : prov->get_capabilities(prov->provctx, capability, cb, arg);
+}
+
 
 const OSSL_ALGORITHM *ossl_provider_query_operation(const OSSL_PROVIDER *prov,
                                                     int operation_id,