2 * linux/net/sunrpc/gss_krb5_mech.c
4 * Copyright (c) 2001-2008 The Regents of the University of Michigan.
7 * Andy Adamson <andros@umich.edu>
8 * J. Bruce Fields <bfields@umich.edu>
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the University nor the names of its
20 * contributors may be used to endorse or promote products derived
21 * from this software without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
24 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
30 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 #include <crypto/hash.h>
38 #include <crypto/skcipher.h>
39 #include <linux/err.h>
40 #include <linux/module.h>
41 #include <linux/init.h>
42 #include <linux/types.h>
43 #include <linux/slab.h>
44 #include <linux/sunrpc/auth.h>
45 #include <linux/sunrpc/gss_krb5.h>
46 #include <linux/sunrpc/xdr.h>
47 #include <linux/sunrpc/gss_krb5_enctypes.h>
49 #if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
50 # define RPCDBG_FACILITY RPCDBG_AUTH
53 static struct gss_api_mech gss_kerberos_mech
; /* forward declaration */
55 static const struct gss_krb5_enctype supported_gss_krb5_enctypes
[] = {
57 * DES (All DES enctypes are mapped to the same gss functionality)
60 .etype
= ENCTYPE_DES_CBC_RAW
,
61 .ctype
= CKSUMTYPE_RSA_MD5
,
62 .name
= "des-cbc-crc",
63 .encrypt_name
= "cbc(des)",
65 .encrypt
= krb5_encrypt
,
66 .decrypt
= krb5_decrypt
,
68 .signalg
= SGN_ALG_DES_MAC_MD5
,
69 .sealalg
= SEAL_ALG_DES
,
81 .etype
= ENCTYPE_ARCFOUR_HMAC
,
82 .ctype
= CKSUMTYPE_HMAC_MD5_ARCFOUR
,
84 .encrypt_name
= "ecb(arc4)",
85 .cksum_name
= "hmac(md5)",
86 .encrypt
= krb5_encrypt
,
87 .decrypt
= krb5_decrypt
,
89 .signalg
= SGN_ALG_HMAC_MD5
,
90 .sealalg
= SEAL_ALG_MICROSOFT_RC4
,
102 .etype
= ENCTYPE_DES3_CBC_RAW
,
103 .ctype
= CKSUMTYPE_HMAC_SHA1_DES3
,
104 .name
= "des3-hmac-sha1",
105 .encrypt_name
= "cbc(des3_ede)",
106 .cksum_name
= "hmac(sha1)",
107 .encrypt
= krb5_encrypt
,
108 .decrypt
= krb5_decrypt
,
109 .mk_key
= gss_krb5_des3_make_key
,
110 .signalg
= SGN_ALG_HMAC_SHA1_DES3_KD
,
111 .sealalg
= SEAL_ALG_DES3KD
,
123 .etype
= ENCTYPE_AES128_CTS_HMAC_SHA1_96
,
124 .ctype
= CKSUMTYPE_HMAC_SHA1_96_AES128
,
125 .name
= "aes128-cts",
126 .encrypt_name
= "cts(cbc(aes))",
127 .cksum_name
= "hmac(sha1)",
128 .encrypt
= krb5_encrypt
,
129 .decrypt
= krb5_decrypt
,
130 .mk_key
= gss_krb5_aes_make_key
,
131 .encrypt_v2
= gss_krb5_aes_encrypt
,
132 .decrypt_v2
= gss_krb5_aes_decrypt
,
146 .etype
= ENCTYPE_AES256_CTS_HMAC_SHA1_96
,
147 .ctype
= CKSUMTYPE_HMAC_SHA1_96_AES256
,
148 .name
= "aes256-cts",
149 .encrypt_name
= "cts(cbc(aes))",
150 .cksum_name
= "hmac(sha1)",
151 .encrypt
= krb5_encrypt
,
152 .decrypt
= krb5_decrypt
,
153 .mk_key
= gss_krb5_aes_make_key
,
154 .encrypt_v2
= gss_krb5_aes_encrypt
,
155 .decrypt_v2
= gss_krb5_aes_decrypt
,
167 static const int num_supported_enctypes
=
168 ARRAY_SIZE(supported_gss_krb5_enctypes
);
171 supported_gss_krb5_enctype(int etype
)
174 for (i
= 0; i
< num_supported_enctypes
; i
++)
175 if (supported_gss_krb5_enctypes
[i
].etype
== etype
)
180 static const struct gss_krb5_enctype
*
181 get_gss_krb5_enctype(int etype
)
184 for (i
= 0; i
< num_supported_enctypes
; i
++)
185 if (supported_gss_krb5_enctypes
[i
].etype
== etype
)
186 return &supported_gss_krb5_enctypes
[i
];
191 simple_get_bytes(const void *p
, const void *end
, void *res
, int len
)
193 const void *q
= (const void *)((const char *)p
+ len
);
194 if (unlikely(q
> end
|| q
< p
))
195 return ERR_PTR(-EFAULT
);
201 simple_get_netobj(const void *p
, const void *end
, struct xdr_netobj
*res
)
206 p
= simple_get_bytes(p
, end
, &len
, sizeof(len
));
209 q
= (const void *)((const char *)p
+ len
);
210 if (unlikely(q
> end
|| q
< p
))
211 return ERR_PTR(-EFAULT
);
212 res
->data
= kmemdup(p
, len
, GFP_NOFS
);
213 if (unlikely(res
->data
== NULL
))
214 return ERR_PTR(-ENOMEM
);
219 static inline const void *
220 get_key(const void *p
, const void *end
,
221 struct krb5_ctx
*ctx
, struct crypto_skcipher
**res
)
223 struct xdr_netobj key
;
226 p
= simple_get_bytes(p
, end
, &alg
, sizeof(alg
));
231 case ENCTYPE_DES_CBC_CRC
:
232 case ENCTYPE_DES_CBC_MD4
:
233 case ENCTYPE_DES_CBC_MD5
:
234 /* Map all these key types to ENCTYPE_DES_CBC_RAW */
235 alg
= ENCTYPE_DES_CBC_RAW
;
239 if (!supported_gss_krb5_enctype(alg
)) {
240 printk(KERN_WARNING
"gss_kerberos_mech: unsupported "
241 "encryption key algorithm %d\n", alg
);
242 p
= ERR_PTR(-EINVAL
);
245 p
= simple_get_netobj(p
, end
, &key
);
249 *res
= crypto_alloc_skcipher(ctx
->gk5e
->encrypt_name
, 0,
252 printk(KERN_WARNING
"gss_kerberos_mech: unable to initialize "
253 "crypto algorithm %s\n", ctx
->gk5e
->encrypt_name
);
255 goto out_err_free_key
;
257 if (crypto_skcipher_setkey(*res
, key
.data
, key
.len
)) {
258 printk(KERN_WARNING
"gss_kerberos_mech: error setting key for "
259 "crypto algorithm %s\n", ctx
->gk5e
->encrypt_name
);
260 goto out_err_free_tfm
;
267 crypto_free_skcipher(*res
);
270 p
= ERR_PTR(-EINVAL
);
276 gss_import_v1_context(const void *p
, const void *end
, struct krb5_ctx
*ctx
)
280 p
= simple_get_bytes(p
, end
, &ctx
->initiate
, sizeof(ctx
->initiate
));
284 /* Old format supports only DES! Any other enctype uses new format */
285 ctx
->enctype
= ENCTYPE_DES_CBC_RAW
;
287 ctx
->gk5e
= get_gss_krb5_enctype(ctx
->enctype
);
288 if (ctx
->gk5e
== NULL
) {
289 p
= ERR_PTR(-EINVAL
);
293 /* The downcall format was designed before we completely understood
294 * the uses of the context fields; so it includes some stuff we
295 * just give some minimal sanity-checking, and some we ignore
296 * completely (like the next twenty bytes): */
297 if (unlikely(p
+ 20 > end
|| p
+ 20 < p
)) {
298 p
= ERR_PTR(-EFAULT
);
302 p
= simple_get_bytes(p
, end
, &tmp
, sizeof(tmp
));
305 if (tmp
!= SGN_ALG_DES_MAC_MD5
) {
306 p
= ERR_PTR(-ENOSYS
);
309 p
= simple_get_bytes(p
, end
, &tmp
, sizeof(tmp
));
312 if (tmp
!= SEAL_ALG_DES
) {
313 p
= ERR_PTR(-ENOSYS
);
316 p
= simple_get_bytes(p
, end
, &ctx
->endtime
, sizeof(ctx
->endtime
));
319 p
= simple_get_bytes(p
, end
, &ctx
->seq_send
, sizeof(ctx
->seq_send
));
322 p
= simple_get_netobj(p
, end
, &ctx
->mech_used
);
325 p
= get_key(p
, end
, ctx
, &ctx
->enc
);
327 goto out_err_free_mech
;
328 p
= get_key(p
, end
, ctx
, &ctx
->seq
);
330 goto out_err_free_key1
;
332 p
= ERR_PTR(-EFAULT
);
333 goto out_err_free_key2
;
339 crypto_free_skcipher(ctx
->seq
);
341 crypto_free_skcipher(ctx
->enc
);
343 kfree(ctx
->mech_used
.data
);
348 static struct crypto_skcipher
*
349 context_v2_alloc_cipher(struct krb5_ctx
*ctx
, const char *cname
, u8
*key
)
351 struct crypto_skcipher
*cp
;
353 cp
= crypto_alloc_skcipher(cname
, 0, CRYPTO_ALG_ASYNC
);
355 dprintk("gss_kerberos_mech: unable to initialize "
356 "crypto algorithm %s\n", cname
);
359 if (crypto_skcipher_setkey(cp
, key
, ctx
->gk5e
->keylength
)) {
360 dprintk("gss_kerberos_mech: error setting key for "
361 "crypto algorithm %s\n", cname
);
362 crypto_free_skcipher(cp
);
369 set_cdata(u8 cdata
[GSS_KRB5_K5CLENGTH
], u32 usage
, u8 seed
)
371 cdata
[0] = (usage
>>24)&0xff;
372 cdata
[1] = (usage
>>16)&0xff;
373 cdata
[2] = (usage
>>8)&0xff;
374 cdata
[3] = usage
&0xff;
379 context_derive_keys_des3(struct krb5_ctx
*ctx
, gfp_t gfp_mask
)
381 struct xdr_netobj c
, keyin
, keyout
;
382 u8 cdata
[GSS_KRB5_K5CLENGTH
];
385 c
.len
= GSS_KRB5_K5CLENGTH
;
388 keyin
.data
= ctx
->Ksess
;
389 keyin
.len
= ctx
->gk5e
->keylength
;
390 keyout
.len
= ctx
->gk5e
->keylength
;
392 /* seq uses the raw key */
393 ctx
->seq
= context_v2_alloc_cipher(ctx
, ctx
->gk5e
->encrypt_name
,
395 if (ctx
->seq
== NULL
)
398 ctx
->enc
= context_v2_alloc_cipher(ctx
, ctx
->gk5e
->encrypt_name
,
400 if (ctx
->enc
== NULL
)
404 set_cdata(cdata
, KG_USAGE_SIGN
, KEY_USAGE_SEED_CHECKSUM
);
405 keyout
.data
= ctx
->cksum
;
406 err
= krb5_derive_key(ctx
->gk5e
, &keyin
, &keyout
, &c
, gfp_mask
);
408 dprintk("%s: Error %d deriving cksum key\n",
416 crypto_free_skcipher(ctx
->enc
);
418 crypto_free_skcipher(ctx
->seq
);
424 * Note that RC4 depends on deriving keys using the sequence
425 * number or the checksum of a token. Therefore, the final keys
426 * cannot be calculated until the token is being constructed!
429 context_derive_keys_rc4(struct krb5_ctx
*ctx
)
431 struct crypto_shash
*hmac
;
432 char sigkeyconstant
[] = "signaturekey";
433 int slen
= strlen(sigkeyconstant
) + 1; /* include null terminator */
434 struct shash_desc
*desc
;
437 dprintk("RPC: %s: entered\n", __func__
);
439 * derive cksum (aka Ksign) key
441 hmac
= crypto_alloc_shash(ctx
->gk5e
->cksum_name
, 0, 0);
443 dprintk("%s: error %ld allocating hash '%s'\n",
444 __func__
, PTR_ERR(hmac
), ctx
->gk5e
->cksum_name
);
449 err
= crypto_shash_setkey(hmac
, ctx
->Ksess
, ctx
->gk5e
->keylength
);
451 goto out_err_free_hmac
;
454 desc
= kmalloc(sizeof(*desc
) + crypto_shash_descsize(hmac
),
457 dprintk("%s: failed to allocate hash descriptor for '%s'\n",
458 __func__
, ctx
->gk5e
->cksum_name
);
460 goto out_err_free_hmac
;
466 err
= crypto_shash_digest(desc
, sigkeyconstant
, slen
, ctx
->cksum
);
469 goto out_err_free_hmac
;
471 * allocate hash, and skciphers for data and seqnum encryption
473 ctx
->enc
= crypto_alloc_skcipher(ctx
->gk5e
->encrypt_name
, 0,
475 if (IS_ERR(ctx
->enc
)) {
476 err
= PTR_ERR(ctx
->enc
);
477 goto out_err_free_hmac
;
480 ctx
->seq
= crypto_alloc_skcipher(ctx
->gk5e
->encrypt_name
, 0,
482 if (IS_ERR(ctx
->seq
)) {
483 crypto_free_skcipher(ctx
->enc
);
484 err
= PTR_ERR(ctx
->seq
);
485 goto out_err_free_hmac
;
488 dprintk("RPC: %s: returning success\n", __func__
);
493 crypto_free_shash(hmac
);
495 dprintk("RPC: %s: returning %d\n", __func__
, err
);
500 context_derive_keys_new(struct krb5_ctx
*ctx
, gfp_t gfp_mask
)
502 struct xdr_netobj c
, keyin
, keyout
;
503 u8 cdata
[GSS_KRB5_K5CLENGTH
];
506 c
.len
= GSS_KRB5_K5CLENGTH
;
509 keyin
.data
= ctx
->Ksess
;
510 keyin
.len
= ctx
->gk5e
->keylength
;
511 keyout
.len
= ctx
->gk5e
->keylength
;
513 /* initiator seal encryption */
514 set_cdata(cdata
, KG_USAGE_INITIATOR_SEAL
, KEY_USAGE_SEED_ENCRYPTION
);
515 keyout
.data
= ctx
->initiator_seal
;
516 err
= krb5_derive_key(ctx
->gk5e
, &keyin
, &keyout
, &c
, gfp_mask
);
518 dprintk("%s: Error %d deriving initiator_seal key\n",
522 ctx
->initiator_enc
= context_v2_alloc_cipher(ctx
,
523 ctx
->gk5e
->encrypt_name
,
524 ctx
->initiator_seal
);
525 if (ctx
->initiator_enc
== NULL
)
528 /* acceptor seal encryption */
529 set_cdata(cdata
, KG_USAGE_ACCEPTOR_SEAL
, KEY_USAGE_SEED_ENCRYPTION
);
530 keyout
.data
= ctx
->acceptor_seal
;
531 err
= krb5_derive_key(ctx
->gk5e
, &keyin
, &keyout
, &c
, gfp_mask
);
533 dprintk("%s: Error %d deriving acceptor_seal key\n",
535 goto out_free_initiator_enc
;
537 ctx
->acceptor_enc
= context_v2_alloc_cipher(ctx
,
538 ctx
->gk5e
->encrypt_name
,
540 if (ctx
->acceptor_enc
== NULL
)
541 goto out_free_initiator_enc
;
543 /* initiator sign checksum */
544 set_cdata(cdata
, KG_USAGE_INITIATOR_SIGN
, KEY_USAGE_SEED_CHECKSUM
);
545 keyout
.data
= ctx
->initiator_sign
;
546 err
= krb5_derive_key(ctx
->gk5e
, &keyin
, &keyout
, &c
, gfp_mask
);
548 dprintk("%s: Error %d deriving initiator_sign key\n",
550 goto out_free_acceptor_enc
;
553 /* acceptor sign checksum */
554 set_cdata(cdata
, KG_USAGE_ACCEPTOR_SIGN
, KEY_USAGE_SEED_CHECKSUM
);
555 keyout
.data
= ctx
->acceptor_sign
;
556 err
= krb5_derive_key(ctx
->gk5e
, &keyin
, &keyout
, &c
, gfp_mask
);
558 dprintk("%s: Error %d deriving acceptor_sign key\n",
560 goto out_free_acceptor_enc
;
563 /* initiator seal integrity */
564 set_cdata(cdata
, KG_USAGE_INITIATOR_SEAL
, KEY_USAGE_SEED_INTEGRITY
);
565 keyout
.data
= ctx
->initiator_integ
;
566 err
= krb5_derive_key(ctx
->gk5e
, &keyin
, &keyout
, &c
, gfp_mask
);
568 dprintk("%s: Error %d deriving initiator_integ key\n",
570 goto out_free_acceptor_enc
;
573 /* acceptor seal integrity */
574 set_cdata(cdata
, KG_USAGE_ACCEPTOR_SEAL
, KEY_USAGE_SEED_INTEGRITY
);
575 keyout
.data
= ctx
->acceptor_integ
;
576 err
= krb5_derive_key(ctx
->gk5e
, &keyin
, &keyout
, &c
, gfp_mask
);
578 dprintk("%s: Error %d deriving acceptor_integ key\n",
580 goto out_free_acceptor_enc
;
583 switch (ctx
->enctype
) {
584 case ENCTYPE_AES128_CTS_HMAC_SHA1_96
:
585 case ENCTYPE_AES256_CTS_HMAC_SHA1_96
:
586 ctx
->initiator_enc_aux
=
587 context_v2_alloc_cipher(ctx
, "cbc(aes)",
588 ctx
->initiator_seal
);
589 if (ctx
->initiator_enc_aux
== NULL
)
590 goto out_free_acceptor_enc
;
591 ctx
->acceptor_enc_aux
=
592 context_v2_alloc_cipher(ctx
, "cbc(aes)",
594 if (ctx
->acceptor_enc_aux
== NULL
) {
595 crypto_free_skcipher(ctx
->initiator_enc_aux
);
596 goto out_free_acceptor_enc
;
602 out_free_acceptor_enc
:
603 crypto_free_skcipher(ctx
->acceptor_enc
);
604 out_free_initiator_enc
:
605 crypto_free_skcipher(ctx
->initiator_enc
);
611 gss_import_v2_context(const void *p
, const void *end
, struct krb5_ctx
*ctx
,
616 p
= simple_get_bytes(p
, end
, &ctx
->flags
, sizeof(ctx
->flags
));
619 ctx
->initiate
= ctx
->flags
& KRB5_CTX_FLAG_INITIATOR
;
621 p
= simple_get_bytes(p
, end
, &ctx
->endtime
, sizeof(ctx
->endtime
));
624 p
= simple_get_bytes(p
, end
, &ctx
->seq_send64
, sizeof(ctx
->seq_send64
));
627 /* set seq_send for use by "older" enctypes */
628 ctx
->seq_send
= ctx
->seq_send64
;
629 if (ctx
->seq_send64
!= ctx
->seq_send
) {
630 dprintk("%s: seq_send64 %lx, seq_send %x overflow?\n", __func__
,
631 (unsigned long)ctx
->seq_send64
, ctx
->seq_send
);
632 p
= ERR_PTR(-EINVAL
);
635 p
= simple_get_bytes(p
, end
, &ctx
->enctype
, sizeof(ctx
->enctype
));
638 /* Map ENCTYPE_DES3_CBC_SHA1 to ENCTYPE_DES3_CBC_RAW */
639 if (ctx
->enctype
== ENCTYPE_DES3_CBC_SHA1
)
640 ctx
->enctype
= ENCTYPE_DES3_CBC_RAW
;
641 ctx
->gk5e
= get_gss_krb5_enctype(ctx
->enctype
);
642 if (ctx
->gk5e
== NULL
) {
643 dprintk("gss_kerberos_mech: unsupported krb5 enctype %u\n",
645 p
= ERR_PTR(-EINVAL
);
648 keylen
= ctx
->gk5e
->keylength
;
650 p
= simple_get_bytes(p
, end
, ctx
->Ksess
, keylen
);
655 p
= ERR_PTR(-EINVAL
);
659 ctx
->mech_used
.data
= kmemdup(gss_kerberos_mech
.gm_oid
.data
,
660 gss_kerberos_mech
.gm_oid
.len
, gfp_mask
);
661 if (unlikely(ctx
->mech_used
.data
== NULL
)) {
662 p
= ERR_PTR(-ENOMEM
);
665 ctx
->mech_used
.len
= gss_kerberos_mech
.gm_oid
.len
;
667 switch (ctx
->enctype
) {
668 case ENCTYPE_DES3_CBC_RAW
:
669 return context_derive_keys_des3(ctx
, gfp_mask
);
670 case ENCTYPE_ARCFOUR_HMAC
:
671 return context_derive_keys_rc4(ctx
);
672 case ENCTYPE_AES128_CTS_HMAC_SHA1_96
:
673 case ENCTYPE_AES256_CTS_HMAC_SHA1_96
:
674 return context_derive_keys_new(ctx
, gfp_mask
);
684 gss_import_sec_context_kerberos(const void *p
, size_t len
,
685 struct gss_ctx
*ctx_id
,
689 const void *end
= (const void *)((const char *)p
+ len
);
690 struct krb5_ctx
*ctx
;
693 ctx
= kzalloc(sizeof(*ctx
), gfp_mask
);
698 ret
= gss_import_v1_context(p
, end
, ctx
);
700 ret
= gss_import_v2_context(p
, end
, ctx
, gfp_mask
);
703 ctx_id
->internal_ctx_id
= ctx
;
705 *endtime
= ctx
->endtime
;
709 dprintk("RPC: %s: returning %d\n", __func__
, ret
);
714 gss_delete_sec_context_kerberos(void *internal_ctx
) {
715 struct krb5_ctx
*kctx
= internal_ctx
;
717 crypto_free_skcipher(kctx
->seq
);
718 crypto_free_skcipher(kctx
->enc
);
719 crypto_free_skcipher(kctx
->acceptor_enc
);
720 crypto_free_skcipher(kctx
->initiator_enc
);
721 crypto_free_skcipher(kctx
->acceptor_enc_aux
);
722 crypto_free_skcipher(kctx
->initiator_enc_aux
);
723 kfree(kctx
->mech_used
.data
);
727 static const struct gss_api_ops gss_kerberos_ops
= {
728 .gss_import_sec_context
= gss_import_sec_context_kerberos
,
729 .gss_get_mic
= gss_get_mic_kerberos
,
730 .gss_verify_mic
= gss_verify_mic_kerberos
,
731 .gss_wrap
= gss_wrap_kerberos
,
732 .gss_unwrap
= gss_unwrap_kerberos
,
733 .gss_delete_sec_context
= gss_delete_sec_context_kerberos
,
736 static struct pf_desc gss_kerberos_pfs
[] = {
738 .pseudoflavor
= RPC_AUTH_GSS_KRB5
,
739 .qop
= GSS_C_QOP_DEFAULT
,
740 .service
= RPC_GSS_SVC_NONE
,
744 .pseudoflavor
= RPC_AUTH_GSS_KRB5I
,
745 .qop
= GSS_C_QOP_DEFAULT
,
746 .service
= RPC_GSS_SVC_INTEGRITY
,
750 .pseudoflavor
= RPC_AUTH_GSS_KRB5P
,
751 .qop
= GSS_C_QOP_DEFAULT
,
752 .service
= RPC_GSS_SVC_PRIVACY
,
757 MODULE_ALIAS("rpc-auth-gss-krb5");
758 MODULE_ALIAS("rpc-auth-gss-krb5i");
759 MODULE_ALIAS("rpc-auth-gss-krb5p");
760 MODULE_ALIAS("rpc-auth-gss-390003");
761 MODULE_ALIAS("rpc-auth-gss-390004");
762 MODULE_ALIAS("rpc-auth-gss-390005");
763 MODULE_ALIAS("rpc-auth-gss-1.2.840.113554.1.2.2");
765 static struct gss_api_mech gss_kerberos_mech
= {
767 .gm_owner
= THIS_MODULE
,
768 .gm_oid
= { 9, "\x2a\x86\x48\x86\xf7\x12\x01\x02\x02" },
769 .gm_ops
= &gss_kerberos_ops
,
770 .gm_pf_num
= ARRAY_SIZE(gss_kerberos_pfs
),
771 .gm_pfs
= gss_kerberos_pfs
,
772 .gm_upcall_enctypes
= KRB5_SUPPORTED_ENCTYPES
,
775 static int __init
init_kerberos_module(void)
779 status
= gss_mech_register(&gss_kerberos_mech
);
781 printk("Failed to register kerberos gss mechanism!\n");
785 static void __exit
cleanup_kerberos_module(void)
787 gss_mech_unregister(&gss_kerberos_mech
);
790 MODULE_LICENSE("GPL");
791 module_init(init_kerberos_module
);
792 module_exit(cleanup_kerberos_module
);