예제 #1
0
int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type)
{
    int ret;

    if (c->cipher->set_asn1_parameters != NULL)
        ret = c->cipher->set_asn1_parameters(c, type);
    else if (c->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) {
        switch (EVP_CIPHER_CTX_mode(c)) {
        case EVP_CIPH_WRAP_MODE:
            ASN1_TYPE_set(type, V_ASN1_NULL, NULL);
            ret = 1;
            break;

        case EVP_CIPH_GCM_MODE:
        case EVP_CIPH_CCM_MODE:
        case EVP_CIPH_XTS_MODE:
        case EVP_CIPH_OCB_MODE:
            ret = -1;
            break;

        default:
            ret = EVP_CIPHER_set_asn1_iv(c, type);
        }
    } else
        ret = -1;
    return (ret);
}
예제 #2
0
파일: evp_lib.c 프로젝트: vigortls/vigortls
int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type)
{
    int ret;

    if (c->cipher->set_asn1_parameters != NULL)
        ret = c->cipher->set_asn1_parameters(c, type);
    else if (c->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1)
        switch (EVP_CIPHER_CTX_mode(c)) {
            case EVP_CIPH_WRAP_MODE:
                if (EVP_CIPHER_CTX_nid(c) == NID_id_smime_alg_CMS3DESwrap)
                    ASN1_TYPE_set(type, V_ASN1_NULL, NULL);
                ret = 1;
                break;

            case EVP_CIPH_GCM_MODE:
            case EVP_CIPH_CCM_MODE:
            case EVP_CIPH_XTS_MODE:
                ret = -1;
                break;
            default:
                ret = EVP_CIPHER_set_asn1_iv(c, type);
                break;
        }
    else
        ret = -1;
    return ret;
}
예제 #3
0
파일: evp_lib.c 프로젝트: Abhikos/conceal
int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type)
	{
	int ret;

	if (c->cipher->set_asn1_parameters != NULL)
		ret=c->cipher->set_asn1_parameters(c,type);
	else if (c->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1)
		ret=EVP_CIPHER_set_asn1_iv(c, type);
	else
		ret=-1;
	return(ret);
	}
예제 #4
0
파일: evp_lib.c 프로젝트: 0culus/openssl
int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type)
	{
	int ret;

	if (c->cipher->set_asn1_parameters != NULL)
		ret=c->cipher->set_asn1_parameters(c,type);
	else if (c->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1)
		{
		if (EVP_CIPHER_CTX_mode(c) == EVP_CIPH_WRAP_MODE)
			{
			ASN1_TYPE_set(type, V_ASN1_NULL, NULL);
			ret = 1;
			}
		else
			ret=EVP_CIPHER_set_asn1_iv(c, type);
		}
	else
		ret=-1;
	return(ret);
	}