/crypto/asymmetric_keys/ |
D | x509_cert_parser.c | 66 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 …]
|
D | pkcs7_parser.c | 117 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 …]
|
D | verify_pefile.c | 23 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 …]
|
D | pkcs8_parser.c | 37 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 …]
|
D | mscode_parser.c | 23 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/ |
D | zstd.c | 32 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 …]
|
D | ansi_cprng.c | 80 static int _get_more_prng_bytes(struct prng_context *ctx, int cont_test) in _get_more_prng_bytes() argument 88 ctx); in _get_more_prng_bytes() 90 hexdump("Input DT: ", ctx->DT, DEFAULT_BLK_SZ); in _get_more_prng_bytes() 91 hexdump("Input I: ", ctx->I, DEFAULT_BLK_SZ); in _get_more_prng_bytes() 92 hexdump("Input V: ", ctx->V, DEFAULT_BLK_SZ); in _get_more_prng_bytes() 105 memcpy(tmp, ctx->DT, DEFAULT_BLK_SZ); in _get_more_prng_bytes() 106 output = ctx->I; in _get_more_prng_bytes() 116 xor_vectors(ctx->I, ctx->V, tmp, DEFAULT_BLK_SZ); in _get_more_prng_bytes() 118 output = ctx->rand_data; in _get_more_prng_bytes() 125 if (!memcmp(ctx->rand_data, ctx->last_rand_data, in _get_more_prng_bytes() [all …]
|
D | ecrdsa.c | 73 struct ecrdsa_ctx *ctx = akcipher_tfm_ctx(tfm); in ecrdsa_verify() local 91 if (!ctx->curve || in ecrdsa_verify() 92 !ctx->digest || in ecrdsa_verify() 94 !ctx->pub_key.x || in ecrdsa_verify() 95 req->dst_len != ctx->digest_len || in ecrdsa_verify() 96 req->dst_len != ctx->curve->g.ndigits * sizeof(u64) || in ecrdsa_verify() 97 ctx->pub_key.ndigits != ctx->curve->g.ndigits || in ecrdsa_verify() 115 vli_cmp(r, ctx->curve->n, ndigits) == 1 || in ecrdsa_verify() 117 vli_cmp(s, ctx->curve->n, ndigits) == 1) in ecrdsa_verify() 123 if (vli_cmp(e, ctx->curve->n, ndigits) == 1) in ecrdsa_verify() [all …]
|
D | algif_hash.c | 32 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 …]
|
D | dh.c | 21 static void dh_clear_ctx(struct dh_ctx *ctx) in dh_clear_ctx() argument 23 mpi_free(ctx->p); in dh_clear_ctx() 24 mpi_free(ctx->q); in dh_clear_ctx() 25 mpi_free(ctx->g); in dh_clear_ctx() 26 mpi_free(ctx->xa); in dh_clear_ctx() 27 memset(ctx, 0, sizeof(*ctx)); in dh_clear_ctx() 36 static int _compute_val(const struct dh_ctx *ctx, MPI base, MPI val) in _compute_val() argument 39 return mpi_powm(val, base, ctx->xa, ctx->p); in _compute_val() 52 static int dh_set_params(struct dh_ctx *ctx, struct dh *params) in dh_set_params() argument 57 ctx->p = mpi_read_raw_data(params->p, params->p_size); in dh_set_params() [all …]
|
D | streebog_generic.c | 910 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 …]
|
D | deflate.c | 42 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 …]
|
D | xcbc.c | 29 u8 ctx[]; member 45 u8 ctx[]; member 54 struct xcbc_tfm_ctx *ctx = crypto_shash_ctx(parent); in crypto_xcbc_digest_setkey() local 55 u8 *consts = PTR_ALIGN(&ctx->ctx[0], alignmask + 1); in crypto_xcbc_digest_setkey() 60 if ((err = crypto_cipher_setkey(ctx->child, inkey, keylen))) in crypto_xcbc_digest_setkey() 63 crypto_cipher_encrypt_one(ctx->child, consts, (u8 *)ks + bs); in crypto_xcbc_digest_setkey() 64 crypto_cipher_encrypt_one(ctx->child, consts + bs, (u8 *)ks + bs * 2); in crypto_xcbc_digest_setkey() 65 crypto_cipher_encrypt_one(ctx->child, key1, (u8 *)ks); in crypto_xcbc_digest_setkey() 67 return crypto_cipher_setkey(ctx->child, key1, bs); in crypto_xcbc_digest_setkey() 74 struct xcbc_desc_ctx *ctx = shash_desc_ctx(pdesc); in crypto_xcbc_digest_init() local [all …]
|
D | rsa-pkcs1pad.c | 109 struct pkcs1pad_ctx *ctx = akcipher_tfm_ctx(tfm); in pkcs1pad_set_pub_key() local 112 ctx->key_size = 0; in pkcs1pad_set_pub_key() 114 err = crypto_akcipher_set_pub_key(ctx->child, key, keylen); in pkcs1pad_set_pub_key() 119 err = crypto_akcipher_maxsize(ctx->child); in pkcs1pad_set_pub_key() 123 ctx->key_size = err; in pkcs1pad_set_pub_key() 130 struct pkcs1pad_ctx *ctx = akcipher_tfm_ctx(tfm); in pkcs1pad_set_priv_key() local 133 ctx->key_size = 0; in pkcs1pad_set_priv_key() 135 err = crypto_akcipher_set_priv_key(ctx->child, key, keylen); in pkcs1pad_set_priv_key() 140 err = crypto_akcipher_maxsize(ctx->child); in pkcs1pad_set_priv_key() 144 ctx->key_size = err; in pkcs1pad_set_priv_key() [all …]
|
D | cmac.c | 30 u8 ctx[]; member 46 u8 ctx[]; member 53 struct cmac_tfm_ctx *ctx = crypto_shash_ctx(parent); in crypto_cmac_digest_setkey() local 55 __be64 *consts = PTR_ALIGN((void *)ctx->ctx, in crypto_cmac_digest_setkey() 61 err = crypto_cipher_setkey(ctx->child, inkey, keylen); in crypto_cmac_digest_setkey() 67 crypto_cipher_encrypt_one(ctx->child, (u8 *)consts, (u8 *)consts); in crypto_cmac_digest_setkey() 107 struct cmac_desc_ctx *ctx = shash_desc_ctx(pdesc); in crypto_cmac_digest_init() local 109 u8 *prev = PTR_ALIGN((void *)ctx->ctx, alignmask + 1) + bs; in crypto_cmac_digest_init() 111 ctx->len = 0; in crypto_cmac_digest_init() 123 struct cmac_desc_ctx *ctx = shash_desc_ctx(pdesc); in crypto_cmac_digest_update() local [all …]
|
D | cryptd.c | 253 struct cryptd_skcipher_ctx *ctx = crypto_skcipher_ctx(parent); in cryptd_skcipher_setkey() local 254 struct crypto_sync_skcipher *child = ctx->child; in cryptd_skcipher_setkey() 271 struct cryptd_skcipher_ctx *ctx = crypto_skcipher_ctx(tfm); in cryptd_skcipher_complete() local 273 int refcnt = refcount_read(&ctx->refcnt); in cryptd_skcipher_complete() 279 if (err != -EINPROGRESS && refcnt && refcount_dec_and_test(&ctx->refcnt)) in cryptd_skcipher_complete() 289 struct cryptd_skcipher_ctx *ctx = crypto_skcipher_ctx(tfm); in cryptd_skcipher_encrypt() local 290 struct crypto_sync_skcipher *child = ctx->child; in cryptd_skcipher_encrypt() 317 struct cryptd_skcipher_ctx *ctx = crypto_skcipher_ctx(tfm); in cryptd_skcipher_decrypt() local 318 struct crypto_sync_skcipher *child = ctx->child; in cryptd_skcipher_decrypt() 368 struct cryptd_skcipher_ctx *ctx = crypto_skcipher_ctx(tfm); in cryptd_skcipher_init_tfm() local [all …]
|
D | lz4.c | 21 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 …]
|
D | lz4hc.c | 20 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 …]
|
D | tea.c | 45 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 …]
|
D | ecdh.c | 38 struct ecdh_ctx *ctx = ecdh_get_ctx(tfm); in ecdh_set_secret() local 49 ctx->curve_id = params.curve_id; in ecdh_set_secret() 50 ctx->ndigits = ndigits; in ecdh_set_secret() 53 return ecc_gen_privkey(ctx->curve_id, ctx->ndigits, in ecdh_set_secret() 54 ctx->private_key); in ecdh_set_secret() 56 if (ecc_is_key_valid(ctx->curve_id, ctx->ndigits, in ecdh_set_secret() 60 memcpy(ctx->private_key, params.key, params.key_size); in ecdh_set_secret() 68 struct ecdh_ctx *ctx = ecdh_get_ctx(tfm); in ecdh_compute_value() local 75 nbytes = ctx->ndigits << ECC_DIGITS_TO_BYTES_SHIFT; in ecdh_compute_value() 102 ret = crypto_ecdh_shared_secret(ctx->curve_id, ctx->ndigits, in ecdh_compute_value() [all …]
|
D | lzo-rle.c | 20 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 …]
|
D | lzo.c | 20 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 …]
|
D | 842.c | 33 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 …]
|
D | algif_skcipher.c | 57 struct af_alg_ctx *ctx = ask->private; in _skcipher_recvmsg() local 64 if (!ctx->used) { in _skcipher_recvmsg() 82 if (len > ctx->used) in _skcipher_recvmsg() 83 len = ctx->used; in _skcipher_recvmsg() 89 if (ctx->more || len < ctx->used) in _skcipher_recvmsg() 112 areq->first_rsgl.sgl.sg, len, ctx->iv); in _skcipher_recvmsg() 125 err = ctx->enc ? in _skcipher_recvmsg() 139 crypto_req_done, &ctx->wait); in _skcipher_recvmsg() 140 err = crypto_wait_req(ctx->enc ? in _skcipher_recvmsg() 143 &ctx->wait); in _skcipher_recvmsg() [all …]
|
D | chacha_generic.c | 35 const struct chacha_ctx *ctx, const u8 *iv) in chacha_stream_xor() argument 43 crypto_chacha_init(state, ctx, iv); in chacha_stream_xor() 52 nbytes, ctx->nrounds); in chacha_stream_xor() 59 void crypto_chacha_init(u32 *state, const struct chacha_ctx *ctx, const u8 *iv) in crypto_chacha_init() argument 65 state[4] = ctx->key[0]; in crypto_chacha_init() 66 state[5] = ctx->key[1]; in crypto_chacha_init() 67 state[6] = ctx->key[2]; in crypto_chacha_init() 68 state[7] = ctx->key[3]; in crypto_chacha_init() 69 state[8] = ctx->key[4]; in crypto_chacha_init() 70 state[9] = ctx->key[5]; in crypto_chacha_init() [all …]
|