hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/crypto/echainiv.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * echainiv: Encrypted Chain IV Generator
34 *
....@@ -10,12 +11,6 @@
1011 * is performed after encryption (i.e., authenc).
1112 *
1213 * Copyright (c) 2015 Herbert Xu <herbert@gondor.apana.org.au>
13
- *
14
- * This program is free software; you can redistribute it and/or modify it
15
- * under the terms of the GNU General Public License as published by the Free
16
- * Software Foundation; either version 2 of the License, or (at your option)
17
- * any later version.
18
- *
1914 */
2015
2116 #include <crypto/internal/geniv.h>
....@@ -47,9 +42,9 @@
4742 info = req->iv;
4843
4944 if (req->src != req->dst) {
50
- SKCIPHER_REQUEST_ON_STACK(nreq, ctx->sknull);
45
+ SYNC_SKCIPHER_REQUEST_ON_STACK(nreq, ctx->sknull);
5146
52
- skcipher_request_set_tfm(nreq, ctx->sknull);
47
+ skcipher_request_set_sync_tfm(nreq, ctx->sknull);
5348 skcipher_request_set_callback(nreq, req->base.flags,
5449 NULL, NULL);
5550 skcipher_request_set_crypt(nreq, req->src, req->dst,
....@@ -120,7 +115,7 @@
120115 struct aead_instance *inst;
121116 int err;
122117
123
- inst = aead_geniv_alloc(tmpl, tb, 0, 0);
118
+ inst = aead_geniv_alloc(tmpl, tb);
124119
125120 if (IS_ERR(inst))
126121 return PTR_ERR(inst);
....@@ -138,29 +133,17 @@
138133 inst->alg.base.cra_ctxsize = sizeof(struct aead_geniv_ctx);
139134 inst->alg.base.cra_ctxsize += inst->alg.ivsize;
140135
141
- inst->free = aead_geniv_free;
142
-
143136 err = aead_register_instance(tmpl, inst);
144
- if (err)
145
- goto free_inst;
146
-
147
-out:
148
- return err;
149
-
137
+ if (err) {
150138 free_inst:
151
- aead_geniv_free(inst);
152
- goto out;
153
-}
154
-
155
-static void echainiv_free(struct crypto_instance *inst)
156
-{
157
- aead_geniv_free(aead_instance(inst));
139
+ inst->free(inst);
140
+ }
141
+ return err;
158142 }
159143
160144 static struct crypto_template echainiv_tmpl = {
161145 .name = "echainiv",
162146 .create = echainiv_aead_create,
163
- .free = echainiv_free,
164147 .module = THIS_MODULE,
165148 };
166149
....@@ -174,7 +157,7 @@
174157 crypto_unregister_template(&echainiv_tmpl);
175158 }
176159
177
-module_init(echainiv_module_init);
160
+subsys_initcall(echainiv_module_init);
178161 module_exit(echainiv_module_exit);
179162
180163 MODULE_LICENSE("GPL");