sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget/translations/zh_CN/crypto/krb5modnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget/translations/zh_TW/crypto/krb5modnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget/translations/it_IT/crypto/krb5modnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget/translations/ja_JP/crypto/krb5modnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget/translations/ko_KR/crypto/krb5modnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget/translations/sp_SP/crypto/krb5modnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h SPDX-License-Identifier: GPL-2.0h]h SPDX-License-Identifier: GPL-2.0}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhh9/var/lib/git/docbuild/linux/Documentation/crypto/krb5.rsthKubhsection)}(hhh](htitle)}(hKerberos V Cryptography APIh]hKerberos V Cryptography API}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh)}(hContents: - Overview. - Small Buffer. - Encoding Type. - Key Derivation. - PRF+ Calculation. - Kc, Ke And Ki Derivation. - Crypto Functions. - Preparation Functions. - Encryption Mode. - Checksum Mode. - The krb5enc AEAD algorithmh]hContents: - Overview. - Small Buffer. - Encoding Type. - Key Derivation. - PRF+ Calculation. - Kc, Ke And Ki Derivation. - Crypto Functions. - Preparation Functions. - Encryption Mode. - Checksum Mode. - The krb5enc AEAD algorithm}hhsbah}(h]h ]h"]h$]h&]hhuh1hhhhhhhhKubh)}(hhh](h)}(hOverviewh]hOverview}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hThis API provides Kerberos 5-style cryptography for key derivation, encryption and checksumming for use in network filesystems and can be used to implement the low-level crypto that's needed for GSSAPI.h]hThis API provides Kerberos 5-style cryptography for key derivation, encryption and checksumming for use in network filesystems and can be used to implement the low-level crypto that’s needed for GSSAPI.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(h*The following crypto types are supported::h]h)The following crypto types are supported:}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh literal_block)}(hXKRB5_ENCTYPE_AES128_CTS_HMAC_SHA1_96 KRB5_ENCTYPE_AES256_CTS_HMAC_SHA1_96 KRB5_ENCTYPE_AES128_CTS_HMAC_SHA256_128 KRB5_ENCTYPE_AES256_CTS_HMAC_SHA384_192 KRB5_ENCTYPE_CAMELLIA128_CTS_CMAC KRB5_ENCTYPE_CAMELLIA256_CTS_CMAC KRB5_CKSUMTYPE_HMAC_SHA1_96_AES128 KRB5_CKSUMTYPE_HMAC_SHA1_96_AES256 KRB5_CKSUMTYPE_CMAC_CAMELLIA128 KRB5_CKSUMTYPE_CMAC_CAMELLIA256 KRB5_CKSUMTYPE_HMAC_SHA256_128_AES128 KRB5_CKSUMTYPE_HMAC_SHA384_192_AES256h]hXKRB5_ENCTYPE_AES128_CTS_HMAC_SHA1_96 KRB5_ENCTYPE_AES256_CTS_HMAC_SHA1_96 KRB5_ENCTYPE_AES128_CTS_HMAC_SHA256_128 KRB5_ENCTYPE_AES256_CTS_HMAC_SHA384_192 KRB5_ENCTYPE_CAMELLIA128_CTS_CMAC KRB5_ENCTYPE_CAMELLIA256_CTS_CMAC KRB5_CKSUMTYPE_HMAC_SHA1_96_AES128 KRB5_CKSUMTYPE_HMAC_SHA1_96_AES256 KRB5_CKSUMTYPE_CMAC_CAMELLIA128 KRB5_CKSUMTYPE_CMAC_CAMELLIA256 KRB5_CKSUMTYPE_HMAC_SHA256_128_AES128 KRB5_CKSUMTYPE_HMAC_SHA384_192_AES256}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhhhhubh)}(hThe API can be included by::h]hThe API can be included by:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK,hhhhubj)}(h#include h]h#include }hj$sbah}(h]h ]h"]h$]h&]hhuh1jhhhK.hhhhubh)}(hhh](h)}(h Small Bufferh]h Small Buffer}(hj5hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj2hhhhhK1ubh)}(hTo pass small pieces of data about, such as keys, a buffer structure is defined, giving a pointer to the data and the size of that data::h]hTo pass small pieces of data about, such as keys, a buffer structure is defined, giving a pointer to the data and the size of that data:}(hjChhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK3hj2hhubj)}(hSstruct krb5_buffer { unsigned int len; void *data; };h]hSstruct krb5_buffer { unsigned int len; void *data; };}hjQsbah}(h]h ]h"]h$]h&]hhuh1jhhhK6hj2hhubeh}(h] small-bufferah ]h"] small bufferah$]h&]uh1hhhhhhhhK1ubeh}(h]overviewah ]h"]overviewah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h Encoding Typeh]h Encoding Type}(hjrhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjohhhhhKhjohhubj)}(hXstruct krb5_enctype { int etype; int ctype; const char *name; u16 key_bytes; u16 key_len; u16 Kc_len; u16 Ke_len; u16 Ki_len; u16 prf_len; u16 block_len; u16 conf_len; u16 cksum_len; ... };h]hXstruct krb5_enctype { int etype; int ctype; const char *name; u16 key_bytes; u16 key_len; u16 Kc_len; u16 Ke_len; u16 Ki_len; u16 prf_len; u16 block_len; u16 conf_len; u16 cksum_len; ... };}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhK@hjohhubh)}(h=The fields of interest to the user of the API are as follows:h]h=The fields of interest to the user of the API are as follows:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKPhjohhubh block_quote)}(hXj* ``etype`` and ``ctype`` indicate the protocol number for this encoding type for encryption and checksumming respectively. They hold ``KRB5_ENCTYPE_*`` and ``KRB5_CKSUMTYPE_*`` constants. * ``name`` is the formal name of the encoding. * ``key_len`` and ``key_bytes`` are the input key length and the derived key length. (I think they only differ for DES, which isn't supported here). * ``Kc_len``, ``Ke_len`` and ``Ki_len`` are the sizes of the derived Kc, Ke and Ki keys. Kc is used for in checksum mode; Ke and Ki are used in encryption mode. * ``prf_len`` is the size of the result from the PRF+ function calculation. * ``block_len``, ``conf_len`` and ``cksum_len`` are the encryption block length, confounder length and checksum length respectively. All three are used in encryption mode, but only the checksum length is used in checksum mode. h]h bullet_list)}(hhh](h list_item)}(h``etype`` and ``ctype`` indicate the protocol number for this encoding type for encryption and checksumming respectively. They hold ``KRB5_ENCTYPE_*`` and ``KRB5_CKSUMTYPE_*`` constants. h]h)}(h``etype`` and ``ctype`` indicate the protocol number for this encoding type for encryption and checksumming respectively. They hold ``KRB5_ENCTYPE_*`` and ``KRB5_CKSUMTYPE_*`` constants.h](hliteral)}(h ``etype``h]hetype}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh and }(hjhhhNhNubj)}(h ``ctype``h]hctype}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhn indicate the protocol number for this encoding type for encryption and checksumming respectively. They hold }(hjhhhNhNubj)}(h``KRB5_ENCTYPE_*``h]hKRB5_ENCTYPE_*}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh and }hjsbj)}(h``KRB5_CKSUMTYPE_*``h]hKRB5_CKSUMTYPE_*}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh constants.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKRhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(h-``name`` is the formal name of the encoding. h]h)}(h,``name`` is the formal name of the encoding.h](j)}(h``name``h]hname}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh$ is the formal name of the encoding.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKVhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(h``key_len`` and ``key_bytes`` are the input key length and the derived key length. (I think they only differ for DES, which isn't supported here). h]h)}(h``key_len`` and ``key_bytes`` are the input key length and the derived key length. (I think they only differ for DES, which isn't supported here).h](j)}(h ``key_len``h]hkey_len}(hjChhhNhNubah}(h]h ]h"]h$]h&]uh1jhj?ubh and }(hj?hhhNhNubj)}(h ``key_bytes``h]h key_bytes}(hjUhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj?ubhx are the input key length and the derived key length. (I think they only differ for DES, which isn’t supported here).}(hj?hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKXhj;ubah}(h]h ]h"]h$]h&]uh1jhjubj)}(h``Kc_len``, ``Ke_len`` and ``Ki_len`` are the sizes of the derived Kc, Ke and Ki keys. Kc is used for in checksum mode; Ke and Ki are used in encryption mode. h]h)}(h``Kc_len``, ``Ke_len`` and ``Ki_len`` are the sizes of the derived Kc, Ke and Ki keys. Kc is used for in checksum mode; Ke and Ki are used in encryption mode.h](j)}(h ``Kc_len``h]hKc_len}(hj{hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjwubh, }(hjwhhhNhNubj)}(h ``Ke_len``h]hKe_len}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjwubh and }(hjwhhhNhNubj)}(h ``Ki_len``h]hKi_len}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjwubhz are the sizes of the derived Kc, Ke and Ki keys. Kc is used for in checksum mode; Ke and Ki are used in encryption mode.}(hjwhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK[hjsubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hJ``prf_len`` is the size of the result from the PRF+ function calculation. h]h)}(hI``prf_len`` is the size of the result from the PRF+ function calculation.h](j)}(h ``prf_len``h]hprf_len}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh> is the size of the result from the PRF+ function calculation.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK_hjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(h``block_len``, ``conf_len`` and ``cksum_len`` are the encryption block length, confounder length and checksum length respectively. All three are used in encryption mode, but only the checksum length is used in checksum mode. h]h)}(h``block_len``, ``conf_len`` and ``cksum_len`` are the encryption block length, confounder length and checksum length respectively. All three are used in encryption mode, but only the checksum length is used in checksum mode.h](j)}(h ``block_len``h]h block_len}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh, }(hjhhhNhNubj)}(h ``conf_len``h]hconf_len}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh and }(hjhhhNhNubj)}(h ``cksum_len``h]h cksum_len}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh are the encryption block length, confounder length and checksum length respectively. All three are used in encryption mode, but only the checksum length is used in checksum mode.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKahjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]bullet*uh1jhhhKRhjubah}(h]h ]h"]h$]h&]uh1jhhhKRhjohhubh)}(hGThe encoding type is looked up by number using the following function::h]hFThe encoding type is looked up by number using the following function:}(hj;hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKfhjohhubj)}(hAconst struct krb5_enctype *crypto_krb5_find_enctype(u32 enctype);h]hAconst struct krb5_enctype *crypto_krb5_find_enctype(u32 enctype);}hjIsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhhjohhubeh}(h] encoding-typeah ]h"] encoding typeah$]h&]uh1hhhhhhhhKssize_t crypto_krb5_encrypt(const struct krb5_enctype *krb5, struct crypto_aead *aead, struct scatterlist *sg, unsigned int nr_sg, size_t sg_len, size_t data_offset, size_t data_len, bool preconfounded); int crypto_krb5_decrypt(const struct krb5_enctype *krb5, struct crypto_aead *aead, struct scatterlist *sg, unsigned int nr_sg, size_t *_offset, size_t *_len);h]hX>ssize_t crypto_krb5_encrypt(const struct krb5_enctype *krb5, struct crypto_aead *aead, struct scatterlist *sg, unsigned int nr_sg, size_t sg_len, size_t data_offset, size_t data_len, bool preconfounded); int crypto_krb5_decrypt(const struct krb5_enctype *krb5, struct crypto_aead *aead, struct scatterlist *sg, unsigned int nr_sg, size_t *_offset, size_t *_len);}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubh)}(hRIn both cases, the input and output buffers are indicated by the same scatterlist.h]hRIn both cases, the input and output buffers are indicated by the same scatterlist.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hXFor the encryption function, the output buffer may be larger than is needed (the amount of output generated is returned) and the location and size of the data are indicated (which must match the encoding). If no confounder is set, the function will insert one.h]hXFor the encryption function, the output buffer may be larger than is needed (the amount of output generated is returned) and the location and size of the data are indicated (which must match the encoding). If no confounder is set, the function will insert one.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hFor the decryption function, the offset and length of the message in buffer are supplied and these are shrunk to fit the data. The decryption function will verify any checksums within the message and give an error if they don't match.h]hFor the decryption function, the offset and length of the message in buffer are supplied and these are shrunk to fit the data. The decryption function will verify any checksums within the message and give an error if they don’t match.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h]encryption-modeah ]h"]encryption modeah$]h&]uh1hhjhhhhhKubh)}(hhh](h)}(h Checksum Modeh]h Checksum Mode}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hcA pair of function are provided to generate the checksum on a message and to verify that checksum::h]hbA pair of function are provided to generate the checksum on a message and to verify that checksum:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(hXssize_t crypto_krb5_get_mic(const struct krb5_enctype *krb5, struct crypto_shash *shash, const struct krb5_buffer *metadata, struct scatterlist *sg, unsigned int nr_sg, size_t sg_len, size_t data_offset, size_t data_len); int crypto_krb5_verify_mic(const struct krb5_enctype *krb5, struct crypto_shash *shash, const struct krb5_buffer *metadata, struct scatterlist *sg, unsigned int nr_sg, size_t *_offset, size_t *_len);h]hXssize_t crypto_krb5_get_mic(const struct krb5_enctype *krb5, struct crypto_shash *shash, const struct krb5_buffer *metadata, struct scatterlist *sg, unsigned int nr_sg, size_t sg_len, size_t data_offset, size_t data_len); int crypto_krb5_verify_mic(const struct krb5_enctype *krb5, struct crypto_shash *shash, const struct krb5_buffer *metadata, struct scatterlist *sg, unsigned int nr_sg, size_t *_offset, size_t *_len);}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubh)}(hIn both cases, the input and output buffers are indicated by the same scatterlist. Additional metadata can be passed in which will get added to the hash before the data.h]hIn both cases, the input and output buffers are indicated by the same scatterlist. Additional metadata can be passed in which will get added to the hash before the data.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hFor the get_mic function, the output buffer may be larger than is needed (the amount of output generated is returned) and the location and size of the data are indicated (which must match the encoding).h]hFor the get_mic function, the output buffer may be larger than is needed (the amount of output generated is returned) and the location and size of the data are indicated (which must match the encoding).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hFor the verification function, the offset and length of the message in buffer are supplied and these are shrunk to fit the data. An error will be returned if the checksums don't match.h]hFor the verification function, the offset and length of the message in buffer are supplied and these are shrunk to fit the data. An error will be returned if the checksums don’t match.}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h] checksum-modeah ]h"] checksum modeah$]h&]uh1hhjhhhhhKubeh}(h]crypto-functionsah ]h"]crypto functionsah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hThe krb5enc AEAD algorithmh]hThe krb5enc AEAD algorithm}(hjHhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjEhhhhhKubh)}(hX,A template AEAD crypto algorithm, called "krb5enc", is provided that hashes the plaintext before encrypting it (the reverse of authenc). The handle returned by ``crypto_krb5_prepare_encryption()`` may be one of these, but there's no requirement for the user of this API to interact with it directly.h](hA template AEAD crypto algorithm, called “krb5enc”, is provided that hashes the plaintext before encrypting it (the reverse of authenc). The handle returned by }(hjVhhhNhNubj)}(h$``crypto_krb5_prepare_encryption()``h]h crypto_krb5_prepare_encryption()}(hj^hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjVubhi may be one of these, but there’s no requirement for the user of this API to interact with it directly.}(hjVhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjEhhubh)}(hFor reference, its key format begins with a BE32 of the format number. Only format 1 is provided and that continues with a BE32 of the Ke key length followed by a BE32 of the Ki key length, followed by the bytes from the Ke key and then the Ki key.h]hFor reference, its key format begins with a BE32 of the format number. Only format 1 is provided and that continues with a BE32 of the Ke key length followed by a BE32 of the Ki key length, followed by the bytes from the Ke key and then the Ki key.}(hjvhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjEhhubh)}(h^Using specifically ordered words means that the static test data doesn't require byteswapping.h]h`Using specifically ordered words means that the static test data doesn’t require byteswapping.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjEhhubeh}(h]the-krb5enc-aead-algorithmah ]h"]the krb5enc aead algorithmah$]h&]uh1hhhhhhhhKubeh}(h]kerberos-v-cryptography-apiah ]h"]kerberos v cryptography apiah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjerror_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(jjjljijdjaj\jYjjjjjBj?j|jyjjj:j7jju nametypes}(jjljdj\jjjBj|jj:juh}(jhjihjaj2jYjojj_jj~j?jjyj<jjj7jjjEu footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.