src/ssl_sock.c
static int
smp_fetch_ssl_c_sig_alg(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
                        const struct arg *args, struct sample *smp)
{
	X509 *crt;
	int nid;

	if (!l4 || l4->si[0].conn->xprt != &ssl_sock)
		return 0;

	if (!(l4->si[0].conn->flags & CO_FL_CONNECTED)) {
		smp->flags |= SMP_F_MAY_CHANGE;
		return 0;
	}

	/* SSL_get_peer_certificate increase X509 * ref count  */
	crt = SSL_get_peer_certificate(l4->si[0].conn->xprt_ctx);
	if (!crt)
		return 0;

	nid = OBJ_obj2nid((ASN1_OBJECT *)(crt->cert_info->signature->algorithm));

	smp->data.str.str = (char *)OBJ_nid2sn(nid);
	if (!smp->data.str.str)
		return 0;

	smp->type = SMP_T_CSTR;
	smp->data.str.len = strlen(smp->data.str.str);
	X509_free(crt);

	return 1;
}
/* str, returns the client certificate sig alg */
str, returns the client certificate sig alg
str returns the client certificate sig alg
static int
smp_fetch_ssl_c_sig_alg(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
                        const struct arg *args, struct sample *smp)
{
	X509 *crt;
	int nid;
	if (!l4 || l4->si[0].conn->xprt != &ssl_sock)
		return 0;
	if (!(l4->si[0].conn->flags & CO_FL_CONNECTED)) {
		smp->flags |= SMP_F_MAY_CHANGE;
		return 0;
	}
	crt = SSL_get_peer_certificate(l4->si[0].conn->xprt_ctx);
	if (!crt)
		return 0;
	nid = OBJ_obj2nid((ASN1_OBJECT *)(crt->cert_info->signature->algorithm));
	smp->data.str.str = (char *)OBJ_nid2sn(nid);
	if (!smp->data.str.str)
		return 0;
	smp->type = SMP_T_CSTR;
	smp->data.str.len = strlen(smp->data.str.str);
	X509_free(crt);
	return 1;
}
static int smp_fetch_ssl_c_sig_alg ( struct proxy * px , struct session * l4 , void * l7 , unsigned int opt , const struct arg * args , struct sample * smp ) { X509 * crt ; int nid ; if ( ! l4 || l4 -> si [ 0 ] . conn -> xprt != & ssl_sock ) return 0 ; if ( ! ( l4 -> si [ 0 ] . conn -> flags & CO_FL_CONNECTED ) ) { smp -> flags |= SMP_F_MAY_CHANGE ; return 0 ; } crt = SSL_get_peer_certificate ( l4 -> si [ 0 ] . conn -> xprt_ctx ) ; if ( ! crt ) return 0 ; nid = OBJ_obj2nid ( ( ASN1_OBJECT * ) ( crt -> cert_info -> signature -> algorithm ) ) ; smp -> data . str . str = ( char * ) OBJ_nid2sn ( nid ) ; if ( ! smp -> data . str . str ) return 0 ; smp -> type = SMP_T_CSTR ; smp -> data . str . len = strlen ( smp -> data . str . str ) ; X509_free ( crt ) ; return 1 ; }
str, returns the client certificate sig alg
str returns the client certificate sig alg
/* SSL_get_peer_certificate increase X509 * ref count  */