Lines Matching refs:cipher
83 if (c->cipher != NULL && c->cipher->cleanup) { in EVP_CIPHER_CTX_cleanup()
84 c->cipher->cleanup(c); in EVP_CIPHER_CTX_cleanup()
100 if (in == NULL || in->cipher == NULL) { in EVP_CIPHER_CTX_copy()
108 if (in->cipher_data && in->cipher->ctx_size) { in EVP_CIPHER_CTX_copy()
109 out->cipher_data = OPENSSL_malloc(in->cipher->ctx_size); in EVP_CIPHER_CTX_copy()
111 out->cipher = NULL; in EVP_CIPHER_CTX_copy()
115 OPENSSL_memcpy(out->cipher_data, in->cipher_data, in->cipher->ctx_size); in EVP_CIPHER_CTX_copy()
118 if (in->cipher->flags & EVP_CIPH_CUSTOM_COPY) { in EVP_CIPHER_CTX_copy()
119 if (!in->cipher->ctrl((EVP_CIPHER_CTX *)in, EVP_CTRL_COPY, 0, out)) { in EVP_CIPHER_CTX_copy()
120 out->cipher = NULL; in EVP_CIPHER_CTX_copy()
133 int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, in EVP_CipherInit_ex() argument
145 if (cipher) { in EVP_CipherInit_ex()
149 if (ctx->cipher) { in EVP_CipherInit_ex()
155 ctx->cipher = cipher; in EVP_CipherInit_ex()
156 if (ctx->cipher->ctx_size) { in EVP_CipherInit_ex()
157 ctx->cipher_data = OPENSSL_malloc(ctx->cipher->ctx_size); in EVP_CipherInit_ex()
159 ctx->cipher = NULL; in EVP_CipherInit_ex()
167 ctx->key_len = cipher->key_len; in EVP_CipherInit_ex()
170 if (ctx->cipher->flags & EVP_CIPH_CTRL_INIT) { in EVP_CipherInit_ex()
172 ctx->cipher = NULL; in EVP_CipherInit_ex()
177 } else if (!ctx->cipher) { in EVP_CipherInit_ex()
183 assert(ctx->cipher->block_size == 1 || ctx->cipher->block_size == 8 || in EVP_CipherInit_ex()
184 ctx->cipher->block_size == 16); in EVP_CipherInit_ex()
218 if (key || (ctx->cipher->flags & EVP_CIPH_ALWAYS_CALL_INIT)) { in EVP_CipherInit_ex()
219 if (!ctx->cipher->init(ctx, key, iv, enc)) { in EVP_CipherInit_ex()
226 ctx->block_mask = ctx->cipher->block_size - 1; in EVP_CipherInit_ex()
230 int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, in EVP_EncryptInit_ex() argument
232 return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 1); in EVP_EncryptInit_ex()
235 int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, in EVP_DecryptInit_ex() argument
237 return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 0); in EVP_DecryptInit_ex()
244 if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) { in EVP_EncryptUpdate()
245 i = ctx->cipher->cipher(ctx, out, in, in_len); in EVP_EncryptUpdate()
260 if (ctx->cipher->cipher(ctx, out, in, in_len)) { in EVP_EncryptUpdate()
270 bl = ctx->cipher->block_size; in EVP_EncryptUpdate()
281 if (!ctx->cipher->cipher(ctx, out, ctx->buf, bl)) { in EVP_EncryptUpdate()
296 if (!ctx->cipher->cipher(ctx, out, in, in_len)) { in EVP_EncryptUpdate()
313 if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) { in EVP_EncryptFinal_ex()
314 ret = ctx->cipher->cipher(ctx, out, NULL, 0); in EVP_EncryptFinal_ex()
323 b = ctx->cipher->block_size; in EVP_EncryptFinal_ex()
344 ret = ctx->cipher->cipher(ctx, out, ctx->buf, b); in EVP_EncryptFinal_ex()
358 if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) { in EVP_DecryptUpdate()
359 int r = ctx->cipher->cipher(ctx, out, in, in_len); in EVP_DecryptUpdate()
378 b = ctx->cipher->block_size; in EVP_DecryptUpdate()
415 if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) { in EVP_DecryptFinal_ex()
416 i = ctx->cipher->cipher(ctx, out, NULL, 0); in EVP_DecryptFinal_ex()
425 b = ctx->cipher->block_size; in EVP_DecryptFinal_ex()
457 n = ctx->cipher->block_size - n; in EVP_DecryptFinal_ex()
471 return ctx->cipher->cipher(ctx, out, in, in_len); in EVP_Cipher()
492 return ctx->cipher; in EVP_CIPHER_CTX_cipher()
496 return ctx->cipher->nid; in EVP_CIPHER_CTX_nid()
504 return ctx->cipher->block_size; in EVP_CIPHER_CTX_block_size()
512 return ctx->cipher->iv_len; in EVP_CIPHER_CTX_iv_length()
524 return ctx->cipher->flags & ~EVP_CIPH_MODE_MASK; in EVP_CIPHER_CTX_flags()
528 return ctx->cipher->flags & EVP_CIPH_MODE_MASK; in EVP_CIPHER_CTX_mode()
533 if (!ctx->cipher) { in EVP_CIPHER_CTX_ctrl()
538 if (!ctx->cipher->ctrl) { in EVP_CIPHER_CTX_ctrl()
543 ret = ctx->cipher->ctrl(ctx, command, arg, ptr); in EVP_CIPHER_CTX_ctrl()
566 if (key_len == 0 || !(c->cipher->flags & EVP_CIPH_VARIABLE_LENGTH)) { in EVP_CIPHER_CTX_set_key_length()
575 int EVP_CIPHER_nid(const EVP_CIPHER *cipher) { return cipher->nid; } in EVP_CIPHER_nid() argument
577 unsigned EVP_CIPHER_block_size(const EVP_CIPHER *cipher) { in EVP_CIPHER_block_size() argument
578 return cipher->block_size; in EVP_CIPHER_block_size()
581 unsigned EVP_CIPHER_key_length(const EVP_CIPHER *cipher) { in EVP_CIPHER_key_length() argument
582 return cipher->key_len; in EVP_CIPHER_key_length()
585 unsigned EVP_CIPHER_iv_length(const EVP_CIPHER *cipher) { in EVP_CIPHER_iv_length() argument
586 return cipher->iv_len; in EVP_CIPHER_iv_length()
589 uint32_t EVP_CIPHER_flags(const EVP_CIPHER *cipher) { in EVP_CIPHER_flags() argument
590 return cipher->flags & ~EVP_CIPH_MODE_MASK; in EVP_CIPHER_flags()
593 uint32_t EVP_CIPHER_mode(const EVP_CIPHER *cipher) { in EVP_CIPHER_mode() argument
594 return cipher->flags & EVP_CIPH_MODE_MASK; in EVP_CIPHER_mode()
597 int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, in EVP_CipherInit() argument
599 if (cipher) { in EVP_CipherInit()
602 return EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, enc); in EVP_CipherInit()
605 int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, in EVP_EncryptInit() argument
607 return EVP_CipherInit(ctx, cipher, key, iv, 1); in EVP_EncryptInit()
610 int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, in EVP_DecryptInit() argument
612 return EVP_CipherInit(ctx, cipher, key, iv, 0); in EVP_DecryptInit()