Projectname
large_stringclasses
15 values
Filepath
large_stringlengths
4
106
⌀
Function
large_stringlengths
11
3.45k
Label
list
Linux Kernel
crypto/scompress.c
int crypto_register_scomp(struct scomp_alg *alg) { struct crypto_alg *base = &alg->base; base->cra_type = &crypto_scomp_type; base->cra_flags &= ~CRYPTO_ALG_TYPE_MASK; base->cra_flags |= CRYPTO_ALG_TYPE_SCOMPRESS; return crypto_register_alg(base); }
[ 0, 0 ]
Linux Kernel
crypto/seed.c
static void seed_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) { const struct seed_ctx *ctx = crypto_tfm_ctx(tfm); const __be32 *src = (const __be32 *)in; __be32 *dst = (__be32 *)out; u32 x1, x2, x3, x4, t0, t1; const u32 *ks = ctx->keysched; x1 = be32_to_cpu(src[0]); x2 = be32_to_cpu(src[1]); ...
[ 0, 0 ]
Linux Kernel
crypto/seed.c
static int __init seed_init(void) { return crypto_register_alg(&seed_alg); }
[ 0, 0 ]
Linux Kernel
crypto/seqiv.c
static int seqiv_aead_encrypt(struct aead_request *req) { struct crypto_aead *geniv = crypto_aead_reqtfm(req); struct aead_geniv_ctx *ctx = crypto_aead_ctx(geniv); struct aead_request *subreq = aead_request_ctx(req); crypto_completion_t compl; void *data; u8 *info; unsigned int ivsize = 8; int err; ...
[ 1, 0 ]
Linux Kernel
crypto/seqiv.c
static int seqiv_aead_decrypt(struct aead_request *req) { struct crypto_aead *geniv = crypto_aead_reqtfm(req); struct aead_geniv_ctx *ctx = crypto_aead_ctx(geniv); struct aead_request *subreq = aead_request_ctx(req); crypto_completion_t compl; void *data; unsigned int ivsize = 8; if (req->cryptlen < ivs...
[ 1, 0 ]
Linux Kernel
crypto/seqiv.c
static void __exit seqiv_module_exit(void) { crypto_unregister_template(&seqiv_tmpl); }
[ 0, 0 ]
Linux Kernel
crypto/serpent_generic.c
int serpent_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen) { return __serpent_setkey(crypto_tfm_ctx(tfm), key, keylen); }
[ 0, 0 ]
Linux Kernel
crypto/serpent_generic.c
static void serpent_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) { struct serpent_ctx *ctx = crypto_tfm_ctx(tfm); __serpent_decrypt(ctx, dst, src); }
[ 0, 0 ]
Linux Kernel
crypto/serpent_generic.c
static int __init serpent_mod_init(void) { return crypto_register_alg(&srp_alg); }
[ 0, 0 ]
Linux Kernel
crypto/sha1_generic.c
static void sha1_generic_block_fn(struct sha1_state *sst, u8 const *src, int blocks) { u32 temp[SHA1_WORKSPACE_WORDS]; while (blocks--) { sha1_transform(sst->state, src, temp); src += SHA1_BLOCK_SIZE; } memzero_explicit(temp, sizeof(temp)); }
[ 1, 0 ]
Linux Kernel
crypto/sha1_generic.c
static int sha1_final(struct shash_desc *desc, u8 *out) { sha1_base_do_finalize(desc, sha1_generic_block_fn); return sha1_base_finish(desc, out); }
[ 0, 0 ]
Linux Kernel
crypto/sha1_generic.c
int crypto_sha1_finup(struct shash_desc *desc, const u8 *data, unsigned int len, u8 *out) { sha1_base_do_update(desc, data, len, sha1_generic_block_fn); return sha1_final(desc, out); }
[ 0, 0 ]
Linux Kernel
crypto/sha256_generic.c
int crypto_sha256_finup(struct shash_desc *desc, const u8 *data, unsigned int len, u8 *hash) { sha256_update(shash_desc_ctx(desc), data, len); return crypto_sha256_final(desc, hash); }
[ 0, 0 ]
Linux Kernel
crypto/sha256_generic.c
static void __exit sha256_generic_mod_fini(void) { crypto_unregister_shashes(sha256_algs, ARRAY_SIZE(sha256_algs)); }
[ 0, 0 ]
Linux Kernel
crypto/sha512_generic.c
static inline u64 Ch(u64 x, u64 y, u64 z) { return z ^ (x & (y ^ z)); }
[ 0, 0 ]
Linux Kernel
crypto/sha512_generic.c
int crypto_sha512_finup(struct shash_desc *desc, const u8 *data, unsigned int len, u8 *hash) { sha512_base_do_update(desc, data, len, sha512_generic_block_fn); return sha512_final(desc, hash); }
[ 0, 0 ]
Linux Kernel
crypto/sha512_generic.c
static int __init sha512_generic_mod_init(void) { return crypto_register_shashes(sha512_algs, ARRAY_SIZE(sha512_algs)); }
[ 0, 0 ]
Linux Kernel
crypto/sha512_generic.c
static void __exit sha512_generic_mod_fini(void) { crypto_unregister_shashes(sha512_algs, ARRAY_SIZE(sha512_algs)); }
[ 0, 0 ]
Linux Kernel
crypto/shash.c
static int shash_no_setkey(struct crypto_shash *tfm, const u8 *key, unsigned int keylen) { return -ENOSYS; }
[ 0, 0 ]
Linux Kernel
crypto/shash.c
static int shash_setkey_unaligned(struct crypto_shash *tfm, const u8 *key, unsigned int keylen) { struct shash_alg *shash = crypto_shash_alg(tfm); unsigned long alignmask = crypto_shash_alignmask(tfm); unsigned long absize; u8 *buffer, *alignbuffer; int err; absize = keyl...
[ 1, 0 ]
Linux Kernel
crypto/shash.c
int crypto_shash_update(struct shash_desc *desc, const u8 *data, unsigned int len) { struct crypto_shash *tfm = desc->tfm; struct shash_alg *shash = crypto_shash_alg(tfm); unsigned long alignmask = crypto_shash_alignmask(tfm); if ((unsigned long)data & alignmask) return shash_updat...
[ 1, 0 ]
Linux Kernel
crypto/shash.c
int crypto_shash_final(struct shash_desc *desc, u8 *out) { struct crypto_shash *tfm = desc->tfm; struct shash_alg *shash = crypto_shash_alg(tfm); unsigned long alignmask = crypto_shash_alignmask(tfm); if ((unsigned long)out & alignmask) return shash_final_unaligned(desc, out); return shash->final(desc,...
[ 1, 0 ]
Linux Kernel
crypto/shash.c
static int shash_digest_unaligned(struct shash_desc *desc, const u8 *data, unsigned int len, u8 *out) { return crypto_shash_init(desc) ?: crypto_shash_finup(desc, data, len, out); }
[ 0, 0 ]
Linux Kernel
crypto/shash.c
static int shash_async_final(struct ahash_request *req) { return crypto_shash_final(ahash_request_ctx(req), req->result); }
[ 0, 0 ]
Linux Kernel
crypto/shash.c
int shash_ahash_finup(struct ahash_request *req, struct shash_desc *desc) { struct crypto_hash_walk walk; int nbytes; nbytes = crypto_hash_walk_first(req, &walk); if (!nbytes) return crypto_shash_final(desc, req->result); do { nbytes = crypto_hash_walk_last(&walk) ? crypto_shash_fi...
[ 0, 0 ]
Linux Kernel
crypto/shash.c
static int shash_async_export(struct ahash_request *req, void *out) { return crypto_shash_export(ahash_request_ctx(req), out); }
[ 0, 0 ]
Linux Kernel
crypto/shash.c
int crypto_init_shash_ops_async(struct crypto_tfm *tfm) { struct crypto_alg *calg = tfm->__crt_alg; struct shash_alg *alg = __crypto_shash_alg(calg); struct crypto_ahash *crt = __crypto_ahash_cast(tfm); struct crypto_shash **ctx = crypto_tfm_ctx(tfm); struct crypto_shash *shash; if (!crypto_mod_get(calg))...
[ 1, 0 ]
Linux Kernel
crypto/shash.c
static int crypto_shash_init_tfm(struct crypto_tfm *tfm) { struct crypto_shash *hash = __crypto_shash_cast(tfm); struct shash_alg *alg = crypto_shash_alg(hash); int err; hash->descsize = alg->descsize; shash_set_needkey(hash, alg); if (alg->exit_tfm) tfm->exit = crypto_shash_exit_tfm; if (!alg->in...
[ 0, 0 ]
Linux Kernel
crypto/shash.c
static void crypto_shash_free_instance(struct crypto_instance *inst) { struct shash_instance *shash = shash_instance(inst); shash->free(shash); }
[ 0, 0 ]
Linux Kernel
crypto/shash.c
int crypto_register_shashes(struct shash_alg *algs, int count) { int i, ret; for (i = 0; i < count; i++) { ret = crypto_register_shash(&algs[i]); if (ret) goto err; } return 0; err: for (--i; i >= 0; --i) crypto_unregister_shash(&algs[i]); return ret; }
[ 0, 0 ]
Linux Kernel
crypto/simd.c
static void simd_skcipher_exit(struct crypto_skcipher *tfm) { struct simd_skcipher_ctx *ctx = crypto_skcipher_ctx(tfm); cryptd_free_skcipher(ctx->cryptd_tfm); }
[ 0, 0 ]
Linux Kernel
crypto/simd.c
void simd_unregister_skciphers(struct skcipher_alg *algs, int count, struct simd_skcipher_alg **simd_algs) { int i; crypto_unregister_skciphers(algs, count); for (i = 0; i < count; i++) { if (simd_algs[i]) { simd_skcipher_free(simd_algs[i]); simd_algs[i] = NULL; ...
[ 0, 0 ]
Linux Kernel
crypto/simd.c
static int simd_aead_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int key_len) { struct simd_aead_ctx *ctx = crypto_aead_ctx(tfm); struct crypto_aead *child = &ctx->cryptd_tfm->base; crypto_aead_clear_flags(child, CRYPTO_TFM_REQ_MASK); crypto_aead_set_flags(child, ...
[ 0, 0 ]
Linux Kernel
crypto/simd.c
struct simd_aead_alg *simd_aead_create(const char *algname, const char *basename) { char drvname[CRYPTO_MAX_ALG_NAME]; if (snprintf(drvname, CRYPTO_MAX_ALG_NAME, "simd-%s", basename) >= CRYPTO_MAX_ALG_NAME) return ERR_PTR(-ENAMETOOLONG); return simd_aead_create_...
[ 1, 0 ]
Linux Kernel
crypto/simd.c
void simd_unregister_aeads(struct aead_alg *algs, int count, struct simd_aead_alg **simd_algs) { int i; crypto_unregister_aeads(algs, count); for (i = 0; i < count; i++) { if (simd_algs[i]) { simd_aead_free(simd_algs[i]); simd_algs[i] = NULL; } } }
[ 0, 0 ]
Linux Kernel
crypto/skcipher.c
static inline void skcipher_unmap(struct scatter_walk *walk, void *vaddr) { if (PageHighMem(scatterwalk_page(walk))) kunmap_atomic(vaddr); }
[ 0, 0 ]
Linux Kernel
crypto/skcipher.c
static inline void skcipher_map_src(struct skcipher_walk *walk) { walk->src.virt.addr = skcipher_map(&walk->in); }
[ 0, 0 ]
Linux Kernel
crypto/skcipher.c
static int skcipher_done_slow(struct skcipher_walk *walk, unsigned int bsize) { u8 *addr; addr = (u8 *)ALIGN((unsigned long)walk->buffer, walk->alignmask + 1); addr = skcipher_get_spot(addr, bsize); scatterwalk_copychunks(addr, &walk->out, bsize, (walk->flags & SKCIPHER_WALK_PHYS) ? 2...
[ 0, 0 ]
Linux Kernel
crypto/skcipher.c
void skcipher_walk_complete(struct skcipher_walk *walk, int err) { struct skcipher_walk_buffer *p, *tmp; list_for_each_entry_safe(p, tmp, &walk->buffers, entry) { u8 *data; if (err) goto done; data = p->data; if (!data) { data = PTR_ALIGN(&p->buffer[0], walk->alignmask + 1); da...
[ 1, 0 ]
Linux Kernel
crypto/skcipher.c
static void skcipher_queue_write(struct skcipher_walk *walk, struct skcipher_walk_buffer *p) { p->dst = walk->out; list_add_tail(&p->entry, &walk->buffers); }
[ 0, 0 ]
Linux Kernel
crypto/skcipher.c
int skcipher_walk_virt(struct skcipher_walk *walk, struct skcipher_request *req, bool atomic) { int err; might_sleep_if(req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP); walk->flags &= ~SKCIPHER_WALK_PHYS; err = skcipher_walk_skcipher(walk, req); walk->flags &= atomic ? ~SKCIPHER_WALK_S...
[ 0, 0 ]
Linux Kernel
crypto/skcipher.c
static int skcipher_walk_aead_common(struct skcipher_walk *walk, struct aead_request *req, bool atomic) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); int err; walk->nbytes = 0; walk->iv = req->iv; walk->oiv = req->iv; if (unlikely(!walk->total)) return 0; ...
[ 0, 0 ]
Linux Kernel
crypto/skcipher.c
int skcipher_walk_aead_encrypt(struct skcipher_walk *walk, struct aead_request *req, bool atomic) { walk->total = req->cryptlen; return skcipher_walk_aead_common(walk, req, atomic); }
[ 0, 0 ]
Linux Kernel
crypto/skcipher.c
static void skcipher_set_needkey(struct crypto_skcipher *tfm) { if (crypto_skcipher_max_keysize(tfm) != 0) crypto_skcipher_set_flags(tfm, CRYPTO_TFM_NEED_KEY); }
[ 0, 0 ]
Linux Kernel
crypto/skcipher.c
int crypto_skcipher_setkey(struct crypto_skcipher *tfm, const u8 *key, unsigned int keylen) { struct skcipher_alg *cipher = crypto_skcipher_alg(tfm); unsigned long alignmask = crypto_skcipher_alignmask(tfm); int err; if (keylen < cipher->min_keysize || keylen > cipher->max_keysize) ...
[ 1, 0 ]
Linux Kernel
crypto/skcipher.c
int crypto_grab_skcipher(struct crypto_skcipher_spawn *spawn, struct crypto_instance *inst, const char *name, u32 type, u32 mask) { spawn->base.frontend = &crypto_skcipher_type; return crypto_grab_spawn(&spawn->base, inst, name, type, mask); }
[ 0, 0 ]
Linux Kernel
crypto/skcipher.c
void crypto_unregister_skcipher(struct skcipher_alg *alg) { crypto_unregister_alg(&alg->base); }
[ 0, 0 ]
Linux Kernel
crypto/skcipher.c
int crypto_register_skciphers(struct skcipher_alg *algs, int count) { int i, ret; for (i = 0; i < count; i++) { ret = crypto_register_skcipher(&algs[i]); if (ret) goto err; } return 0; err: for (--i; i >= 0; --i) crypto_unregister_skcipher(&algs[i]); return ret; }
[ 0, 0 ]
Linux Kernel
crypto/skcipher.c
static void skcipher_exit_tfm_simple(struct crypto_skcipher *tfm) { struct skcipher_ctx_simple *ctx = crypto_skcipher_ctx(tfm); crypto_free_cipher(ctx->cipher); }
[ 0, 0 ]
Linux Kernel
crypto/sm2.c
int sm2_get_signature_r(void *context, size_t hdrlen, unsigned char tag, const void *value, size_t vlen) { struct sm2_signature_ctx *sig = context; if (!value || !vlen) return -EINVAL; sig->sig_r = mpi_read_raw_data(value, vlen); if (!sig->sig_r) return -ENOMEM; return 0; }
[ 0, 0 ]
Linux Kernel
crypto/sm2.c
static int sm2_init_tfm(struct crypto_akcipher *tfm) { struct mpi_ec_ctx *ec = akcipher_tfm_ctx(tfm); return sm2_ec_ctx_init(ec); }
[ 0, 0 ]
Linux Kernel
crypto/sm2.c
static int __init sm2_init(void) { return crypto_register_akcipher(&sm2); }
[ 0, 0 ]
Linux Kernel
crypto/sm3.c
static inline void sm3_block(struct sm3_state *sctx, u8 const *data, int blocks, u32 W[16]) { while (blocks--) { sm3_transform(sctx, data, W); data += SM3_BLOCK_SIZE; } }
[ 0, 0 ]
Linux Kernel
crypto/sm3.c
void sm3_update(struct sm3_state *sctx, const u8 *data, unsigned int len) { unsigned int partial = sctx->count % SM3_BLOCK_SIZE; u32 W[16]; sctx->count += len; if ((partial + len) >= SM3_BLOCK_SIZE) { int blocks; if (partial) { int p = SM3_BLOCK_SIZE - partial; memcpy(sctx->buffer + par...
[ 1, 0 ]
Linux Kernel
crypto/sm4.c
static inline u32 sm4_t_non_lin_sub(u32 x) { u32 out; out = (u32)sbox[x & 0xff]; out |= (u32)sbox[(x >> 8) & 0xff] << 8; out |= (u32)sbox[(x >> 16) & 0xff] << 16; out |= (u32)sbox[(x >> 24) & 0xff] << 24; return out; }
[ 0, 0 ]
Linux Kernel
crypto/sm4.c
static inline u32 sm4_key_sub(u32 x) { return sm4_key_lin_sub(sm4_t_non_lin_sub(x)); }
[ 0, 0 ]
Linux Kernel
crypto/sm4.c
static inline u32 sm4_enc_sub(u32 x) { return sm4_enc_lin_sub(sm4_t_non_lin_sub(x)); }
[ 0, 0 ]
Linux Kernel
crypto/streebog_generic.c
static void streebog_round(int i, struct streebog_uint512 *Ki, struct streebog_uint512 *data) { streebog_xlps(Ki, &C[i], Ki); streebog_xlps(Ki, data, data); }
[ 0, 0 ]
Linux Kernel
crypto/streebog_generic.c
static void streebog_add512(const struct streebog_uint512 *x, const struct streebog_uint512 *y, struct streebog_uint512 *r) { u64 carry = 0; int i; for (i = 0; i < 8; i++) { const u64 left = le64_to_cpu(x->qword[i]); u64 sum; sum = left + le64...
[ 0, 0 ]
Linux Kernel
crypto/streebog_generic.c
static void streebog_g(struct streebog_uint512 *h, const struct streebog_uint512 *N, const struct streebog_uint512 *m) { struct streebog_uint512 Ki, data; unsigned int i; streebog_xlps(h, N, &data); Ki = data; streebog_xlps(&Ki, m, &data); for (i = 0; i < 11;...
[ 0, 0 ]
Linux Kernel
crypto/streebog_generic.c
static void streebog_stage2(struct streebog_state *ctx, const u8 *data) { struct streebog_uint512 m; memcpy(&m, data, sizeof(m)); streebog_g(&ctx->h, &ctx->N, &m); streebog_add512(&ctx->N, &buffer512, &ctx->N); streebog_add512(&ctx->Sigma, &m, &ctx->Sigma); }
[ 1, 0 ]
Linux Kernel
crypto/streebog_generic.c
static void streebog_stage3(struct streebog_state *ctx) { struct streebog_uint512 buf = {{0}}; buf.qword[0] = cpu_to_le64(ctx->fillsize << 3); streebog_pad(ctx); streebog_g(&ctx->h, &ctx->N, &ctx->m); streebog_add512(&ctx->N, &buf, &ctx->N); streebog_add512(&ctx->Sigma, &ctx->m, &ctx->Sigma); streebog_...
[ 1, 0 ]
Linux Kernel
crypto/streebog_generic.c
static int __init streebog_mod_init(void) { return crypto_register_shashes(algs, ARRAY_SIZE(algs)); }
[ 0, 0 ]
Linux Kernel
crypto/tcrypt.c
static int testmgr_alloc_buf(char *buf[XBUFSIZE]) { int i; for (i = 0; i < XBUFSIZE; i++) { buf[i] = (void *)__get_free_page(GFP_KERNEL); if (!buf[i]) goto err_free_buf; } return 0; err_free_buf: while (i-- > 0) free_page((unsigned long)buf[i]); return -ENOMEM; }
[ 0, 0 ]
Linux Kernel
crypto/tcrypt.c
static void sg_init_aead(struct scatterlist *sg, char *xbuf[XBUFSIZE], unsigned int buflen, const void *assoc, unsigned int aad_size) { int np = (buflen + PAGE_SIZE - 1) / PAGE_SIZE; int k, rem; if (np > XBUFSIZE) { rem = PAGE_SIZE; np = XBUFSIZE; } el...
[ 1, 0 ]
Linux Kernel
crypto/tcrypt.c
static inline int do_one_aead_op(struct aead_request *req, int ret) { struct crypto_wait *wait = req->base.data; return crypto_wait_req(ret, wait); }
[ 0, 0 ]
Linux Kernel
crypto/tcrypt.c
static int test_mb_aead_jiffies(struct test_mb_aead_data *data, int enc, int blen, int secs, u32 num_mb) { unsigned long start, end; int bcount; int ret = 0; int *rc; rc = kcalloc(num_mb, sizeof(*rc), GFP_KERNEL); if (!rc) return -ENOMEM; for (start = jiffies, end = ...
[ 1, 0 ]
Linux Kernel
crypto/tcrypt.c
static int test_aead_cycles(struct aead_request *req, int enc, int blen) { unsigned long cycles = 0; int ret = 0; int i; for (i = 0; i < 4; i++) { if (enc) ret = do_one_aead_op(req, crypto_aead_encrypt(req)); else ret = do_one_aead_op(req, crypto_aead_decrypt(req)); if (ret) goto...
[ 1, 0 ]
Linux Kernel
crypto/tcrypt.c
static void test_hash_sg_init(struct scatterlist *sg) { int i; sg_init_table(sg, TVMEMSIZE); for (i = 0; i < TVMEMSIZE; i++) { sg_set_buf(sg + i, tvmem[i], PAGE_SIZE); memset(tvmem[i], 0xff, PAGE_SIZE); } }
[ 1, 0 ]
Linux Kernel
crypto/tcrypt.c
static void test_ahash_speed(const char *algo, unsigned int secs, struct hash_speed *speed) { return test_ahash_speed_common(algo, secs, speed, 0); }
[ 0, 0 ]
Linux Kernel
crypto/tcrypt.c
static int do_mult_acipher_op(struct test_mb_skcipher_data *data, int enc, u32 num_mb, int *rc) { int i, err = 0; for (i = 0; i < num_mb; i++) { if (enc == ENCRYPT) rc[i] = crypto_skcipher_encrypt(data[i].req); else rc[i] = crypto_skcipher_decrypt(data[i].req); }...
[ 0, 0 ]
Linux Kernel
crypto/tcrypt.c
static int test_acipher_jiffies(struct skcipher_request *req, int enc, int blen, int secs) { unsigned long start, end; int bcount; int ret; for (start = jiffies, end = start + secs * HZ, bcount = 0; time_before(jiffies, end); bcount++) { if (enc) ret = do_one_a...
[ 0, 0 ]
Linux Kernel
crypto/tcrypt.c
static int test_acipher_cycles(struct skcipher_request *req, int enc, int blen) { unsigned long cycles = 0; int ret = 0; int i; for (i = 0; i < 4; i++) { if (enc) ret = do_one_acipher_op(req, crypto_skcipher_encrypt(req)); else ret = do_one_acipher_op(req, cry...
[ 1, 0 ]
Linux Kernel
crypto/tcrypt.c
static void test_acipher_speed(const char *algo, int enc, unsigned int secs, struct cipher_speed_template *template, unsigned int tcount, u8 *keysize) { return test_skcipher_speed(algo, enc, secs, template, tcount, keysize, true); }
[ 0, 0 ]
Linux Kernel
crypto/tcrypt.c
static inline int tcrypt_test(const char *alg) { int ret; pr_debug("testing %s\n", alg); ret = alg_test(alg, alg, 0, 0); if (fips_enabled && (ret == -EINVAL || ret == -ECANCELED)) ret = 0; return ret; }
[ 0, 0 ]
Linux Kernel
crypto/tcrypt.c
static int __init tcrypt_mod_init(void) { int err = -ENOMEM; int i; for (i = 0; i < TVMEMSIZE; i++) { tvmem[i] = (void *)__get_free_page(GFP_KERNEL); if (!tvmem[i]) goto err_free_tv; } err = do_test(alg, type, mask, mode, num_mb); if (err) { printk(KERN_ERR "tcrypt: one or more tests fa...
[ 1, 0 ]
Linux Kernel
crypto/tea.c
static void tea_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) { u32 y, z, n, sum = 0; u32 k0, k1, k2, k3; struct tea_ctx *ctx = crypto_tfm_ctx(tfm); const __le32 *in = (const __le32 *)src; __le32 *out = (__le32 *)dst; y = le32_to_cpu(in[0]); z = le32_to_cpu(in[1]); k0 = ctx->KEY[0]; k1 = ...
[ 0, 0 ]
Linux Kernel
crypto/tea.c
static void xeta_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) { u32 y, z, sum; struct tea_ctx *ctx = crypto_tfm_ctx(tfm); const __le32 *in = (const __le32 *)src; __le32 *out = (__le32 *)dst; y = le32_to_cpu(in[0]); z = le32_to_cpu(in[1]); sum = XTEA_DELTA * XTEA_ROUNDS; while (sum) { ...
[ 1, 0 ]
Linux Kernel
crypto/testmgr.c
static int testmgr_alloc_buf(char *buf[XBUFSIZE]) { return __testmgr_alloc_buf(buf, 0); }
[ 0, 0 ]
Linux Kernel
crypto/testmgr.c
static void __testmgr_free_buf(char *buf[XBUFSIZE], int order) { int i; for (i = 0; i < XBUFSIZE; i++) free_pages((unsigned long)buf[i], order); }
[ 0, 0 ]
Linux Kernel
crypto/testmgr.c
static unsigned int count_test_sg_divisions(const struct test_sg_division *divs) { unsigned int remaining = TEST_SG_TOTAL; unsigned int ndivs = 0; do { remaining -= divs[ndivs++].proportion_of_total; } while (remaining); return ndivs; } #define SGDIVS_HAVE_FLUSHES BIT(0) #define SGDIVS_HAVE_NOSIMD BIT...
[ 1, 0 ]
Linux Kernel
crypto/testmgr.c
static bool valid_testvec_config(const struct testvec_config *cfg) { int flags = 0; if (cfg->name == NULL) return false; if (!valid_sg_divisions(cfg->src_divs, ARRAY_SIZE(cfg->src_divs), &flags)) return false; if (cfg->dst_divs[0].proportion_of_total) { if (!valid_sg_divisions(cfg->dst_divs, ARRA...
[ 1, 0 ]
Linux Kernel
crypto/testmgr.c
static int build_cipher_test_sglists(struct cipher_test_sglists *tsgls, const struct testvec_config *cfg, unsigned int alignmask, unsigned int src_total_len, unsigned int d...
[ 1, 0 ]
Linux Kernel
crypto/testmgr.c
static unsigned int generate_random_length(unsigned int max_len) { unsigned int len = get_random_u32_below(max_len + 1); switch (get_random_u32_below(4)) { case 0: return len % 64; case 1: return len % 256; case 2: return len % 1024; default: return len; } }
[ 1, 0 ]
Linux Kernel
crypto/testmgr.c
static void generate_random_bytes(u8 *buf, size_t count) { u8 b; u8 increment; size_t i; if (count == 0) return; switch (get_random_u32_below(8)) { case 0: case 1: /* All the same byte, plus optional mutations */ switch (get_random_u32_below(4)) { case 0: b = 0x00; break; ...
[ 1, 0 ]
Linux Kernel
crypto/testmgr.c
static void crypto_reenable_simd_for_test(void) { __this_cpu_write(crypto_simd_disabled_for_test, false); migrate_enable(); }
[ 0, 0 ]
Linux Kernel
crypto/testmgr.c
static void crypto_disable_simd_for_test(void) {}
[ 0, 0 ]
Linux Kernel
crypto/testmgr.c
static int build_hash_sglist(struct test_sglist *tsgl, const struct hash_testvec *vec, const struct testvec_config *cfg, unsigned int alignmask, const struct test_sg_division *divs[XBUFSIZE]) { struct ...
[ 0, 0 ]
Linux Kernel
crypto/testmgr.c
static int check_hash_result(const char *type, const u8 *result, unsigned int digestsize, const struct hash_testvec *vec, const char *vec_name, const char *driver, const struct testvec_config *cfg) { i...
[ 0, 0 ]
Linux Kernel
crypto/testmgr.c
static void generate_random_hash_testvec(struct shash_desc *desc, struct hash_testvec *vec, unsigned int maxkeysize, unsigned int maxdatasize, char *name, s...
[ 0, 0 ]
Linux Kernel
crypto/testmgr.c
static int test_aead_vec(int enc, const struct aead_testvec *vec, unsigned int vec_num, struct aead_request *req, struct cipher_test_sglists *tsgls) { char vec_name[16]; unsigned int i; int err; if (enc && vec->novrfy) return 0; sprintf(vec_name, "%u", ...
[ 1, 0 ]
Linux Kernel
crypto/testmgr.c
static int test_skcipher_vs_generic_impl(const char *generic_driver, struct skcipher_request *req, struct cipher_test_sglists *tsgls) { return 0; } #endif
[ 0, 0 ]
Linux Kernel
crypto/testmgr.c
static int alg_test_comp(const struct alg_test_desc *desc, const char *driver, u32 type, u32 mask) { struct crypto_comp *comp; struct crypto_acomp *acomp; int err; u32 algo_type = type & CRYPTO_ALG_TYPE_ACOMPRESS_MASK; if (algo_type == CRYPTO_ALG_TYPE_ACOMPRESS) { acomp = crypto...
[ 0, 0 ]
Linux Kernel
crypto/testmgr.c
static int alg_test_cprng(const struct alg_test_desc *desc, const char *driver, u32 type, u32 mask) { struct crypto_rng *rng; int err; rng = crypto_alloc_rng(driver, type, mask); if (IS_ERR(rng)) { printk(KERN_ERR "alg: cprng: Failed to load transform for %s: " ...
[ 0, 0 ]
Linux Kernel
crypto/testmgr.c
static int test_kpp(struct crypto_kpp *tfm, const char *alg, const struct kpp_testvec *vecs, unsigned int tcount) { int ret, i; for (i = 0; i < tcount; i++) { ret = do_test_kpp(tfm, vecs++, alg); if (ret) { pr_err("alg: %s: test failed on vector %d, err=%d\n", alg, i + 1, ret); ...
[ 0, 0 ]
Linux Kernel
crypto/testmgr.c
static int test_akcipher(struct crypto_akcipher *tfm, const char *alg, const struct akcipher_testvec *vecs, unsigned int tcount) { const char *algo = crypto_tfm_alg_driver_name(crypto_akcipher_tfm(tfm)); int ret, i; for (i = 0; i < tcount; i++) { ret = test_...
[ 0, 0 ]
Linux Kernel
crypto/testmgr.c
static int alg_test_akcipher(const struct alg_test_desc *desc, const char *driver, u32 type, u32 mask) { struct crypto_akcipher *tfm; int err = 0; tfm = crypto_alloc_akcipher(driver, type, mask); if (IS_ERR(tfm)) { pr_err("alg: akcipher: Failed to load tfm for %s: %ld\n", driv...
[ 0, 0 ]
Linux Kernel
crypto/testmgr.c
static void alg_check_test_descs_order(void) { int i; for (i = 1; i < ARRAY_SIZE(alg_test_descs); i++) { int diff = strcmp(alg_test_descs[i - 1].alg, alg_test_descs[i].alg); if (WARN_ON(diff > 0)) { pr_warn( "testmgr: alg_test_descs entries in wrong order: '%s' before '%s'\n", a...
[ 0, 0 ]
Linux Kernel
crypto/testmgr.c
static void alg_check_testvec_configs(void) { int i; for (i = 0; i < ARRAY_SIZE(default_cipher_testvec_configs); i++) WARN_ON(!valid_testvec_config(&default_cipher_testvec_configs[i])); for (i = 0; i < ARRAY_SIZE(default_hash_testvec_configs); i++) WARN_ON(!valid_testvec_config(&default_hash_testvec_co...
[ 0, 0 ]
Linux Kernel
crypto/vmac.c
static int vmac_init(struct shash_desc *desc) { const struct vmac_tfm_ctx *tctx = crypto_shash_ctx(desc->tfm); struct vmac_desc_ctx *dctx = shash_desc_ctx(desc); dctx->partial_size = 0; dctx->first_block_processed = false; memcpy(dctx->polytmp, tctx->polykey, sizeof(dctx->polytmp)); dctx->nonce_size = 0; ...
[ 1, 0 ]