Home | History | Annotate | Download | only in evp

Lines Matching refs:cipher

75 #define M_do_cipher(ctx, out, in, inl) ctx->cipher->do_cipher(ctx, out, in, inl)
84 /* ctx->cipher=NULL; */
95 int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
98 if (cipher)
100 return EVP_CipherInit_ex(ctx,cipher,NULL,key,iv,enc);
103 int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl,
119 if (ctx->engine && ctx->cipher && (!cipher ||
120 (cipher && (cipher->nid == ctx->cipher->nid))))
123 if (cipher)
128 if (ctx->cipher)
147 impl = ENGINE_get_cipher_engine(cipher->nid);
151 const EVP_CIPHER *c = ENGINE_get_cipher(impl, cipher->nid);
161 /* We'll use the ENGINE's private cipher definition */
162 cipher = c;
164 * 'cipher' came from an ENGINE and we need to release
174 return FIPS_cipherinit(ctx, cipher, key, iv, enc);
176 ctx->cipher=cipher;
177 if (ctx->cipher->ctx_size)
179 ctx->cipher_data=OPENSSL_malloc(ctx->cipher->ctx_size);
190 ctx->key_len = cipher->key_len;
192 if(ctx->cipher->flags & EVP_CIPH_CTRL_INIT)
201 else if(!ctx->cipher)
211 return FIPS_cipherinit(ctx, cipher, key, iv, enc);
214 OPENSSL_assert(ctx->cipher->block_size == 1
215 || ctx->cipher->block_size == 8
216 || ctx->cipher->block_size == 16);
252 if(key || (ctx->cipher->flags & EVP_CIPH_ALWAYS_CALL_INIT)) {
253 if(!ctx->cipher->init(ctx,key,iv,enc)) return 0;
257 ctx->block_mask=ctx->cipher->block_size-1;
283 int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
286 return EVP_CipherInit(ctx, cipher, key, iv, 1);
289 int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl,
292 return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 1);
295 int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
298 return EVP_CipherInit(ctx, cipher, key, iv, 0);
301 int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl,
304 return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 0);
312 if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER)
342 bl=ctx->cipher->block_size;
392 if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER)
402 b=ctx->cipher->block_size;
439 if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER)
461 b=ctx->cipher->block_size;
507 if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER)
517 b=ctx->cipher->block_size;
550 n=ctx->cipher->block_size-n;
572 if (c->cipher != NULL)
574 if(c->cipher->cleanup && !c->cipher->cleanup(c))
576 /* Cleanse cipher context data */
578 OPENSSL_cleanse(c->cipher_data, c->cipher->ctx_size);
598 if(c->cipher->flags & EVP_CIPH_CUSTOM_KEY_LENGTH)
601 if((keylen > 0) && (c->cipher->flags & EVP_CIPH_VARIABLE_LENGTH))
620 if(!ctx->cipher) {
625 if(!ctx->cipher->ctrl) {
630 ret = ctx->cipher->ctrl(ctx, type, arg, ptr);
640 if (ctx->cipher->flags & EVP_CIPH_RAND_KEY)
649 if ((in == NULL) || (in->cipher == NULL))
655 /* Make sure it's safe to copy a cipher context using an ENGINE */
666 if (in->cipher_data && in->cipher->ctx_size)
668 cipher->ctx_size);
674 memcpy(out->cipher_data,in->cipher_data,in->cipher->ctx_size);
677 if (in->cipher->flags & EVP_CIPH_CUSTOM_COPY)
678 return in->cipher->ctrl((EVP_CIPHER_CTX *)in, EVP_CTRL_COPY, 0, out);