Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/sodium/crypto_pwhash.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 #ifndef crypto_pwhash_H
0002 #define crypto_pwhash_H
0003 
0004 #include <stddef.h>
0005 
0006 #include "crypto_pwhash_argon2i.h"
0007 #include "crypto_pwhash_argon2id.h"
0008 #include "export.h"
0009 
0010 #ifdef __cplusplus
0011 # ifdef __GNUC__
0012 #  pragma GCC diagnostic ignored "-Wlong-long"
0013 # endif
0014 extern "C" {
0015 #endif
0016 
0017 #define crypto_pwhash_ALG_ARGON2I13 crypto_pwhash_argon2i_ALG_ARGON2I13
0018 SODIUM_EXPORT
0019 int crypto_pwhash_alg_argon2i13(void);
0020 
0021 #define crypto_pwhash_ALG_ARGON2ID13 crypto_pwhash_argon2id_ALG_ARGON2ID13
0022 SODIUM_EXPORT
0023 int crypto_pwhash_alg_argon2id13(void);
0024 
0025 #define crypto_pwhash_ALG_DEFAULT crypto_pwhash_ALG_ARGON2ID13
0026 SODIUM_EXPORT
0027 int crypto_pwhash_alg_default(void);
0028 
0029 #define crypto_pwhash_BYTES_MIN crypto_pwhash_argon2id_BYTES_MIN
0030 SODIUM_EXPORT
0031 size_t crypto_pwhash_bytes_min(void);
0032 
0033 #define crypto_pwhash_BYTES_MAX crypto_pwhash_argon2id_BYTES_MAX
0034 SODIUM_EXPORT
0035 size_t crypto_pwhash_bytes_max(void);
0036 
0037 #define crypto_pwhash_PASSWD_MIN crypto_pwhash_argon2id_PASSWD_MIN
0038 SODIUM_EXPORT
0039 size_t crypto_pwhash_passwd_min(void);
0040 
0041 #define crypto_pwhash_PASSWD_MAX crypto_pwhash_argon2id_PASSWD_MAX
0042 SODIUM_EXPORT
0043 size_t crypto_pwhash_passwd_max(void);
0044 
0045 #define crypto_pwhash_SALTBYTES crypto_pwhash_argon2id_SALTBYTES
0046 SODIUM_EXPORT
0047 size_t crypto_pwhash_saltbytes(void);
0048 
0049 #define crypto_pwhash_STRBYTES crypto_pwhash_argon2id_STRBYTES
0050 SODIUM_EXPORT
0051 size_t crypto_pwhash_strbytes(void);
0052 
0053 #define crypto_pwhash_STRPREFIX crypto_pwhash_argon2id_STRPREFIX
0054 SODIUM_EXPORT
0055 const char *crypto_pwhash_strprefix(void);
0056 
0057 #define crypto_pwhash_OPSLIMIT_MIN crypto_pwhash_argon2id_OPSLIMIT_MIN
0058 SODIUM_EXPORT
0059 size_t crypto_pwhash_opslimit_min(void);
0060 
0061 #define crypto_pwhash_OPSLIMIT_MAX crypto_pwhash_argon2id_OPSLIMIT_MAX
0062 SODIUM_EXPORT
0063 size_t crypto_pwhash_opslimit_max(void);
0064 
0065 #define crypto_pwhash_MEMLIMIT_MIN crypto_pwhash_argon2id_MEMLIMIT_MIN
0066 SODIUM_EXPORT
0067 size_t crypto_pwhash_memlimit_min(void);
0068 
0069 #define crypto_pwhash_MEMLIMIT_MAX crypto_pwhash_argon2id_MEMLIMIT_MAX
0070 SODIUM_EXPORT
0071 size_t crypto_pwhash_memlimit_max(void);
0072 
0073 #define crypto_pwhash_OPSLIMIT_INTERACTIVE crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE
0074 SODIUM_EXPORT
0075 size_t crypto_pwhash_opslimit_interactive(void);
0076 
0077 #define crypto_pwhash_MEMLIMIT_INTERACTIVE crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE
0078 SODIUM_EXPORT
0079 size_t crypto_pwhash_memlimit_interactive(void);
0080 
0081 #define crypto_pwhash_OPSLIMIT_MODERATE crypto_pwhash_argon2id_OPSLIMIT_MODERATE
0082 SODIUM_EXPORT
0083 size_t crypto_pwhash_opslimit_moderate(void);
0084 
0085 #define crypto_pwhash_MEMLIMIT_MODERATE crypto_pwhash_argon2id_MEMLIMIT_MODERATE
0086 SODIUM_EXPORT
0087 size_t crypto_pwhash_memlimit_moderate(void);
0088 
0089 #define crypto_pwhash_OPSLIMIT_SENSITIVE crypto_pwhash_argon2id_OPSLIMIT_SENSITIVE
0090 SODIUM_EXPORT
0091 size_t crypto_pwhash_opslimit_sensitive(void);
0092 
0093 #define crypto_pwhash_MEMLIMIT_SENSITIVE crypto_pwhash_argon2id_MEMLIMIT_SENSITIVE
0094 SODIUM_EXPORT
0095 size_t crypto_pwhash_memlimit_sensitive(void);
0096 
0097 /*
0098  * With this function, do not forget to store all parameters, including the
0099  * algorithm identifier in order to produce deterministic output.
0100  * The crypto_pwhash_* definitions, including crypto_pwhash_ALG_DEFAULT,
0101  * may change.
0102  */
0103 SODIUM_EXPORT
0104 int crypto_pwhash(unsigned char * const out, unsigned long long outlen,
0105                   const char * const passwd, unsigned long long passwdlen,
0106                   const unsigned char * const salt,
0107                   unsigned long long opslimit, size_t memlimit, int alg)
0108             __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
0109 
0110 /*
0111  * The output string already includes all the required parameters, including
0112  * the algorithm identifier. The string is all that has to be stored in
0113  * order to verify a password.
0114  */
0115 SODIUM_EXPORT
0116 int crypto_pwhash_str(char out[crypto_pwhash_STRBYTES],
0117                       const char * const passwd, unsigned long long passwdlen,
0118                       unsigned long long opslimit, size_t memlimit)
0119             __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
0120 
0121 SODIUM_EXPORT
0122 int crypto_pwhash_str_alg(char out[crypto_pwhash_STRBYTES],
0123                           const char * const passwd, unsigned long long passwdlen,
0124                           unsigned long long opslimit, size_t memlimit, int alg)
0125             __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
0126 
0127 SODIUM_EXPORT
0128 int crypto_pwhash_str_verify(const char *str,
0129                              const char * const passwd,
0130                              unsigned long long passwdlen)
0131             __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
0132 
0133 SODIUM_EXPORT
0134 int crypto_pwhash_str_needs_rehash(const char *str,
0135                                    unsigned long long opslimit, size_t memlimit)
0136             __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
0137 
0138 #define crypto_pwhash_PRIMITIVE "argon2id,argon2i"
0139 SODIUM_EXPORT
0140 const char *crypto_pwhash_primitive(void)
0141             __attribute__ ((warn_unused_result));
0142 
0143 #ifdef __cplusplus
0144 }
0145 #endif
0146 
0147 #endif