[xmlsec] I needed some help with src/openssl/app.c

Aleksey Sanin aleksey at aleksey.com
Sat Feb 5 21:10:35 PST 2011


Good catch! Thanks! Fixed.

Aleksey

On 2/5/11 8:39 PM, André de Souza Pinto wrote:
> Hello Alexsey Sanin,
>
> Please analyse this code, I guess this is wrong
> but I'm not sure about this.
> --------------------------------------------------------------------------------
> --- a/src/openssl/app.c
> +++ b/src/openssl/app.c
> @@ -771,13 +771,14 @@ xmlSecOpenSSLAppPkcs12LoadBIO(BIO* bio, const
> char *pwd, for(i = 0; i<  sk_X509_num(chain); ++i) {
>           xmlSecAssert2(sk_X509_value(chain, i), NULL);
>
> -        if(X509_cmp(sk_X509_value(chain, i), cert) != 0) {
> +        ret = X509_cmp(sk_X509_value(chain, i), cert);
> +        if(ret == 0) {
>               has_cert = 1;
>               break;
>           }
>       }
>
> -    if(has_cert != 0) {
> +    if(has_cert == 0) {
>           tmpcert = X509_dup(cert);
>           if(tmpcert == NULL) {
>               xmlSecError(XMLSEC_ERRORS_HERE,
> --------------------------------------------------------------------------------
>
> I change src/openssl/app.c because cert was not returning when calling
> the following code:
>
> key = xmlSecCryptoAppKeyLoad(cert_file, xmlSecKeyDataFormatPkcs12,
> 	password, xmlSecCryptoAppGetDefaultPwdCallback(),
> (void*)cert_file);
>
> I'm using git clone git://git.gnome.org/xmlsec
>
> Thanks for your attention
>
> by André de Souza Pinto
>  From ASP Informática Ltda
> Caxias do Sul / RS / Brasil


More information about the xmlsec mailing list