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i_
\bg_
\b__
\bs_
\bt_
\ba_
\bt_
\be _
\b*_
\bs_
\bt_
\ba_
\bt_
\be);
34 _
\bu_
\b__
\bc_
\bh_
\ba_
\br _
\b*
35 n
\bns
\bs_
\b_f
\bfi
\bin
\bnd
\bd_
\b_t
\bts
\bsi
\big
\bg(_
\bu_
\b__
\bc_
\bh_
\ba_
\br _
\b*_
\bm_
\bs_
\bg, _
\bu_
\b__
\bc_
\bh_
\ba_
\br _
\b*_
\be_
\bo_
\bm);
37 D
\bDE
\bES
\bSC
\bCR
\bRI
\bIP
\bPT
\bTI
\bIO
\bON
\bN
38 The TSIG routines are used to implement transaction/request security of
41 n
\bns
\bs_
\b_s
\bsi
\big
\bgn
\bn() and n
\bns
\bs_
\b_v
\bve
\ber
\bri
\bif
\bfy
\by() are the basic routines. n
\bns
\bs_
\b_s
\bsi
\big
\bgn
\bn_
\b_t
\btc
\bcp
\bp() and
42 n
\bns
\bs_
\b_v
\bve
\ber
\bri
\bif
\bfy
\by_
\b_t
\btc
\bcp
\bp() are used to sign/verify TCP messages that may be split
43 into multiple packets, such as zone transfers, and n
\bns
\bs_
\b_s
\bsi
\big
\bgn
\bn_
\b_t
\btc
\bcp
\bp_
\b_i
\bin
\bni
\bit
\bt(),
44 n
\bns
\bs_
\b_v
\bve
\ber
\bri
\bif
\bfy
\by_
\b_t
\btc
\bcp
\bp_
\b_i
\bin
\bni
\bit
\bt() initialize the state structure necessary for TCP
45 operations. n
\bns
\bs_
\b_f
\bfi
\bin
\bnd
\bd_
\b_t
\bts
\bsi
\big
\bg() locates the TSIG record in a message, if one
48 n
\bns
\bs_
\b_s
\bsi
\big
\bgn
\bn()
49 msg the incoming DNS message, which will be modified
50 msglen the length of the DNS message, on input and output
51 msgsize the size of the buffer containing the DNS message on
53 error the value to be placed in the TSIG error field
54 key the (DST_KEY *) to sign the data
55 querysig for a response, the signature contained in the query
56 querysiglen the length of the query signature
57 sig a buffer to be filled with the generated signature
58 siglen the length of the signature buffer on input, the
59 signature length on output
61 n
\bns
\bs_
\b_s
\bsi
\big
\bgn
\bn_
\b_t
\btc
\bcp
\bp()
62 msg the incoming DNS message, which will be modified
63 msglen the length of the DNS message, on input and output
64 msgsize the size of the buffer containing the DNS message on
66 error the value to be placed in the TSIG error field
67 state the state of the operation
68 done non-zero value signifies that this is the last
71 n
\bns
\bs_
\b_s
\bsi
\big
\bgn
\bn_
\b_t
\btc
\bcp
\bp_
\b_i
\bin
\bni
\bit
\bt()
72 k the (DST_KEY *) to sign the data
73 querysig for a response, the signature contained in the query
74 querysiglen the length of the query signature
75 state the state of the operation, which this initializes
77 n
\bns
\bs_
\b_v
\bve
\ber
\bri
\bif
\bfy
\by()
78 msg the incoming DNS message, which will be modified
79 msglen the length of the DNS message, on input and output
80 key the (DST_KEY *) to sign the data
81 querysig for a response, the signature contained in the query
82 querysiglen the length of the query signature
83 sig a buffer to be filled with the signature contained
84 siglen the length of the signature buffer on input, the
85 signature length on output
86 nostrip non-zero value means that the TSIG is left intact
88 n
\bns
\bs_
\b_v
\bve
\ber
\bri
\bif
\bfy
\by_
\b_t
\btc
\bcp
\bp()
89 msg the incoming DNS message, which will be modified
90 msglen the length of the DNS message, on input and output
91 state the state of the operation
92 required non-zero value signifies that a TSIG record must be
95 n
\bns
\bs_
\b_v
\bve
\ber
\bri
\bif
\bfy
\by_
\b_t
\btc
\bcp
\bp_
\b_i
\bin
\bni
\bit
\bt()
96 k the (DST_KEY *) to verify the data
97 querysig for a response, the signature contained in the query
98 querysiglen the length of the query signature
99 state the state of the operation, which this initializes
101 n
\bns
\bs_
\b_f
\bfi
\bin
\bnd
\bd_
\b_t
\bts
\bsi
\big
\bg()
102 msg the incoming DNS message
103 msglen the length of the DNS message
105 R
\bRE
\bET
\bTU
\bUR
\bRN
\bN V
\bVA
\bAL
\bLU
\bUE
\bES
\bS
106 n
\bns
\bs_
\b_f
\bfi
\bin
\bnd
\bd_
\b_t
\bts
\bsi
\big
\bg() returns a pointer to the TSIG record if one is found, and
109 All other routines return 0 on success, modifying arguments when neces‐
112 n
\bns
\bs_
\b_s
\bsi
\big
\bgn
\bn() and n
\bns
\bs_
\b_s
\bsi
\big
\bgn
\bn_
\b_t
\btc
\bcp
\bp() return the following errors:
114 (-ns_r_badkey) The key was invalid, or the signing failed
115 NS_TSIG_ERROR_NO_SPACE the message buffer is too small.
117 n
\bns
\bs_
\b_v
\bve
\ber
\bri
\bif
\bfy
\by() and n
\bns
\bs_
\b_v
\bve
\ber
\bri
\bif
\bfy
\by_
\b_t
\btc
\bcp
\bp() return the following errors:
119 NS_TSIG_ERROR_FORMERR The message is malformed
120 NS_TSIG_ERROR_NO_TSIG The message does not contain a TSIG record
121 NS_TSIG_ERROR_ID_MISMATCH
122 The TSIG original ID field does not match
124 (-ns_r_badkey) Verification failed due to an invalid key
125 (-ns_r_badsig) Verification failed due to an invalid sig‐
127 (-ns_r_badtime) Verification failed due to an invalid
129 ns_r_badkey Verification succeeded but the message had
131 ns_r_badsig Verification succeeded but the message had
133 ns_r_badtime Verification succeeded but the message had
136 S
\bSE
\bEE
\bE A
\bAL
\bLS
\bSO
\bO
139 A
\bAU
\bUT
\bTH
\bHO
\bOR
\bRS
\bS
140 Brian Wellington, TISLabs at Network Associates
142 4th Berkeley Distribution January 1, 1996 4th Berkeley Distribution