geniv.c (cd900f0cacd7601dabdd028e8cbdbf2a7041cee2) | geniv.c (0f8f6d86d415f9d88dc0f7847f11d0c52dba1965) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * geniv: Shared IV generator code 4 * 5 * This file provides common code to IV generators such as seqiv. 6 * 7 * Copyright (c) 2007-2019 Herbert Xu <herbert@gondor.apana.org.au> 8 */ --- 18 unchanged lines hidden (view full) --- 27static int aead_geniv_setauthsize(struct crypto_aead *tfm, 28 unsigned int authsize) 29{ 30 struct aead_geniv_ctx *ctx = crypto_aead_ctx(tfm); 31 32 return crypto_aead_setauthsize(ctx->child, authsize); 33} 34 | 1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * geniv: Shared IV generator code 4 * 5 * This file provides common code to IV generators such as seqiv. 6 * 7 * Copyright (c) 2007-2019 Herbert Xu <herbert@gondor.apana.org.au> 8 */ --- 18 unchanged lines hidden (view full) --- 27static int aead_geniv_setauthsize(struct crypto_aead *tfm, 28 unsigned int authsize) 29{ 30 struct aead_geniv_ctx *ctx = crypto_aead_ctx(tfm); 31 32 return crypto_aead_setauthsize(ctx->child, authsize); 33} 34 |
35static void aead_geniv_free(struct aead_instance *inst) 36{ 37 crypto_drop_aead(aead_instance_ctx(inst)); 38 kfree(inst); 39} 40 |
|
35struct aead_instance *aead_geniv_alloc(struct crypto_template *tmpl, 36 struct rtattr **tb, u32 type, u32 mask) 37{ 38 const char *name; 39 struct crypto_aead_spawn *spawn; 40 struct crypto_attr_type *algt; 41 struct aead_instance *inst; 42 struct aead_alg *alg; --- 52 unchanged lines hidden (view full) --- 95 inst->alg.base.cra_ctxsize = sizeof(struct aead_geniv_ctx); 96 97 inst->alg.setkey = aead_geniv_setkey; 98 inst->alg.setauthsize = aead_geniv_setauthsize; 99 100 inst->alg.ivsize = ivsize; 101 inst->alg.maxauthsize = maxauthsize; 102 | 41struct aead_instance *aead_geniv_alloc(struct crypto_template *tmpl, 42 struct rtattr **tb, u32 type, u32 mask) 43{ 44 const char *name; 45 struct crypto_aead_spawn *spawn; 46 struct crypto_attr_type *algt; 47 struct aead_instance *inst; 48 struct aead_alg *alg; --- 52 unchanged lines hidden (view full) --- 101 inst->alg.base.cra_ctxsize = sizeof(struct aead_geniv_ctx); 102 103 inst->alg.setkey = aead_geniv_setkey; 104 inst->alg.setauthsize = aead_geniv_setauthsize; 105 106 inst->alg.ivsize = ivsize; 107 inst->alg.maxauthsize = maxauthsize; 108 |
109 inst->free = aead_geniv_free; 110 |
|
103out: 104 return inst; 105 106err_drop_alg: 107 crypto_drop_aead(spawn); 108err_free_inst: 109 kfree(inst); 110 inst = ERR_PTR(err); 111 goto out; 112} 113EXPORT_SYMBOL_GPL(aead_geniv_alloc); 114 | 111out: 112 return inst; 113 114err_drop_alg: 115 crypto_drop_aead(spawn); 116err_free_inst: 117 kfree(inst); 118 inst = ERR_PTR(err); 119 goto out; 120} 121EXPORT_SYMBOL_GPL(aead_geniv_alloc); 122 |
115void aead_geniv_free(struct aead_instance *inst) 116{ 117 crypto_drop_aead(aead_instance_ctx(inst)); 118 kfree(inst); 119} 120EXPORT_SYMBOL_GPL(aead_geniv_free); 121 | |
122int aead_init_geniv(struct crypto_aead *aead) 123{ 124 struct aead_geniv_ctx *ctx = crypto_aead_ctx(aead); 125 struct aead_instance *inst = aead_alg_instance(aead); 126 struct crypto_aead *child; 127 int err; 128 129 spin_lock_init(&ctx->lock); --- 47 unchanged lines hidden --- | 123int aead_init_geniv(struct crypto_aead *aead) 124{ 125 struct aead_geniv_ctx *ctx = crypto_aead_ctx(aead); 126 struct aead_instance *inst = aead_alg_instance(aead); 127 struct crypto_aead *child; 128 int err; 129 130 spin_lock_init(&ctx->lock); --- 47 unchanged lines hidden --- |