Merge 4.14.86 into android-4.14-p
[GitHub/moto-9609/android_kernel_motorola_exynos9610.git] / crypto / api.c
index 941cd4c6c7ecbbb02348dc99f2a0fbed4576421d..ff7a7852bb17acc90535be965727f42a2a9ef7e4 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/sched/signal.h>
 #include <linux/slab.h>
 #include <linux/string.h>
+#include <linux/completion.h>
 #include "internal.h"
 
 LIST_HEAD(crypto_alg_list);
@@ -215,7 +216,7 @@ struct crypto_alg *crypto_larval_lookup(const char *name, u32 type, u32 mask)
        mask &= ~(CRYPTO_ALG_LARVAL | CRYPTO_ALG_DEAD);
 
        alg = crypto_alg_lookup(name, type, mask);
-       if (!alg) {
+       if (!alg && !(mask & CRYPTO_NOLOAD)) {
                request_module("crypto-%s", name);
 
                if (!((type ^ CRYPTO_ALG_NEED_FALLBACK) & mask &
@@ -595,5 +596,17 @@ int crypto_has_alg(const char *name, u32 type, u32 mask)
 }
 EXPORT_SYMBOL_GPL(crypto_has_alg);
 
+void crypto_req_done(struct crypto_async_request *req, int err)
+{
+       struct crypto_wait *wait = req->data;
+
+       if (err == -EINPROGRESS)
+               return;
+
+       wait->err = err;
+       complete(&wait->completion);
+}
+EXPORT_SYMBOL_GPL(crypto_req_done);
+
 MODULE_DESCRIPTION("Cryptographic core API");
 MODULE_LICENSE("GPL");