Print this page
4853 illumos-gate is not lint-clean when built with openssl 1.0
Reviewed by Keith Wesolowski <keith.wesolowski@joyent.com>
Reviewed by Alexander Eremin <alexander.eremin@nexenta.com>


3761 
3762         if (pkey == NULL || attrib == NULL)
3763                 return (KMF_ERR_BAD_PARAMETER);
3764 
3765         if (pkey->attributes == NULL) {
3766                 pkey->attributes = sk_X509_ATTRIBUTE_new_null();
3767                 if (pkey->attributes == NULL)
3768                         return (KMF_ERR_MEMORY);
3769         }
3770         attr = X509_ATTRIBUTE_create(nid, attrib->type, attrib->value.ptr);
3771         if (attr != NULL) {
3772                 int i;
3773                 X509_ATTRIBUTE *a;
3774                 for (i = 0;
3775                     i < sk_X509_ATTRIBUTE_num(pkey->attributes); i++) {
3776                         /* LINTED E_BAD_PTR_CASE_ALIGN */
3777                         a = sk_X509_ATTRIBUTE_value(pkey->attributes, i);
3778                         if (OBJ_obj2nid(a->object) == nid) {
3779                                 X509_ATTRIBUTE_free(a);
3780                                 /* LINTED E_BAD_PTR_CAST_ALIGN */
3781                                 sk_X509_ATTRIBUTE_set(pkey->attributes,
3782                                     i, attr);
3783                                 return (KMF_OK);
3784                         }
3785                 }
3786                 if (sk_X509_ATTRIBUTE_push(pkey->attributes, attr) == NULL) {
3787                         X509_ATTRIBUTE_free(attr);
3788                         return (KMF_ERR_MEMORY);
3789                 }
3790         } else {
3791                 return (KMF_ERR_MEMORY);
3792         }
3793 
3794         return (KMF_OK);
3795 }
3796 
3797 static KMF_RETURN
3798 openssl_parse_bag(PKCS12_SAFEBAG *bag, char *pass, int passlen,
3799         STACK_OF(EVP_PKEY) *keylist, STACK_OF(X509) *certlist)
3800 {
3801         KMF_RETURN ret = KMF_OK;




3761 
3762         if (pkey == NULL || attrib == NULL)
3763                 return (KMF_ERR_BAD_PARAMETER);
3764 
3765         if (pkey->attributes == NULL) {
3766                 pkey->attributes = sk_X509_ATTRIBUTE_new_null();
3767                 if (pkey->attributes == NULL)
3768                         return (KMF_ERR_MEMORY);
3769         }
3770         attr = X509_ATTRIBUTE_create(nid, attrib->type, attrib->value.ptr);
3771         if (attr != NULL) {
3772                 int i;
3773                 X509_ATTRIBUTE *a;
3774                 for (i = 0;
3775                     i < sk_X509_ATTRIBUTE_num(pkey->attributes); i++) {
3776                         /* LINTED E_BAD_PTR_CASE_ALIGN */
3777                         a = sk_X509_ATTRIBUTE_value(pkey->attributes, i);
3778                         if (OBJ_obj2nid(a->object) == nid) {
3779                                 X509_ATTRIBUTE_free(a);
3780                                 /* LINTED E_BAD_PTR_CAST_ALIGN */
3781                                 (void) sk_X509_ATTRIBUTE_set(pkey->attributes,
3782                                     i, attr);
3783                                 return (KMF_OK);
3784                         }
3785                 }
3786                 if (sk_X509_ATTRIBUTE_push(pkey->attributes, attr) == NULL) {
3787                         X509_ATTRIBUTE_free(attr);
3788                         return (KMF_ERR_MEMORY);
3789                 }
3790         } else {
3791                 return (KMF_ERR_MEMORY);
3792         }
3793 
3794         return (KMF_OK);
3795 }
3796 
3797 static KMF_RETURN
3798 openssl_parse_bag(PKCS12_SAFEBAG *bag, char *pass, int passlen,
3799         STACK_OF(EVP_PKEY) *keylist, STACK_OF(X509) *certlist)
3800 {
3801         KMF_RETURN ret = KMF_OK;