aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/auth_gss/gss_krb5_crypto.c
diff options
context:
space:
mode:
authorKevin Coffman <kwc@citi.umich.edu>2010-03-17 13:03:02 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-05-14 15:09:19 -0400
commit8b23707612cffdba694dcd18aa8a018918aa86dc (patch)
tree3dd484658768c0a710b252a674c697124380b223 /net/sunrpc/auth_gss/gss_krb5_crypto.c
parentbf6d359c508cf83401c942262a9749752598394d (diff)
gssd_krb5: arcfour-hmac support
For arcfour-hmac support, the make_checksum function needs a usage field to correctly calculate the checksum differently for MIC and WRAP tokens. Signed-off-by: Kevin Coffman <kwc@citi.umich.edu> Signed-off-by: Steve Dickson <steved@redhat.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/auth_gss/gss_krb5_crypto.c')
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_crypto.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/net/sunrpc/auth_gss/gss_krb5_crypto.c b/net/sunrpc/auth_gss/gss_krb5_crypto.c
index 967484a914f3..33ae7023cf3a 100644
--- a/net/sunrpc/auth_gss/gss_krb5_crypto.c
+++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c
@@ -132,7 +132,7 @@ checksummer(struct scatterlist *sg, void *data)
132u32 132u32
133make_checksum(struct krb5_ctx *kctx, char *header, int hdrlen, 133make_checksum(struct krb5_ctx *kctx, char *header, int hdrlen,
134 struct xdr_buf *body, int body_offset, u8 *cksumkey, 134 struct xdr_buf *body, int body_offset, u8 *cksumkey,
135 struct xdr_netobj *cksumout) 135 unsigned int usage, struct xdr_netobj *cksumout)
136{ 136{
137 struct hash_desc desc; 137 struct hash_desc desc;
138 struct scatterlist sg[1]; 138 struct scatterlist sg[1];
@@ -208,7 +208,7 @@ out:
208u32 208u32
209make_checksum_v2(struct krb5_ctx *kctx, char *header, int hdrlen, 209make_checksum_v2(struct krb5_ctx *kctx, char *header, int hdrlen,
210 struct xdr_buf *body, int body_offset, u8 *cksumkey, 210 struct xdr_buf *body, int body_offset, u8 *cksumkey,
211 struct xdr_netobj *cksumout) 211 unsigned int usage, struct xdr_netobj *cksumout)
212{ 212{
213 struct hash_desc desc; 213 struct hash_desc desc;
214 struct scatterlist sg[1]; 214 struct scatterlist sg[1];
@@ -537,15 +537,18 @@ gss_krb5_aes_encrypt(struct krb5_ctx *kctx, u32 offset,
537 int nblocks, nbytes; 537 int nblocks, nbytes;
538 struct encryptor_desc desc; 538 struct encryptor_desc desc;
539 u32 cbcbytes; 539 u32 cbcbytes;
540 unsigned int usage;
540 541
541 if (kctx->initiate) { 542 if (kctx->initiate) {
542 cipher = kctx->initiator_enc; 543 cipher = kctx->initiator_enc;
543 aux_cipher = kctx->initiator_enc_aux; 544 aux_cipher = kctx->initiator_enc_aux;
544 cksumkey = kctx->initiator_integ; 545 cksumkey = kctx->initiator_integ;
546 usage = KG_USAGE_INITIATOR_SEAL;
545 } else { 547 } else {
546 cipher = kctx->acceptor_enc; 548 cipher = kctx->acceptor_enc;
547 aux_cipher = kctx->acceptor_enc_aux; 549 aux_cipher = kctx->acceptor_enc_aux;
548 cksumkey = kctx->acceptor_integ; 550 cksumkey = kctx->acceptor_integ;
551 usage = KG_USAGE_ACCEPTOR_SEAL;
549 } 552 }
550 blocksize = crypto_blkcipher_blocksize(cipher); 553 blocksize = crypto_blkcipher_blocksize(cipher);
551 554
@@ -590,7 +593,8 @@ gss_krb5_aes_encrypt(struct krb5_ctx *kctx, u32 offset,
590 buf->pages = pages; 593 buf->pages = pages;
591 594
592 err = make_checksum_v2(kctx, NULL, 0, buf, 595 err = make_checksum_v2(kctx, NULL, 0, buf,
593 offset + GSS_KRB5_TOK_HDR_LEN, cksumkey, &hmac); 596 offset + GSS_KRB5_TOK_HDR_LEN,
597 cksumkey, usage, &hmac);
594 buf->pages = save_pages; 598 buf->pages = save_pages;
595 if (err) 599 if (err)
596 return GSS_S_FAILURE; 600 return GSS_S_FAILURE;
@@ -654,15 +658,18 @@ gss_krb5_aes_decrypt(struct krb5_ctx *kctx, u32 offset, struct xdr_buf *buf,
654 u8 pkt_hmac[GSS_KRB5_MAX_CKSUM_LEN]; 658 u8 pkt_hmac[GSS_KRB5_MAX_CKSUM_LEN];
655 int nblocks, blocksize, cbcbytes; 659 int nblocks, blocksize, cbcbytes;
656 struct decryptor_desc desc; 660 struct decryptor_desc desc;
661 unsigned int usage;
657 662
658 if (kctx->initiate) { 663 if (kctx->initiate) {
659 cipher = kctx->acceptor_enc; 664 cipher = kctx->acceptor_enc;
660 aux_cipher = kctx->acceptor_enc_aux; 665 aux_cipher = kctx->acceptor_enc_aux;
661 cksum_key = kctx->acceptor_integ; 666 cksum_key = kctx->acceptor_integ;
667 usage = KG_USAGE_ACCEPTOR_SEAL;
662 } else { 668 } else {
663 cipher = kctx->initiator_enc; 669 cipher = kctx->initiator_enc;
664 aux_cipher = kctx->initiator_enc_aux; 670 aux_cipher = kctx->initiator_enc_aux;
665 cksum_key = kctx->initiator_integ; 671 cksum_key = kctx->initiator_integ;
672 usage = KG_USAGE_INITIATOR_SEAL;
666 } 673 }
667 blocksize = crypto_blkcipher_blocksize(cipher); 674 blocksize = crypto_blkcipher_blocksize(cipher);
668 675
@@ -705,7 +712,7 @@ gss_krb5_aes_decrypt(struct krb5_ctx *kctx, u32 offset, struct xdr_buf *buf,
705 our_hmac_obj.data = our_hmac; 712 our_hmac_obj.data = our_hmac;
706 713
707 ret = make_checksum_v2(kctx, NULL, 0, &subbuf, 0, 714 ret = make_checksum_v2(kctx, NULL, 0, &subbuf, 0,
708 cksum_key, &our_hmac_obj); 715 cksum_key, usage, &our_hmac_obj);
709 if (ret) 716 if (ret)
710 goto out_err; 717 goto out_err;
711 718