summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/a_bitstr.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/asn1/a_bitstr.c')
-rw-r--r--src/lib/libcrypto/asn1/a_bitstr.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/lib/libcrypto/asn1/a_bitstr.c b/src/lib/libcrypto/asn1/a_bitstr.c
index b81bf4fc81..0fb9ce0c2a 100644
--- a/src/lib/libcrypto/asn1/a_bitstr.c
+++ b/src/lib/libcrypto/asn1/a_bitstr.c
@@ -113,11 +113,12 @@ int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp)
113 return(ret); 113 return(ret);
114 } 114 }
115 115
116ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, unsigned char **pp, 116ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
117 long len) 117 const unsigned char **pp, long len)
118 { 118 {
119 ASN1_BIT_STRING *ret=NULL; 119 ASN1_BIT_STRING *ret=NULL;
120 unsigned char *p,*s; 120 const unsigned char *p;
121 unsigned char *s;
121 int i; 122 int i;
122 123
123 if (len < 1) 124 if (len < 1)
@@ -164,7 +165,7 @@ ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, unsigned char **pp,
164 *pp=p; 165 *pp=p;
165 return(ret); 166 return(ret);
166err: 167err:
167 ASN1err(ASN1_F_D2I_ASN1_BIT_STRING,i); 168 ASN1err(ASN1_F_C2I_ASN1_BIT_STRING,i);
168 if ((ret != NULL) && ((a == NULL) || (*a != ret))) 169 if ((ret != NULL) && ((a == NULL) || (*a != ret)))
169 M_ASN1_BIT_STRING_free(ret); 170 M_ASN1_BIT_STRING_free(ret);
170 return(NULL); 171 return(NULL);
@@ -182,9 +183,11 @@ int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value)
182 iv= ~v; 183 iv= ~v;
183 if (!value) v=0; 184 if (!value) v=0;
184 185
186 if (a == NULL)
187 return 0;
188
185 a->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); /* clear, set on write */ 189 a->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); /* clear, set on write */
186 190
187 if (a == NULL) return(0);
188 if ((a->length < (w+1)) || (a->data == NULL)) 191 if ((a->length < (w+1)) || (a->data == NULL))
189 { 192 {
190 if (!value) return(1); /* Don't need to set */ 193 if (!value) return(1); /* Don't need to set */