Remove goto inside an if(0) block
There were a dozen-plus instances of this construct: if (0) { label: ..... } Reviewed-by: Tim Hudson <tjh@openssl.org>
This commit is contained in:
parent
190c8c60c1
commit
666964780a
@ -97,7 +97,6 @@ int i2a_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *a)
|
|||||||
|
|
||||||
int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size)
|
int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
|
||||||
int i, j, k, m, n, again, bufsize;
|
int i, j, k, m, n, again, bufsize;
|
||||||
unsigned char *s = NULL, *sp;
|
unsigned char *s = NULL, *sp;
|
||||||
unsigned char *bufp;
|
unsigned char *bufp;
|
||||||
@ -108,16 +107,16 @@ int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size)
|
|||||||
bufsize = BIO_gets(bp, buf, size);
|
bufsize = BIO_gets(bp, buf, size);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (bufsize < 1)
|
if (bufsize < 1)
|
||||||
goto err_sl;
|
goto err;
|
||||||
i = bufsize;
|
i = bufsize;
|
||||||
if (buf[i - 1] == '\n')
|
if (buf[i - 1] == '\n')
|
||||||
buf[--i] = '\0';
|
buf[--i] = '\0';
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
goto err_sl;
|
goto err;
|
||||||
if (buf[i - 1] == '\r')
|
if (buf[i - 1] == '\r')
|
||||||
buf[--i] = '\0';
|
buf[--i] = '\0';
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
goto err_sl;
|
goto err;
|
||||||
again = (buf[i - 1] == '\\');
|
again = (buf[i - 1] == '\\');
|
||||||
|
|
||||||
for (j = 0; j < i; j++) {
|
for (j = 0; j < i; j++) {
|
||||||
@ -133,7 +132,7 @@ int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size)
|
|||||||
* We have now cleared all the crap off the end of the line
|
* We have now cleared all the crap off the end of the line
|
||||||
*/
|
*/
|
||||||
if (i < 2)
|
if (i < 2)
|
||||||
goto err_sl;
|
goto err;
|
||||||
|
|
||||||
bufp = (unsigned char *)buf;
|
bufp = (unsigned char *)buf;
|
||||||
if (first) {
|
if (first) {
|
||||||
@ -147,7 +146,7 @@ int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size)
|
|||||||
i -= again;
|
i -= again;
|
||||||
if (i % 2 != 0) {
|
if (i % 2 != 0) {
|
||||||
ASN1err(ASN1_F_A2I_ASN1_ENUMERATED, ASN1_R_ODD_NUMBER_OF_CHARS);
|
ASN1err(ASN1_F_A2I_ASN1_ENUMERATED, ASN1_R_ODD_NUMBER_OF_CHARS);
|
||||||
goto err;
|
return 0;
|
||||||
}
|
}
|
||||||
i /= 2;
|
i /= 2;
|
||||||
if (num + i > slen) {
|
if (num + i > slen) {
|
||||||
@ -155,7 +154,7 @@ int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size)
|
|||||||
if (sp == NULL) {
|
if (sp == NULL) {
|
||||||
ASN1err(ASN1_F_A2I_ASN1_ENUMERATED, ERR_R_MALLOC_FAILURE);
|
ASN1err(ASN1_F_A2I_ASN1_ENUMERATED, ERR_R_MALLOC_FAILURE);
|
||||||
OPENSSL_free(s);
|
OPENSSL_free(s);
|
||||||
goto err;
|
return 0;
|
||||||
}
|
}
|
||||||
s = sp;
|
s = sp;
|
||||||
slen = num + i * 2;
|
slen = num + i * 2;
|
||||||
@ -172,7 +171,7 @@ int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size)
|
|||||||
else {
|
else {
|
||||||
ASN1err(ASN1_F_A2I_ASN1_ENUMERATED,
|
ASN1err(ASN1_F_A2I_ASN1_ENUMERATED,
|
||||||
ASN1_R_NON_HEX_CHARACTERS);
|
ASN1_R_NON_HEX_CHARACTERS);
|
||||||
goto err;
|
return 0;
|
||||||
}
|
}
|
||||||
s[num + j] <<= 4;
|
s[num + j] <<= 4;
|
||||||
s[num + j] |= m;
|
s[num + j] |= m;
|
||||||
@ -186,11 +185,9 @@ int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size)
|
|||||||
}
|
}
|
||||||
bs->length = num;
|
bs->length = num;
|
||||||
bs->data = s;
|
bs->data = s;
|
||||||
ret = 1;
|
return 1;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
if (0) {
|
ASN1err(ASN1_F_A2I_ASN1_ENUMERATED, ASN1_R_SHORT_LINE);
|
||||||
err_sl:
|
return 0;
|
||||||
ASN1err(ASN1_F_A2I_ASN1_ENUMERATED, ASN1_R_SHORT_LINE);
|
|
||||||
}
|
|
||||||
return (ret);
|
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,6 @@ int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a)
|
|||||||
|
|
||||||
int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size)
|
int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
|
||||||
int i, j, k, m, n, again, bufsize;
|
int i, j, k, m, n, again, bufsize;
|
||||||
unsigned char *s = NULL, *sp;
|
unsigned char *s = NULL, *sp;
|
||||||
unsigned char *bufp;
|
unsigned char *bufp;
|
||||||
@ -112,16 +111,16 @@ int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size)
|
|||||||
bufsize = BIO_gets(bp, buf, size);
|
bufsize = BIO_gets(bp, buf, size);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (bufsize < 1)
|
if (bufsize < 1)
|
||||||
goto err_sl;
|
goto err;
|
||||||
i = bufsize;
|
i = bufsize;
|
||||||
if (buf[i - 1] == '\n')
|
if (buf[i - 1] == '\n')
|
||||||
buf[--i] = '\0';
|
buf[--i] = '\0';
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
goto err_sl;
|
goto err;
|
||||||
if (buf[i - 1] == '\r')
|
if (buf[i - 1] == '\r')
|
||||||
buf[--i] = '\0';
|
buf[--i] = '\0';
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
goto err_sl;
|
goto err;
|
||||||
again = (buf[i - 1] == '\\');
|
again = (buf[i - 1] == '\\');
|
||||||
|
|
||||||
for (j = 0; j < i; j++) {
|
for (j = 0; j < i; j++) {
|
||||||
@ -147,7 +146,7 @@ int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size)
|
|||||||
* We have now cleared all the crap off the end of the line
|
* We have now cleared all the crap off the end of the line
|
||||||
*/
|
*/
|
||||||
if (i < 2)
|
if (i < 2)
|
||||||
goto err_sl;
|
goto err;
|
||||||
|
|
||||||
bufp = (unsigned char *)buf;
|
bufp = (unsigned char *)buf;
|
||||||
if (first) {
|
if (first) {
|
||||||
@ -161,7 +160,7 @@ int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size)
|
|||||||
i -= again;
|
i -= again;
|
||||||
if (i % 2 != 0) {
|
if (i % 2 != 0) {
|
||||||
ASN1err(ASN1_F_A2I_ASN1_INTEGER, ASN1_R_ODD_NUMBER_OF_CHARS);
|
ASN1err(ASN1_F_A2I_ASN1_INTEGER, ASN1_R_ODD_NUMBER_OF_CHARS);
|
||||||
goto err;
|
return 0;
|
||||||
}
|
}
|
||||||
i /= 2;
|
i /= 2;
|
||||||
if (num + i > slen) {
|
if (num + i > slen) {
|
||||||
@ -169,7 +168,7 @@ int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size)
|
|||||||
if (sp == NULL) {
|
if (sp == NULL) {
|
||||||
ASN1err(ASN1_F_A2I_ASN1_INTEGER, ERR_R_MALLOC_FAILURE);
|
ASN1err(ASN1_F_A2I_ASN1_INTEGER, ERR_R_MALLOC_FAILURE);
|
||||||
OPENSSL_free(s);
|
OPENSSL_free(s);
|
||||||
goto err;
|
return 0;
|
||||||
}
|
}
|
||||||
s = sp;
|
s = sp;
|
||||||
slen = num + i * 2;
|
slen = num + i * 2;
|
||||||
@ -200,11 +199,8 @@ int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size)
|
|||||||
}
|
}
|
||||||
bs->length = num;
|
bs->length = num;
|
||||||
bs->data = s;
|
bs->data = s;
|
||||||
ret = 1;
|
return 1;
|
||||||
err:
|
err:
|
||||||
if (0) {
|
ASN1err(ASN1_F_A2I_ASN1_INTEGER, ASN1_R_SHORT_LINE);
|
||||||
err_sl:
|
return 0;
|
||||||
ASN1err(ASN1_F_A2I_ASN1_INTEGER, ASN1_R_SHORT_LINE);
|
|
||||||
}
|
|
||||||
return (ret);
|
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,6 @@ int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type)
|
|||||||
|
|
||||||
int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size)
|
int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
|
||||||
int i, j, k, m, n, again, bufsize;
|
int i, j, k, m, n, again, bufsize;
|
||||||
unsigned char *s = NULL, *sp;
|
unsigned char *s = NULL, *sp;
|
||||||
unsigned char *bufp;
|
unsigned char *bufp;
|
||||||
@ -107,7 +106,7 @@ int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size)
|
|||||||
if (first)
|
if (first)
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
goto err_sl;
|
goto err;
|
||||||
}
|
}
|
||||||
first = 0;
|
first = 0;
|
||||||
|
|
||||||
@ -115,11 +114,11 @@ int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size)
|
|||||||
if (buf[i - 1] == '\n')
|
if (buf[i - 1] == '\n')
|
||||||
buf[--i] = '\0';
|
buf[--i] = '\0';
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
goto err_sl;
|
goto err;
|
||||||
if (buf[i - 1] == '\r')
|
if (buf[i - 1] == '\r')
|
||||||
buf[--i] = '\0';
|
buf[--i] = '\0';
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
goto err_sl;
|
goto err;
|
||||||
again = (buf[i - 1] == '\\');
|
again = (buf[i - 1] == '\\');
|
||||||
|
|
||||||
for (j = i - 1; j > 0; j--) {
|
for (j = i - 1; j > 0; j--) {
|
||||||
@ -145,7 +144,7 @@ int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size)
|
|||||||
* We have now cleared all the crap off the end of the line
|
* We have now cleared all the crap off the end of the line
|
||||||
*/
|
*/
|
||||||
if (i < 2)
|
if (i < 2)
|
||||||
goto err_sl;
|
goto err;
|
||||||
|
|
||||||
bufp = (unsigned char *)buf;
|
bufp = (unsigned char *)buf;
|
||||||
|
|
||||||
@ -153,7 +152,7 @@ int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size)
|
|||||||
i -= again;
|
i -= again;
|
||||||
if (i % 2 != 0) {
|
if (i % 2 != 0) {
|
||||||
ASN1err(ASN1_F_A2I_ASN1_STRING, ASN1_R_ODD_NUMBER_OF_CHARS);
|
ASN1err(ASN1_F_A2I_ASN1_STRING, ASN1_R_ODD_NUMBER_OF_CHARS);
|
||||||
goto err;
|
return 0;
|
||||||
}
|
}
|
||||||
i /= 2;
|
i /= 2;
|
||||||
if (num + i > slen) {
|
if (num + i > slen) {
|
||||||
@ -161,7 +160,7 @@ int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size)
|
|||||||
if (sp == NULL) {
|
if (sp == NULL) {
|
||||||
ASN1err(ASN1_F_A2I_ASN1_STRING, ERR_R_MALLOC_FAILURE);
|
ASN1err(ASN1_F_A2I_ASN1_STRING, ERR_R_MALLOC_FAILURE);
|
||||||
OPENSSL_free(s);
|
OPENSSL_free(s);
|
||||||
goto err;
|
return 0;
|
||||||
}
|
}
|
||||||
s = sp;
|
s = sp;
|
||||||
slen = num + i * 2;
|
slen = num + i * 2;
|
||||||
@ -178,7 +177,7 @@ int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size)
|
|||||||
else {
|
else {
|
||||||
ASN1err(ASN1_F_A2I_ASN1_STRING,
|
ASN1err(ASN1_F_A2I_ASN1_STRING,
|
||||||
ASN1_R_NON_HEX_CHARACTERS);
|
ASN1_R_NON_HEX_CHARACTERS);
|
||||||
goto err;
|
return 0;
|
||||||
}
|
}
|
||||||
s[num + j] <<= 4;
|
s[num + j] <<= 4;
|
||||||
s[num + j] |= m;
|
s[num + j] |= m;
|
||||||
@ -192,11 +191,9 @@ int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size)
|
|||||||
}
|
}
|
||||||
bs->length = num;
|
bs->length = num;
|
||||||
bs->data = s;
|
bs->data = s;
|
||||||
ret = 1;
|
return 1;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
if (0) {
|
ASN1err(ASN1_F_A2I_ASN1_STRING, ASN1_R_SHORT_LINE);
|
||||||
err_sl:
|
return 0;
|
||||||
ASN1err(ASN1_F_A2I_ASN1_STRING, ASN1_R_SHORT_LINE);
|
|
||||||
}
|
|
||||||
return (ret);
|
|
||||||
}
|
}
|
||||||
|
@ -490,7 +490,7 @@ int ASN1_UTCTIME_print(BIO *bp, const ASN1_UTCTIME *tm)
|
|||||||
int X509_NAME_print(BIO *bp, X509_NAME *name, int obase)
|
int X509_NAME_print(BIO *bp, X509_NAME *name, int obase)
|
||||||
{
|
{
|
||||||
char *s, *c, *b;
|
char *s, *c, *b;
|
||||||
int ret = 0, l, i;
|
int l, i;
|
||||||
|
|
||||||
l = 80 - 2 - obase;
|
l = 80 - 2 - obase;
|
||||||
|
|
||||||
@ -535,11 +535,10 @@ int X509_NAME_print(BIO *bp, X509_NAME *name, int obase)
|
|||||||
l--;
|
l--;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 1;
|
|
||||||
if (0) {
|
|
||||||
err:
|
|
||||||
X509err(X509_F_X509_NAME_PRINT, ERR_R_BUF_LIB);
|
|
||||||
}
|
|
||||||
OPENSSL_free(b);
|
OPENSSL_free(b);
|
||||||
return (ret);
|
return 1;
|
||||||
|
err:
|
||||||
|
X509err(X509_F_X509_NAME_PRINT, ERR_R_BUF_LIB);
|
||||||
|
OPENSSL_free(b);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -327,7 +327,7 @@ static int do_dh_print(BIO *bp, const DH *x, int indent,
|
|||||||
ASN1_PCTX *ctx, int ptype)
|
ASN1_PCTX *ctx, int ptype)
|
||||||
{
|
{
|
||||||
unsigned char *m = NULL;
|
unsigned char *m = NULL;
|
||||||
int reason = ERR_R_BUF_LIB, ret = 0;
|
int reason = ERR_R_BUF_LIB;
|
||||||
size_t buf_len = 0;
|
size_t buf_len = 0;
|
||||||
|
|
||||||
const char *ktype = NULL;
|
const char *ktype = NULL;
|
||||||
@ -415,13 +415,13 @@ static int do_dh_print(BIO *bp, const DH *x, int indent,
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 1;
|
|
||||||
if (0) {
|
|
||||||
err:
|
|
||||||
DHerr(DH_F_DO_DH_PRINT, reason);
|
|
||||||
}
|
|
||||||
OPENSSL_free(m);
|
OPENSSL_free(m);
|
||||||
return (ret);
|
return 1;
|
||||||
|
|
||||||
|
err:
|
||||||
|
DHerr(DH_F_DO_DH_PRINT, reason);
|
||||||
|
OPENSSL_free(m);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int int_dh_size(const EVP_PKEY *pkey)
|
static int int_dh_size(const EVP_PKEY *pkey)
|
||||||
|
@ -489,12 +489,12 @@ int X509_verify_cert(X509_STORE_CTX *ctx)
|
|||||||
/* If we get this far evaluate policies */
|
/* If we get this far evaluate policies */
|
||||||
if (!bad_chain && (ctx->param->flags & X509_V_FLAG_POLICY_CHECK))
|
if (!bad_chain && (ctx->param->flags & X509_V_FLAG_POLICY_CHECK))
|
||||||
ok = ctx->check_policy(ctx);
|
ok = ctx->check_policy(ctx);
|
||||||
if (!ok)
|
if (ok)
|
||||||
goto end;
|
goto done;
|
||||||
if (0) {
|
|
||||||
end:
|
end:
|
||||||
X509_get_pubkey_parameters(NULL, ctx->chain);
|
X509_get_pubkey_parameters(NULL, ctx->chain);
|
||||||
}
|
done:
|
||||||
sk_X509_free(sktmp);
|
sk_X509_free(sktmp);
|
||||||
X509_free(chain_ss);
|
X509_free(chain_ss);
|
||||||
return ok;
|
return ok;
|
||||||
|
@ -200,12 +200,12 @@ static int policy_cache_new(X509 *x)
|
|||||||
goto bad_cache;
|
goto bad_cache;
|
||||||
} else if (!policy_cache_set_int(&cache->any_skip, ext_any))
|
} else if (!policy_cache_set_int(&cache->any_skip, ext_any))
|
||||||
goto bad_cache;
|
goto bad_cache;
|
||||||
|
goto just_cleanup;
|
||||||
|
|
||||||
if (0) {
|
|
||||||
bad_cache:
|
bad_cache:
|
||||||
x->ex_flags |= EXFLAG_INVALID_POLICY;
|
x->ex_flags |= EXFLAG_INVALID_POLICY;
|
||||||
}
|
|
||||||
|
|
||||||
|
just_cleanup:
|
||||||
if (ext_pcons)
|
if (ext_pcons)
|
||||||
POLICY_CONSTRAINTS_free(ext_pcons);
|
POLICY_CONSTRAINTS_free(ext_pcons);
|
||||||
|
|
||||||
|
@ -96,17 +96,16 @@ char *argv[];
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = 1;
|
ret = 1;
|
||||||
|
goto done;
|
||||||
|
|
||||||
if (0) {
|
|
||||||
err:
|
err:
|
||||||
if (ERR_peek_error() == 0) { /* system call error */
|
if (ERR_peek_error() == 0) { /* system call error */
|
||||||
fprintf(stderr, "errno=%d ", errno);
|
fprintf(stderr, "errno=%d ", errno);
|
||||||
perror("error");
|
perror("error");
|
||||||
} else
|
} else
|
||||||
ERR_print_errors_fp(stderr);
|
ERR_print_errors_fp(stderr);
|
||||||
}
|
done:
|
||||||
BIO_free_all(out);
|
BIO_free_all(out);
|
||||||
SSL_CTX_free(ssl_ctx);
|
SSL_CTX_free(ssl_ctx);
|
||||||
exit(!ret);
|
return (ret == 1);
|
||||||
return (ret);
|
|
||||||
}
|
}
|
||||||
|
@ -1189,7 +1189,7 @@ int ssl3_get_server_certificate(SSL *s)
|
|||||||
|
|
||||||
if ((sk = sk_X509_new_null()) == NULL) {
|
if ((sk = sk_X509_new_null()) == NULL) {
|
||||||
SSLerr(SSL_F_SSL3_GET_SERVER_CERTIFICATE, ERR_R_MALLOC_FAILURE);
|
SSLerr(SSL_F_SSL3_GET_SERVER_CERTIFICATE, ERR_R_MALLOC_FAILURE);
|
||||||
goto err;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
n2l3(p, llen);
|
n2l3(p, llen);
|
||||||
@ -1222,7 +1222,7 @@ int ssl3_get_server_certificate(SSL *s)
|
|||||||
}
|
}
|
||||||
if (!sk_X509_push(sk, x)) {
|
if (!sk_X509_push(sk, x)) {
|
||||||
SSLerr(SSL_F_SSL3_GET_SERVER_CERTIFICATE, ERR_R_MALLOC_FAILURE);
|
SSLerr(SSL_F_SSL3_GET_SERVER_CERTIFICATE, ERR_R_MALLOC_FAILURE);
|
||||||
goto err;
|
goto done;
|
||||||
}
|
}
|
||||||
x = NULL;
|
x = NULL;
|
||||||
nc += l + 3;
|
nc += l + 3;
|
||||||
@ -1250,7 +1250,7 @@ int ssl3_get_server_certificate(SSL *s)
|
|||||||
|
|
||||||
sc = ssl_sess_cert_new();
|
sc = ssl_sess_cert_new();
|
||||||
if (sc == NULL)
|
if (sc == NULL)
|
||||||
goto err;
|
goto done;
|
||||||
|
|
||||||
ssl_sess_cert_free(s->session->sess_cert);
|
ssl_sess_cert_free(s->session->sess_cert);
|
||||||
s->session->sess_cert = sc;
|
s->session->sess_cert = sc;
|
||||||
@ -1332,11 +1332,11 @@ int ssl3_get_server_certificate(SSL *s)
|
|||||||
|
|
||||||
x = NULL;
|
x = NULL;
|
||||||
ret = 1;
|
ret = 1;
|
||||||
if (0) {
|
goto done;
|
||||||
|
|
||||||
f_err:
|
f_err:
|
||||||
ssl3_send_alert(s, SSL3_AL_FATAL, al);
|
ssl3_send_alert(s, SSL3_AL_FATAL, al);
|
||||||
}
|
done:
|
||||||
err:
|
|
||||||
EVP_PKEY_free(pkey);
|
EVP_PKEY_free(pkey);
|
||||||
X509_free(x);
|
X509_free(x);
|
||||||
sk_X509_pop_free(sk, X509_free);
|
sk_X509_pop_free(sk, X509_free);
|
||||||
|
@ -3570,7 +3570,6 @@ long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg)
|
|||||||
ptmp = EVP_PKEY_new();
|
ptmp = EVP_PKEY_new();
|
||||||
if (!ptmp)
|
if (!ptmp)
|
||||||
return 0;
|
return 0;
|
||||||
if (0) ;
|
|
||||||
#ifndef OPENSSL_NO_RSA
|
#ifndef OPENSSL_NO_RSA
|
||||||
else if (sc->peer_rsa_tmp)
|
else if (sc->peer_rsa_tmp)
|
||||||
rv = EVP_PKEY_set1_RSA(ptmp, sc->peer_rsa_tmp);
|
rv = EVP_PKEY_set1_RSA(ptmp, sc->peer_rsa_tmp);
|
||||||
|
@ -3184,7 +3184,7 @@ int ssl3_get_client_certificate(SSL *s)
|
|||||||
|
|
||||||
if ((sk = sk_X509_new_null()) == NULL) {
|
if ((sk = sk_X509_new_null()) == NULL) {
|
||||||
SSLerr(SSL_F_SSL3_GET_CLIENT_CERTIFICATE, ERR_R_MALLOC_FAILURE);
|
SSLerr(SSL_F_SSL3_GET_CLIENT_CERTIFICATE, ERR_R_MALLOC_FAILURE);
|
||||||
goto err;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
n2l3(p, llen);
|
n2l3(p, llen);
|
||||||
@ -3206,7 +3206,7 @@ int ssl3_get_client_certificate(SSL *s)
|
|||||||
x = d2i_X509(NULL, &p, l);
|
x = d2i_X509(NULL, &p, l);
|
||||||
if (x == NULL) {
|
if (x == NULL) {
|
||||||
SSLerr(SSL_F_SSL3_GET_CLIENT_CERTIFICATE, ERR_R_ASN1_LIB);
|
SSLerr(SSL_F_SSL3_GET_CLIENT_CERTIFICATE, ERR_R_ASN1_LIB);
|
||||||
goto err;
|
goto done;
|
||||||
}
|
}
|
||||||
if (p != (q + l)) {
|
if (p != (q + l)) {
|
||||||
al = SSL_AD_DECODE_ERROR;
|
al = SSL_AD_DECODE_ERROR;
|
||||||
@ -3216,7 +3216,7 @@ int ssl3_get_client_certificate(SSL *s)
|
|||||||
}
|
}
|
||||||
if (!sk_X509_push(sk, x)) {
|
if (!sk_X509_push(sk, x)) {
|
||||||
SSLerr(SSL_F_SSL3_GET_CLIENT_CERTIFICATE, ERR_R_MALLOC_FAILURE);
|
SSLerr(SSL_F_SSL3_GET_CLIENT_CERTIFICATE, ERR_R_MALLOC_FAILURE);
|
||||||
goto err;
|
goto done;
|
||||||
}
|
}
|
||||||
x = NULL;
|
x = NULL;
|
||||||
nc += l + 3;
|
nc += l + 3;
|
||||||
@ -3279,7 +3279,7 @@ int ssl3_get_client_certificate(SSL *s)
|
|||||||
s->session->sess_cert = ssl_sess_cert_new();
|
s->session->sess_cert = ssl_sess_cert_new();
|
||||||
if (s->session->sess_cert == NULL) {
|
if (s->session->sess_cert == NULL) {
|
||||||
SSLerr(SSL_F_SSL3_GET_CLIENT_CERTIFICATE, ERR_R_MALLOC_FAILURE);
|
SSLerr(SSL_F_SSL3_GET_CLIENT_CERTIFICATE, ERR_R_MALLOC_FAILURE);
|
||||||
goto err;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sk_X509_pop_free(s->session->sess_cert->cert_chain, X509_free);
|
sk_X509_pop_free(s->session->sess_cert->cert_chain, X509_free);
|
||||||
@ -3288,15 +3288,13 @@ int ssl3_get_client_certificate(SSL *s)
|
|||||||
* Inconsistency alert: cert_chain does *not* include the peer's own
|
* Inconsistency alert: cert_chain does *not* include the peer's own
|
||||||
* certificate, while we do include it in s3_clnt.c
|
* certificate, while we do include it in s3_clnt.c
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sk = NULL;
|
sk = NULL;
|
||||||
|
|
||||||
ret = 1;
|
ret = 1;
|
||||||
if (0) {
|
goto done;
|
||||||
|
|
||||||
f_err:
|
f_err:
|
||||||
ssl3_send_alert(s, SSL3_AL_FATAL, al);
|
ssl3_send_alert(s, SSL3_AL_FATAL, al);
|
||||||
}
|
done:
|
||||||
err:
|
|
||||||
X509_free(x);
|
X509_free(x);
|
||||||
sk_X509_pop_free(sk, X509_free);
|
sk_X509_pop_free(sk, X509_free);
|
||||||
return (ret);
|
return (ret);
|
||||||
|
@ -325,10 +325,6 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp,
|
|||||||
if (as == NULL)
|
if (as == NULL)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
if (0) {
|
|
||||||
i2d_SSL_SESSION_ASN1(NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!a || !*a) {
|
if (!a || !*a) {
|
||||||
ret = SSL_SESSION_new();
|
ret = SSL_SESSION_new();
|
||||||
if (ret == NULL)
|
if (ret == NULL)
|
||||||
|
@ -850,12 +850,12 @@ STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file)
|
|||||||
sk_X509_NAME_push(ret, xn);
|
sk_X509_NAME_push(ret, xn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
goto done;
|
||||||
|
|
||||||
if (0) {
|
|
||||||
err:
|
err:
|
||||||
sk_X509_NAME_pop_free(ret, X509_NAME_free);
|
sk_X509_NAME_pop_free(ret, X509_NAME_free);
|
||||||
ret = NULL;
|
ret = NULL;
|
||||||
}
|
done:
|
||||||
sk_X509_NAME_free(sk);
|
sk_X509_NAME_free(sk);
|
||||||
BIO_free(in);
|
BIO_free(in);
|
||||||
X509_free(x);
|
X509_free(x);
|
||||||
@ -911,17 +911,15 @@ int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
|
goto done;
|
||||||
|
|
||||||
if (0) {
|
|
||||||
err:
|
err:
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
done:
|
||||||
BIO_free(in);
|
BIO_free(in);
|
||||||
if (x != NULL)
|
if (x != NULL)
|
||||||
X509_free(x);
|
X509_free(x);
|
||||||
|
|
||||||
(void)sk_X509_NAME_set_cmp_func(stack, oldcmp);
|
(void)sk_X509_NAME_set_cmp_func(stack, oldcmp);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2838,13 +2838,11 @@ SSL *SSL_dup(SSL *s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return ret;
|
||||||
|
|
||||||
if (0) {
|
|
||||||
err:
|
err:
|
||||||
SSL_free(ret);
|
SSL_free(ret);
|
||||||
ret = NULL;
|
return NULL;
|
||||||
}
|
|
||||||
return (ret);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ssl_clear_cipher_ctx(SSL *s)
|
void ssl_clear_cipher_ctx(SSL *s)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user