hi all,
 
    In file $openssl_src/crypto/x509/X509_vfy.c    
 
 int   X509_verify_cert(X509_STORE_CTX* ctx)
{
        .....   
        /* Is last certificate looked up self signed? */
     if (!ctx->check_issued(ctx,x,x))
      {
          if ((chain_ss == NULL) || !ctx->check_issued(ctx, x, chain_ss))
           {
               if (ctx->last_untrusted >= num)/*??????????????*/        
                    ctx->error=X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY;        
                    ctx->error=X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT;
               ctx->current_cert=x;
           }
          else
           {
               sk_X509_push(ctx->chain,chain_ss);
               num++;
               ctx->last_untrusted=num;
               ctx->current_cert=chain_ss;
               ctx->error=X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN;
               chain_ss=NULL;
           }
          ctx->error_depth=num-1;
          ok=cb(0,ctx);
          if (!ok) goto end;
      }
        ......
    if (ctx->verify != NULL)/*??????????????*/        
          ok=ctx->verify(ctx);
     else
          ok=internal_verify(ctx);
    ............
}
first question :
    /*??????????????*/        
        I think it should  if(ctx->last_untrusted <= num )        ???????
second question :
    /*??????????????*/        
        At this point, in ctx->chain ,last certificate must self signed certificate ?????
thanks
 
Regards
vagou

Reply via email to