26 #ifdef WOLFCRYPT_HAVE_SRP 28 #ifndef WOLFCRYPT_SRP_H 29 #define WOLFCRYPT_SRP_H 35 #include <wolfssl/wolfcrypt/integer.h> 42 #if defined(WOLFSSL_SHA512) 43 #define SRP_MAX_DIGEST_SIZE WC_SHA512_DIGEST_SIZE 44 #elif defined(WOLFSSL_SHA384) 45 #define SRP_MAX_DIGEST_SIZE WC_SHA384_DIGEST_SIZE 46 #elif !defined(NO_SHA256) 47 #define SRP_MAX_DIGEST_SIZE WC_SHA256_DIGEST_SIZE 48 #elif !defined(NO_SHA) 49 #define SRP_MAX_DIGEST_SIZE WC_SHA_DIGEST_SIZE 51 #error "You have to have some kind of SHA hash if you want to use SRP." 55 #define SRP_MODULUS_MIN_BITS 512 58 #define SRP_PRIVATE_KEY_MIN_BITS 256 61 #define SRP_SALT_SIZE 16 112 byte
k[SRP_MAX_DIGEST_SIZE];
178 const byte*
g, word32 gSz,
276 byte* clientPubKey, word32 clientPubKeySz,
277 byte* serverPubKey, word32 serverPubKeySz);
mp_int N
Definition: srp.h:110
mp_int g
Definition: srp.h:111
byte k[SRP_MAX_DIGEST_SIZE]
Definition: srp.h:112
WOLFSSL_API void wc_SrpTerm(Srp *srp)
Releases the Srp struct resources after usage.
Definition: srp.c:267
mp_int priv
Definition: srp.h:115
byte * key
Definition: srp.h:118
int(* keyGenFunc_cb)(struct Srp *srp, byte *secret, word32 size)
Definition: srp.h:120
WOLFSSL_API int wc_SrpGetVerifier(Srp *srp, byte *verifier, word32 *size)
Gets the verifier. The client calculates the verifier with v = g ^ x % N. This function MAY be called...
Definition: srp.c:424
word32 saltSz
Definition: srp.h:109
SrpHash client_proof
Definition: srp.h:116
WOLFSSL_API int wc_SrpSetPassword(Srp *srp, const byte *password, word32 size)
Sets the password. Setting the password does not persists the clear password data in the srp structur...
Definition: srp.c:388
word32 keySz
Definition: srp.h:119
WOLFSSL_API int wc_SrpInit(Srp *srp, SrpType type, SrpSide side)
Initializes the Srp struct for usage.
Definition: srp.c:191
SrpType type
Definition: srp.h:105
Definition: integer.h:200
word32 userSz
Definition: srp.h:107
WOLFSSL_API int wc_SrpSetUsername(Srp *srp, const byte *username, word32 size)
Sets the username. This function MUST be called after wc_SrpInit.
Definition: srp.c:289
SrpSide side
Definition: srp.h:104
SrpType
Definition: srp.h:74
WOLFSSL_API int wc_SrpSetPrivate(Srp *srp, const byte *priv, word32 size)
Sets the private ephemeral value. The private ephemeral value is known as: a at the client side...
Definition: srp.c:458
WOLFSSL_API int wc_SrpSetVerifier(Srp *srp, const byte *verifier, word32 size)
Sets the verifier. This function MUST be called after wc_SrpSetParams and is SERVER SIDE ONLY...
Definition: srp.c:450
byte * salt
Definition: srp.h:108
WOLFSSL_API int wc_SrpVerifyPeersProof(Srp *srp, byte *proof, word32 size)
Verifies the peers proof. This function MUST be called before wc_SrpGetSessionKey.
Definition: srp.c:730
byte * user
Definition: srp.h:106
WOLFSSL_API int wc_SrpGetPublic(Srp *srp, byte *pub, word32 *size)
Gets the public ephemeral value. The public ephemeral value is known as: A at the client side...
Definition: srp.c:494
void * heap
Definition: srp.h:127
Definition: wolfcaam_sha.h:68
WOLFSSL_API int wc_SrpGetProof(Srp *srp, byte *proof, word32 *size)
Gets the proof. This function MUST be called after wc_SrpComputeKey.
Definition: srp.c:704
WOLFSSL_API int wc_SrpComputeKey(Srp *srp, byte *clientPubKey, word32 clientPubKeySz, byte *serverPubKey, word32 serverPubKeySz)
Computes the session key. The key can be accessed at srp->key after success.
Definition: srp.c:590
SrpHash server_proof
Definition: srp.h:117
WOLFSSL_API int wc_SrpSetParams(Srp *srp, const byte *N, word32 nSz, const byte *g, word32 gSz, const byte *salt, word32 saltSz)
Sets the srp parameters based on the username.. Must be called after wc_SrpSetUsername.
Definition: srp.c:304
mp_int auth
Definition: srp.h:113