Lines Matching defs:ctx

295 static int pk11_cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key,
298 static int pk11_cipher_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
300 static int pk11_cipher_cleanup(EVP_CIPHER_CTX *ctx);
305 static CK_OBJECT_HANDLE pk11_get_cipher_key(EVP_CIPHER_CTX *ctx,
310 static int pk11_digest_init(EVP_MD_CTX *ctx);
311 static int pk11_digest_update(EVP_MD_CTX *ctx, const void *data,
313 static int pk11_digest_final(EVP_MD_CTX *ctx, unsigned char *md);
315 static int pk11_digest_cleanup(EVP_MD_CTX *ctx);
2236 static int pk11_init_symmetric(EVP_CIPHER_CTX *ctx, PK11_CIPHER *pcipher,
2251 if (ctx->cipher->nid == NID_aes_128_ctr ||
2252 ctx->cipher->nid == NID_aes_192_ctr ||
2253 ctx->cipher->nid == NID_aes_256_ctr)
2267 (void) memcpy(ctr_params.cb, ctx->iv, AES_BLOCK_SIZE);
2273 pmech->pParameter = (void *)ctx->iv;
2279 if (ctx->encrypt)
2288 PK11err_add_data(PK11_F_CIPHER_INIT, ctx->encrypt ?
2299 pk11_cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key,
2304 PK11_CIPHER_STATE *state = (PK11_CIPHER_STATE *) ctx->cipher_data;
2310 index = cipher_nid_to_pk11(ctx->cipher->nid);
2316 * iv_len in the ctx->cipher structure is the maximum IV length for the
2324 * Note that the reason why the IV length in ctx->cipher might be
2329 if (ctx->cipher->iv_len < p_ciph_table_row->iv_len ||
2330 ctx->key_len < p_ciph_table_row->min_key_len ||
2331 ctx->key_len > p_ciph_table_row->max_key_len) {
2345 (void) check_new_cipher_key(sp, key, ctx->key_len);
2353 sp->opdata_encrypt == ctx->encrypt)
2356 if (pk11_init_symmetric(ctx, p_ciph_table_row, sp, &mech) == 0)
2369 ctx, key, p_ciph_table_row->key_type, sp);
2372 if (sp->opdata_encrypt != ctx->encrypt && sp->opdata_encrypt != -1)
2392 if (pk11_init_symmetric(ctx, p_ciph_table_row, sp, &mech) == 0)
2395 sp->opdata_encrypt = ctx->encrypt;
2441 pk11_cipher_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
2444 PK11_CIPHER_STATE *state = (PK11_CIPHER_STATE *) ctx->cipher_data;
2458 if (ctx->cipher->nid != NID_rc4 && (inl % ctx->cipher->block_size) != 0)
2461 if (ctx->encrypt)
2509 pk11_cipher_cleanup(EVP_CIPHER_CTX *ctx)
2514 PK11_CIPHER_STATE *state = ctx->cipher_data;
2522 if (ctx->encrypt)
2531 PK11err_add_data(PK11_F_CIPHER_CLEANUP, ctx->encrypt ?
2658 static CK_OBJECT_HANDLE pk11_get_cipher_key(EVP_CIPHER_CTX *ctx,
2693 a_key_template[5].ulValueLen = (unsigned long) ctx->key_len;
2708 sp->opdata_key_len = ctx->key_len > PK11_KEY_LEN_MAX ?
2709 PK11_KEY_LEN_MAX : ctx->key_len;
2728 pk11_digest_init(EVP_MD_CTX *ctx)
2735 PK11_CIPHER_STATE *state = (PK11_CIPHER_STATE *) ctx->md_data;
2739 index = md_nid_to_pk11(ctx->digest->type);
2767 pk11_digest_update(EVP_MD_CTX *ctx, const void *data, size_t count)
2770 PK11_CIPHER_STATE *state = (PK11_CIPHER_STATE *) ctx->md_data;
2794 pk11_digest_final(EVP_MD_CTX *ctx, unsigned char *md)
2798 PK11_CIPHER_STATE *state = (PK11_CIPHER_STATE *) ctx->md_data;
2799 len = ctx->digest->md_size;
2814 if (ctx->digest->md_size != len)
2903 pk11_digest_cleanup(EVP_MD_CTX *ctx)
2905 PK11_CIPHER_STATE *state = ctx->md_data;
2917 if (!pk11_digest_final(ctx, buf))