diff options
Diffstat (limited to 'src/lib/libcrypto/x509v3/v3_utl.c')
-rw-r--r-- | src/lib/libcrypto/x509v3/v3_utl.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/lib/libcrypto/x509v3/v3_utl.c b/src/lib/libcrypto/x509v3/v3_utl.c index c4b6143eff..d938a175ed 100644 --- a/src/lib/libcrypto/x509v3/v3_utl.c +++ b/src/lib/libcrypto/x509v3/v3_utl.c | |||
@@ -85,7 +85,7 @@ int X509V3_add_value(const char *name, const char *value, | |||
85 | char *tname = NULL, *tvalue = NULL; | 85 | char *tname = NULL, *tvalue = NULL; |
86 | if(name && !(tname = BUF_strdup(name))) goto err; | 86 | if(name && !(tname = BUF_strdup(name))) goto err; |
87 | if(value && !(tvalue = BUF_strdup(value))) goto err; | 87 | if(value && !(tvalue = BUF_strdup(value))) goto err; |
88 | if(!(vtmp = (CONF_VALUE *)OPENSSL_malloc(sizeof(CONF_VALUE)))) goto err; | 88 | if(!(vtmp = (CONF_VALUE *)malloc(sizeof(CONF_VALUE)))) goto err; |
89 | if(!*extlist && !(*extlist = sk_CONF_VALUE_new_null())) goto err; | 89 | if(!*extlist && !(*extlist = sk_CONF_VALUE_new_null())) goto err; |
90 | vtmp->section = NULL; | 90 | vtmp->section = NULL; |
91 | vtmp->name = tname; | 91 | vtmp->name = tname; |
@@ -94,9 +94,9 @@ int X509V3_add_value(const char *name, const char *value, | |||
94 | return 1; | 94 | return 1; |
95 | err: | 95 | err: |
96 | X509V3err(X509V3_F_X509V3_ADD_VALUE,ERR_R_MALLOC_FAILURE); | 96 | X509V3err(X509V3_F_X509V3_ADD_VALUE,ERR_R_MALLOC_FAILURE); |
97 | if(vtmp) OPENSSL_free(vtmp); | 97 | if(vtmp) free(vtmp); |
98 | if(tname) OPENSSL_free(tname); | 98 | if(tname) free(tname); |
99 | if(tvalue) OPENSSL_free(tvalue); | 99 | if(tvalue) free(tvalue); |
100 | return 0; | 100 | return 0; |
101 | } | 101 | } |
102 | 102 | ||
@@ -111,10 +111,10 @@ int X509V3_add_value_uchar(const char *name, const unsigned char *value, | |||
111 | void X509V3_conf_free(CONF_VALUE *conf) | 111 | void X509V3_conf_free(CONF_VALUE *conf) |
112 | { | 112 | { |
113 | if(!conf) return; | 113 | if(!conf) return; |
114 | if(conf->name) OPENSSL_free(conf->name); | 114 | if(conf->name) free(conf->name); |
115 | if(conf->value) OPENSSL_free(conf->value); | 115 | if(conf->value) free(conf->value); |
116 | if(conf->section) OPENSSL_free(conf->section); | 116 | if(conf->section) free(conf->section); |
117 | OPENSSL_free(conf); | 117 | free(conf); |
118 | } | 118 | } |
119 | 119 | ||
120 | int X509V3_add_value_bool(const char *name, int asn1_bool, | 120 | int X509V3_add_value_bool(const char *name, int asn1_bool, |
@@ -206,7 +206,7 @@ int X509V3_add_value_int(const char *name, ASN1_INTEGER *aint, | |||
206 | if(!aint) return 1; | 206 | if(!aint) return 1; |
207 | if(!(strtmp = i2s_ASN1_INTEGER(NULL, aint))) return 0; | 207 | if(!(strtmp = i2s_ASN1_INTEGER(NULL, aint))) return 0; |
208 | ret = X509V3_add_value(name, strtmp, extlist); | 208 | ret = X509V3_add_value(name, strtmp, extlist); |
209 | OPENSSL_free(strtmp); | 209 | free(strtmp); |
210 | return ret; | 210 | return ret; |
211 | } | 211 | } |
212 | 212 | ||
@@ -328,11 +328,11 @@ STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line) | |||
328 | } | 328 | } |
329 | X509V3_add_value(ntmp, NULL, &values); | 329 | X509V3_add_value(ntmp, NULL, &values); |
330 | } | 330 | } |
331 | OPENSSL_free(linebuf); | 331 | free(linebuf); |
332 | return values; | 332 | return values; |
333 | 333 | ||
334 | err: | 334 | err: |
335 | OPENSSL_free(linebuf); | 335 | free(linebuf); |
336 | sk_CONF_VALUE_pop_free(values, X509V3_conf_free); | 336 | sk_CONF_VALUE_pop_free(values, X509V3_conf_free); |
337 | return NULL; | 337 | return NULL; |
338 | 338 | ||
@@ -355,7 +355,7 @@ static char *strip_spaces(char *name) | |||
355 | 355 | ||
356 | /* hex string utilities */ | 356 | /* hex string utilities */ |
357 | 357 | ||
358 | /* Given a buffer of length 'len' return a OPENSSL_malloc'ed string with its | 358 | /* Given a buffer of length 'len' return a malloc'ed string with its |
359 | * hex representation | 359 | * hex representation |
360 | * @@@ (Contents of buffer are always kept in ASCII, also on EBCDIC machines) | 360 | * @@@ (Contents of buffer are always kept in ASCII, also on EBCDIC machines) |
361 | */ | 361 | */ |
@@ -367,7 +367,7 @@ char *hex_to_string(const unsigned char *buffer, long len) | |||
367 | int i; | 367 | int i; |
368 | const static char hexdig[] = "0123456789ABCDEF"; | 368 | const static char hexdig[] = "0123456789ABCDEF"; |
369 | if(!buffer || !len) return NULL; | 369 | if(!buffer || !len) return NULL; |
370 | if(!(tmp = OPENSSL_malloc(len * 3 + 1))) { | 370 | if(!(tmp = malloc(len * 3 + 1))) { |
371 | X509V3err(X509V3_F_HEX_TO_STRING,ERR_R_MALLOC_FAILURE); | 371 | X509V3err(X509V3_F_HEX_TO_STRING,ERR_R_MALLOC_FAILURE); |
372 | return NULL; | 372 | return NULL; |
373 | } | 373 | } |
@@ -393,14 +393,14 @@ unsigned char *string_to_hex(const char *str, long *len) | |||
393 | X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_INVALID_NULL_ARGUMENT); | 393 | X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_INVALID_NULL_ARGUMENT); |
394 | return NULL; | 394 | return NULL; |
395 | } | 395 | } |
396 | if(!(hexbuf = OPENSSL_malloc(strlen(str) >> 1))) goto err; | 396 | if(!(hexbuf = malloc(strlen(str) >> 1))) goto err; |
397 | for(p = (unsigned char *)str, q = hexbuf; *p;) { | 397 | for(p = (unsigned char *)str, q = hexbuf; *p;) { |
398 | ch = *p++; | 398 | ch = *p++; |
399 | if(ch == ':') continue; | 399 | if(ch == ':') continue; |
400 | cl = *p++; | 400 | cl = *p++; |
401 | if(!cl) { | 401 | if(!cl) { |
402 | X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_ODD_NUMBER_OF_DIGITS); | 402 | X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_ODD_NUMBER_OF_DIGITS); |
403 | OPENSSL_free(hexbuf); | 403 | free(hexbuf); |
404 | return NULL; | 404 | return NULL; |
405 | } | 405 | } |
406 | if(isupper(ch)) ch = tolower(ch); | 406 | if(isupper(ch)) ch = tolower(ch); |
@@ -422,12 +422,12 @@ unsigned char *string_to_hex(const char *str, long *len) | |||
422 | return hexbuf; | 422 | return hexbuf; |
423 | 423 | ||
424 | err: | 424 | err: |
425 | if(hexbuf) OPENSSL_free(hexbuf); | 425 | if(hexbuf) free(hexbuf); |
426 | X509V3err(X509V3_F_STRING_TO_HEX,ERR_R_MALLOC_FAILURE); | 426 | X509V3err(X509V3_F_STRING_TO_HEX,ERR_R_MALLOC_FAILURE); |
427 | return NULL; | 427 | return NULL; |
428 | 428 | ||
429 | badhex: | 429 | badhex: |
430 | OPENSSL_free(hexbuf); | 430 | free(hexbuf); |
431 | X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_ILLEGAL_HEX_DIGIT); | 431 | X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_ILLEGAL_HEX_DIGIT); |
432 | return NULL; | 432 | return NULL; |
433 | 433 | ||
@@ -531,7 +531,7 @@ static STACK_OF(OPENSSL_STRING) *get_email(X509_NAME *name, GENERAL_NAMES *gens) | |||
531 | 531 | ||
532 | static void str_free(OPENSSL_STRING str) | 532 | static void str_free(OPENSSL_STRING str) |
533 | { | 533 | { |
534 | OPENSSL_free(str); | 534 | free(str); |
535 | } | 535 | } |
536 | 536 | ||
537 | static int append_ia5(STACK_OF(OPENSSL_STRING) **sk, ASN1_IA5STRING *email) | 537 | static int append_ia5(STACK_OF(OPENSSL_STRING) **sk, ASN1_IA5STRING *email) |
@@ -608,7 +608,7 @@ ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc) | |||
608 | 608 | ||
609 | iplen2 = a2i_ipadd(ipout + iplen1, p); | 609 | iplen2 = a2i_ipadd(ipout + iplen1, p); |
610 | 610 | ||
611 | OPENSSL_free(iptmp); | 611 | free(iptmp); |
612 | iptmp = NULL; | 612 | iptmp = NULL; |
613 | 613 | ||
614 | if (!iplen2 || (iplen1 != iplen2)) | 614 | if (!iplen2 || (iplen1 != iplen2)) |
@@ -624,7 +624,7 @@ ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc) | |||
624 | 624 | ||
625 | err: | 625 | err: |
626 | if (iptmp) | 626 | if (iptmp) |
627 | OPENSSL_free(iptmp); | 627 | free(iptmp); |
628 | if (ret) | 628 | if (ret) |
629 | ASN1_OCTET_STRING_free(ret); | 629 | ASN1_OCTET_STRING_free(ret); |
630 | return NULL; | 630 | return NULL; |