| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * echainiv: Encrypted Chain IV Generator |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 10 | 11 | * is performed after encryption (i.e., authenc). |
|---|
| 11 | 12 | * |
|---|
| 12 | 13 | * 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 | | - * |
|---|
| 19 | 14 | */ |
|---|
| 20 | 15 | |
|---|
| 21 | 16 | #include <crypto/internal/geniv.h> |
|---|
| .. | .. |
|---|
| 47 | 42 | info = req->iv; |
|---|
| 48 | 43 | |
|---|
| 49 | 44 | if (req->src != req->dst) { |
|---|
| 50 | | - SKCIPHER_REQUEST_ON_STACK(nreq, ctx->sknull); |
|---|
| 45 | + SYNC_SKCIPHER_REQUEST_ON_STACK(nreq, ctx->sknull); |
|---|
| 51 | 46 | |
|---|
| 52 | | - skcipher_request_set_tfm(nreq, ctx->sknull); |
|---|
| 47 | + skcipher_request_set_sync_tfm(nreq, ctx->sknull); |
|---|
| 53 | 48 | skcipher_request_set_callback(nreq, req->base.flags, |
|---|
| 54 | 49 | NULL, NULL); |
|---|
| 55 | 50 | skcipher_request_set_crypt(nreq, req->src, req->dst, |
|---|
| .. | .. |
|---|
| 120 | 115 | struct aead_instance *inst; |
|---|
| 121 | 116 | int err; |
|---|
| 122 | 117 | |
|---|
| 123 | | - inst = aead_geniv_alloc(tmpl, tb, 0, 0); |
|---|
| 118 | + inst = aead_geniv_alloc(tmpl, tb); |
|---|
| 124 | 119 | |
|---|
| 125 | 120 | if (IS_ERR(inst)) |
|---|
| 126 | 121 | return PTR_ERR(inst); |
|---|
| .. | .. |
|---|
| 138 | 133 | inst->alg.base.cra_ctxsize = sizeof(struct aead_geniv_ctx); |
|---|
| 139 | 134 | inst->alg.base.cra_ctxsize += inst->alg.ivsize; |
|---|
| 140 | 135 | |
|---|
| 141 | | - inst->free = aead_geniv_free; |
|---|
| 142 | | - |
|---|
| 143 | 136 | err = aead_register_instance(tmpl, inst); |
|---|
| 144 | | - if (err) |
|---|
| 145 | | - goto free_inst; |
|---|
| 146 | | - |
|---|
| 147 | | -out: |
|---|
| 148 | | - return err; |
|---|
| 149 | | - |
|---|
| 137 | + if (err) { |
|---|
| 150 | 138 | 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; |
|---|
| 158 | 142 | } |
|---|
| 159 | 143 | |
|---|
| 160 | 144 | static struct crypto_template echainiv_tmpl = { |
|---|
| 161 | 145 | .name = "echainiv", |
|---|
| 162 | 146 | .create = echainiv_aead_create, |
|---|
| 163 | | - .free = echainiv_free, |
|---|
| 164 | 147 | .module = THIS_MODULE, |
|---|
| 165 | 148 | }; |
|---|
| 166 | 149 | |
|---|
| .. | .. |
|---|
| 174 | 157 | crypto_unregister_template(&echainiv_tmpl); |
|---|
| 175 | 158 | } |
|---|
| 176 | 159 | |
|---|
| 177 | | -module_init(echainiv_module_init); |
|---|
| 160 | +subsys_initcall(echainiv_module_init); |
|---|
| 178 | 161 | module_exit(echainiv_module_exit); |
|---|
| 179 | 162 | |
|---|
| 180 | 163 | MODULE_LICENSE("GPL"); |
|---|