summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/x_algor.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/asn1/x_algor.c')
-rw-r--r--src/lib/libcrypto/asn1/x_algor.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/lib/libcrypto/asn1/x_algor.c b/src/lib/libcrypto/asn1/x_algor.c
index 274e456c73..6f6fbb112a 100644
--- a/src/lib/libcrypto/asn1/x_algor.c
+++ b/src/lib/libcrypto/asn1/x_algor.c
@@ -78,60 +78,60 @@ IMPLEMENT_STACK_OF(X509_ALGOR)
78IMPLEMENT_ASN1_SET_OF(X509_ALGOR) 78IMPLEMENT_ASN1_SET_OF(X509_ALGOR)
79 79
80int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval) 80int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval)
81 { 81{
82 if (!alg) 82 if (!alg)
83 return 0; 83 return 0;
84 if (ptype != V_ASN1_UNDEF) 84 if (ptype != V_ASN1_UNDEF)
85 { 85 {
86 if (alg->parameter == NULL) 86 if (alg->parameter == NULL)
87 alg->parameter = ASN1_TYPE_new(); 87 alg->parameter = ASN1_TYPE_new();
88 if (alg->parameter == NULL) 88 if (alg->parameter == NULL)
89 return 0; 89 return 0;
90 } 90 }
91 if (alg) 91 if (alg)
92 { 92 {
93 if (alg->algorithm) 93 if (alg->algorithm)
94 ASN1_OBJECT_free(alg->algorithm); 94 ASN1_OBJECT_free(alg->algorithm);
95 alg->algorithm = aobj; 95 alg->algorithm = aobj;
96 } 96 }
97 if (ptype == 0) 97 if (ptype == 0)
98 return 1; 98 return 1;
99 if (ptype == V_ASN1_UNDEF) 99 if (ptype == V_ASN1_UNDEF)
100 { 100 {
101 if (alg->parameter) 101 if (alg->parameter)
102 { 102 {
103 ASN1_TYPE_free(alg->parameter); 103 ASN1_TYPE_free(alg->parameter);
104 alg->parameter = NULL; 104 alg->parameter = NULL;
105 }
106 } 105 }
106 }
107 else 107 else
108 ASN1_TYPE_set(alg->parameter, ptype, pval); 108 ASN1_TYPE_set(alg->parameter, ptype, pval);
109 return 1; 109 return 1;
110 } 110}
111 111
112void X509_ALGOR_get0(ASN1_OBJECT **paobj, int *pptype, void **ppval, 112void X509_ALGOR_get0(ASN1_OBJECT **paobj, int *pptype, void **ppval,
113 X509_ALGOR *algor) 113 X509_ALGOR *algor)
114 { 114{
115 if (paobj) 115 if (paobj)
116 *paobj = algor->algorithm; 116 *paobj = algor->algorithm;
117 if (pptype) 117 if (pptype)
118 { 118 {
119 if (algor->parameter == NULL) 119 if (algor->parameter == NULL)
120 { 120 {
121 *pptype = V_ASN1_UNDEF; 121 *pptype = V_ASN1_UNDEF;
122 return; 122 return;
123 } 123 }
124 else 124 else
125 *pptype = algor->parameter->type; 125 *pptype = algor->parameter->type;
126 if (ppval) 126 if (ppval)
127 *ppval = algor->parameter->value.ptr; 127 *ppval = algor->parameter->value.ptr;
128 }
129 } 128 }
129}
130 130
131/* Set up an X509_ALGOR DigestAlgorithmIdentifier from an EVP_MD */ 131/* Set up an X509_ALGOR DigestAlgorithmIdentifier from an EVP_MD */
132 132
133void X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md) 133void X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md)
134 { 134{
135 int param_type; 135 int param_type;
136 136
137 if (md->flags & EVP_MD_FLAG_DIGALGID_ABSENT) 137 if (md->flags & EVP_MD_FLAG_DIGALGID_ABSENT)
@@ -141,4 +141,4 @@ void X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md)
141 141
142 X509_ALGOR_set0(alg, OBJ_nid2obj(EVP_MD_type(md)), param_type, NULL); 142 X509_ALGOR_set0(alg, OBJ_nid2obj(EVP_MD_type(md)), param_type, NULL);
143 143
144 } 144}