{
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)
{
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)
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)
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,
{
X509_NAME_ENTRY *ne;
int ret;
+
ne = X509_NAME_ENTRY_create_by_OBJ(NULL, obj, type, bytes, len);
if (!ne)
return 0;
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;
}
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);
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;
{
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) {
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);
}
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);
} 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 );