Lines Matching refs:cipher
125 EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, in EVP_CipherInit() argument
128 return EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, enc); in EVP_CipherInit()
133 EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *engine, in EVP_CipherInit_ex() argument
142 if (cipher == NULL && ctx->cipher == NULL) { in EVP_CipherInit_ex()
151 if (cipher != NULL) { in EVP_CipherInit_ex()
158 ctx->cipher = cipher; in EVP_CipherInit_ex()
159 ctx->key_len = cipher->key_len; in EVP_CipherInit_ex()
161 if (ctx->cipher->ctx_size != 0) { in EVP_CipherInit_ex()
162 ctx->cipher_data = calloc(1, ctx->cipher->ctx_size); in EVP_CipherInit_ex()
169 if ((ctx->cipher->flags & EVP_CIPH_CTRL_INIT) != 0) { in EVP_CipherInit_ex()
178 if (ctx->cipher->block_size != 1 && in EVP_CipherInit_ex()
179 ctx->cipher->block_size != 8 && in EVP_CipherInit_ex()
180 ctx->cipher->block_size != 16) { in EVP_CipherInit_ex()
236 if (key != NULL || (ctx->cipher->flags & EVP_CIPH_ALWAYS_CALL_INIT) != 0) { in EVP_CipherInit_ex()
237 if (!ctx->cipher->init(ctx, key, iv, enc)) in EVP_CipherInit_ex()
280 EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, in EVP_EncryptInit() argument
283 return EVP_CipherInit(ctx, cipher, key, iv, 1); in EVP_EncryptInit()
288 EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *engine, in EVP_EncryptInit_ex() argument
291 return EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, 1); in EVP_EncryptInit_ex()
311 return ctx->cipher->do_cipher(ctx, out, in, in_len); in EVP_Cipher()
326 if ((ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) != 0) { in evp_cipher()
327 if ((len = ctx->cipher->do_cipher(ctx, out, in, in_len)) < 0) in evp_cipher()
334 if (!ctx->cipher->do_cipher(ctx, out, in, in_len)) in evp_cipher()
346 const int block_size = ctx->cipher->block_size; in EVP_EncryptUpdate()
359 if (in_len == 0 && EVP_CIPHER_mode(ctx->cipher) != EVP_CIPH_CCM_MODE) in EVP_EncryptUpdate()
362 if ((ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) != 0) in EVP_EncryptUpdate()
436 const int block_size = ctx->cipher->block_size; in EVP_EncryptFinal_ex()
442 if ((ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) != 0) in EVP_EncryptFinal_ex()
469 EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, in EVP_DecryptInit() argument
472 return EVP_CipherInit(ctx, cipher, key, iv, 0); in EVP_DecryptInit()
477 EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *engine, in EVP_DecryptInit_ex() argument
480 return EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, 0); in EVP_DecryptInit_ex()
488 const int block_size = ctx->cipher->block_size; in EVP_DecryptUpdate()
500 if (in_len == 0 && EVP_CIPHER_mode(ctx->cipher) != EVP_CIPH_CCM_MODE) in EVP_DecryptUpdate()
503 if ((ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) != 0) in EVP_DecryptUpdate()
564 const int block_size = ctx->cipher->block_size; in EVP_DecryptFinal_ex()
570 if ((ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) != 0) in EVP_DecryptFinal_ex()
659 if (ctx->cipher != NULL) { in EVP_CIPHER_CTX_cleanup()
661 if (ctx->cipher->cleanup != NULL) in EVP_CIPHER_CTX_cleanup()
662 ctx->cipher->cleanup(ctx); in EVP_CIPHER_CTX_cleanup()
664 explicit_bzero(ctx->cipher_data, ctx->cipher->ctx_size); in EVP_CIPHER_CTX_cleanup()
681 if (!ctx->cipher) { in EVP_CIPHER_CTX_ctrl()
686 if (!ctx->cipher->ctrl) { in EVP_CIPHER_CTX_ctrl()
691 ret = ctx->cipher->ctrl(ctx, type, arg, ptr); in EVP_CIPHER_CTX_ctrl()
703 if (ctx->cipher->flags & EVP_CIPH_RAND_KEY) in EVP_CIPHER_CTX_rand_key()
713 if (in == NULL || in->cipher == NULL) { in EVP_CIPHER_CTX_copy()
721 if (in->cipher_data && in->cipher->ctx_size) { in EVP_CIPHER_CTX_copy()
722 out->cipher_data = calloc(1, in->cipher->ctx_size); in EVP_CIPHER_CTX_copy()
727 memcpy(out->cipher_data, in->cipher_data, in->cipher->ctx_size); in EVP_CIPHER_CTX_copy()
730 if (in->cipher->flags & EVP_CIPH_CUSTOM_COPY) { in EVP_CIPHER_CTX_copy()
731 if (!in->cipher->ctrl((EVP_CIPHER_CTX *)in, EVP_CTRL_COPY, in EVP_CIPHER_CTX_copy()
740 freezero(out->cipher_data, in->cipher->ctx_size); in EVP_CIPHER_CTX_copy()
757 return ctx->cipher; in EVP_CIPHER_CTX_cipher()
841 if (key_len > 0 && (ctx->cipher->flags & EVP_CIPH_VARIABLE_LENGTH)) { in EVP_CIPHER_CTX_set_key_length()
908 return ctx->cipher->nid; in EVP_CIPHER_CTX_nid()
915 return ctx->cipher->block_size; in EVP_CIPHER_CTX_block_size()
924 if ((ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_IV_LENGTH) == 0) in EVP_CIPHER_CTX_iv_length()
925 return ctx->cipher->iv_len; in EVP_CIPHER_CTX_iv_length()
942 return ctx->cipher->flags; in EVP_CIPHER_CTX_flags()
975 if (ctx->cipher->get_asn1_parameters != NULL) in EVP_CIPHER_asn1_to_param()
976 return ctx->cipher->get_asn1_parameters(ctx, type); in EVP_CIPHER_asn1_to_param()
978 if ((ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) != 0) in EVP_CIPHER_asn1_to_param()
1004 if (ctx->cipher->set_asn1_parameters != NULL) in EVP_CIPHER_param_to_asn1()
1005 return ctx->cipher->set_asn1_parameters(ctx, type); in EVP_CIPHER_param_to_asn1()
1007 if ((ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) != 0) in EVP_CIPHER_param_to_asn1()
1015 EVP_CIPHER_type(const EVP_CIPHER *cipher) in EVP_CIPHER_type() argument
1020 nid = EVP_CIPHER_nid(cipher); in EVP_CIPHER_type()
1073 EVP_CIPHER_nid(const EVP_CIPHER *cipher) in EVP_CIPHER_nid() argument
1075 return cipher->nid; in EVP_CIPHER_nid()
1080 EVP_CIPHER_block_size(const EVP_CIPHER *cipher) in EVP_CIPHER_block_size() argument
1082 return cipher->block_size; in EVP_CIPHER_block_size()
1087 EVP_CIPHER_key_length(const EVP_CIPHER *cipher) in EVP_CIPHER_key_length() argument
1089 return cipher->key_len; in EVP_CIPHER_key_length()
1094 EVP_CIPHER_iv_length(const EVP_CIPHER *cipher) in EVP_CIPHER_iv_length() argument
1096 return cipher->iv_len; in EVP_CIPHER_iv_length()
1101 EVP_CIPHER_flags(const EVP_CIPHER *cipher) in EVP_CIPHER_flags() argument
1103 return cipher->flags; in EVP_CIPHER_flags()
1110 EVP_CIPHER *cipher; in EVP_CIPHER_meth_new() local
1119 if ((cipher = calloc(1, sizeof(*cipher))) == NULL) in EVP_CIPHER_meth_new()
1122 cipher->nid = cipher_type; in EVP_CIPHER_meth_new()
1123 cipher->block_size = block_size; in EVP_CIPHER_meth_new()
1124 cipher->key_len = key_len; in EVP_CIPHER_meth_new()
1126 return cipher; in EVP_CIPHER_meth_new()
1131 EVP_CIPHER_meth_dup(const EVP_CIPHER *cipher) in EVP_CIPHER_meth_dup() argument
1138 *copy = *cipher; in EVP_CIPHER_meth_dup()
1145 EVP_CIPHER_meth_free(EVP_CIPHER *cipher) in EVP_CIPHER_meth_free() argument
1147 free(cipher); in EVP_CIPHER_meth_free()
1152 EVP_CIPHER_meth_set_iv_length(EVP_CIPHER *cipher, int iv_len) in EVP_CIPHER_meth_set_iv_length() argument
1154 cipher->iv_len = iv_len; in EVP_CIPHER_meth_set_iv_length()
1161 EVP_CIPHER_meth_set_flags(EVP_CIPHER *cipher, unsigned long flags) in EVP_CIPHER_meth_set_flags() argument
1163 cipher->flags = flags; in EVP_CIPHER_meth_set_flags()
1170 EVP_CIPHER_meth_set_impl_ctx_size(EVP_CIPHER *cipher, int ctx_size) in EVP_CIPHER_meth_set_impl_ctx_size() argument
1172 cipher->ctx_size = ctx_size; in EVP_CIPHER_meth_set_impl_ctx_size()
1179 EVP_CIPHER_meth_set_init(EVP_CIPHER *cipher, in EVP_CIPHER_meth_set_init() argument
1183 cipher->init = init; in EVP_CIPHER_meth_set_init()
1190 EVP_CIPHER_meth_set_do_cipher(EVP_CIPHER *cipher, in EVP_CIPHER_meth_set_do_cipher() argument
1194 cipher->do_cipher = do_cipher; in EVP_CIPHER_meth_set_do_cipher()
1201 EVP_CIPHER_meth_set_cleanup(EVP_CIPHER *cipher, in EVP_CIPHER_meth_set_cleanup() argument
1204 cipher->cleanup = cleanup; in EVP_CIPHER_meth_set_cleanup()
1211 EVP_CIPHER_meth_set_set_asn1_params(EVP_CIPHER *cipher, in EVP_CIPHER_meth_set_set_asn1_params() argument
1214 cipher->set_asn1_parameters = set_asn1_parameters; in EVP_CIPHER_meth_set_set_asn1_params()
1221 EVP_CIPHER_meth_set_get_asn1_params(EVP_CIPHER *cipher, in EVP_CIPHER_meth_set_get_asn1_params() argument
1224 cipher->get_asn1_parameters = get_asn1_parameters; in EVP_CIPHER_meth_set_get_asn1_params()
1231 EVP_CIPHER_meth_set_ctrl(EVP_CIPHER *cipher, in EVP_CIPHER_meth_set_ctrl() argument
1234 cipher->ctrl = ctrl; in EVP_CIPHER_meth_set_ctrl()