From 6f007023a611a19be8d7cc79ffc8cc5e8ba946da Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Mon, 4 Oct 2010 22:31:05 -0400 Subject: [PATCH 045/150] - more template consolidation --- src/plugins/preauth/pkinit/pkinit_crypto_nss.c | 30 +++++++++++++---------- 1 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/plugins/preauth/pkinit/pkinit_crypto_nss.c b/src/plugins/preauth/pkinit/pkinit_crypto_nss.c index fedabfe..2c49a2c 100644 --- a/src/plugins/preauth/pkinit/pkinit_crypto_nss.c +++ b/src/plugins/preauth/pkinit/pkinit_crypto_nss.c @@ -254,17 +254,7 @@ issuer_and_serial_number_template[] = { { 0, 0, NULL, 0}, }; -struct realm { - SECItem name; -}; -struct principal_name { - SECItem name_type; - SECItem **name_string; -}; -struct kerberos_principal_name { - SECItem realm; - struct principal_name principal_name; -}; +/* KerberosString: RFC 4120, 5.2.1. */ static const SEC_ASN1Template kerberos_string_template[] = { { @@ -274,6 +264,10 @@ kerberos_string_template[] = { .size = sizeof(SECItem), }, }; +/* Realm: RFC 4120, 5.2.2. */ +struct realm { + SECItem name; +}; static const SEC_ASN1Template realm_template[] = { { @@ -283,6 +277,7 @@ realm_template[] = { .size = sizeof(SECItem), }, }; +/* PrincipalName: RFC 4120, 5.2.2. */ static const SEC_ASN1Template sequence_of_kerberos_string_template[] = { { @@ -292,6 +287,10 @@ sequence_of_kerberos_string_template[] = { .size = 0, }, }; +struct principal_name { + SECItem name_type; + SECItem **name_string; +}; static const SEC_ASN1Template principal_name_template[] = { { @@ -318,8 +317,13 @@ principal_name_template[] = { }, {0, 0, NULL, 0}, }; +/* KRB5PrincipalName: RFC 4556, 3.2.2. */ +struct kerberos_principal_name { + SECItem realm; + struct principal_name principal_name; +}; static const SEC_ASN1Template -nt_kerberos_principal_name_template[] = { +kerberos_principal_name_template[] = { { .kind = SEC_ASN1_SEQUENCE, .offset = 0, @@ -2632,7 +2636,7 @@ cert_add_kpn(PLArenaPool *pool, krb5_context context, /* Decode the structure. */ if (SEC_ASN1DecodeItem(pool, &kname, - nt_kerberos_principal_name_template, + kerberos_principal_name_template, name) != SECSuccess) { return ENOMEM; } -- 1.7.6.4