Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Linux Kernel | crypto/ctr.c | static int crypto_ctr_crypt_inplace(struct skcipher_walk *walk,
struct crypto_cipher *tfm) {
void (*fn)(struct crypto_tfm *, u8 *, const u8 *) =
crypto_cipher_alg(tfm)->cia_encrypt;
unsigned int bsize = crypto_cipher_blocksize(tfm);
unsigned long alignmask = crypto_cipher... | [
1,
0
] |
Linux Kernel | crypto/ctr.c | static int crypto_ctr_create(struct crypto_template *tmpl, struct rtattr **tb) {
struct skcipher_instance *inst;
struct crypto_alg *alg;
int err;
inst = skcipher_alloc_instance_simple(tmpl, tb);
if (IS_ERR(inst))
return PTR_ERR(inst);
alg = skcipher_ialg_simple(inst);
err = -EINVAL;
if (alg->cra_... | [
0,
0
] |
Linux Kernel | crypto/ctr.c | static int crypto_rfc3686_crypt(struct skcipher_request *req) {
struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
struct crypto_rfc3686_ctx *ctx = crypto_skcipher_ctx(tfm);
struct crypto_skcipher *child = ctx->child;
unsigned long align = crypto_skcipher_alignmask(tfm);
struct crypto_rfc3686_req_ctx ... | [
1,
0
] |
Linux Kernel | crypto/cts.c |
static int crypto_cts_setkey(struct crypto_skcipher *parent, const u8 *key,
unsigned int keylen) {
struct crypto_cts_ctx *ctx = crypto_skcipher_ctx(parent);
struct crypto_skcipher *child = ctx->child;
crypto_skcipher_clear_flags(child, CRYPTO_TFM_REQ_MASK);
crypto_skcipher_set_fla... | [
0,
0
] |
Linux Kernel | crypto/cts.c |
static int cts_cbc_encrypt(struct skcipher_request *req) {
struct crypto_cts_reqctx *rctx = skcipher_request_ctx(req);
struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
struct skcipher_request *subreq = &rctx->subreq;
int bsize = crypto_skcipher_blocksize(tfm);
u8 d[MAX_CIPHER_BLOCKSIZE * 2] __align... | [
1,
0
] |
Linux Kernel | crypto/cts.c |
static int crypto_cts_encrypt(struct skcipher_request *req) {
struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
struct crypto_cts_reqctx *rctx = skcipher_request_ctx(req);
struct crypto_cts_ctx *ctx = crypto_skcipher_ctx(tfm);
struct skcipher_request *subreq = &rctx->subreq;
int bsize = crypto_skcip... | [
1,
0
] |
Linux Kernel | crypto/cts.c |
static int __init crypto_cts_module_init(void) {
return crypto_register_template(&crypto_cts_tmpl);
} | [
0,
0
] |
Linux Kernel | crypto/cts.c |
static void __exit crypto_cts_module_exit(void) {
crypto_unregister_template(&crypto_cts_tmpl);
} | [
0,
0
] |
Linux Kernel | crypto/curve25519-generic.c |
static unsigned int curve25519_max_size(struct crypto_kpp *tfm) {
return CURVE25519_KEY_SIZE;
} | [
0,
0
] |
Linux Kernel | crypto/deflate.c |
static int deflate_comp_init(struct deflate_ctx *ctx, int format) {
int ret = 0;
struct z_stream_s *stream = &ctx->comp_stream;
stream->workspace =
vzalloc(zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL));
if (!stream->workspace) {
ret = -ENOMEM;
goto out;
}
if (format)
ret = zlib_d... | [
0,
0
] |
Linux Kernel | crypto/deflate.c |
static void deflate_comp_exit(struct deflate_ctx *ctx) {
zlib_deflateEnd(&ctx->comp_stream);
vfree(ctx->comp_stream.workspace);
} | [
0,
0
] |
Linux Kernel | crypto/deflate.c |
static int __deflate_init(void *ctx, int format) {
int ret;
ret = deflate_comp_init(ctx, format);
if (ret)
goto out;
ret = deflate_decomp_init(ctx, format);
if (ret)
deflate_comp_exit(ctx);
out:
return ret;
} | [
0,
0
] |
Linux Kernel | crypto/deflate.c |
static void deflate_free_ctx(struct crypto_scomp *tfm, void *ctx) {
__deflate_exit(ctx);
kfree_sensitive(ctx);
} | [
0,
0
] |
Linux Kernel | crypto/deflate.c |
static void deflate_exit(struct crypto_tfm *tfm) {
struct deflate_ctx *ctx = crypto_tfm_ctx(tfm);
__deflate_exit(ctx);
} | [
0,
0
] |
Linux Kernel | crypto/des_generic.c |
static int des_setkey(struct crypto_tfm *tfm, const u8 *key,
unsigned int keylen) {
struct des_ctx *dctx = crypto_tfm_ctx(tfm);
int err;
err = des_expand_key(dctx, key, keylen);
if (err == -ENOKEY) {
if (crypto_tfm_get_flags(tfm) & CRYPTO_TFM_REQ_FORBID_WEAK_KEYS)
err = -EINVAL... | [
1,
0
] |
Linux Kernel | crypto/des_generic.c |
static void crypto_des3_ede_decrypt(struct crypto_tfm *tfm, u8 *dst,
const u8 *src) {
const struct des3_ede_ctx *dctx = crypto_tfm_ctx(tfm);
des3_ede_decrypt(dctx, dst, src);
} | [
0,
0
] |
Linux Kernel | crypto/dh.c | static int _compute_val(const struct dh_ctx *ctx, MPI base, MPI val) {
return mpi_powm(val, base, ctx->xa, ctx->p);
} | [
0,
0
] |
Linux Kernel | crypto/dh.c |
static inline struct dh_safe_prime_instance_ctx *
dh_safe_prime_instance_ctx(struct crypto_kpp *tfm) {
return kpp_instance_ctx(kpp_alg_instance(tfm));
} | [
0,
0
] |
Linux Kernel | crypto/dh.c |
static u64 __add_u64_to_be(__be64 *dst, unsigned int n, u64 val) {
unsigned int i;
for (i = n; val && i > 0; --i) {
u64 tmp = be64_to_cpu(dst[i - 1]);
tmp += val;
val = tmp >= val ? 0 : 1;
dst[i - 1] = cpu_to_be64(tmp);
}
return val;
} | [
1,
0
] |
Linux Kernel | crypto/dh.c |
static int dh_safe_prime_set_secret(struct crypto_kpp *tfm, const void *buffer,
unsigned int len) {
struct dh_safe_prime_instance_ctx *inst_ctx = dh_safe_prime_instance_ctx(tfm);
struct dh_safe_prime_tfm_ctx *tfm_ctx = kpp_tfm_ctx(tfm);
struct dh params = {};
void *buf = NUL... | [
1,
0
] |
Linux Kernel | crypto/dh.c |
static int dh_safe_prime_generate_public_key(struct kpp_request *req) {
struct kpp_request *dh_req = dh_safe_prime_prepare_dh_req(req);
return crypto_kpp_generate_public_key(dh_req);
} | [
0,
0
] |
Linux Kernel | crypto/dh.c |
static int dh_ffdhe6144_create(struct crypto_template *tmpl,
struct rtattr **tb) {
return __dh_safe_prime_create(tmpl, tb, &ffdhe6144_prime);
} | [
0,
0
] |
Linux Kernel | crypto/dh.c |
static int __init dh_init(void) {
int err;
err = crypto_register_kpp(&dh);
if (err)
return err;
err = crypto_register_templates(crypto_ffdhe_templates,
ARRAY_SIZE(crypto_ffdhe_templates));
if (err) {
crypto_unregister_kpp(&dh);
return err;
}
return 0;
} | [
0,
0
] |
Linux Kernel | crypto/dh_helper.c |
unsigned int crypto_dh_key_len(const struct dh *p) {
return DH_KPP_SECRET_MIN_SIZE + dh_data_size(p);
} | [
0,
0
] |
Linux Kernel | crypto/dh_helper.c |
int crypto_dh_encode_key(char *buf, unsigned int len, const struct dh *params) {
u8 *ptr = buf;
u8 *const end = ptr + len;
struct kpp_secret secret = {.type = CRYPTO_KPP_SECRET_TYPE_DH, .len = len};
if (unlikely(!len))
return -EINVAL;
ptr = dh_pack_data(ptr, end, &secret, sizeof(secret));
ptr = dh_pa... | [
1,
0
] |
Linux Kernel | crypto/dh_helper.c | int __crypto_dh_decode_key(const char *buf, unsigned int len,
struct dh *params) {
const u8 *ptr = buf;
struct kpp_secret secret;
if (unlikely(!buf || len < DH_KPP_SECRET_MIN_SIZE))
return -EINVAL;
ptr = dh_unpack_data(&secret, ptr, sizeof(secret));
if (secret.type != CRYPTO_K... | [
1,
0
] |
Linux Kernel | crypto/drbg.c | static int drbg_ctr_generate(struct drbg_state *drbg, unsigned char *buf,
unsigned int buflen, struct list_head *addtl) {
int ret;
int len = min_t(int, buflen, INT_MAX);
if (addtl && !list_empty(addtl)) {
ret = drbg_ctr_update(drbg, addtl, 2);
if (ret)
return 0;
}
... | [
0,
0
] |
Linux Kernel | crypto/drbg.c | static int drbg_hmac_update(struct drbg_state *drbg, struct list_head *seed,
int reseed) {
int ret = -EFAULT;
int i = 0;
struct drbg_string seed1, seed2, vdata;
LIST_HEAD(seedlist);
LIST_HEAD(vdatalist);
if (!reseed) {
memset(drbg->V, 1, drbg_statelen(drbg));
drbg_kcapi... | [
1,
0
] |
Linux Kernel | crypto/drbg.c | static inline int __drbg_seed(struct drbg_state *drbg, struct list_head *seed,
int reseed, enum drbg_seed_state new_seed_state) {
int ret = drbg->d_ops->update(drbg, seed, reseed);
if (ret)
return ret;
drbg->seeded = new_seed_state;
drbg->last_seed_time = jiffies;
drbg->re... | [
1,
0
] |
Linux Kernel | crypto/drbg.c |
static inline int drbg_get_random_bytes(struct drbg_state *drbg,
unsigned char *entropy,
unsigned int entropylen) {
int ret;
do {
get_random_bytes(entropy, entropylen);
ret = drbg_fips_continuous_test(drbg, entropy);
if (r... | [
1,
0
] |
Linux Kernel | crypto/drbg.c | static bool drbg_nopr_reseed_interval_elapsed(struct drbg_state *drbg) {
unsigned long next_reseed;
if (list_empty(&drbg->test_data.list))
return false;
/*
* Obtain fresh entropy for the nopr DRBGs after 300s have
* elapsed in order to still achieve sort of partial
* prediction resistance over the ... | [
0,
0
] |
Linux Kernel | crypto/drbg.c | static int drbg_generate_long(struct drbg_state *drbg, unsigned char *buf,
unsigned int buflen, struct drbg_string *addtl) {
unsigned int len = 0;
unsigned int slice = 0;
do {
int err = 0;
unsigned int chunk = 0;
slice = ((buflen - len) / drbg_max_request_bytes(drbg));
... | [
1,
0
] |
Linux Kernel | crypto/drbg.c | static int drbg_uninstantiate(struct drbg_state *drbg) {
if (!IS_ERR_OR_NULL(drbg->jent))
crypto_free_rng(drbg->jent);
drbg->jent = NULL;
if (drbg->d_ops)
drbg->d_ops->crypto_fini(drbg);
drbg_dealloc_state(drbg);
return 0;
} | [
0,
0
] |
Linux Kernel | crypto/drbg.c |
static int drbg_fini_hash_kernel(struct drbg_state *drbg) {
struct sdesc *sdesc = drbg->priv_data;
if (sdesc) {
crypto_free_shash(sdesc->shash.tfm);
kfree_sensitive(sdesc);
}
drbg->priv_data = NULL;
return 0;
} | [
0,
0
] |
Linux Kernel | crypto/drbg.c |
static void drbg_kcapi_hmacsetkey(struct drbg_state *drbg,
const unsigned char *key) {
struct sdesc *sdesc = drbg->priv_data;
crypto_shash_setkey(sdesc->shash.tfm, key, drbg_statelen(drbg));
} | [
0,
0
] |
Linux Kernel | crypto/drbg.c | static int drbg_kcapi_sym_ctr(struct drbg_state *drbg, u8 *inbuf, u32 inlen,
u8 *outbuf, u32 outlen) {
struct scatterlist *sg_in = &drbg->sg_in, *sg_out = &drbg->sg_out;
u32 scratchpad_use = min_t(u32, outlen, DRBG_OUTSCRATCHLEN);
int ret;
if (inbuf) {
sg_set_buf(sg_in, inbuf... | [
1,
0
] |
Linux Kernel | crypto/drbg.c | static inline void drbg_convert_tfm_core(const char *cra_driver_name,
int *coreref, bool *pr) {
int i = 0;
size_t start = 0;
int len = 0;
*pr = true;
if (!memcmp(cra_driver_name, "drbg_nopr_", 10)) {
start = 10;
*pr = false;
} else if (!memcmp(cra_driver_na... | [
0,
0
] |
Linux Kernel | crypto/drbg.c |
static int drbg_kcapi_init(struct crypto_tfm *tfm) {
struct drbg_state *drbg = crypto_tfm_ctx(tfm);
mutex_init(&drbg->drbg_mutex);
return 0;
} | [
0,
0
] |
Linux Kernel | crypto/drbg.c | static int drbg_kcapi_random(struct crypto_rng *tfm, const u8 *src,
unsigned int slen, u8 *dst, unsigned int dlen) {
struct drbg_state *drbg = crypto_rng_ctx(tfm);
struct drbg_string *addtl = NULL;
struct drbg_string string;
if (slen) {
drbg_string_fill(&string, src, slen);
... | [
0,
0
] |
Linux Kernel | crypto/ecb.c |
static int crypto_ecb_crypt(struct skcipher_request *req,
struct crypto_cipher *cipher,
void (*fn)(struct crypto_tfm *, u8 *, const u8 *)) {
const unsigned int bsize = crypto_cipher_blocksize(cipher);
struct skcipher_walk walk;
unsigned int nbytes;
int er... | [
1,
0
] |
Linux Kernel | crypto/ecb.c |
static int crypto_ecb_encrypt(struct skcipher_request *req) {
struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
struct crypto_cipher *cipher = skcipher_cipher_simple(tfm);
return crypto_ecb_crypt(req, cipher, crypto_cipher_alg(cipher)->cia_encrypt);
} | [
0,
0
] |
Linux Kernel | crypto/ecc.c |
static u64 *ecc_alloc_digits_space(unsigned int ndigits) {
size_t len = ndigits * sizeof(u64);
if (!len)
return NULL;
return kmalloc(len, GFP_KERNEL);
} | [
1,
0
] |
Linux Kernel | crypto/ecc.c | bool vli_is_zero(const u64 *vli, unsigned int ndigits) {
int i;
for (i = 0; i < ndigits; i++) {
if (vli[i])
return false;
}
return true;
} | [
0,
0
] |
Linux Kernel | crypto/ecc.c | static u64 vli_test_bit(const u64 *vli, unsigned int bit) {
return (vli[bit / 64] & ((u64)1 << (bit % 64)));
} | [
0,
0
] |
Linux Kernel | crypto/ecc.c |
void vli_from_le64(u64 *dest, const void *src, unsigned int ndigits) {
int i;
const u64 *from = src;
for (i = 0; i < ndigits; i++)
dest[i] = get_unaligned_le64(&from[i]);
} | [
0,
0
] |
Linux Kernel | crypto/ecc.c | int vli_cmp(const u64 *left, const u64 *right, unsigned int ndigits) {
int i;
for (i = ndigits - 1; i >= 0; i--) {
if (left[i] > right[i])
return 1;
else if (left[i] < right[i])
return -1;
}
return 0;
} | [
1,
0
] |
Linux Kernel | crypto/ecc.c | static uint128_t mul_64_64(u64 left, u64 right) {
uint128_t result;
#if defined(CONFIG_ARCH_SUPPORTS_INT128)
unsigned __int128 m = (unsigned __int128)left * right;
result.m_low = m;
result.m_high = m >> 64;
#else
u64 a0 = left & 0xffffffffull;
u64 a1 = left >> 32;
u64 b0 = right & 0xffffffffull;
u64 b1... | [
1,
0
] |
Linux Kernel | crypto/ecc.c | static void vli_umult(u64 *result, const u64 *left, u32 right,
unsigned int ndigits) {
uint128_t r01 = {0};
unsigned int k;
for (k = 0; k < ndigits; k++) {
uint128_t product;
product = mul_64_64(left[k], right);
r01 = add_128_128(r01, product);
result[k] = r01.m_low;
r... | [
1,
0
] |
Linux Kernel | crypto/ecc.c | static void vli_mod_sub(u64 *result, const u64 *left, const u64 *right,
const u64 *mod, unsigned int ndigits) {
u64 borrow = vli_sub(result, left, right, ndigits);
if (borrow)
vli_add(result, result, mod, ndigits);
} | [
0,
0
] |
Linux Kernel | crypto/ecc.c | static void vli_mmod_slow(u64 *result, u64 *product, const u64 *mod,
unsigned int ndigits) {
u64 mod_m[2 * ECC_MAX_DIGITS];
u64 tmp[2 * ECC_MAX_DIGITS];
u64 *v[2] = {tmp, product};
u64 carry = 0;
unsigned int i;
int shift = (ndigits * 2 * 64) - vli_num_bits(mod, ndigits);
int wo... | [
1,
0
] |
Linux Kernel | crypto/ecc.c | static void vli_mmod_barrett(u64 *result, u64 *product, const u64 *mod,
unsigned int ndigits) {
u64 q[ECC_MAX_DIGITS * 2];
u64 r[ECC_MAX_DIGITS * 2];
const u64 *mu = mod + ndigits;
vli_mult(q, product + ndigits, mu, ndigits);
if (mu[ndigits])
vli_add(q + ndigits, q + ndigits,... | [
1,
0
] |
Linux Kernel | crypto/ecc.c | static bool vli_mmod_fast(u64 *result, u64 *product,
const struct ecc_curve *curve) {
u64 tmp[2 * ECC_MAX_DIGITS];
const u64 *curve_prime = curve->p;
const unsigned int ndigits = curve->g.ndigits;
if (strncmp(curve->name, "nist_", 5) != 0) {
/* Try to handle Pseudo-Marsenne primes... | [
1,
0
] |
Linux Kernel | crypto/ecc.c | static void vli_mod_mult_fast(u64 *result, const u64 *left, const u64 *right,
const struct ecc_curve *curve) {
u64 product[2 * ECC_MAX_DIGITS];
vli_mult(product, left, right, curve->g.ndigits);
vli_mmod_fast(result, product, curve);
} | [
0,
0
] |
Linux Kernel | crypto/ecc.c | static void xycz_add(u64 *x1, u64 *y1, u64 *x2, u64 *y2,
const struct ecc_curve *curve) {
u64 t5[ECC_MAX_DIGITS];
const u64 *curve_prime = curve->p;
const unsigned int ndigits = curve->g.ndigits;
/* t5 = x2 - x1 */
vli_mod_sub(t5, x2, x1, curve_prime, ndigits);
/* t5 = (x2 - x1)^2 = A... | [
1,
0
] |
Linux Kernel | crypto/ecc.c | static int __ecc_is_key_valid(const struct ecc_curve *curve,
const u64 *private_key, unsigned int ndigits) {
u64 one[ECC_MAX_DIGITS] = {
1,
};
u64 res[ECC_MAX_DIGITS];
if (!private_key)
return -EINVAL;
if (curve->g.ndigits != ndigits)
return -EINVAL;
if (vli_cm... | [
1,
0
] |
Linux Kernel | crypto/ecc.c |
int ecc_is_key_valid(unsigned int curve_id, unsigned int ndigits,
const u64 *private_key, unsigned int private_key_len) {
int nbytes;
const struct ecc_curve *curve = ecc_get_curve(curve_id);
nbytes = ndigits << ECC_DIGITS_TO_BYTES_SHIFT;
if (private_key_len != nbytes)
return -EINVAL;... | [
0,
0
] |
Linux Kernel | crypto/ecc.c | int ecc_gen_privkey(unsigned int curve_id, unsigned int ndigits, u64 *privkey) {
const struct ecc_curve *curve = ecc_get_curve(curve_id);
u64 priv[ECC_MAX_DIGITS];
unsigned int nbytes = ndigits << ECC_DIGITS_TO_BYTES_SHIFT;
unsigned int nbits = vli_num_bits(curve->n, ndigits);
int err;
if (nbits < 160 || n... | [
1,
0
] |
Linux Kernel | crypto/ecc.c | int ecc_is_pubkey_valid_partial(const struct ecc_curve *curve,
struct ecc_point *pk) {
u64 yy[ECC_MAX_DIGITS], xxx[ECC_MAX_DIGITS], w[ECC_MAX_DIGITS];
if (WARN_ON(pk->ndigits != curve->g.ndigits))
return -EINVAL;
if (ecc_point_is_zero(pk))
return -EINVAL;
/* Check 2: V... | [
1,
0
] |
Linux Kernel | crypto/ecc.c | int ecc_is_pubkey_valid_full(const struct ecc_curve *curve,
struct ecc_point *pk) {
struct ecc_point *nQ;
int ret = ecc_is_pubkey_valid_partial(curve, pk);
if (ret)
return ret;
/* Check 4: Verify that nQ is the zero point. */
nQ = ecc_alloc_point(pk->ndigits);
if (!nQ)
... | [
0,
0
] |
Linux Kernel | crypto/ecdh.c |
static inline struct ecdh_ctx *ecdh_get_ctx(struct crypto_kpp *tfm) {
return kpp_tfm_ctx(tfm);
} | [
0,
0
] |
Linux Kernel | crypto/ecdh.c | static unsigned int ecdh_max_size(struct crypto_kpp *tfm) {
struct ecdh_ctx *ctx = ecdh_get_ctx(tfm);
return ctx->ndigits << (ECC_DIGITS_TO_BYTES_SHIFT + 1);
} | [
0,
0
] |
Linux Kernel | crypto/ecdh_helper.c |
static inline const u8 *ecdh_unpack_data(void *dst, const void *src,
size_t sz) {
memcpy(dst, src, sz);
return src + sz;
} | [
1,
0
] |
Linux Kernel | crypto/ecdsa.c |
static int ecdsa_ecc_ctx_reset(struct ecc_ctx *ctx) {
unsigned int curve_id = ctx->curve_id;
int ret;
ecdsa_ecc_ctx_deinit(ctx);
ret = ecdsa_ecc_ctx_init(ctx, curve_id);
if (ret == 0)
ctx->pub_key = ECC_POINT_INIT(ctx->x, ctx->y, ctx->curve->g.ndigits);
return ret;
} | [
1,
0
] |
Linux Kernel | crypto/ecdsa.c | static int ecdsa_set_pub_key(struct crypto_akcipher *tfm, const void *key,
unsigned int keylen) {
struct ecc_ctx *ctx = akcipher_tfm_ctx(tfm);
const unsigned char *d = key;
const u64 *digits = (const u64 *)&d[1];
unsigned int ndigits;
int ret;
ret = ecdsa_ecc_ctx_reset(ctx);
... | [
1,
0
] |
Linux Kernel | crypto/ecdsa.c |
static void ecdsa_exit_tfm(struct crypto_akcipher *tfm) {
struct ecc_ctx *ctx = akcipher_tfm_ctx(tfm);
ecdsa_ecc_ctx_deinit(ctx);
} | [
0,
0
] |
Linux Kernel | crypto/ecdsa.c |
static int ecdsa_nist_p384_init_tfm(struct crypto_akcipher *tfm) {
struct ecc_ctx *ctx = akcipher_tfm_ctx(tfm);
return ecdsa_ecc_ctx_init(ctx, ECC_CURVE_NIST_P384);
} | [
0,
0
] |
Linux Kernel | crypto/ecdsa.c |
static int ecdsa_nist_p192_init_tfm(struct crypto_akcipher *tfm) {
struct ecc_ctx *ctx = akcipher_tfm_ctx(tfm);
return ecdsa_ecc_ctx_init(ctx, ECC_CURVE_NIST_P192);
} | [
0,
0
] |
Linux Kernel | crypto/ecdsa.c | static int __init ecdsa_init(void) {
int ret;
ret = crypto_register_akcipher(&ecdsa_nist_p192);
ecdsa_nist_p192_registered = ret == 0;
ret = crypto_register_akcipher(&ecdsa_nist_p256);
if (ret)
goto nist_p256_error;
ret = crypto_register_akcipher(&ecdsa_nist_p384);
if (ret)
goto nist_p384_error... | [
0,
0
] |
Linux Kernel | crypto/echainiv.c |
static int echainiv_aead_create(struct crypto_template *tmpl,
struct rtattr **tb) {
struct aead_instance *inst;
int err;
inst = aead_geniv_alloc(tmpl, tb);
if (IS_ERR(inst))
return PTR_ERR(inst);
err = -EINVAL;
if (inst->alg.ivsize & (sizeof(u64) - 1) || !inst->alg.iv... | [
1,
0
] |
Linux Kernel | crypto/ecrdsa.c | static const struct ecc_curve *get_curve_by_oid(enum OID oid) {
switch (oid) {
case OID_gostCPSignA:
case OID_gostTC26Sign256B:
return &gost_cp256a;
case OID_gostCPSignB:
case OID_gostTC26Sign256C:
return &gost_cp256b;
case OID_gostCPSignC:
case OID_gostTC26Sign256D:
return &gost_cp256c;
cas... | [
0,
0
] |
Linux Kernel | crypto/essiv.c |
static int essiv_skcipher_setkey(struct crypto_skcipher *tfm, const u8 *key,
unsigned int keylen) {
struct essiv_tfm_ctx *tctx = crypto_skcipher_ctx(tfm);
u8 salt[HASH_MAX_DIGESTSIZE];
int err;
crypto_skcipher_clear_flags(tctx->u.skcipher, CRYPTO_TFM_REQ_MASK);
crypto_skciph... | [
0,
0
] |
Linux Kernel | crypto/essiv.c |
static int essiv_aead_setkey(struct crypto_aead *tfm, const u8 *key,
unsigned int keylen) {
struct essiv_tfm_ctx *tctx = crypto_aead_ctx(tfm);
SHASH_DESC_ON_STACK(desc, tctx->hash);
struct crypto_authenc_keys keys;
u8 salt[HASH_MAX_DIGESTSIZE];
int err;
crypto_aead_clear_flags... | [
0,
0
] |
Linux Kernel | crypto/essiv.c |
static int essiv_init_tfm(struct essiv_instance_ctx *ictx,
struct essiv_tfm_ctx *tctx) {
struct crypto_cipher *essiv_cipher;
struct crypto_shash *hash;
int err;
essiv_cipher = crypto_alloc_cipher(ictx->essiv_cipher_name, 0, 0);
if (IS_ERR(essiv_cipher))
return PTR_ERR(essiv_cip... | [
0,
0
] |
Linux Kernel | crypto/essiv.c |
static int essiv_skcipher_init_tfm(struct crypto_skcipher *tfm) {
struct skcipher_instance *inst = skcipher_alg_instance(tfm);
struct essiv_instance_ctx *ictx = skcipher_instance_ctx(inst);
struct essiv_tfm_ctx *tctx = crypto_skcipher_ctx(tfm);
struct crypto_skcipher *skcipher;
int err;
skcipher = crypto_... | [
1,
0
] |
Linux Kernel | crypto/essiv.c |
static void essiv_skcipher_free_instance(struct skcipher_instance *inst) {
struct essiv_instance_ctx *ictx = skcipher_instance_ctx(inst);
crypto_drop_skcipher(&ictx->u.skcipher_spawn);
kfree(inst);
} | [
0,
0
] |
Linux Kernel | crypto/essiv.c |
static void essiv_aead_free_instance(struct aead_instance *inst) {
struct essiv_instance_ctx *ictx = aead_instance_ctx(inst);
crypto_drop_aead(&ictx->u.aead_spawn);
kfree(inst);
} | [
0,
0
] |
Linux Kernel | crypto/gcm.c |
static int crypto_gcm_setauthsize(struct crypto_aead *tfm,
unsigned int authsize) {
return crypto_gcm_check_authsize(authsize);
} | [
0,
0
] |
Linux Kernel | crypto/gcm.c |
static void gcm_hash_crypt_remain_done(struct crypto_async_request *areq,
int err) {
struct aead_request *req = areq->data;
if (err)
goto out;
err = gcm_hash_crypt_remain_continue(req, 0);
if (err == -EINPROGRESS)
return;
out:
aead_request_complete(req, err);... | [
0,
0
] |
Linux Kernel | crypto/gcm.c |
static int gcm_hash_crypt_continue(struct aead_request *req, u32 flags) {
struct crypto_gcm_req_priv_ctx *pctx = crypto_gcm_reqctx(req);
struct crypto_gcm_ghash_ctx *gctx = &pctx->ghash_ctx;
unsigned int remain;
remain = gcm_remain(gctx->cryptlen);
if (remain)
return gcm_hash_remain(req, remain, gcm_has... | [
0,
0
] |
Linux Kernel | crypto/gcm.c |
static void gcm_hash_crypt_done(struct crypto_async_request *areq, int err) {
struct aead_request *req = areq->data;
if (err)
goto out;
err = gcm_hash_crypt_continue(req, 0);
if (err == -EINPROGRESS)
return;
out:
aead_request_complete(req, err);
} | [
0,
0
] |
Linux Kernel | crypto/gcm.c |
static void gcm_hash_assoc_remain_done(struct crypto_async_request *areq,
int err) {
struct aead_request *req = areq->data;
if (err)
goto out;
err = gcm_hash_assoc_remain_continue(req, 0);
if (err == -EINPROGRESS)
return;
out:
aead_request_complete(req, err);... | [
0,
0
] |
Linux Kernel | crypto/gcm.c |
static int crypto_gcm_encrypt(struct aead_request *req) {
struct crypto_gcm_req_priv_ctx *pctx = crypto_gcm_reqctx(req);
struct skcipher_request *skreq = &pctx->u.skreq;
u32 flags = aead_request_flags(req);
crypto_gcm_init_common(req);
crypto_gcm_init_crypt(req, req->cryptlen);
skcipher_request_set_callba... | [
0,
0
] |
Linux Kernel | crypto/gcm.c |
static int gcm_dec_hash_continue(struct aead_request *req, u32 flags) {
struct crypto_gcm_req_priv_ctx *pctx = crypto_gcm_reqctx(req);
struct skcipher_request *skreq = &pctx->u.skreq;
struct crypto_gcm_ghash_ctx *gctx = &pctx->ghash_ctx;
crypto_gcm_init_crypt(req, gctx->cryptlen);
skcipher_request_set_callb... | [
0,
0
] |
Linux Kernel | crypto/gcm.c |
static void crypto_gcm_free(struct aead_instance *inst) {
struct gcm_instance_ctx *ctx = aead_instance_ctx(inst);
crypto_drop_skcipher(&ctx->ctr);
crypto_drop_ahash(&ctx->ghash);
kfree(inst);
} | [
0,
0
] |
Linux Kernel | crypto/gcm.c |
static int crypto_rfc4106_setkey(struct crypto_aead *parent, const u8 *key,
unsigned int keylen) {
struct crypto_rfc4106_ctx *ctx = crypto_aead_ctx(parent);
struct crypto_aead *child = ctx->child;
if (keylen < 4)
return -EINVAL;
keylen -= 4;
memcpy(ctx->nonce, key + key... | [
1,
0
] |
Linux Kernel | crypto/gcm.c |
static int crypto_rfc4106_setauthsize(struct crypto_aead *parent,
unsigned int authsize) {
struct crypto_rfc4106_ctx *ctx = crypto_aead_ctx(parent);
int err;
err = crypto_rfc4106_check_authsize(authsize);
if (err)
return err;
return crypto_aead_setauthsize(ctx->chi... | [
0,
0
] |
Linux Kernel | crypto/gcm.c |
static struct aead_request *crypto_rfc4106_crypt(struct aead_request *req) {
struct crypto_rfc4106_req_ctx *rctx = aead_request_ctx(req);
struct crypto_aead *aead = crypto_aead_reqtfm(req);
struct crypto_rfc4106_ctx *ctx = crypto_aead_ctx(aead);
struct aead_request *subreq = &rctx->subreq;
struct crypto_aead... | [
1,
0
] |
Linux Kernel | crypto/gcm.c |
static int crypto_rfc4106_init_tfm(struct crypto_aead *tfm) {
struct aead_instance *inst = aead_alg_instance(tfm);
struct crypto_aead_spawn *spawn = aead_instance_ctx(inst);
struct crypto_rfc4106_ctx *ctx = crypto_aead_ctx(tfm);
struct crypto_aead *aead;
unsigned long align;
aead = crypto_spawn_aead(spawn... | [
1,
0
] |
Linux Kernel | crypto/gcm.c |
static int crypto_rfc4543_setkey(struct crypto_aead *parent, const u8 *key,
unsigned int keylen) {
struct crypto_rfc4543_ctx *ctx = crypto_aead_ctx(parent);
struct crypto_aead *child = ctx->child;
if (keylen < 4)
return -EINVAL;
keylen -= 4;
memcpy(ctx->nonce, key + key... | [
1,
0
] |
Linux Kernel | crypto/gcm.c |
static int crypto_rfc4543_copy_src_to_dst(struct aead_request *req, bool enc) {
struct crypto_aead *aead = crypto_aead_reqtfm(req);
struct crypto_rfc4543_ctx *ctx = crypto_aead_ctx(aead);
unsigned int authsize = crypto_aead_authsize(aead);
unsigned int nbytes = req->assoclen + req->cryptlen - (enc ? 0 : authsi... | [
1,
0
] |
Linux Kernel | crypto/gcm.c |
static int crypto_rfc4543_encrypt(struct aead_request *req) {
return crypto_ipsec_check_assoclen(req->assoclen)
?: crypto_rfc4543_crypt(req, true);
} | [
0,
0
] |
Linux Kernel | crypto/geniv.c |
static int aead_geniv_setkey(struct crypto_aead *tfm, const u8 *key,
unsigned int keylen) {
struct aead_geniv_ctx *ctx = crypto_aead_ctx(tfm);
return crypto_aead_setkey(ctx->child, key, keylen);
} | [
0,
0
] |
Linux Kernel | crypto/geniv.c |
static void aead_geniv_free(struct aead_instance *inst) {
crypto_drop_aead(aead_instance_ctx(inst));
kfree(inst);
} | [
0,
0
] |
Linux Kernel | crypto/geniv.c |
int aead_init_geniv(struct crypto_aead *aead) {
struct aead_geniv_ctx *ctx = crypto_aead_ctx(aead);
struct aead_instance *inst = aead_alg_instance(aead);
struct crypto_aead *child;
int err;
spin_lock_init(&ctx->lock);
err = crypto_get_default_rng();
if (err)
goto out;
err = crypto_rng_get_bytes(... | [
1,
0
] |
Linux Kernel | crypto/geniv.c |
void aead_exit_geniv(struct crypto_aead *tfm) {
struct aead_geniv_ctx *ctx = crypto_aead_ctx(tfm);
crypto_free_aead(ctx->child);
crypto_put_default_null_skcipher();
} | [
0,
0
] |
Linux Kernel | crypto/gf128mul.c |
void gf128mul_lle(be128 *r, const be128 *b) {
be128 p[8];
int i;
p[0] = *r;
for (i = 0; i < 7; ++i)
gf128mul_x_lle(&p[i + 1], &p[i]);
memset(r, 0, sizeof(*r));
for (i = 0;;) {
u8 ch = ((u8 *)b)[15 - i];
if (ch & 0x80)
be128_xor(r, r, &p[0]);
if (ch & 0x40)
be128_xor(r, r, &p[... | [
1,
0
] |
Linux Kernel | crypto/gf128mul.c | struct gf128mul_64k *gf128mul_init_64k_bbe(const be128 *g) {
struct gf128mul_64k *t;
int i, j, k;
t = kzalloc(sizeof(*t), GFP_KERNEL);
if (!t)
goto out;
for (i = 0; i < 16; i++) {
t->t[i] = kzalloc(sizeof(*t->t[i]), GFP_KERNEL);
if (!t->t[i]) {
gf128mul_free_64k(t);
t = NULL;
g... | [
1,
0
] |
Linux Kernel | crypto/gf128mul.c | struct gf128mul_4k *gf128mul_init_4k_lle(const be128 *g) {
struct gf128mul_4k *t;
int j, k;
t = kzalloc(sizeof(*t), GFP_KERNEL);
if (!t)
goto out;
t->t[128] = *g;
for (j = 64; j > 0; j >>= 1)
gf128mul_x_lle(&t->t[j], &t->t[j + j]);
for (j = 2; j < 256; j += j)
for (k = 1; k < j; ++k)
... | [
1,
0
] |
Linux Kernel | crypto/gf128mul.c |
void gf128mul_4k_lle(be128 *a, const struct gf128mul_4k *t) {
u8 *ap = (u8 *)a;
be128 r[1];
int i = 15;
*r = t->t[ap[15]];
while (i--) {
gf128mul_x8_lle(r);
be128_xor(r, r, &t->t[ap[i]]);
}
*a = *r;
} | [
0,
0
] |
Linux Kernel | crypto/gf128mul.c |
void gf128mul_4k_bbe(be128 *a, const struct gf128mul_4k *t) {
u8 *ap = (u8 *)a;
be128 r[1];
int i = 0;
*r = t->t[ap[0]];
while (++i < 16) {
gf128mul_x8_bbe(r);
be128_xor(r, r, &t->t[ap[i]]);
}
*a = *r;
} | [
0,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.