Lines Matching full:algorithm
75 * parameter such as a key type, algorithm, etc. is not recognized.
245 * an algorithm with a randomized result, as well as functions that
333 /** \defgroup crypto_types Key and algorithm types
426 * The key policy determines which underlying hash algorithm the key can be
431 * \c alg is the HMAC algorithm or the underlying hash algorithm. */
442 * The key policy determines which key derivation algorithm the key
465 * The key policy determines which key derivation algorithm the key can be
472 * The key policy determines which key derivation algorithm the key
480 * The key policy determines which key derivation algorithm the key
485 /** Key for a cipher, AEAD or MAC algorithm based on the AES block cipher.
492 /** Key for a cipher, AEAD or MAC algorithm based on the
496 /** Key for a cipher or MAC algorithm based on DES or 3DES (Triple-DES).
507 /** Key for a cipher, AEAD or MAC algorithm based on the
511 /** Key for the ChaCha20 stream cipher or the Chacha20-Poly1305 AEAD algorithm.
652 * The algorithm #PSA_ALG_ECDH performs X25519 when used with this curve.
655 * The algorithm #PSA_ALG_ECDH performs X448 when used with this curve.
745 /* Note that algorithm values are embedded in the persistent key store,
750 /** Vendor-defined algorithm flag.
769 /** Whether an algorithm is vendor-defined.
776 /** Whether the specified algorithm is a hash algorithm.
778 * \param alg An algorithm identifier (value of type #psa_algorithm_t).
780 * \return 1 if \p alg is a hash algorithm, 0 otherwise.
782 * algorithm identifier.
787 /** Whether the specified algorithm is a MAC algorithm.
789 * \param alg An algorithm identifier (value of type #psa_algorithm_t).
791 * \return 1 if \p alg is a MAC algorithm, 0 otherwise.
793 * algorithm identifier.
798 /** Whether the specified algorithm is a symmetric cipher algorithm.
800 * \param alg An algorithm identifier (value of type #psa_algorithm_t).
802 * \return 1 if \p alg is a symmetric cipher algorithm, 0 otherwise.
804 * algorithm identifier.
809 /** Whether the specified algorithm is an authenticated encryption
810 * with associated data (AEAD) algorithm.
812 * \param alg An algorithm identifier (value of type #psa_algorithm_t).
814 * \return 1 if \p alg is an AEAD algorithm, 0 otherwise.
816 * algorithm identifier.
821 /** Whether the specified algorithm is an asymmetric signature algorithm,
822 * also known as public-key signature algorithm.
824 * \param alg An algorithm identifier (value of type #psa_algorithm_t).
826 * \return 1 if \p alg is an asymmetric signature algorithm, 0 otherwise.
828 * algorithm identifier.
833 /** Whether the specified algorithm is an asymmetric encryption algorithm,
834 * also known as public-key encryption algorithm.
836 * \param alg An algorithm identifier (value of type #psa_algorithm_t).
838 * \return 1 if \p alg is an asymmetric encryption algorithm, 0 otherwise.
840 * algorithm identifier.
845 /** Whether the specified algorithm is a key agreement algorithm.
847 * \param alg An algorithm identifier (value of type #psa_algorithm_t).
849 * \return 1 if \p alg is a key agreement algorithm, 0 otherwise.
851 * algorithm identifier.
856 /** Whether the specified algorithm is a key derivation algorithm.
858 * \param alg An algorithm identifier (value of type #psa_algorithm_t).
860 * \return 1 if \p alg is a key derivation algorithm, 0 otherwise.
862 * algorithm identifier.
867 /** Whether the specified algorithm is a key stretching / password hashing
868 * algorithm.
870 * A key stretching / password hashing algorithm is a key derivation algorithm
872 * Equivalently, it's a key derivation algorithm that uses a
875 * \param alg An algorithm identifier (value of type #psa_algorithm_t).
877 * \return 1 if \p alg is a key stretching / password hashing algorithm, 0
879 * supported algorithm identifier.
885 /** An invalid algorithm identifier value. */
923 /** In a hash-and-sign algorithm policy, allow any hash algorithm.
925 * This value may be used to form the algorithm usage field of a policy
926 * for a signature algorithm that is parametrized by a hash. The key
928 * algorithm parametrized with any supported hash.
941 * an algorithm built from `PSA_xxx_SIGNATURE` and a specific hash. Each
951 * an algorithm \c alg, #PSA_ALG_IS_HASH_AND_SIGN(\c alg) is true.
953 * This value may not be used to build an algorithm specification to
960 /** Macro to build an HMAC algorithm.
964 * \param hash_alg A hash algorithm (\c PSA_ALG_XXX value such that
967 * \return The corresponding HMAC algorithm.
969 * hash algorithm.
977 /** Whether the specified algorithm is an HMAC algorithm.
981 * \param alg An algorithm identifier (value of type #psa_algorithm_t).
983 * \return 1 if \p alg is an HMAC algorithm, 0 otherwise.
985 * algorithm identifier.
991 /* In the encoding of a MAC algorithm, the bits corresponding to
993 * truncated. As an exception, the value 0 means the untruncated algorithm,
1001 /* In the encoding of a MAC algorithm, the bit corresponding to
1002 * #PSA_ALG_MAC_AT_LEAST_THIS_LENGTH_FLAG encodes the fact that the algorithm
1003 * is a wildcard algorithm. A key with such wildcard algorithm as permitted
1004 * algorithm policy can be used with any algorithm corresponding to the
1009 /** Macro to build a truncated MAC algorithm.
1011 * A truncated MAC algorithm is identical to the corresponding MAC
1012 * algorithm except that the MAC value for the truncated algorithm
1014 * for the untruncated algorithm.
1016 * \note This macro may allow constructing algorithm identifiers that
1023 * algorithm is considered identical to the untruncated algorithm
1026 * \param mac_alg A MAC algorithm identifier (value of type
1029 * MAC algorithm.
1036 * \return The corresponding MAC algorithm with the specified
1039 * MAC algorithm or if \p mac_length is too small or
1040 * too large for the specified MAC algorithm.
1047 /** Macro to build the base MAC algorithm corresponding to a truncated
1048 * MAC algorithm.
1050 * \param mac_alg A MAC algorithm identifier (value of type
1053 * MAC algorithm.
1055 * \return The corresponding base MAC algorithm.
1057 * MAC algorithm.
1063 /** Length to which a MAC algorithm is truncated.
1065 * \param mac_alg A MAC algorithm identifier (value of type
1070 * \return 0 if \p mac_alg is a non-truncated MAC algorithm.
1072 * MAC algorithm.
1077 /** Macro to build a MAC minimum-MAC-length wildcard algorithm.
1079 * A minimum-MAC-length MAC wildcard algorithm permits all MAC algorithms
1080 * sharing the same base algorithm, and where the (potentially truncated) MAC
1081 * length of the specific algorithm is equal to or larger then the wildcard
1082 * algorithm's minimum MAC length.
1085 * smallest MAC length allowed by the base algorithm, this effectively
1086 * becomes an 'any-MAC-length-allowed' policy for that base algorithm.
1088 * \param mac_alg A MAC algorithm identifier (value of type
1095 * \return The corresponding MAC wildcard algorithm with the
1098 * algorithm or if \p min_mac_length is less than 1 or
1099 * too large for the specified MAC algorithm.
1115 /** Whether the specified algorithm is a MAC algorithm based on a block cipher.
1117 * \param alg An algorithm identifier (value of type #psa_algorithm_t).
1119 * \return 1 if \p alg is a MAC algorithm based on a block cipher, 0 otherwise.
1121 * algorithm identifier.
1130 /** Whether the specified algorithm is a stream cipher.
1136 * \param alg An algorithm identifier (value of type #psa_algorithm_t).
1138 * \return 1 if \p alg is a stream cipher algorithm, 0 otherwise.
1140 * algorithm identifier or if it is not a symmetric cipher algorithm.
1146 /** The stream cipher mode of a stream cipher algorithm.
1157 * For example, to use AES-128-CTR, use this algorithm with
1197 * multi-part cipher operation with this algorithm, psa_cipher_generate_iv()
1221 /** Whether the specified algorithm is an AEAD mode on a block cipher.
1223 * \param alg An algorithm identifier (value of type #psa_algorithm_t).
1225 * \return 1 if \p alg is an AEAD algorithm which is an AEAD mode based on
1228 * algorithm identifier.
1234 /** The CCM authenticated encryption algorithm.
1243 * For CCM* with a nonzero tag length, use the AEAD algorithm #PSA_ALG_CCM.
1251 /** The GCM authenticated encryption algorithm.
1257 /** The Chacha20-Poly1305 AEAD algorithm.
1268 /* In the encoding of an AEAD algorithm, the bits corresponding to
1275 /* In the encoding of an AEAD algorithm, the bit corresponding to
1276 * #PSA_ALG_AEAD_AT_LEAST_THIS_LENGTH_FLAG encodes the fact that the algorithm
1277 * is a wildcard algorithm. A key with such wildcard algorithm as permitted
1278 * algorithm policy can be used with any algorithm corresponding to the
1283 /** Macro to build a shortened AEAD algorithm.
1285 * A shortened AEAD algorithm is similar to the corresponding AEAD
1286 * algorithm, but has an authentication tag that consists of fewer bytes.
1287 * Depending on the algorithm, the tag length may affect the calculation
1290 * \param aead_alg An AEAD algorithm identifier (value of type
1295 * \return The corresponding AEAD algorithm with the specified
1298 * AEAD algorithm or if \p tag_length is not valid
1299 * for the specified AEAD algorithm.
1307 /** Retrieve the tag length of a specified AEAD algorithm
1309 * \param aead_alg An AEAD algorithm identifier (value of type
1313 * \return The tag length specified by the input algorithm.
1315 * AEAD algorithm.
1321 /** Calculate the corresponding AEAD algorithm with the default tag length.
1323 * \param aead_alg An AEAD algorithm (\c PSA_ALG_XXX value such that
1326 * \return The corresponding AEAD algorithm with the default
1327 * tag length for that algorithm.
1340 /** Macro to build an AEAD minimum-tag-length wildcard algorithm.
1342 * A minimum-tag-length AEAD wildcard algorithm permits all AEAD algorithms
1343 * sharing the same base algorithm, and where the tag length of the specific
1344 * algorithm is equal to or larger then the minimum tag length specified by the
1345 * wildcard algorithm.
1348 * smallest tag length allowed by the base algorithm, this effectively
1349 * becomes an 'any-tag-length-allowed' policy for that base algorithm.
1351 * \param aead_alg An AEAD algorithm identifier (value of type
1356 * allowed tag length of the algorithm.
1358 * \return The corresponding AEAD wildcard algorithm with the
1361 * AEAD algorithm or if \p min_tag_length is less than 1
1362 * or too large for the specified AEAD algorithm.
1375 * \param hash_alg A hash algorithm (\c PSA_ALG_XXX value such that
1378 * when specifying the algorithm in a usage policy.
1380 * \return The corresponding RSA PKCS#1 v1.5 signature algorithm.
1382 * hash algorithm.
1388 * The input to this algorithm is the DigestInfo structure used by
1404 * possible salt length for the algorithm and key size if that is
1405 * smaller than the hash length. The specified hash algorithm is
1409 * \param hash_alg A hash algorithm (\c PSA_ALG_XXX value such that
1412 * when specifying the algorithm in a usage policy.
1414 * \return The corresponding RSA PSS signature algorithm.
1416 * hash algorithm.
1423 * This algorithm has the same behavior as #PSA_ALG_RSA_PSS when signing,
1427 * \param hash_alg A hash algorithm (\c PSA_ALG_XXX value such that
1430 * when specifying the algorithm in a usage policy.
1432 * \return The corresponding RSA PSS signature algorithm.
1434 * hash algorithm.
1439 /** Whether the specified algorithm is RSA PSS with standard salt.
1441 * \param alg An algorithm value or an algorithm policy wildcard.
1445 * where \c hash_alg is a hash algorithm or
1448 * a supported algorithm identifier or policy.
1453 /** Whether the specified algorithm is RSA PSS with any salt.
1455 * \param alg An algorithm value or an algorithm policy wildcard.
1459 * where \c hash_alg is a hash algorithm or
1462 * a supported algorithm identifier or policy.
1467 /** Whether the specified algorithm is RSA PSS.
1469 * This includes any of the RSA PSS algorithm variants, regardless of the
1472 * \param alg An algorithm value or an algorithm policy wildcard.
1477 * where \c hash_alg is a hash algorithm or
1480 * a supported algorithm identifier or policy.
1498 * \param hash_alg A hash algorithm (\c PSA_ALG_XXX value such that
1501 * when specifying the algorithm in a usage policy.
1503 * \return The corresponding ECDSA signature algorithm.
1505 * hash algorithm.
1512 * without specifying a hash algorithm. This algorithm may only be
1526 * Note that when this algorithm is used for verification, signatures
1532 * \param hash_alg A hash algorithm (\c PSA_ALG_XXX value such that
1535 * when specifying the algorithm in a usage policy.
1538 * algorithm.
1540 * hash algorithm.
1555 /** Edwards-curve digital signature algorithm without prehashing (PureEdDSA),
1561 * suitable functions and extend this algorithm to support contexts.
1575 * This algorithm can be used with psa_sign_message() and
1589 /** Edwards-curve digital signature algorithm with prehashing (HashEdDSA),
1594 * This algorithm is Ed25519 as specified in RFC 8032.
1599 * This is a hash-and-sign algorithm: to calculate a signature,
1605 * using the hash algorithm #PSA_ALG_SHA_512,
1613 /** Edwards-curve digital signature algorithm with prehashing (HashEdDSA),
1618 * This algorithm is Ed448 as specified in RFC 8032.
1624 * This is a hash-and-sign algorithm: to calculate a signature,
1630 * using the hash algorithm #PSA_ALG_SHAKE256_512,
1643 /** Whether the specified algorithm is a signature algorithm that can be used
1652 * \param alg An algorithm identifier (value of type psa_algorithm_t).
1654 * \return 1 if alg is a signature algorithm that can be used to sign a
1655 * hash. 0 if alg is a signature algorithm that can only be used
1656 * to sign a message. 0 if alg is not a signature algorithm.
1658 * supported algorithm identifier.
1665 /** Whether the specified algorithm is a signature algorithm that can be used
1668 * \param alg An algorithm identifier (value of type #psa_algorithm_t).
1670 * \return 1 if alg is a signature algorithm that can be used to sign a
1671 * message. 0 if \p alg is a signature algorithm that can only be used
1673 * algorithm. This macro can return either 0 or 1 if \p alg is not a
1674 * supported algorithm identifier.
1679 /** Whether the specified algorithm is a hash-and-sign algorithm.
1686 * to extract this algorithm.
1688 * Thus, for a hash-and-sign algorithm,
1699 * \param alg An algorithm identifier (value of type #psa_algorithm_t).
1701 * \return 1 if \p alg is a hash-and-sign algorithm, 0 otherwise.
1703 * algorithm identifier.
1709 /** Get the hash used by a hash-and-sign signature algorithm.
1711 * A hash-and-sign algorithm is a signature algorithm which is
1717 * \param alg A signature algorithm (\c PSA_ALG_XXX value such that
1720 * \return The underlying hash algorithm if \p alg is a hash-and-sign
1721 * algorithm.
1722 * \return 0 if \p alg is a signature algorithm that does not
1724 * \return Unspecified if \p alg is not a signature algorithm or
1743 * \param hash_alg The hash algorithm (\c PSA_ALG_XXX value such that
1747 * \return The corresponding RSA OAEP encryption algorithm.
1749 * hash algorithm.
1761 /** Macro to build an HKDF algorithm.
1765 * This key derivation algorithm uses the following inputs:
1775 * if the salt is longer than the block size of the hash algorithm; then
1780 * \param hash_alg A hash algorithm (\c PSA_ALG_XXX value such that
1783 * \return The corresponding HKDF algorithm.
1785 * hash algorithm.
1789 /** Whether the specified algorithm is an HKDF algorithm.
1794 * \param alg An algorithm identifier (value of type #psa_algorithm_t).
1796 * \return 1 if \c alg is an HKDF algorithm, 0 otherwise.
1798 * key derivation algorithm identifier.
1806 /** Macro to build an HKDF-Extract algorithm.
1811 * This key derivation algorithm uses the following inputs:
1820 * as a separate algorithm for the sake of protocols that use it as a
1826 * if the salt is longer than the block size of the hash algorithm; then
1831 * \param hash_alg A hash algorithm (\c PSA_ALG_XXX value such that
1834 * \return The corresponding HKDF-Extract algorithm.
1836 * hash algorithm.
1840 /** Whether the specified algorithm is an HKDF-Extract algorithm.
1845 * \param alg An algorithm identifier (value of type #psa_algorithm_t).
1847 * \return 1 if \c alg is an HKDF-Extract algorithm, 0 otherwise.
1849 * key derivation algorithm identifier.
1855 /** Macro to build an HKDF-Expand algorithm.
1860 * This key derivation algorithm uses the following inputs:
1869 * a separate algorithm for the sake of protocols that use it as a building
1873 * \param hash_alg A hash algorithm (\c PSA_ALG_XXX value such that
1876 * \return The corresponding HKDF-Expand algorithm.
1878 * hash algorithm.
1882 /** Whether the specified algorithm is an HKDF-Expand algorithm.
1887 * \param alg An algorithm identifier (value of type #psa_algorithm_t).
1889 * \return 1 if \c alg is an HKDF-Expand algorithm, 0 otherwise.
1891 * key derivation algorithm identifier.
1896 /** Whether the specified algorithm is an HKDF or HKDF-Extract or
1897 * HKDF-Expand algorithm.
1900 * \param alg An algorithm identifier (value of type #psa_algorithm_t).
1902 * \return 1 if \c alg is any HKDF type algorithm, 0 otherwise.
1904 * key derivation algorithm identifier.
1912 /** Macro to build a TLS-1.2 PRF algorithm.
1918 * This key derivation algorithm uses the following inputs, which must be
1931 * \param hash_alg A hash algorithm (\c PSA_ALG_XXX value such that
1934 * \return The corresponding TLS-1.2 PRF algorithm.
1936 * hash algorithm.
1941 /** Whether the specified algorithm is a TLS-1.2 PRF algorithm.
1943 * \param alg An algorithm identifier (value of type #psa_algorithm_t).
1945 * \return 1 if \c alg is a TLS-1.2 PRF algorithm, 0 otherwise.
1947 * key derivation algorithm identifier.
1955 /** Macro to build a TLS-1.2 PSK-to-MasterSecret algorithm.
1963 * This key derivation algorithm uses the following inputs, which must be
1984 * algorithm constructed as
2001 * \param hash_alg A hash algorithm (\c PSA_ALG_XXX value such that
2004 * \return The corresponding TLS-1.2 PSK to MS algorithm.
2006 * hash algorithm.
2011 /** Whether the specified algorithm is a TLS-1.2 PSK to MS algorithm.
2013 * \param alg An algorithm identifier (value of type #psa_algorithm_t).
2015 * \return 1 if \c alg is a TLS-1.2 PSK to MS algorithm, 0 otherwise.
2017 * key derivation algorithm identifier.
2038 /* This flag indicates whether the key derivation algorithm is suitable for
2043 * Those algorithms cannot be combined with a key agreement algorithm.
2048 /** Macro to build a PBKDF2-HMAC password hashing / key stretching algorithm.
2051 * This macro specifies the PBKDF2 algorithm constructed using a PRF based on
2056 * This key derivation algorithm uses the following inputs, which must be
2067 * \param hash_alg A hash algorithm (\c PSA_ALG_XXX value such that
2070 * \return The corresponding PBKDF2-HMAC-XXX algorithm.
2072 * hash algorithm.
2077 /** Whether the specified algorithm is a PBKDF2-HMAC algorithm.
2079 * \param alg An algorithm identifier (value of type #psa_algorithm_t).
2081 * \return 1 if \c alg is a PBKDF2-HMAC algorithm, 0 otherwise.
2083 * key derivation algorithm identifier.
2088 /** The PBKDF2-AES-CMAC-PRF-128 password hashing / key stretching algorithm.
2091 * This macro specifies the PBKDF2 algorithm constructed using the
2094 * This key derivation algorithm uses the same inputs as
2102 /** Macro to build a combined algorithm that chains a key agreement with
2105 * \param ka_alg A key agreement algorithm (\c PSA_ALG_XXX value such
2107 * \param kdf_alg A key derivation algorithm (\c PSA_ALG_XXX value such
2111 * algorithm.
2113 * key agreement algorithm or \p kdf_alg is not a
2114 * supported key derivation algorithm.
2125 /** Whether the specified algorithm is a raw key agreement algorithm.
2127 * A raw key agreement algorithm is one that does not specify
2133 * \param alg An algorithm identifier (value of type #psa_algorithm_t).
2135 * \return 1 if \p alg is a raw key agreement algorithm, 0 otherwise.
2137 * algorithm identifier.
2146 /** The finite-field Diffie-Hellman (DH) key agreement algorithm.
2155 /** Whether the specified algorithm is a finite field Diffie-Hellman algorithm.
2157 * This includes the raw finite field Diffie-Hellman algorithm as well as
2159 * algorithm.
2161 * \param alg An algorithm identifier (value of type #psa_algorithm_t).
2163 * \return 1 if \c alg is a finite field Diffie-Hellman algorithm, 0 otherwise.
2165 * key agreement algorithm identifier.
2170 /** The elliptic curve Diffie-Hellman (ECDH) key agreement algorithm.
2197 /** Whether the specified algorithm is an elliptic curve Diffie-Hellman
2198 * algorithm.
2200 * This includes the raw elliptic curve Diffie-Hellman algorithm as well as
2202 * algorithm.
2204 * \param alg An algorithm identifier (value of type #psa_algorithm_t).
2206 * \return 1 if \c alg is an elliptic curve Diffie-Hellman algorithm,
2209 * key agreement algorithm identifier.
2214 /** Whether the specified algorithm encoding is a wildcard.
2216 * Wildcard values may only be used to set the usage algorithm field in
2219 * \param alg An algorithm identifier (value of type #psa_algorithm_t).
2221 * \return 1 if \c alg is a wildcard algorithm encoding.
2222 * \return 0 if \c alg is a non-wildcard algorithm encoding (suitable for
2225 * algorithm identifier.
2236 /** Get the hash used by a composite algorithm.
2238 * \param alg An algorithm identifier (value of type #psa_algorithm_t).
2240 * \return The underlying hash algorithm if alg is a composite algorithm that
2241 * uses a hash algorithm.
2243 * \return \c 0 if alg is not a composite algorithm that uses a hash.
2712 /** Check if two AEAD algorithm identifiers refer to the same AEAD algorithm
2715 * \param aead_alg_1 An AEAD algorithm identifier.
2716 * \param aead_alg_2 An AEAD algorithm identifier.
2718 * \return 1 if both identifiers refer to the same AEAD algorithm,
2721 * a supported AEAD algorithm.