1 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 /* 3 * Copyright (C) 1998 by the FundsXpress, INC. 4 * 5 * All rights reserved. 6 * 7 * Export of this software from the United States of America may require 8 * a specific license from the United States Government. It is the 9 * responsibility of any person or organization contemplating export to 10 * obtain such a license before exporting. 11 * 12 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and 13 * distribute this software and its documentation for any purpose and 14 * without fee is hereby granted, provided that the above copyright 15 * notice appear in all copies and that both that copyright notice and 16 * this permission notice appear in supporting documentation, and that 17 * the name of FundsXpress. not be used in advertising or publicity pertaining 18 * to distribution of the software without specific, written prior 19 * permission. FundsXpress makes no representations about the suitability of 20 * this software for any purpose. It is provided "as is" without express 21 * or implied warranty. 22 * 23 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 24 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 25 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 26 */ 27 28 #include "crypto_int.h" 29 30 /* these will be linear searched. if they ever get big, a binary 31 search or hash table would be better, which means these would need 32 to be sorted. An array would be more efficient, but that assumes 33 that the keytypes are all near each other. I'd rather not make 34 that assumption. */ 35 36 /* Deprecations come from RFC 6649 and RFC 8249. */ 37 const struct krb5_keytypes krb5int_enctypes_list[] = { 38 { ENCTYPE_DES3_CBC_RAW, 39 "des3-cbc-raw", { 0 }, "Triple DES cbc mode raw", 40 &krb5int_enc_des3, NULL, 41 16, 42 krb5int_raw_crypto_length, krb5int_raw_encrypt, krb5int_raw_decrypt, 43 krb5int_dk_string_to_key, k5_rand2key_des3, 44 NULL, /*PRF*/ 45 0, 46 ETYPE_WEAK | ETYPE_DEPRECATED, 112 }, 47 48 { ENCTYPE_DES3_CBC_SHA1, 49 "des3-cbc-sha1", { "des3-hmac-sha1", "des3-cbc-sha1-kd" }, 50 "Triple DES cbc mode with HMAC/sha1", 51 &krb5int_enc_des3, &krb5int_hash_sha1, 52 16, 53 krb5int_dk_crypto_length, krb5int_dk_encrypt, krb5int_dk_decrypt, 54 krb5int_dk_string_to_key, k5_rand2key_des3, 55 krb5int_dk_prf, 56 CKSUMTYPE_HMAC_SHA1_DES3, 57 ETYPE_DEPRECATED, 112 }, 58 59 /* rc4-hmac uses a 128-bit key, but due to weaknesses in the RC4 cipher, we 60 * consider its strength degraded and assign it an SSF value of 64. */ 61 { ENCTYPE_ARCFOUR_HMAC, 62 "arcfour-hmac", { "rc4-hmac", "arcfour-hmac-md5" }, 63 "ArcFour with HMAC/md5", 64 &krb5int_enc_arcfour, 65 &krb5int_hash_md5, 66 20, 67 krb5int_arcfour_crypto_length, krb5int_arcfour_encrypt, 68 krb5int_arcfour_decrypt, krb5int_arcfour_string_to_key, 69 k5_rand2key_direct, krb5int_arcfour_prf, 70 CKSUMTYPE_HMAC_MD5_ARCFOUR, 71 ETYPE_DEPRECATED, 64 }, 72 { ENCTYPE_ARCFOUR_HMAC_EXP, 73 "arcfour-hmac-exp", { "rc4-hmac-exp", "arcfour-hmac-md5-exp" }, 74 "Exportable ArcFour with HMAC/md5", 75 &krb5int_enc_arcfour, 76 &krb5int_hash_md5, 77 20, 78 krb5int_arcfour_crypto_length, krb5int_arcfour_encrypt, 79 krb5int_arcfour_decrypt, krb5int_arcfour_string_to_key, 80 k5_rand2key_direct, krb5int_arcfour_prf, 81 CKSUMTYPE_HMAC_MD5_ARCFOUR, 82 ETYPE_WEAK | ETYPE_DEPRECATED, 40 83 }, 84 85 { ENCTYPE_AES128_CTS_HMAC_SHA1_96, 86 "aes128-cts-hmac-sha1-96", { "aes128-cts", "aes128-sha1" }, 87 "AES-128 CTS mode with 96-bit SHA-1 HMAC", 88 &krb5int_enc_aes128, &krb5int_hash_sha1, 89 16, 90 krb5int_aes_crypto_length, krb5int_dk_encrypt, krb5int_dk_decrypt, 91 krb5int_aes_string_to_key, k5_rand2key_direct, 92 krb5int_dk_prf, 93 CKSUMTYPE_HMAC_SHA1_96_AES128, 94 0 /*flags*/, 128 }, 95 { ENCTYPE_AES256_CTS_HMAC_SHA1_96, 96 "aes256-cts-hmac-sha1-96", { "aes256-cts", "aes256-sha1" }, 97 "AES-256 CTS mode with 96-bit SHA-1 HMAC", 98 &krb5int_enc_aes256, &krb5int_hash_sha1, 99 16, 100 krb5int_aes_crypto_length, krb5int_dk_encrypt, krb5int_dk_decrypt, 101 krb5int_aes_string_to_key, k5_rand2key_direct, 102 krb5int_dk_prf, 103 CKSUMTYPE_HMAC_SHA1_96_AES256, 104 0 /*flags*/, 256 }, 105 106 { ENCTYPE_CAMELLIA128_CTS_CMAC, 107 "camellia128-cts-cmac", { "camellia128-cts" }, 108 "Camellia-128 CTS mode with CMAC", 109 &krb5int_enc_camellia128, NULL, 110 16, 111 krb5int_camellia_crypto_length, 112 krb5int_dk_cmac_encrypt, krb5int_dk_cmac_decrypt, 113 krb5int_camellia_string_to_key, k5_rand2key_direct, 114 krb5int_dk_cmac_prf, 115 CKSUMTYPE_CMAC_CAMELLIA128, 116 0 /*flags*/, 128 }, 117 { ENCTYPE_CAMELLIA256_CTS_CMAC, 118 "camellia256-cts-cmac", { "camellia256-cts" }, 119 "Camellia-256 CTS mode with CMAC", 120 &krb5int_enc_camellia256, NULL, 121 16, 122 krb5int_camellia_crypto_length, 123 krb5int_dk_cmac_encrypt, krb5int_dk_cmac_decrypt, 124 krb5int_camellia_string_to_key, k5_rand2key_direct, 125 krb5int_dk_cmac_prf, 126 CKSUMTYPE_CMAC_CAMELLIA256, 127 0 /*flags */, 256 }, 128 129 { ENCTYPE_AES128_CTS_HMAC_SHA256_128, 130 "aes128-cts-hmac-sha256-128", { "aes128-sha2" }, 131 "AES-128 CTS mode with 128-bit SHA-256 HMAC", 132 &krb5int_enc_aes128, &krb5int_hash_sha256, 133 32, 134 krb5int_aes2_crypto_length, krb5int_etm_encrypt, krb5int_etm_decrypt, 135 krb5int_aes2_string_to_key, k5_rand2key_direct, 136 krb5int_aes2_prf, 137 CKSUMTYPE_HMAC_SHA256_128_AES128, 138 0 /*flags*/, 128 }, 139 { ENCTYPE_AES256_CTS_HMAC_SHA384_192, 140 "aes256-cts-hmac-sha384-192", { "aes256-sha2" }, 141 "AES-256 CTS mode with 192-bit SHA-384 HMAC", 142 &krb5int_enc_aes256, &krb5int_hash_sha384, 143 48, 144 krb5int_aes2_crypto_length, krb5int_etm_encrypt, krb5int_etm_decrypt, 145 krb5int_aes2_string_to_key, k5_rand2key_direct, 146 krb5int_aes2_prf, 147 CKSUMTYPE_HMAC_SHA384_192_AES256, 148 0 /*flags*/, 256 }, 149 }; 150 151 const int krb5int_enctypes_length = 152 sizeof(krb5int_enctypes_list) / sizeof(struct krb5_keytypes); 153