Home
last modified time | relevance | path

Searched refs:ctx (Results 1 – 25 of 75) sorted by relevance

123

/crypto/asymmetric_keys/
Dx509_cert_parser.c66 struct x509_parse_context *ctx; in x509_cert_parse() local
80 ctx = kzalloc(sizeof(struct x509_parse_context), GFP_KERNEL); in x509_cert_parse()
81 if (!ctx) in x509_cert_parse()
84 ctx->cert = cert; in x509_cert_parse()
85 ctx->data = (unsigned long)data; in x509_cert_parse()
88 ret = asn1_ber_decoder(&x509_decoder, ctx, data, datalen); in x509_cert_parse()
93 if (ctx->raw_akid) { in x509_cert_parse()
95 ctx->raw_akid_size, ctx->raw_akid_size, ctx->raw_akid); in x509_cert_parse()
96 ret = asn1_ber_decoder(&x509_akid_decoder, ctx, in x509_cert_parse()
97 ctx->raw_akid, ctx->raw_akid_size); in x509_cert_parse()
[all …]
Dpkcs7_parser.c117 struct pkcs7_parse_context *ctx; in pkcs7_parse_message() local
121 ctx = kzalloc(sizeof(struct pkcs7_parse_context), GFP_KERNEL); in pkcs7_parse_message()
122 if (!ctx) in pkcs7_parse_message()
124 ctx->msg = kzalloc(sizeof(struct pkcs7_message), GFP_KERNEL); in pkcs7_parse_message()
125 if (!ctx->msg) in pkcs7_parse_message()
127 ctx->sinfo = kzalloc(sizeof(struct pkcs7_signed_info), GFP_KERNEL); in pkcs7_parse_message()
128 if (!ctx->sinfo) in pkcs7_parse_message()
130 ctx->sinfo->sig = kzalloc(sizeof(struct public_key_signature), in pkcs7_parse_message()
132 if (!ctx->sinfo->sig) in pkcs7_parse_message()
135 ctx->data = (unsigned long)data; in pkcs7_parse_message()
[all …]
Dverify_pefile.c23 struct pefile_context *ctx) in pefile_parse_binary() argument
60 ctx->image_checksum_offset = in pefile_parse_binary()
62 ctx->header_size = pe32->header_size; in pefile_parse_binary()
64 ctx->n_data_dirents = pe32->data_dirs; in pefile_parse_binary()
69 ctx->image_checksum_offset = in pefile_parse_binary()
71 ctx->header_size = pe64->header_size; in pefile_parse_binary()
73 ctx->n_data_dirents = pe64->data_dirs; in pefile_parse_binary()
81 pr_debug("checksum @ %x\n", ctx->image_checksum_offset); in pefile_parse_binary()
82 pr_debug("header size = %x\n", ctx->header_size); in pefile_parse_binary()
84 if (cursor >= ctx->header_size || ctx->header_size >= datalen) in pefile_parse_binary()
[all …]
Dpkcs8_parser.c37 struct pkcs8_parse_context *ctx = context; in pkcs8_note_OID() local
39 ctx->last_oid = look_up_OID(value, vlen); in pkcs8_note_OID()
40 if (ctx->last_oid == OID__NR) { in pkcs8_note_OID()
45 (unsigned long)value - ctx->data, buffer); in pkcs8_note_OID()
71 struct pkcs8_parse_context *ctx = context; in pkcs8_note_algo() local
73 if (ctx->last_oid != OID_rsaEncryption) in pkcs8_note_algo()
76 ctx->pub->pkey_algo = "rsa"; in pkcs8_note_algo()
87 struct pkcs8_parse_context *ctx = context; in pkcs8_note_key() local
89 ctx->key = value; in pkcs8_note_key()
90 ctx->key_size = vlen; in pkcs8_note_key()
[all …]
Dmscode_parser.c23 struct pefile_context *ctx = _ctx; in mscode_parse() local
30 return asn1_ber_decoder(&mscode_decoder, ctx, content_data, data_len); in mscode_parse()
72 struct pefile_context *ctx = context; in mscode_note_digest_algo() local
79 ctx->digest_algo = "md4"; in mscode_note_digest_algo()
82 ctx->digest_algo = "md5"; in mscode_note_digest_algo()
85 ctx->digest_algo = "sha1"; in mscode_note_digest_algo()
88 ctx->digest_algo = "sha256"; in mscode_note_digest_algo()
91 ctx->digest_algo = "sha384"; in mscode_note_digest_algo()
94 ctx->digest_algo = "sha512"; in mscode_note_digest_algo()
97 ctx->digest_algo = "sha224"; in mscode_note_digest_algo()
[all …]
/crypto/
Dzstd.c32 static int zstd_comp_init(struct zstd_ctx *ctx) in zstd_comp_init() argument
38 ctx->cwksp = vzalloc(wksp_size); in zstd_comp_init()
39 if (!ctx->cwksp) { in zstd_comp_init()
44 ctx->cctx = ZSTD_initCCtx(ctx->cwksp, wksp_size); in zstd_comp_init()
45 if (!ctx->cctx) { in zstd_comp_init()
52 vfree(ctx->cwksp); in zstd_comp_init()
56 static int zstd_decomp_init(struct zstd_ctx *ctx) in zstd_decomp_init() argument
61 ctx->dwksp = vzalloc(wksp_size); in zstd_decomp_init()
62 if (!ctx->dwksp) { in zstd_decomp_init()
67 ctx->dctx = ZSTD_initDCtx(ctx->dwksp, wksp_size); in zstd_decomp_init()
[all …]
Dansi_cprng.c81 static int _get_more_prng_bytes(struct prng_context *ctx, int cont_test) in _get_more_prng_bytes() argument
89 ctx); in _get_more_prng_bytes()
91 hexdump("Input DT: ", ctx->DT, DEFAULT_BLK_SZ); in _get_more_prng_bytes()
92 hexdump("Input I: ", ctx->I, DEFAULT_BLK_SZ); in _get_more_prng_bytes()
93 hexdump("Input V: ", ctx->V, DEFAULT_BLK_SZ); in _get_more_prng_bytes()
106 memcpy(tmp, ctx->DT, DEFAULT_BLK_SZ); in _get_more_prng_bytes()
107 output = ctx->I; in _get_more_prng_bytes()
117 xor_vectors(ctx->I, ctx->V, tmp, DEFAULT_BLK_SZ); in _get_more_prng_bytes()
119 output = ctx->rand_data; in _get_more_prng_bytes()
126 if (!memcmp(ctx->rand_data, ctx->last_rand_data, in _get_more_prng_bytes()
[all …]
Decrdsa.c74 struct ecrdsa_ctx *ctx = akcipher_tfm_ctx(tfm); in ecrdsa_verify() local
92 if (!ctx->curve || in ecrdsa_verify()
93 !ctx->digest || in ecrdsa_verify()
95 !ctx->pub_key.x || in ecrdsa_verify()
96 req->dst_len != ctx->digest_len || in ecrdsa_verify()
97 req->dst_len != ctx->curve->g.ndigits * sizeof(u64) || in ecrdsa_verify()
98 ctx->pub_key.ndigits != ctx->curve->g.ndigits || in ecrdsa_verify()
116 vli_cmp(r, ctx->curve->n, ndigits) >= 0 || in ecrdsa_verify()
118 vli_cmp(s, ctx->curve->n, ndigits) >= 0) in ecrdsa_verify()
124 if (vli_cmp(e, ctx->curve->n, ndigits) >= 0) in ecrdsa_verify()
[all …]
Dalgif_hash.c32 static int hash_alloc_result(struct sock *sk, struct hash_ctx *ctx) in hash_alloc_result() argument
36 if (ctx->result) in hash_alloc_result()
39 ds = crypto_ahash_digestsize(crypto_ahash_reqtfm(&ctx->req)); in hash_alloc_result()
41 ctx->result = sock_kmalloc(sk, ds, GFP_KERNEL); in hash_alloc_result()
42 if (!ctx->result) in hash_alloc_result()
45 memset(ctx->result, 0, ds); in hash_alloc_result()
50 static void hash_free_result(struct sock *sk, struct hash_ctx *ctx) in hash_free_result() argument
54 if (!ctx->result) in hash_free_result()
57 ds = crypto_ahash_digestsize(crypto_ahash_reqtfm(&ctx->req)); in hash_free_result()
59 sock_kzfree_s(sk, ctx->result, ds); in hash_free_result()
[all …]
Ddh.c22 static void dh_clear_ctx(struct dh_ctx *ctx) in dh_clear_ctx() argument
24 mpi_free(ctx->p); in dh_clear_ctx()
25 mpi_free(ctx->q); in dh_clear_ctx()
26 mpi_free(ctx->g); in dh_clear_ctx()
27 mpi_free(ctx->xa); in dh_clear_ctx()
28 memset(ctx, 0, sizeof(*ctx)); in dh_clear_ctx()
37 static int _compute_val(const struct dh_ctx *ctx, MPI base, MPI val) in _compute_val() argument
40 return mpi_powm(val, base, ctx->xa, ctx->p); in _compute_val()
53 static int dh_set_params(struct dh_ctx *ctx, struct dh *params) in dh_set_params() argument
58 ctx->p = mpi_read_raw_data(params->p, params->p_size); in dh_set_params()
[all …]
Dstreebog_generic.c910 struct streebog_state *ctx = shash_desc_ctx(desc); in streebog_init() local
914 memset(ctx, 0, sizeof(struct streebog_state)); in streebog_init()
917 ctx->h.qword[i] = cpu_to_le64(0x0101010101010101ULL); in streebog_init()
922 static void streebog_pad(struct streebog_state *ctx) in streebog_pad() argument
924 if (ctx->fillsize >= STREEBOG_BLOCK_SIZE) in streebog_pad()
927 memset(ctx->buffer + ctx->fillsize, 0, in streebog_pad()
928 sizeof(ctx->buffer) - ctx->fillsize); in streebog_pad()
930 ctx->buffer[ctx->fillsize] = 1; in streebog_pad()
975 static void streebog_stage2(struct streebog_state *ctx, const u8 *data) in streebog_stage2() argument
981 streebog_g(&ctx->h, &ctx->N, &m); in streebog_stage2()
[all …]
Drsa-pkcs1pad.c110 struct pkcs1pad_ctx *ctx = akcipher_tfm_ctx(tfm); in pkcs1pad_set_pub_key() local
113 ctx->key_size = 0; in pkcs1pad_set_pub_key()
115 err = crypto_akcipher_set_pub_key(ctx->child, key, keylen); in pkcs1pad_set_pub_key()
120 err = crypto_akcipher_maxsize(ctx->child); in pkcs1pad_set_pub_key()
124 ctx->key_size = err; in pkcs1pad_set_pub_key()
131 struct pkcs1pad_ctx *ctx = akcipher_tfm_ctx(tfm); in pkcs1pad_set_priv_key() local
134 ctx->key_size = 0; in pkcs1pad_set_priv_key()
136 err = crypto_akcipher_set_priv_key(ctx->child, key, keylen); in pkcs1pad_set_priv_key()
141 err = crypto_akcipher_maxsize(ctx->child); in pkcs1pad_set_priv_key()
145 ctx->key_size = err; in pkcs1pad_set_priv_key()
[all …]
Ddeflate.c42 static int deflate_comp_init(struct deflate_ctx *ctx, int format) in deflate_comp_init() argument
45 struct z_stream_s *stream = &ctx->comp_stream; in deflate_comp_init()
71 static int deflate_decomp_init(struct deflate_ctx *ctx, int format) in deflate_decomp_init() argument
74 struct z_stream_s *stream = &ctx->decomp_stream; in deflate_decomp_init()
96 static void deflate_comp_exit(struct deflate_ctx *ctx) in deflate_comp_exit() argument
98 zlib_deflateEnd(&ctx->comp_stream); in deflate_comp_exit()
99 vfree(ctx->comp_stream.workspace); in deflate_comp_exit()
102 static void deflate_decomp_exit(struct deflate_ctx *ctx) in deflate_decomp_exit() argument
104 zlib_inflateEnd(&ctx->decomp_stream); in deflate_decomp_exit()
105 vfree(ctx->decomp_stream.workspace); in deflate_decomp_exit()
[all …]
Dxcbc.c30 u8 ctx[]; member
46 u8 ctx[]; member
55 struct xcbc_tfm_ctx *ctx = crypto_shash_ctx(parent); in crypto_xcbc_digest_setkey() local
56 u8 *consts = PTR_ALIGN(&ctx->ctx[0], alignmask + 1); in crypto_xcbc_digest_setkey()
61 if ((err = crypto_cipher_setkey(ctx->child, inkey, keylen))) in crypto_xcbc_digest_setkey()
64 crypto_cipher_encrypt_one(ctx->child, consts, (u8 *)ks + bs); in crypto_xcbc_digest_setkey()
65 crypto_cipher_encrypt_one(ctx->child, consts + bs, (u8 *)ks + bs * 2); in crypto_xcbc_digest_setkey()
66 crypto_cipher_encrypt_one(ctx->child, key1, (u8 *)ks); in crypto_xcbc_digest_setkey()
68 return crypto_cipher_setkey(ctx->child, key1, bs); in crypto_xcbc_digest_setkey()
75 struct xcbc_desc_ctx *ctx = shash_desc_ctx(pdesc); in crypto_xcbc_digest_init() local
[all …]
Decdh.c38 struct ecdh_ctx *ctx = ecdh_get_ctx(tfm); in ecdh_set_secret() local
43 params.key_size > sizeof(ctx->private_key)) in ecdh_set_secret()
50 ctx->curve_id = params.curve_id; in ecdh_set_secret()
51 ctx->ndigits = ndigits; in ecdh_set_secret()
54 return ecc_gen_privkey(ctx->curve_id, ctx->ndigits, in ecdh_set_secret()
55 ctx->private_key); in ecdh_set_secret()
57 memcpy(ctx->private_key, params.key, params.key_size); in ecdh_set_secret()
59 if (ecc_is_key_valid(ctx->curve_id, ctx->ndigits, in ecdh_set_secret()
60 ctx->private_key, params.key_size) < 0) { in ecdh_set_secret()
61 memzero_explicit(ctx->private_key, params.key_size); in ecdh_set_secret()
[all …]
Dalgif_rng.c66 static void rng_reset_addtl(struct rng_ctx *ctx) in rng_reset_addtl() argument
68 kfree_sensitive(ctx->addtl); in rng_reset_addtl()
69 ctx->addtl = NULL; in rng_reset_addtl()
70 ctx->addtl_len = 0; in rng_reset_addtl()
112 struct rng_ctx *ctx = ask->private; in rng_recvmsg() local
114 return _rng_recvmsg(ctx->drng, msg, len, NULL, 0); in rng_recvmsg()
122 struct rng_ctx *ctx = ask->private; in rng_test_recvmsg() local
126 ret = _rng_recvmsg(ctx->drng, msg, len, ctx->addtl, ctx->addtl_len); in rng_test_recvmsg()
127 rng_reset_addtl(ctx); in rng_test_recvmsg()
137 struct rng_ctx *ctx = ask->private; in rng_test_sendmsg() local
[all …]
Dcmac.c31 u8 ctx[]; member
47 u8 ctx[]; member
54 struct cmac_tfm_ctx *ctx = crypto_shash_ctx(parent); in crypto_cmac_digest_setkey() local
56 __be64 *consts = PTR_ALIGN((void *)ctx->ctx, in crypto_cmac_digest_setkey()
62 err = crypto_cipher_setkey(ctx->child, inkey, keylen); in crypto_cmac_digest_setkey()
68 crypto_cipher_encrypt_one(ctx->child, (u8 *)consts, (u8 *)consts); in crypto_cmac_digest_setkey()
108 struct cmac_desc_ctx *ctx = shash_desc_ctx(pdesc); in crypto_cmac_digest_init() local
110 u8 *prev = PTR_ALIGN((void *)ctx->ctx, alignmask + 1) + bs; in crypto_cmac_digest_init()
112 ctx->len = 0; in crypto_cmac_digest_init()
124 struct cmac_desc_ctx *ctx = shash_desc_ctx(pdesc); in crypto_cmac_digest_update() local
[all …]
Dlz4hc.c20 void *ctx; in lz4hc_alloc_ctx() local
22 ctx = vmalloc(LZ4HC_MEM_COMPRESS); in lz4hc_alloc_ctx()
23 if (!ctx) in lz4hc_alloc_ctx()
26 return ctx; in lz4hc_alloc_ctx()
31 struct lz4hc_ctx *ctx = crypto_tfm_ctx(tfm); in lz4hc_init() local
33 ctx->lz4hc_comp_mem = lz4hc_alloc_ctx(NULL); in lz4hc_init()
34 if (IS_ERR(ctx->lz4hc_comp_mem)) in lz4hc_init()
40 static void lz4hc_free_ctx(struct crypto_scomp *tfm, void *ctx) in lz4hc_free_ctx() argument
42 vfree(ctx); in lz4hc_free_ctx()
47 struct lz4hc_ctx *ctx = crypto_tfm_ctx(tfm); in lz4hc_exit() local
[all …]
Dlz4.c21 void *ctx; in lz4_alloc_ctx() local
23 ctx = vmalloc(LZ4_MEM_COMPRESS); in lz4_alloc_ctx()
24 if (!ctx) in lz4_alloc_ctx()
27 return ctx; in lz4_alloc_ctx()
32 struct lz4_ctx *ctx = crypto_tfm_ctx(tfm); in lz4_init() local
34 ctx->lz4_comp_mem = lz4_alloc_ctx(NULL); in lz4_init()
35 if (IS_ERR(ctx->lz4_comp_mem)) in lz4_init()
41 static void lz4_free_ctx(struct crypto_scomp *tfm, void *ctx) in lz4_free_ctx() argument
43 vfree(ctx); in lz4_free_ctx()
48 struct lz4_ctx *ctx = crypto_tfm_ctx(tfm); in lz4_exit() local
[all …]
Dcryptd.c230 struct cryptd_skcipher_ctx *ctx = crypto_skcipher_ctx(parent); in cryptd_skcipher_setkey() local
231 struct crypto_skcipher *child = ctx->child; in cryptd_skcipher_setkey()
243 struct cryptd_skcipher_ctx *ctx = crypto_skcipher_ctx(tfm); in cryptd_skcipher_complete() local
245 int refcnt = refcount_read(&ctx->refcnt); in cryptd_skcipher_complete()
251 if (err != -EINPROGRESS && refcnt && refcount_dec_and_test(&ctx->refcnt)) in cryptd_skcipher_complete()
261 struct cryptd_skcipher_ctx *ctx = crypto_skcipher_ctx(tfm); in cryptd_skcipher_encrypt() local
263 struct crypto_skcipher *child = ctx->child; in cryptd_skcipher_encrypt()
289 struct cryptd_skcipher_ctx *ctx = crypto_skcipher_ctx(tfm); in cryptd_skcipher_decrypt() local
291 struct crypto_skcipher *child = ctx->child; in cryptd_skcipher_decrypt()
340 struct cryptd_skcipher_ctx *ctx = crypto_skcipher_ctx(tfm); in cryptd_skcipher_init_tfm() local
[all …]
Dtea.c45 struct tea_ctx *ctx = crypto_tfm_ctx(tfm); in tea_setkey() local
48 ctx->KEY[0] = le32_to_cpu(key[0]); in tea_setkey()
49 ctx->KEY[1] = le32_to_cpu(key[1]); in tea_setkey()
50 ctx->KEY[2] = le32_to_cpu(key[2]); in tea_setkey()
51 ctx->KEY[3] = le32_to_cpu(key[3]); in tea_setkey()
61 struct tea_ctx *ctx = crypto_tfm_ctx(tfm); in tea_encrypt() local
68 k0 = ctx->KEY[0]; in tea_encrypt()
69 k1 = ctx->KEY[1]; in tea_encrypt()
70 k2 = ctx->KEY[2]; in tea_encrypt()
71 k3 = ctx->KEY[3]; in tea_encrypt()
[all …]
Dlzo-rle.c20 void *ctx; in lzorle_alloc_ctx() local
22 ctx = kvmalloc(LZO1X_MEM_COMPRESS, GFP_KERNEL); in lzorle_alloc_ctx()
23 if (!ctx) in lzorle_alloc_ctx()
26 return ctx; in lzorle_alloc_ctx()
31 struct lzorle_ctx *ctx = crypto_tfm_ctx(tfm); in lzorle_init() local
33 ctx->lzorle_comp_mem = lzorle_alloc_ctx(NULL); in lzorle_init()
34 if (IS_ERR(ctx->lzorle_comp_mem)) in lzorle_init()
40 static void lzorle_free_ctx(struct crypto_scomp *tfm, void *ctx) in lzorle_free_ctx() argument
42 kvfree(ctx); in lzorle_free_ctx()
47 struct lzorle_ctx *ctx = crypto_tfm_ctx(tfm); in lzorle_exit() local
[all …]
Dlzo.c20 void *ctx; in lzo_alloc_ctx() local
22 ctx = kvmalloc(LZO1X_MEM_COMPRESS, GFP_KERNEL); in lzo_alloc_ctx()
23 if (!ctx) in lzo_alloc_ctx()
26 return ctx; in lzo_alloc_ctx()
31 struct lzo_ctx *ctx = crypto_tfm_ctx(tfm); in lzo_init() local
33 ctx->lzo_comp_mem = lzo_alloc_ctx(NULL); in lzo_init()
34 if (IS_ERR(ctx->lzo_comp_mem)) in lzo_init()
40 static void lzo_free_ctx(struct crypto_scomp *tfm, void *ctx) in lzo_free_ctx() argument
42 kvfree(ctx); in lzo_free_ctx()
47 struct lzo_ctx *ctx = crypto_tfm_ctx(tfm); in lzo_exit() local
[all …]
D842.c33 void *ctx; in crypto842_alloc_ctx() local
35 ctx = kmalloc(SW842_MEM_COMPRESS, GFP_KERNEL); in crypto842_alloc_ctx()
36 if (!ctx) in crypto842_alloc_ctx()
39 return ctx; in crypto842_alloc_ctx()
44 struct crypto842_ctx *ctx = crypto_tfm_ctx(tfm); in crypto842_init() local
46 ctx->wmem = crypto842_alloc_ctx(NULL); in crypto842_init()
47 if (IS_ERR(ctx->wmem)) in crypto842_init()
53 static void crypto842_free_ctx(struct crypto_scomp *tfm, void *ctx) in crypto842_free_ctx() argument
55 kfree(ctx); in crypto842_free_ctx()
60 struct crypto842_ctx *ctx = crypto_tfm_ctx(tfm); in crypto842_exit() local
[all …]
Dsalsa20_generic.c103 static void salsa20_init(u32 *state, const struct salsa20_ctx *ctx, in salsa20_init() argument
106 memcpy(state, ctx->initial_state, sizeof(ctx->initial_state)); in salsa20_init()
116 struct salsa20_ctx *ctx = crypto_skcipher_ctx(tfm); in salsa20_setkey() local
123 ctx->initial_state[1] = get_unaligned_le32(key + 0); in salsa20_setkey()
124 ctx->initial_state[2] = get_unaligned_le32(key + 4); in salsa20_setkey()
125 ctx->initial_state[3] = get_unaligned_le32(key + 8); in salsa20_setkey()
126 ctx->initial_state[4] = get_unaligned_le32(key + 12); in salsa20_setkey()
133 ctx->initial_state[11] = get_unaligned_le32(key + 0); in salsa20_setkey()
134 ctx->initial_state[12] = get_unaligned_le32(key + 4); in salsa20_setkey()
135 ctx->initial_state[13] = get_unaligned_le32(key + 8); in salsa20_setkey()
[all …]

123