Navigation


Changeset 18:e7187583dcf8 in freeDiameter for freeDiameter/fdd.y


Ignore:
Timestamp:
Oct 5, 2009, 5:13:01 PM (15 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Added CA helper script

File:
1 edited

Legend:

Unmodified
Added
Removed
  • freeDiameter/fdd.y

    r14 r18  
    112112%token          CONNPEER
    113113%token          CONNTO
     114%token          TLS_CRED
     115%token          TLS_CA
     116%token          TLS_CRL
     117%token          TLS_PRIO
     118%token          TLS_DH_BITS
    114119
    115120
     
    118123
    119124        /* The grammar definition - Sections blocs. */
    120 conffile:               /* Empty is OK */
     125conffile:               /* Empty is OK -- for simplicity here, we reject in daemon later */
    121126                        | conffile identity
    122127                        | conffile realm
     
    136141                        | conffile loadext
    137142                        | conffile connpeer
     143                        | conffile tls_cred
     144                        | conffile tls_ca
     145                        | conffile tls_crl
     146                        | conffile tls_prio
     147                        | conffile tls_dh
    138148                        | conffile errors
    139149                        {
     
    447457                        }
    448458                        ;
     459
     460tls_cred:               TLS_CRED '=' QSTRING ',' QSTRING ';'
     461                        {
     462                                conf->cnf_sec_data.cert_file = $3;
     463                                conf->cnf_sec_data.key_file = $5;
     464                               
     465                                CHECK_GNUTLS_DO( gnutls_certificate_set_x509_key_file(
     466                                                        conf->cnf_sec_data.credentials,
     467                                                        conf->cnf_sec_data.cert_file,
     468                                                        conf->cnf_sec_data.key_file,
     469                                                        GNUTLS_X509_FMT_PEM),
     470                                                { yyerror (&yylloc, conf, "Error opening certificate or private key file."); YYERROR; } );
     471                        }
     472                        ;
     473
     474tls_ca:                 TLS_CA '=' QSTRING ';'
     475                        {
     476                                conf->cnf_sec_data.ca_file = $3;
     477                                CHECK_GNUTLS_DO( gnutls_certificate_set_x509_trust_file(
     478                                                        conf->cnf_sec_data.credentials,
     479                                                        conf->cnf_sec_data.ca_file,
     480                                                        GNUTLS_X509_FMT_PEM),
     481                                                { yyerror (&yylloc, conf, "Error setting CA parameters."); YYERROR; } );
     482                        }
     483                        ;
     484                       
     485tls_crl:                TLS_CRL '=' QSTRING ';'
     486                        {
     487                                conf->cnf_sec_data.crl_file = $3;
     488                                CHECK_GNUTLS_DO( gnutls_certificate_set_x509_crl_file(
     489                                                        conf->cnf_sec_data.credentials,
     490                                                        conf->cnf_sec_data.ca_file,
     491                                                        GNUTLS_X509_FMT_PEM),
     492                                                { yyerror (&yylloc, conf, "Error setting CRL parameters."); YYERROR; } );
     493                        }
     494                        ;
     495                       
     496tls_prio:               TLS_PRIO '=' QSTRING ';'
     497                        {
     498                                const char * err_pos = NULL;
     499                                conf->cnf_sec_data.prio_string = $3;
     500                                CHECK_GNUTLS_DO( gnutls_priority_init(
     501                                                        &conf->cnf_sec_data.prio_cache,
     502                                                        conf->cnf_sec_data.prio_string,
     503                                                        &err_pos),
     504                                                { yyerror (&yylloc, conf, "Error setting Priority parameter.");
     505                                                  fprintf(stderr, "Error at position : %s\n", err_pos);
     506                                                  YYERROR; } );
     507                        }
     508                        ;
     509                       
     510tls_dh:                 TLS_DH_BITS '=' INTEGER ';'
     511                        {
     512                                conf->cnf_sec_data.dh_bits = $3;
     513                                CHECK_GNUTLS_DO( gnutls_dh_params_generate2(
     514                                                        conf->cnf_sec_data.dh_cache,
     515                                                        conf->cnf_sec_data.dh_bits),
     516                                                { yyerror (&yylloc, conf, "Error setting DH Bits parameters.");
     517                                                 YYERROR; } );
     518                        }
     519                        ;
Note: See TracChangeset for help on using the changeset viewer.