aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/tcrypt.h
diff options
context:
space:
mode:
authorKevin Coffman <kwc@citi.umich.edu>2008-03-24 09:26:16 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2008-04-20 22:19:23 -0400
commit76cb9521795a167ae3d206343c072f602d84f815 (patch)
tree36aa2e201867c76ac244de69e1bb16befa0504ee /crypto/tcrypt.h
parentfd4609a8e00a867303783ade62d67953fb72adc8 (diff)
[CRYPTO] cts: Add CTS mode required for Kerberos AES support
Implement CTS wrapper for CBC mode required for support of AES encryption support for Kerberos (rfc3962). Signed-off-by: Kevin Coffman <kwc@citi.umich.edu> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/tcrypt.h')
-rw-r--r--crypto/tcrypt.h209
1 files changed, 209 insertions, 0 deletions
diff --git a/crypto/tcrypt.h b/crypto/tcrypt.h
index aae79e9c256c..47bc0ecb8978 100644
--- a/crypto/tcrypt.h
+++ b/crypto/tcrypt.h
@@ -7623,6 +7623,215 @@ static struct cipher_testvec salsa20_stream_enc_tv_template[] = {
7623}; 7623};
7624 7624
7625/* 7625/*
7626 * CTS (Cipher Text Stealing) mode tests
7627 */
7628#define CTS_MODE_ENC_TEST_VECTORS 6
7629#define CTS_MODE_DEC_TEST_VECTORS 6
7630static struct cipher_testvec cts_mode_enc_tv_template[] = {
7631 { /* from rfc3962 */
7632 .klen = 16,
7633 .key = "\x63\x68\x69\x63\x6b\x65\x6e\x20"
7634 "\x74\x65\x72\x69\x79\x61\x6b\x69",
7635 .ilen = 17,
7636 .input = "\x49\x20\x77\x6f\x75\x6c\x64\x20"
7637 "\x6c\x69\x6b\x65\x20\x74\x68\x65"
7638 "\x20",
7639 .rlen = 17,
7640 .result = "\xc6\x35\x35\x68\xf2\xbf\x8c\xb4"
7641 "\xd8\xa5\x80\x36\x2d\xa7\xff\x7f"
7642 "\x97",
7643 }, {
7644 .klen = 16,
7645 .key = "\x63\x68\x69\x63\x6b\x65\x6e\x20"
7646 "\x74\x65\x72\x69\x79\x61\x6b\x69",
7647 .ilen = 31,
7648 .input = "\x49\x20\x77\x6f\x75\x6c\x64\x20"
7649 "\x6c\x69\x6b\x65\x20\x74\x68\x65"
7650 "\x20\x47\x65\x6e\x65\x72\x61\x6c"
7651 "\x20\x47\x61\x75\x27\x73\x20",
7652 .rlen = 31,
7653 .result = "\xfc\x00\x78\x3e\x0e\xfd\xb2\xc1"
7654 "\xd4\x45\xd4\xc8\xef\xf7\xed\x22"
7655 "\x97\x68\x72\x68\xd6\xec\xcc\xc0"
7656 "\xc0\x7b\x25\xe2\x5e\xcf\xe5",
7657 }, {
7658 .klen = 16,
7659 .key = "\x63\x68\x69\x63\x6b\x65\x6e\x20"
7660 "\x74\x65\x72\x69\x79\x61\x6b\x69",
7661 .ilen = 32,
7662 .input = "\x49\x20\x77\x6f\x75\x6c\x64\x20"
7663 "\x6c\x69\x6b\x65\x20\x74\x68\x65"
7664 "\x20\x47\x65\x6e\x65\x72\x61\x6c"
7665 "\x20\x47\x61\x75\x27\x73\x20\x43",
7666 .rlen = 32,
7667 .result = "\x39\x31\x25\x23\xa7\x86\x62\xd5"
7668 "\xbe\x7f\xcb\xcc\x98\xeb\xf5\xa8"
7669 "\x97\x68\x72\x68\xd6\xec\xcc\xc0"
7670 "\xc0\x7b\x25\xe2\x5e\xcf\xe5\x84",
7671 }, {
7672 .klen = 16,
7673 .key = "\x63\x68\x69\x63\x6b\x65\x6e\x20"
7674 "\x74\x65\x72\x69\x79\x61\x6b\x69",
7675 .ilen = 47,
7676 .input = "\x49\x20\x77\x6f\x75\x6c\x64\x20"
7677 "\x6c\x69\x6b\x65\x20\x74\x68\x65"
7678 "\x20\x47\x65\x6e\x65\x72\x61\x6c"
7679 "\x20\x47\x61\x75\x27\x73\x20\x43"
7680 "\x68\x69\x63\x6b\x65\x6e\x2c\x20"
7681 "\x70\x6c\x65\x61\x73\x65\x2c",
7682 .rlen = 47,
7683 .result = "\x97\x68\x72\x68\xd6\xec\xcc\xc0"
7684 "\xc0\x7b\x25\xe2\x5e\xcf\xe5\x84"
7685 "\xb3\xff\xfd\x94\x0c\x16\xa1\x8c"
7686 "\x1b\x55\x49\xd2\xf8\x38\x02\x9e"
7687 "\x39\x31\x25\x23\xa7\x86\x62\xd5"
7688 "\xbe\x7f\xcb\xcc\x98\xeb\xf5",
7689 }, {
7690 .klen = 16,
7691 .key = "\x63\x68\x69\x63\x6b\x65\x6e\x20"
7692 "\x74\x65\x72\x69\x79\x61\x6b\x69",
7693 .ilen = 48,
7694 .input = "\x49\x20\x77\x6f\x75\x6c\x64\x20"
7695 "\x6c\x69\x6b\x65\x20\x74\x68\x65"
7696 "\x20\x47\x65\x6e\x65\x72\x61\x6c"
7697 "\x20\x47\x61\x75\x27\x73\x20\x43"
7698 "\x68\x69\x63\x6b\x65\x6e\x2c\x20"
7699 "\x70\x6c\x65\x61\x73\x65\x2c\x20",
7700 .rlen = 48,
7701 .result = "\x97\x68\x72\x68\xd6\xec\xcc\xc0"
7702 "\xc0\x7b\x25\xe2\x5e\xcf\xe5\x84"
7703 "\x9d\xad\x8b\xbb\x96\xc4\xcd\xc0"
7704 "\x3b\xc1\x03\xe1\xa1\x94\xbb\xd8"
7705 "\x39\x31\x25\x23\xa7\x86\x62\xd5"
7706 "\xbe\x7f\xcb\xcc\x98\xeb\xf5\xa8",
7707 }, {
7708 .klen = 16,
7709 .key = "\x63\x68\x69\x63\x6b\x65\x6e\x20"
7710 "\x74\x65\x72\x69\x79\x61\x6b\x69",
7711 .ilen = 64,
7712 .input = "\x49\x20\x77\x6f\x75\x6c\x64\x20"
7713 "\x6c\x69\x6b\x65\x20\x74\x68\x65"
7714 "\x20\x47\x65\x6e\x65\x72\x61\x6c"
7715 "\x20\x47\x61\x75\x27\x73\x20\x43"
7716 "\x68\x69\x63\x6b\x65\x6e\x2c\x20"
7717 "\x70\x6c\x65\x61\x73\x65\x2c\x20"
7718 "\x61\x6e\x64\x20\x77\x6f\x6e\x74"
7719 "\x6f\x6e\x20\x73\x6f\x75\x70\x2e",
7720 .rlen = 64,
7721 .result = "\x97\x68\x72\x68\xd6\xec\xcc\xc0"
7722 "\xc0\x7b\x25\xe2\x5e\xcf\xe5\x84"
7723 "\x39\x31\x25\x23\xa7\x86\x62\xd5"
7724 "\xbe\x7f\xcb\xcc\x98\xeb\xf5\xa8"
7725 "\x48\x07\xef\xe8\x36\xee\x89\xa5"
7726 "\x26\x73\x0d\xbc\x2f\x7b\xc8\x40"
7727 "\x9d\xad\x8b\xbb\x96\xc4\xcd\xc0"
7728 "\x3b\xc1\x03\xe1\xa1\x94\xbb\xd8",
7729 }
7730};
7731
7732static struct cipher_testvec cts_mode_dec_tv_template[] = {
7733 { /* from rfc3962 */
7734 .klen = 16,
7735 .key = "\x63\x68\x69\x63\x6b\x65\x6e\x20"
7736 "\x74\x65\x72\x69\x79\x61\x6b\x69",
7737 .rlen = 17,
7738 .result = "\x49\x20\x77\x6f\x75\x6c\x64\x20"
7739 "\x6c\x69\x6b\x65\x20\x74\x68\x65"
7740 "\x20",
7741 .ilen = 17,
7742 .input = "\xc6\x35\x35\x68\xf2\xbf\x8c\xb4"
7743 "\xd8\xa5\x80\x36\x2d\xa7\xff\x7f"
7744 "\x97",
7745 }, {
7746 .klen = 16,
7747 .key = "\x63\x68\x69\x63\x6b\x65\x6e\x20"
7748 "\x74\x65\x72\x69\x79\x61\x6b\x69",
7749 .rlen = 31,
7750 .result = "\x49\x20\x77\x6f\x75\x6c\x64\x20"
7751 "\x6c\x69\x6b\x65\x20\x74\x68\x65"
7752 "\x20\x47\x65\x6e\x65\x72\x61\x6c"
7753 "\x20\x47\x61\x75\x27\x73\x20",
7754 .ilen = 31,
7755 .input = "\xfc\x00\x78\x3e\x0e\xfd\xb2\xc1"
7756 "\xd4\x45\xd4\xc8\xef\xf7\xed\x22"
7757 "\x97\x68\x72\x68\xd6\xec\xcc\xc0"
7758 "\xc0\x7b\x25\xe2\x5e\xcf\xe5",
7759 }, {
7760 .klen = 16,
7761 .key = "\x63\x68\x69\x63\x6b\x65\x6e\x20"
7762 "\x74\x65\x72\x69\x79\x61\x6b\x69",
7763 .rlen = 32,
7764 .result = "\x49\x20\x77\x6f\x75\x6c\x64\x20"
7765 "\x6c\x69\x6b\x65\x20\x74\x68\x65"
7766 "\x20\x47\x65\x6e\x65\x72\x61\x6c"
7767 "\x20\x47\x61\x75\x27\x73\x20\x43",
7768 .ilen = 32,
7769 .input = "\x39\x31\x25\x23\xa7\x86\x62\xd5"
7770 "\xbe\x7f\xcb\xcc\x98\xeb\xf5\xa8"
7771 "\x97\x68\x72\x68\xd6\xec\xcc\xc0"
7772 "\xc0\x7b\x25\xe2\x5e\xcf\xe5\x84",
7773 }, {
7774 .klen = 16,
7775 .key = "\x63\x68\x69\x63\x6b\x65\x6e\x20"
7776 "\x74\x65\x72\x69\x79\x61\x6b\x69",
7777 .rlen = 47,
7778 .result = "\x49\x20\x77\x6f\x75\x6c\x64\x20"
7779 "\x6c\x69\x6b\x65\x20\x74\x68\x65"
7780 "\x20\x47\x65\x6e\x65\x72\x61\x6c"
7781 "\x20\x47\x61\x75\x27\x73\x20\x43"
7782 "\x68\x69\x63\x6b\x65\x6e\x2c\x20"
7783 "\x70\x6c\x65\x61\x73\x65\x2c",
7784 .ilen = 47,
7785 .input = "\x97\x68\x72\x68\xd6\xec\xcc\xc0"
7786 "\xc0\x7b\x25\xe2\x5e\xcf\xe5\x84"
7787 "\xb3\xff\xfd\x94\x0c\x16\xa1\x8c"
7788 "\x1b\x55\x49\xd2\xf8\x38\x02\x9e"
7789 "\x39\x31\x25\x23\xa7\x86\x62\xd5"
7790 "\xbe\x7f\xcb\xcc\x98\xeb\xf5",
7791 }, {
7792 .klen = 16,
7793 .key = "\x63\x68\x69\x63\x6b\x65\x6e\x20"
7794 "\x74\x65\x72\x69\x79\x61\x6b\x69",
7795 .rlen = 48,
7796 .result = "\x49\x20\x77\x6f\x75\x6c\x64\x20"
7797 "\x6c\x69\x6b\x65\x20\x74\x68\x65"
7798 "\x20\x47\x65\x6e\x65\x72\x61\x6c"
7799 "\x20\x47\x61\x75\x27\x73\x20\x43"
7800 "\x68\x69\x63\x6b\x65\x6e\x2c\x20"
7801 "\x70\x6c\x65\x61\x73\x65\x2c\x20",
7802 .ilen = 48,
7803 .input = "\x97\x68\x72\x68\xd6\xec\xcc\xc0"
7804 "\xc0\x7b\x25\xe2\x5e\xcf\xe5\x84"
7805 "\x9d\xad\x8b\xbb\x96\xc4\xcd\xc0"
7806 "\x3b\xc1\x03\xe1\xa1\x94\xbb\xd8"
7807 "\x39\x31\x25\x23\xa7\x86\x62\xd5"
7808 "\xbe\x7f\xcb\xcc\x98\xeb\xf5\xa8",
7809 }, {
7810 .klen = 16,
7811 .key = "\x63\x68\x69\x63\x6b\x65\x6e\x20"
7812 "\x74\x65\x72\x69\x79\x61\x6b\x69",
7813 .rlen = 64,
7814 .result = "\x49\x20\x77\x6f\x75\x6c\x64\x20"
7815 "\x6c\x69\x6b\x65\x20\x74\x68\x65"
7816 "\x20\x47\x65\x6e\x65\x72\x61\x6c"
7817 "\x20\x47\x61\x75\x27\x73\x20\x43"
7818 "\x68\x69\x63\x6b\x65\x6e\x2c\x20"
7819 "\x70\x6c\x65\x61\x73\x65\x2c\x20"
7820 "\x61\x6e\x64\x20\x77\x6f\x6e\x74"
7821 "\x6f\x6e\x20\x73\x6f\x75\x70\x2e",
7822 .ilen = 64,
7823 .input = "\x97\x68\x72\x68\xd6\xec\xcc\xc0"
7824 "\xc0\x7b\x25\xe2\x5e\xcf\xe5\x84"
7825 "\x39\x31\x25\x23\xa7\x86\x62\xd5"
7826 "\xbe\x7f\xcb\xcc\x98\xeb\xf5\xa8"
7827 "\x48\x07\xef\xe8\x36\xee\x89\xa5"
7828 "\x26\x73\x0d\xbc\x2f\x7b\xc8\x40"
7829 "\x9d\xad\x8b\xbb\x96\xc4\xcd\xc0"
7830 "\x3b\xc1\x03\xe1\xa1\x94\xbb\xd8",
7831 }
7832};
7833
7834/*
7626 * Compression stuff. 7835 * Compression stuff.
7627 */ 7836 */
7628#define COMP_BUF_SIZE 512 7837#define COMP_BUF_SIZE 512