Lines Matching refs:cipher

76 #define M_do_cipher(ctx, out, in, inl) ctx->cipher->do_cipher(ctx, out, in, inl)
85 /* ctx->cipher=NULL; */
96 int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
99 if (cipher)
101 return EVP_CipherInit_ex(ctx,cipher,NULL,key,iv,enc);
104 int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl,
120 if (ctx->engine && ctx->cipher && (!cipher ||
121 (cipher && (cipher->nid == ctx->cipher->nid))))
124 if (cipher)
129 if (ctx->cipher)
148 impl = ENGINE_get_cipher_engine(cipher->nid);
152 const EVP_CIPHER *c = ENGINE_get_cipher(impl, cipher->nid);
162 /* We'll use the ENGINE's private cipher definition */
163 cipher = c;
165 * 'cipher' came from an ENGINE and we need to release
175 return FIPS_cipherinit(ctx, cipher, key, iv, enc);
177 ctx->cipher=cipher;
178 if (ctx->cipher->ctx_size)
180 ctx->cipher_data=OPENSSL_malloc(ctx->cipher->ctx_size);
191 ctx->key_len = cipher->key_len;
193 if(ctx->cipher->flags & EVP_CIPH_CTRL_INIT)
202 else if(!ctx->cipher)
212 return FIPS_cipherinit(ctx, cipher, key, iv, enc);
215 OPENSSL_assert(ctx->cipher->block_size == 1
216 || ctx->cipher->block_size == 8
217 || ctx->cipher->block_size == 16);
253 if(key || (ctx->cipher->flags & EVP_CIPH_ALWAYS_CALL_INIT)) {
254 if(!ctx->cipher->init(ctx,key,iv,enc)) return 0;
258 ctx->block_mask=ctx->cipher->block_size-1;
284 int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
287 return EVP_CipherInit(ctx, cipher, key, iv, 1);
290 int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl,
293 return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 1);
296 int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
299 return EVP_CipherInit(ctx, cipher, key, iv, 0);
302 int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl,
305 return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 0);
313 if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER)
343 bl=ctx->cipher->block_size;
393 if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER)
403 b=ctx->cipher->block_size;
440 if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER)
462 b=ctx->cipher->block_size;
508 if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER)
518 b=(unsigned int)(ctx->cipher->block_size);
579 if (c->cipher != NULL)
581 if(c->cipher->cleanup && !c->cipher->cleanup(c))
583 /* Cleanse cipher context data */
585 OPENSSL_cleanse(c->cipher_data, c->cipher->ctx_size);
605 if(c->cipher->flags & EVP_CIPH_CUSTOM_KEY_LENGTH)
608 if((keylen > 0) && (c->cipher->flags & EVP_CIPH_VARIABLE_LENGTH))
627 if(!ctx->cipher) {
632 if(!ctx->cipher->ctrl) {
637 ret = ctx->cipher->ctrl(ctx, type, arg, ptr);
647 if (ctx->cipher->flags & EVP_CIPH_RAND_KEY)
656 if ((in == NULL) || (in->cipher == NULL))
662 /* Make sure it's safe to copy a cipher context using an ENGINE */
673 if (in->cipher_data && in->cipher->ctx_size)
675 out->cipher_data=OPENSSL_malloc(in->cipher->ctx_size);
681 memcpy(out->cipher_data,in->cipher_data,in->cipher->ctx_size);
684 if (in->cipher->flags & EVP_CIPH_CUSTOM_COPY)
685 return in->cipher->ctrl((EVP_CIPHER_CTX *)in, EVP_CTRL_COPY, 0, out);