@@ -148,96 +148,6 @@ checksummer(struct scatterlist *sg, void *data)
148148 return crypto_ahash_update (req );
149149}
150150
151- /*
152- * checksum the plaintext data and hdrlen bytes of the token header
153- * The checksum is performed over the first 8 bytes of the
154- * gss token header and then over the data body
155- */
156- u32
157- make_checksum (struct krb5_ctx * kctx , char * header , int hdrlen ,
158- struct xdr_buf * body , int body_offset , u8 * cksumkey ,
159- unsigned int usage , struct xdr_netobj * cksumout )
160- {
161- struct crypto_ahash * tfm ;
162- struct ahash_request * req ;
163- struct scatterlist sg [1 ];
164- int err = -1 ;
165- u8 * checksumdata ;
166- unsigned int checksumlen ;
167-
168- if (cksumout -> len < kctx -> gk5e -> cksumlength ) {
169- dprintk ("%s: checksum buffer length, %u, too small for %s\n" ,
170- __func__ , cksumout -> len , kctx -> gk5e -> name );
171- return GSS_S_FAILURE ;
172- }
173-
174- checksumdata = kmalloc (GSS_KRB5_MAX_CKSUM_LEN , GFP_KERNEL );
175- if (checksumdata == NULL )
176- return GSS_S_FAILURE ;
177-
178- tfm = crypto_alloc_ahash (kctx -> gk5e -> cksum_name , 0 , CRYPTO_ALG_ASYNC );
179- if (IS_ERR (tfm ))
180- goto out_free_cksum ;
181-
182- req = ahash_request_alloc (tfm , GFP_KERNEL );
183- if (!req )
184- goto out_free_ahash ;
185-
186- ahash_request_set_callback (req , CRYPTO_TFM_REQ_MAY_SLEEP , NULL , NULL );
187-
188- checksumlen = crypto_ahash_digestsize (tfm );
189-
190- if (cksumkey != NULL ) {
191- err = crypto_ahash_setkey (tfm , cksumkey ,
192- kctx -> gk5e -> keylength );
193- if (err )
194- goto out ;
195- }
196-
197- err = crypto_ahash_init (req );
198- if (err )
199- goto out ;
200- sg_init_one (sg , header , hdrlen );
201- ahash_request_set_crypt (req , sg , NULL , hdrlen );
202- err = crypto_ahash_update (req );
203- if (err )
204- goto out ;
205- err = xdr_process_buf (body , body_offset , body -> len - body_offset ,
206- checksummer , req );
207- if (err )
208- goto out ;
209- ahash_request_set_crypt (req , NULL , checksumdata , 0 );
210- err = crypto_ahash_final (req );
211- if (err )
212- goto out ;
213-
214- switch (kctx -> gk5e -> ctype ) {
215- case CKSUMTYPE_RSA_MD5 :
216- err = krb5_encrypt (kctx -> seq , NULL , checksumdata ,
217- checksumdata , checksumlen );
218- if (err )
219- goto out ;
220- memcpy (cksumout -> data ,
221- checksumdata + checksumlen - kctx -> gk5e -> cksumlength ,
222- kctx -> gk5e -> cksumlength );
223- break ;
224- case CKSUMTYPE_HMAC_SHA1_DES3 :
225- memcpy (cksumout -> data , checksumdata , kctx -> gk5e -> cksumlength );
226- break ;
227- default :
228- BUG ();
229- break ;
230- }
231- cksumout -> len = kctx -> gk5e -> cksumlength ;
232- out :
233- ahash_request_free (req );
234- out_free_ahash :
235- crypto_free_ahash (tfm );
236- out_free_cksum :
237- kfree (checksumdata );
238- return err ? GSS_S_FAILURE : 0 ;
239- }
240-
241151/**
242152 * gss_krb5_checksum - Compute the MAC for a GSS Wrap or MIC token
243153 * @tfm: an initialized hash transform
0 commit comments