diff --git a/examples/echoserver/echoserver.c b/examples/echoserver/echoserver.c index 2942c803..e7ed95a7 100644 --- a/examples/echoserver/echoserver.c +++ b/examples/echoserver/echoserver.c @@ -544,7 +544,7 @@ typedef struct PwMap { byte type; byte username[32]; word32 usernameSz; - byte p[SHA256_DIGEST_SIZE]; + byte p[WC_SHA256_DIGEST_SIZE]; struct PwMap* next; } PwMap; @@ -561,7 +561,7 @@ static PwMap* PwMapNew(PwMapList* list, byte type, const byte* username, map = (PwMap*)malloc(sizeof(PwMap)); if (map != NULL) { - Sha256 sha; + wc_Sha256 sha; byte flatSz[4]; map->type = type; @@ -741,7 +741,7 @@ static int wsUserAuth(byte authType, { PwMapList* list; PwMap* map; - byte authHash[SHA256_DIGEST_SIZE]; + byte authHash[WC_SHA256_DIGEST_SIZE]; int ret; if (ctx == NULL) { @@ -757,7 +757,7 @@ static int wsUserAuth(byte authType, /* Hash the password or public key with its length. */ { - Sha256 sha; + wc_Sha256 sha; byte flatSz[4]; wc_InitSha256(&sha); if (authType == WOLFSSH_USERAUTH_PASSWORD) { @@ -785,7 +785,7 @@ static int wsUserAuth(byte authType, memcmp(authData->username, map->username, map->usernameSz) == 0) { if (authData->type == map->type) { - if (memcmp(map->p, authHash, SHA256_DIGEST_SIZE) == 0) { + if (memcmp(map->p, authHash, WC_SHA256_DIGEST_SIZE) == 0) { return WOLFSSH_USERAUTH_SUCCESS; } else { diff --git a/examples/server/server.c b/examples/server/server.c index 41f7eab5..0033cf94 100644 --- a/examples/server/server.c +++ b/examples/server/server.c @@ -309,7 +309,7 @@ typedef struct PwMap { byte type; byte username[32]; word32 usernameSz; - byte p[SHA256_DIGEST_SIZE]; + byte p[WC_SHA256_DIGEST_SIZE]; struct PwMap* next; } PwMap; @@ -326,7 +326,7 @@ static PwMap* PwMapNew(PwMapList* list, byte type, const byte* username, map = (PwMap*)malloc(sizeof(PwMap)); if (map != NULL) { - Sha256 sha; + wc_Sha256 sha; byte flatSz[4]; map->type = type; @@ -506,7 +506,7 @@ static int wsUserAuth(byte authType, { PwMapList* list; PwMap* map; - byte authHash[SHA256_DIGEST_SIZE]; + byte authHash[WC_SHA256_DIGEST_SIZE]; if (ctx == NULL) { fprintf(stderr, "wsUserAuth: ctx not set"); @@ -521,7 +521,7 @@ static int wsUserAuth(byte authType, /* Hash the password or public key with its length. */ { - Sha256 sha; + wc_Sha256 sha; byte flatSz[4]; wc_InitSha256(&sha); if (authType == WOLFSSH_USERAUTH_PASSWORD) { @@ -549,7 +549,7 @@ static int wsUserAuth(byte authType, memcmp(authData->username, map->username, map->usernameSz) == 0) { if (authData->type == map->type) { - if (memcmp(map->p, authHash, SHA256_DIGEST_SIZE) == 0) { + if (memcmp(map->p, authHash, WC_SHA256_DIGEST_SIZE) == 0) { return WOLFSSH_USERAUTH_SUCCESS; } else { diff --git a/src/internal.c b/src/internal.c index 42cdb787..7c22ac04 100644 --- a/src/internal.c +++ b/src/internal.c @@ -434,7 +434,7 @@ WOLFSSH* SshInit(WOLFSSH* ssh, WOLFSSH_CTX* ctx) #define RNG WC_RNG #endif HandshakeInfo* handshake; - RNG* rng; + WC_RNG* rng; void* heap; WLOG(WS_LOG_DEBUG, "Entering SshInit()"); @@ -444,7 +444,7 @@ WOLFSSH* SshInit(WOLFSSH* ssh, WOLFSSH_CTX* ctx) heap = ctx->heap; handshake = HandshakeInfoNew(heap); - rng = (RNG*)WMALLOC(sizeof(RNG), heap, DYNTYPE_RNG); + rng = (WC_RNG*)WMALLOC(sizeof(WC_RNG), heap, DYNTYPE_RNG); if (handshake == NULL || rng == NULL || wc_InitRng(rng) != 0) { @@ -1883,11 +1883,11 @@ static INLINE byte MacSzForId(byte id) { switch (id) { case ID_HMAC_SHA1: - return SHA_DIGEST_SIZE; + return WC_SHA_DIGEST_SIZE; case ID_HMAC_SHA1_96: return SHA1_96_SZ; case ID_HMAC_SHA2_256: - return SHA256_DIGEST_SIZE; + return WC_SHA256_DIGEST_SIZE; default: return 0; } @@ -1899,9 +1899,9 @@ static INLINE byte KeySzForId(byte id) switch (id) { case ID_HMAC_SHA1: case ID_HMAC_SHA1_96: - return SHA_DIGEST_SIZE; + return WC_SHA_DIGEST_SIZE; case ID_HMAC_SHA2_256: - return SHA256_DIGEST_SIZE; + return WC_SHA256_DIGEST_SIZE; case ID_AES128_CBC: case ID_AES128_CTR: case ID_AES128_GCM: diff --git a/wolfssh/internal.h b/wolfssh/internal.h index 6affbbb3..7207e6d4 100644 --- a/wolfssh/internal.h +++ b/wolfssh/internal.h @@ -112,7 +112,7 @@ enum { #define MAX_INTEGRITY 2 #define MAX_KEY_EXCHANGE 2 #define MAX_PUBLIC_KEY 1 -#define MAX_HMAC_SZ SHA256_DIGEST_SIZE +#define MAX_HMAC_SZ WC_SHA256_DIGEST_SIZE #define MIN_BLOCK_SZ 8 #define COOKIE_SZ 16 #define LENGTH_SZ 4