Lines Matching defs:cipher

74 	/* ctx->cipher=NULL; */
85 int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
88 if (cipher)
90 return EVP_CipherInit_ex(ctx,cipher,NULL,key,iv,enc);
93 int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl,
109 if (ctx->engine && ctx->cipher && (!cipher ||
110 (cipher && (cipher->nid == ctx->cipher->nid))))
113 if (cipher)
133 impl = ENGINE_get_cipher_engine(cipher->nid);
137 const EVP_CIPHER *c = ENGINE_get_cipher(impl, cipher->nid);
147 /* We'll use the ENGINE's private cipher definition */
148 cipher = c;
150 * 'cipher' came from an ENGINE and we need to release
158 ctx->cipher=cipher;
159 if (ctx->cipher->ctx_size)
161 ctx->cipher_data=OPENSSL_malloc(ctx->cipher->ctx_size);
172 ctx->key_len = cipher->key_len;
174 if(ctx->cipher->flags & EVP_CIPH_CTRL_INIT)
183 else if(!ctx->cipher)
192 OPENSSL_assert(ctx->cipher->block_size == 1
193 || ctx->cipher->block_size == 8
194 || ctx->cipher->block_size == 16);
223 if(key || (ctx->cipher->flags & EVP_CIPH_ALWAYS_CALL_INIT)) {
224 if(!ctx->cipher->init(ctx,key,iv,enc)) return 0;
228 ctx->block_mask=ctx->cipher->block_size-1;
254 int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
257 return EVP_CipherInit(ctx, cipher, key, iv, 1);
260 int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl,
263 return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 1);
266 int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
269 return EVP_CipherInit(ctx, cipher, key, iv, 0);
272 int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl,
275 return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 0);
291 if(ctx->cipher->do_cipher(ctx,out,in,inl))
303 bl=ctx->cipher->block_size;
318 if(!ctx->cipher->do_cipher(ctx,out,ctx->buf,bl)) return 0;
331 if(!ctx->cipher->do_cipher(ctx,out,in,inl)) return 0;
353 b=ctx->cipher->block_size;
375 ret=ctx->cipher->do_cipher(ctx,out,ctx->buf,b);
399 b=ctx->cipher->block_size;
445 b=ctx->cipher->block_size;
478 n=ctx->cipher->block_size-n;
499 if (c->cipher != NULL)
501 if(c->cipher->cleanup && !c->cipher->cleanup(c))
503 /* Cleanse cipher context data */
505 OPENSSL_cleanse(c->cipher_data, c->cipher->ctx_size);
521 if(c->cipher->flags & EVP_CIPH_CUSTOM_KEY_LENGTH)
524 if((keylen > 0) && (c->cipher->flags & EVP_CIPH_VARIABLE_LENGTH))
543 if(!ctx->cipher) {
548 if(!ctx->cipher->ctrl) {
553 ret = ctx->cipher->ctrl(ctx, type, arg, ptr);
563 if (ctx->cipher->flags & EVP_CIPH_RAND_KEY)
572 if ((in == NULL) || (in->cipher == NULL))
578 /* Make sure it's safe to copy a cipher context using an ENGINE */
589 if (in->cipher_data && in->cipher->ctx_size)
591 out->cipher_data=OPENSSL_malloc(in->cipher->ctx_size);
597 memcpy(out->cipher_data,in->cipher_data,in->cipher->ctx_size);
600 if (in->cipher->flags & EVP_CIPH_CUSTOM_COPY)
601 return in->cipher->ctrl((EVP_CIPHER_CTX *)in, EVP_CTRL_COPY, 0, out);