diff options
author | FdaSilvaYY <fdasilvayy@gmail.com> | 2016-09-24 13:37:16 +0200 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2017-01-25 09:06:34 +0000 |
commit | d2a56999985ccf56ea6c82e6fa2f91c345bbc9d3 (patch) | |
tree | ce01aa43b9446862e64c01c383a300a63352243a | |
parent | 28b86f313b43cc70d11054d3830ef82e7af8290a (diff) | |
download | openssl-d2a56999985ccf56ea6c82e6fa2f91c345bbc9d3.tar.gz |
Few nit's
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1618)
-rw-r--r-- | crypto/x509/x509_att.c | 4 | ||||
-rw-r--r-- | crypto/x509/x509name.c | 14 | ||||
-rw-r--r-- | crypto/x509v3/v3_alt.c | 7 | ||||
-rw-r--r-- | crypto/x509v3/v3_ncons.c | 1 | ||||
-rw-r--r-- | crypto/x509v3/v3_utl.c | 6 | ||||
-rw-r--r-- | doc/man3/EVP_DigestInit.pod | 2 | ||||
-rw-r--r-- | doc/man3/SSL_CTX_set_tlsext_ticket_key_cb.pod | 13 |
7 files changed, 24 insertions, 23 deletions
diff --git a/crypto/x509/x509_att.c b/crypto/x509/x509_att.c index 15f0e4fc87..a91f9829b5 100644 --- a/crypto/x509/x509_att.c +++ b/crypto/x509/x509_att.c @@ -56,8 +56,8 @@ X509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc) { if (x == NULL || sk_X509_ATTRIBUTE_num(x) <= loc || loc < 0) return NULL; - else - return sk_X509_ATTRIBUTE_value(x, loc); + + return sk_X509_ATTRIBUTE_value(x, loc); } X509_ATTRIBUTE *X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *x, int loc) diff --git a/crypto/x509/x509name.c b/crypto/x509/x509name.c index 919d8c1e7f..ab53794741 100644 --- a/crypto/x509/x509name.c +++ b/crypto/x509/x509name.c @@ -86,9 +86,9 @@ X509_NAME_ENTRY *X509_NAME_get_entry(const X509_NAME *name, int loc) { if (name == NULL || sk_X509_NAME_ENTRY_num(name->entries) <= loc || loc < 0) - return (NULL); - else - return (sk_X509_NAME_ENTRY_value(name->entries, loc)); + return NULL; + + return sk_X509_NAME_ENTRY_value(name->entries, loc); } X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc) @@ -99,13 +99,14 @@ X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc) if (name == NULL || sk_X509_NAME_ENTRY_num(name->entries) <= loc || loc < 0) - return (NULL); + return NULL; + sk = name->entries; ret = sk_X509_NAME_ENTRY_delete(sk, loc); n = sk_X509_NAME_ENTRY_num(sk); name->modified = 1; if (loc == n) - return (ret); + return ret; /* else we need to fixup the set field */ if (loc != 0) @@ -127,7 +128,7 @@ X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc) if (set_prev + 1 < set_next) for (i = loc; i < n; i++) sk_X509_NAME_ENTRY_value(sk, i)->set--; - return (ret); + return ret; } int X509_NAME_add_entry_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, int type, @@ -136,6 +137,7 @@ int X509_NAME_add_entry_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, int type { X509_NAME_ENTRY *ne; int ret; + ne = X509_NAME_ENTRY_create_by_OBJ(NULL, obj, type, bytes, len); if (!ne) return 0; diff --git a/crypto/x509v3/v3_alt.c b/crypto/x509v3/v3_alt.c index 0364e336a0..3062250d17 100644 --- a/crypto/x509v3/v3_alt.c +++ b/crypto/x509v3/v3_alt.c @@ -303,10 +303,12 @@ static int copy_email(X509V3_CTX *ctx, GENERAL_NAMES *gens, int move_p) ASN1_IA5STRING *email = NULL; X509_NAME_ENTRY *ne; GENERAL_NAME *gen = NULL; - int i; + int i = -1; + if (ctx != NULL && ctx->flags == CTX_TEST) return 1; - if (!ctx || (!ctx->subject_cert && !ctx->subject_req)) { + if (ctx == NULL + || (ctx->subject_cert == NULL && ctx->subject_req == NULL)) { X509V3err(X509V3_F_COPY_EMAIL, X509V3_R_NO_SUBJECT_DETAILS); goto err; } @@ -317,7 +319,6 @@ static int copy_email(X509V3_CTX *ctx, GENERAL_NAMES *gens, int move_p) nm = X509_REQ_get_subject_name(ctx->subject_req); /* Now add any email address(es) to STACK */ - i = -1; while ((i = X509_NAME_get_index_by_NID(nm, NID_pkcs9_emailAddress, i)) >= 0) { ne = X509_NAME_get_entry(nm, i); diff --git a/crypto/x509v3/v3_ncons.c b/crypto/x509v3/v3_ncons.c index 9b3bb128eb..36ff966a36 100644 --- a/crypto/x509v3/v3_ncons.c +++ b/crypto/x509v3/v3_ncons.c @@ -247,6 +247,7 @@ int NAME_CONSTRAINTS_check_CN(X509 *x, NAME_CONSTRAINTS *nc) for (i = -1;;) { X509_NAME_ENTRY *ne; ASN1_STRING *hn; + i = X509_NAME_get_index_by_NID(nm, NID_commonName, i); if (i == -1) break; diff --git a/crypto/x509v3/v3_utl.c b/crypto/x509v3/v3_utl.c index 7dc9a4533e..ac5217053a 100644 --- a/crypto/x509v3/v3_utl.c +++ b/crypto/x509v3/v3_utl.c @@ -424,11 +424,11 @@ static STACK_OF(OPENSSL_STRING) *get_email(X509_NAME *name, { STACK_OF(OPENSSL_STRING) *ret = NULL; X509_NAME_ENTRY *ne; - ASN1_IA5STRING *email; + const ASN1_IA5STRING *email; GENERAL_NAME *gen; - int i; + int i = -1; + /* Now add any email address(es) to STACK */ - i = -1; /* First supplied X509_NAME */ while ((i = X509_NAME_get_index_by_NID(name, NID_pkcs9_emailAddress, i)) >= 0) { diff --git a/doc/man3/EVP_DigestInit.pod b/doc/man3/EVP_DigestInit.pod index d57f09daad..7d283fa7d3 100644 --- a/doc/man3/EVP_DigestInit.pod +++ b/doc/man3/EVP_DigestInit.pod @@ -210,7 +210,7 @@ digest name passed on the command line. unsigned char md_value[EVP_MAX_MD_SIZE]; int md_len, i; - if (!argv[1]) { + if (argv[1] == NULL) { printf("Usage: mdtest digestname\n"); exit(1); } diff --git a/doc/man3/SSL_CTX_set_tlsext_ticket_key_cb.pod b/doc/man3/SSL_CTX_set_tlsext_ticket_key_cb.pod index 71f8792275..0a925ce03a 100644 --- a/doc/man3/SSL_CTX_set_tlsext_ticket_key_cb.pod +++ b/doc/man3/SSL_CTX_set_tlsext_ticket_key_cb.pod @@ -130,20 +130,18 @@ Reference Implementation: static int ssl_tlsext_ticket_key_cb(SSL *s, unsigned char key_name[16], unsigned char *iv, EVP_CIPHER_CTX *ctx, HMAC_CTX *hctx, int enc) { if (enc) { /* create new session */ - if (RAND_bytes(iv, EVP_MAX_IV_LENGTH) ) { + if (RAND_bytes(iv, EVP_MAX_IV_LENGTH) ) return -1; /* insufficient random */ - } key = currentkey(); /* something that you need to implement */ - if ( !key ) { + if ( key == NULL ) { /* current key doesn't exist or isn't valid */ - key = createkey(); /* something that you need to implement. + key = createkey(); /* something that you need to implement. * createkey needs to initialise, a name, * an aes_key, a hmac_key and optionally * an expire time. */ - if ( !key ) { /* key couldn't be created */ + if ( key == NULL ) /* key couldn't be created */ return 0; - } } memcpy(key_name, key->name, 16); @@ -155,9 +153,8 @@ Reference Implementation: } else { /* retrieve session */ key = findkey(name); - if (!key || key->expire < now() ) { + if (key == NULL || key->expire < now() ) return 0; - } HMAC_Init_ex(&hctx, key->hmac_key, 16, EVP_sha256(), NULL); EVP_DecryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, key->aes_key, iv ); |