Path: blob/main/crypto/krb5/src/plugins/preauth/pkinit/pkinit_trace.h
34923 views
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */1/* plugins/preauth/pkinit/pkinit_trace.h - PKINIT tracing macros */2/*3* Copyright (C) 2012 by the Massachusetts Institute of Technology.4* All rights reserved.5*6* Redistribution and use in source and binary forms, with or without7* modification, are permitted provided that the following conditions8* are met:9*10* * Redistributions of source code must retain the above copyright11* notice, this list of conditions and the following disclaimer.12*13* * Redistributions in binary form must reproduce the above copyright14* notice, this list of conditions and the following disclaimer in15* the documentation and/or other materials provided with the16* distribution.17*18* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS19* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT20* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS21* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE22* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,23* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES24* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR25* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)26* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,27* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)28* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED29* OF THE POSSIBILITY OF SUCH DAMAGE.30*/3132#ifndef PKINIT_TRACE_H33#define PKINIT_TRACE_H3435#include "k5-trace.h"3637#define TRACE_PKINIT_CLIENT_EKU_ACCEPT(c) \38TRACE(c, "PKINIT client found acceptable EKU in KDC cert")39#define TRACE_PKINIT_CLIENT_EKU_REJECT(c) \40TRACE(c, "PKINIT client found no acceptable EKU in KDC cert")41#define TRACE_PKINIT_CLIENT_EKU_SKIP(c) \42TRACE(c, "PKINIT client skipping EKU check due to configuration")43#define TRACE_PKINIT_CLIENT_FRESHNESS_TOKEN(c) \44TRACE(c, "PKINIT client received freshness token from KDC")45#define TRACE_PKINIT_CLIENT_NO_IDENTITY(c) \46TRACE(c, "PKINIT client has no configured identity; giving up")47#define TRACE_PKINIT_CLIENT_REP_CHECKSUM_FAIL(c, expected, received) \48TRACE(c, "PKINIT client checksum mismatch: expected {cksum}, " \49"received {cksum}", expected, received)50#define TRACE_PKINIT_CLIENT_REP_DH(c) \51TRACE(c, "PKINIT client verified DH reply")52#define TRACE_PKINIT_CLIENT_REP_DH_FAIL(c) \53TRACE(c, "PKINIT client could not verify DH reply")54#define TRACE_PKINIT_CLIENT_REQ_CHECKSUMS(c, ck1, ck2) \55TRACE(c, "PKINIT client computed checksums: {hexdata} {hexdata}", \56ck1, &(ck2)->checksum)57#define TRACE_PKINIT_CLIENT_REQ_DH(c) \58TRACE(c, "PKINIT client making DH request")59#define TRACE_PKINIT_CLIENT_SAN_CONFIG_DNSNAME(c, host) \60TRACE(c, "PKINIT client config accepts KDC dNSName SAN {str}", host)61#define TRACE_PKINIT_CLIENT_SAN_MATCH_DNSNAME(c, host) \62TRACE(c, "PKINIT client matched KDC hostname {str} against " \63"dNSName SAN; EKU check still required", host)64#define TRACE_PKINIT_CLIENT_SAN_MATCH_NONE(c) \65TRACE(c, "PKINIT client found no acceptable SAN in KDC cert")66#define TRACE_PKINIT_CLIENT_SAN_MATCH_PRINC(c, princ) \67TRACE(c, "PKINIT client matched KDC principal {princ} against " \68"id-pkinit-san; no EKU check required", princ)69#define TRACE_PKINIT_CLIENT_SAN_ERR(c) \70TRACE(c, "PKINIT client failed to decode SANs in KDC cert")71#define TRACE_PKINIT_CLIENT_SAN_KDCCERT_DNSNAME(c, host) \72TRACE(c, "PKINIT client found dNSName SAN in KDC cert: {str}", host)73#define TRACE_PKINIT_CLIENT_SAN_KDCCERT_PRINC(c, princ) \74TRACE(c, "PKINIT client found id-pkinit-san in KDC cert: {princ}", princ)75#define TRACE_PKINIT_CLIENT_TRYAGAIN(c) \76TRACE(c, "PKINIT client trying again with KDC-provided parameters")7778#define TRACE_PKINIT_DH_GROUP_UNAVAILABLE(c, name) \79TRACE(c, "PKINIT key exchange group {str} unsupported", name)80#define TRACE_PKINIT_DH_INVALID_MIN_BITS(c, str) \81TRACE(c, "Invalid pkinit_dh_min_bits value {str}, using default", str)82#define TRACE_PKINIT_DH_NEGOTIATED_GROUP(c, desc) \83TRACE(c, "PKINIT accepting KDC key exchange group preference {str}", desc)84#define TRACE_PKINIT_DH_PROPOSING_GROUP(c, desc) \85TRACE(c, "PKINIT using {str} key exchange group", desc)86#define TRACE_PKINIT_DH_RECEIVED_GROUP(c, desc) \87TRACE(c, "PKINIT received {str} key from client for key exchange", desc)88#define TRACE_PKINIT_DH_REJECTING_GROUP(c, desc, mindesc) \89TRACE(c, "PKINIT client key has group {str}, need at least {str}", \90desc, mindesc)9192#define TRACE_PKINIT_KDF_ALG(c, kdf, keyblock) \93TRACE(c, "PKINIT used KDF {hexdata} to compute reply key {keyblock}", \94kdf, keyblock)95#define TRACE_PKINIT_KDF_OS2K(c, keyblock) \96TRACE(c, "PKINIT used octetstring2key to compute reply key {keyblock}", \97keyblock)9899#define TRACE_PKINIT_OPENSSL_ERROR(c, msg) \100TRACE(c, "PKINIT OpenSSL error: {str}", msg)101102#define TRACE_PKINIT_PKCS11_NO_MATCH_TOKEN(c) \103TRACE(c, "PKINIT PKCS#11 module has no matching tokens")104#define TRACE_PKINIT_PKCS11_NO_TOKEN(c) \105TRACE(c, "PKINIT PKCS#11 module shows no slots with tokens")106#define TRACE_PKINIT_PKCS11_OPEN(c, name) \107TRACE(c, "PKINIT opening PKCS#11 module \"{str}\"", name)108#define TRACE_PKINIT_PKCS11_SLOT(c, slot, len, label) \109TRACE(c, "PKINIT PKCS#11 slotid {int} token {lenstr}", \110slot, len, label)111112#define TRACE_PKINIT_SERVER_CERT_AUTH(c, modname) \113TRACE(c, "PKINIT server authorizing cert with module {str}", \114modname)115#define TRACE_PKINIT_SERVER_EKU_REJECT(c) \116TRACE(c, "PKINIT server found no acceptable EKU in client cert")117#define TRACE_PKINIT_SERVER_EKU_SKIP(c) \118TRACE(c, "PKINIT server skipping EKU check due to configuration")119#define TRACE_PKINIT_SERVER_INIT_REALM(c, realm) \120TRACE(c, "PKINIT server initializing realm {str}", realm)121#define TRACE_PKINIT_SERVER_INIT_FAIL(c, realm, retval) \122TRACE(c, "PKINIT server initialization failed for realm {str}: {kerr}", \123realm, retval)124#define TRACE_PKINIT_SERVER_MATCHING_UPN_FOUND(c) \125TRACE(c, "PKINIT server found a matching UPN SAN in client cert")126#define TRACE_PKINIT_SERVER_MATCHING_SAN_FOUND(c) \127TRACE(c, "PKINIT server found a matching SAN in client cert")128#define TRACE_PKINIT_SERVER_NO_SAN(c) \129TRACE(c, "PKINIT server found no SAN in client cert")130#define TRACE_PKINIT_SERVER_PADATA_VERIFY(c) \131TRACE(c, "PKINIT server verifying KRB5_PADATA_PK_AS_REQ")132#define TRACE_PKINIT_SERVER_PADATA_VERIFY_FAIL(c) \133TRACE(c, "PKINIT server failed to verify PA data")134#define TRACE_PKINIT_SERVER_RETURN_PADATA(c) \135TRACE(c, "PKINIT server returning PA data")136#define TRACE_PKINIT_SERVER_SAN_REJECT(c) \137TRACE(c, "PKINIT server found no acceptable SAN in client cert")138#define TRACE_PKINIT_SERVER_UPN_PARSE_FAIL(c, upn, ret) \139TRACE(c, "PKINIT server could not parse UPN \"{str}\": {kerr}", \140upn, ret)141142#define TRACE_PKINIT_CERT_CHAIN_NAME(c, index, name) \143TRACE(c, "PKINIT chain cert #{int}: {str}", index, name)144#define TRACE_PKINIT_CERT_NUM_MATCHING(c, total, nummatch) \145TRACE(c, "PKINIT client checked {int} certs, found {int} matches", \146total, nummatch)147#define TRACE_PKINIT_CERT_RULE(c, rule) \148TRACE(c, "PKINIT client matching rule '{str}' against certificates", rule)149#define TRACE_PKINIT_CERT_RULE_INVALID(c, rule) \150TRACE(c, "PKINIT client ignoring invalid rule '{str}'", rule)151152#define TRACE_PKINIT_EKU(c) \153TRACE(c, "PKINIT found acceptable EKU and digitalSignature KU")154#define TRACE_PKINIT_EKU_NO_KU(c) \155TRACE(c, "PKINIT found acceptable EKU but no digitalSignature KU")156#define TRACE_PKINIT_IDENTITY_OPTION(c, name) \157TRACE(c, "PKINIT loading identity {str}", name)158#define TRACE_PKINIT_LOADED_CERT(c, name) \159TRACE(c, "PKINIT loaded cert and key for {str}", name)160#define TRACE_PKINIT_LOAD_FROM_FILE(c, name) \161TRACE(c, "PKINIT loading CA certs and CRLs from FILE {str}", name)162#define TRACE_PKINIT_LOAD_FROM_DIR(c, name) \163TRACE(c, "PKINIT loading CA certs and CRLs from DIR {str}", name)164#define TRACE_PKINIT_NO_CA_ANCHOR(c, file) \165TRACE(c, "PKINIT no anchor CA in file {str}", file)166#define TRACE_PKINIT_NO_CA_INTERMEDIATE(c, file) \167TRACE(c, "PKINIT no intermediate CA in file {str}", file)168#define TRACE_PKINIT_NO_CERT(c) \169TRACE(c, "PKINIT no certificate provided")170#define TRACE_PKINIT_NO_CERT_AND_KEY(c, dirname) \171TRACE(c, "PKINIT no cert and key pair found in directory {str}", \172dirname)173#define TRACE_PKINIT_NO_CRL(c, file) \174TRACE(c, "PKINIT no CRL in file {str}", file)175#define TRACE_PKINIT_NO_DEFAULT_CERT(c, count) \176TRACE(c, "PKINIT error: There are {int} certs, but there must " \177"be exactly one.", count)178#define TRACE_PKINIT_NO_MATCHING_CERT(c) \179TRACE(c, "PKINIT no matching certificate found")180#define TRACE_PKINIT_NO_PRIVKEY(c) \181TRACE(c, "PKINIT no private key provided")182#define TRACE_PKINIT_PKCS_DECODE_FAIL(c, name) \183TRACE(c, "PKINIT failed to decode PKCS12 file {str} contents", name)184#define TRACE_PKINIT_PKCS_OPEN_FAIL(c, name, err) \185TRACE(c, "PKINIT failed to open PKCS12 file {str}: err {errno}", \186name, err)187#define TRACE_PKINIT_PKCS_PARSE_FAIL_FIRST(c) \188TRACE(c, "PKINIT initial PKCS12_parse with no password failed")189#define TRACE_PKINIT_PKCS_PARSE_FAIL_SECOND(c) \190TRACE(c, "PKINIT second PKCS12_parse with password failed")191#define TRACE_PKINIT_PKCS_PROMPT_FAIL(c) \192TRACE(c, "PKINIT failed to prompt for PKCS12 password")193#define TRACE_PKINIT_REGEXP_MATCH(c, keyword, comp, value, idx) \194TRACE(c, "PKINIT matched {str} rule '{str}' with " \195"value '{str}' in cert #{int}", keyword, comp, value, (idx) + 1)196#define TRACE_PKINIT_REGEXP_NOMATCH(c, keyword, comp, value, idx) \197TRACE(c, "PKINIT didn't match {str} rule '{str}' with " \198"value '{str}' in cert #{int}", keyword, comp, value, (idx) + 1)199#define TRACE_PKINIT_SAN_CERT_COUNT(c, count, princ, upns, dns, cert) \200TRACE(c, "PKINIT client found {int} SANs ({int} princs, {int} " \201"UPNs, {int} DNS names) in certificate {str}", count, princ, \202upns, dns, cert)203#define TRACE_PKINIT_SAN_CERT_NONE(c, cert) \204TRACE(c, "PKINIT client found no SANs in certificate {str}", cert)205206#define TRACE_CERTAUTH_VTINIT_FAIL(c, ret) \207TRACE(c, "certauth module failed to init vtable: {kerr}", ret)208#define TRACE_CERTAUTH_INIT_FAIL(c, name, ret) \209TRACE(c, "certauth module {str} failed to init: {kerr}", name, ret)210211#endif /* PKINIT_TRACE_H */212213214