Merge tag 'pm-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
[sfrench/cifs-2.6.git] / crypto / akcipher.c
index 0cbeae137e0ae8f9e45f67ef0c6e3475031ed747..7d5cf49394238d49442099974f540c65f1a960fd 100644 (file)
@@ -1,14 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Public Key Encryption
  *
  * Copyright (c) 2015, Intel Corporation
  * Authors: Tadeusz Struk <tadeusz.struk@intel.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
  */
 #include <linux/errno.h>
 #include <linux/kernel.h>
@@ -119,10 +114,24 @@ static void akcipher_prepare_alg(struct akcipher_alg *alg)
        base->cra_flags |= CRYPTO_ALG_TYPE_AKCIPHER;
 }
 
+static int akcipher_default_op(struct akcipher_request *req)
+{
+       return -ENOSYS;
+}
+
 int crypto_register_akcipher(struct akcipher_alg *alg)
 {
        struct crypto_alg *base = &alg->base;
 
+       if (!alg->sign)
+               alg->sign = akcipher_default_op;
+       if (!alg->verify)
+               alg->verify = akcipher_default_op;
+       if (!alg->encrypt)
+               alg->encrypt = akcipher_default_op;
+       if (!alg->decrypt)
+               alg->decrypt = akcipher_default_op;
+
        akcipher_prepare_alg(alg);
        return crypto_register_alg(base);
 }