wc_ udates in src/ directory

This commit is contained in:
kaleb-himes 2014-12-30 14:13:57 -07:00
parent 7a3fdbc07f
commit c57609acc3
3 changed files with 53 additions and 53 deletions

View File

@ -5908,23 +5908,23 @@ static INLINE int Decrypt(WOLFSSL* ssl, byte* plain, const byte* input,
#ifdef HAVE_CAMELLIA
case wolfssl_camellia:
CamelliaCbcDecrypt(ssl->decrypt.cam, plain, input, sz);
wc_CamelliaCbcDecrypt(ssl->decrypt.cam, plain, input, sz);
break;
#endif
#ifdef HAVE_HC128
case wolfssl_hc128:
return Hc128_Process(ssl->decrypt.hc128, plain, input, sz);
return wc_Hc128_Process(ssl->decrypt.hc128, plain, input, sz);
#endif
#ifdef BUILD_RABBIT
case wolfssl_rabbit:
return RabbitProcess(ssl->decrypt.rabbit, plain, input, sz);
return wc_RabbitProcess(ssl->decrypt.rabbit, plain, input, sz);
#endif
#ifdef HAVE_CHACHA
case wolfssl_chacha:
return ChachaAEADDecrypt(ssl, plain, input, sz);
return wc_ChachaAEADDecrypt(ssl, plain, input, sz);
#endif
#ifdef HAVE_NULL_CIPHER
@ -10482,21 +10482,21 @@ static void PickHashSigAlgo(WOLFSSL* ssl,
}
#endif
InitDhKey(&key);
ret = DhSetKey(&key, serverP.buffer, serverP.length,
wc_InitDhKey(&key);
ret = wc_DhSetKey(&key, serverP.buffer, serverP.length,
serverG.buffer, serverG.length);
if (ret == 0)
/* for DH, encSecret is Yc, agree is pre-master */
ret = DhGenerateKeyPair(&key, ssl->rng, priv, &privSz,
ret = wc_DhGenerateKeyPair(&key, ssl->rng, priv, &privSz,
encSecret, &encSz);
if (ret == 0)
ret = DhAgree(&key, ssl->arrays->preMasterSecret,
ret = wc_DhAgree(&key, ssl->arrays->preMasterSecret,
&ssl->arrays->preMasterSz, priv, privSz,
serverPub.buffer, serverPub.length);
#ifdef WOLFSSL_SMALL_STACK
XFREE(priv, NULL, DYNAMIC_TYPE_TMP_BUFFER);
#endif
FreeDhKey(&key);
wc_FreeDhKey(&key);
}
break;
#endif /* NO_DH */
@ -10598,18 +10598,18 @@ static void PickHashSigAlgo(WOLFSSL* ssl,
es += esSz;
encSz = esSz + OPAQUE16_LEN;
InitDhKey(&key);
ret = DhSetKey(&key, serverP.buffer, serverP.length,
wc_InitDhKey(&key);
ret = wc_DhSetKey(&key, serverP.buffer, serverP.length,
serverG.buffer, serverG.length);
if (ret == 0)
/* for DH, encSecret is Yc, agree is pre-master */
ret = DhGenerateKeyPair(&key, ssl->rng, priv, &privSz,
ret = wc_DhGenerateKeyPair(&key, ssl->rng, priv, &privSz,
es + OPAQUE16_LEN, &pubSz);
if (ret == 0)
ret = DhAgree(&key, pms + OPAQUE16_LEN,
ret = wc_DhAgree(&key, pms + OPAQUE16_LEN,
&ssl->arrays->preMasterSz, priv, privSz,
serverPub.buffer, serverPub.length);
FreeDhKey(&key);
wc_FreeDhKey(&key);
#ifdef WOLFSSL_SMALL_STACK
XFREE(priv, NULL, DYNAMIC_TYPE_TMP_BUFFER);
#endif
@ -11518,18 +11518,18 @@ int DoSessionTicket(WOLFSSL* ssl,
return MEMORY_E;
}
InitDhKey(&dhKey);
ret = DhSetKey(&dhKey, ssl->buffers.serverDH_P.buffer,
wc_InitDhKey(&dhKey);
ret = wc_DhSetKey(&dhKey, ssl->buffers.serverDH_P.buffer,
ssl->buffers.serverDH_P.length,
ssl->buffers.serverDH_G.buffer,
ssl->buffers.serverDH_G.length);
if (ret == 0)
ret = DhGenerateKeyPair(&dhKey, ssl->rng,
ret = wc_DhGenerateKeyPair(&dhKey, ssl->rng,
ssl->buffers.serverDH_Priv.buffer,
&ssl->buffers.serverDH_Priv.length,
ssl->buffers.serverDH_Pub.buffer,
&ssl->buffers.serverDH_Pub.length);
FreeDhKey(&dhKey);
wc_FreeDhKey(&dhKey);
if (ret != 0)
return ret;
@ -12111,18 +12111,18 @@ int DoSessionTicket(WOLFSSL* ssl,
return MEMORY_E;
}
InitDhKey(&dhKey);
ret = DhSetKey(&dhKey, ssl->buffers.serverDH_P.buffer,
wc_InitDhKey(&dhKey);
ret = wc_DhSetKey(&dhKey, ssl->buffers.serverDH_P.buffer,
ssl->buffers.serverDH_P.length,
ssl->buffers.serverDH_G.buffer,
ssl->buffers.serverDH_G.length);
if (ret == 0)
ret = DhGenerateKeyPair(&dhKey, ssl->rng,
ret = wc_DhGenerateKeyPair(&dhKey, ssl->rng,
ssl->buffers.serverDH_Priv.buffer,
&ssl->buffers.serverDH_Priv.length,
ssl->buffers.serverDH_Pub.buffer,
&ssl->buffers.serverDH_Pub.length);
FreeDhKey(&dhKey);
wc_FreeDhKey(&dhKey);
if (ret != 0) return ret;
@ -13623,18 +13623,18 @@ int DoSessionTicket(WOLFSSL* ssl,
if ((*inOutIdx - begin) + clientPubSz > size)
return BUFFER_ERROR;
InitDhKey(&dhKey);
ret = DhSetKey(&dhKey, ssl->buffers.serverDH_P.buffer,
wc_InitDhKey(&dhKey);
ret = wc_DhSetKey(&dhKey, ssl->buffers.serverDH_P.buffer,
ssl->buffers.serverDH_P.length,
ssl->buffers.serverDH_G.buffer,
ssl->buffers.serverDH_G.length);
if (ret == 0)
ret = DhAgree(&dhKey, ssl->arrays->preMasterSecret,
ret = wc_DhAgree(&dhKey, ssl->arrays->preMasterSecret,
&ssl->arrays->preMasterSz,
ssl->buffers.serverDH_Priv.buffer,
ssl->buffers.serverDH_Priv.length,
input + *inOutIdx, clientPubSz);
FreeDhKey(&dhKey);
wc_FreeDhKey(&dhKey);
*inOutIdx += clientPubSz;
@ -13678,18 +13678,18 @@ int DoSessionTicket(WOLFSSL* ssl,
if ((*inOutIdx - begin) + clientSz > size)
return BUFFER_ERROR;
InitDhKey(&dhKey);
ret = DhSetKey(&dhKey, ssl->buffers.serverDH_P.buffer,
wc_InitDhKey(&dhKey);
ret = wc_DhSetKey(&dhKey, ssl->buffers.serverDH_P.buffer,
ssl->buffers.serverDH_P.length,
ssl->buffers.serverDH_G.buffer,
ssl->buffers.serverDH_G.length);
if (ret == 0)
ret = DhAgree(&dhKey, pms + OPAQUE16_LEN,
ret = wc_DhAgree(&dhKey, pms + OPAQUE16_LEN,
&ssl->arrays->preMasterSz,
ssl->buffers.serverDH_Priv.buffer,
ssl->buffers.serverDH_Priv.length,
input + *inOutIdx, clientSz);
FreeDhKey(&dhKey);
wc_FreeDhKey(&dhKey);
*inOutIdx += clientSz;
c16toa((word16)ssl->arrays->preMasterSz, pms);

View File

@ -1938,24 +1938,24 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
return MEMORY_E;
if (side == WOLFSSL_CLIENT_END) {
if (enc) {
hcRet = Hc128_SetKey(enc->hc128, keys->client_write_key,
hcRet = wc_Hc128_SetKey(enc->hc128, keys->client_write_key,
keys->client_write_IV);
if (hcRet != 0) return hcRet;
}
if (dec) {
hcRet = Hc128_SetKey(dec->hc128, keys->server_write_key,
hcRet = wc_Hc128_SetKey(dec->hc128, keys->server_write_key,
keys->server_write_IV);
if (hcRet != 0) return hcRet;
}
}
else {
if (enc) {
hcRet = Hc128_SetKey(enc->hc128, keys->server_write_key,
hcRet = wc_Hc128_SetKey(enc->hc128, keys->server_write_key,
keys->server_write_IV);
if (hcRet != 0) return hcRet;
}
if (dec) {
hcRet = Hc128_SetKey(dec->hc128, keys->client_write_key,
hcRet = wc_Hc128_SetKey(dec->hc128, keys->client_write_key,
keys->client_write_IV);
if (hcRet != 0) return hcRet;
}
@ -1982,24 +1982,24 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
return MEMORY_E;
if (side == WOLFSSL_CLIENT_END) {
if (enc) {
rabRet = RabbitSetKey(enc->rabbit, keys->client_write_key,
rabRet = wc_RabbitSetKey(enc->rabbit, keys->client_write_key,
keys->client_write_IV);
if (rabRet != 0) return rabRet;
}
if (dec) {
rabRet = RabbitSetKey(dec->rabbit, keys->server_write_key,
rabRet = wc_RabbitSetKey(dec->rabbit, keys->server_write_key,
keys->server_write_IV);
if (rabRet != 0) return rabRet;
}
}
else {
if (enc) {
rabRet = RabbitSetKey(enc->rabbit, keys->server_write_key,
rabRet = wc_RabbitSetKey(enc->rabbit, keys->server_write_key,
keys->server_write_IV);
if (rabRet != 0) return rabRet;
}
if (dec) {
rabRet = RabbitSetKey(dec->rabbit, keys->client_write_key,
rabRet = wc_RabbitSetKey(dec->rabbit, keys->client_write_key,
keys->client_write_IV);
if (rabRet != 0) return rabRet;
}
@ -2245,24 +2245,24 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
if (side == WOLFSSL_CLIENT_END) {
if (enc) {
camRet = CamelliaSetKey(enc->cam, keys->client_write_key,
camRet = wc_CamelliaSetKey(enc->cam, keys->client_write_key,
specs->key_size, keys->client_write_IV);
if (camRet != 0) return camRet;
}
if (dec) {
camRet = CamelliaSetKey(dec->cam, keys->server_write_key,
camRet = wc_CamelliaSetKey(dec->cam, keys->server_write_key,
specs->key_size, keys->server_write_IV);
if (camRet != 0) return camRet;
}
}
else {
if (enc) {
camRet = CamelliaSetKey(enc->cam, keys->server_write_key,
camRet = wc_CamelliaSetKey(enc->cam, keys->server_write_key,
specs->key_size, keys->server_write_IV);
if (camRet != 0) return camRet;
}
if (dec) {
camRet = CamelliaSetKey(dec->cam, keys->client_write_key,
camRet = wc_CamelliaSetKey(dec->cam, keys->client_write_key,
specs->key_size, keys->client_write_IV);
if (camRet != 0) return camRet;
}

View File

@ -3640,7 +3640,7 @@ static int wolfSSL_SetTmpDH_buffer_wrapper(WOLFSSL_CTX* ctx, WOLFSSL* ssl,
}
if (ret == 0) {
if (DhParamsLoad(der.buffer, der.length, p, &pSz, g, &gSz) < 0)
if (wc_DhParamsLoad(der.buffer, der.length, p, &pSz, g, &gSz) < 0)
ret = SSL_BAD_FILETYPE;
else if (ssl)
ret = wolfSSL_SetTmpDH(ssl, p, pSz, g, gSz);
@ -7661,7 +7661,7 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
break;
case ARC4_TYPE :
Arc4Process(&ctx->cipher.arc4, dst, src, len);
wc_Arc4Process(&ctx->cipher.arc4, dst, src, len);
break;
case NULL_CIPHER_TYPE :
@ -10794,7 +10794,7 @@ WOLFSSL_DH* wolfSSL_DH_new(void)
}
InitwolfSSL_DH(external);
InitDhKey(key);
wc_InitDhKey(key);
external->internal = key;
return external;
@ -10807,7 +10807,7 @@ void wolfSSL_DH_free(WOLFSSL_DH* dh)
if (dh) {
if (dh->internal) {
FreeDhKey((DhKey*)dh->internal);
wc_FreeDhKey((DhKey*)dh->internal);
XFREE(dh->internal, NULL, DYNAMIC_TYPE_DH);
dh->internal = NULL;
}
@ -10860,7 +10860,7 @@ static int SetDhInternal(WOLFSSL_DH* dh)
if (pSz <= 0 || gSz <= 0)
WOLFSSL_MSG("Bad BN2bin set");
else if (DhSetKey((DhKey*)dh->internal, p, pSz, g, gSz) < 0)
else if (wc_DhSetKey((DhKey*)dh->internal, p, pSz, g, gSz) < 0)
WOLFSSL_MSG("Bad DH SetKey");
else {
dh->inSet = 1;
@ -10936,9 +10936,9 @@ int wolfSSL_DH_generate_key(WOLFSSL_DH* dh)
}
if (rng) {
if (DhGenerateKeyPair((DhKey*)dh->internal, rng, priv, &privSz,
if (wc_DhGenerateKeyPair((DhKey*)dh->internal, rng, priv, &privSz,
pub, &pubSz) < 0)
WOLFSSL_MSG("Bad DhGenerateKeyPair");
WOLFSSL_MSG("Bad wc_DhGenerateKeyPair");
else {
if (dh->pub_key)
wolfSSL_BN_free(dh->pub_key);
@ -11021,9 +11021,9 @@ int wolfSSL_DH_compute_key(unsigned char* key, WOLFSSL_BIGNUM* otherPub,
if (privSz <= 0 || pubSz <= 0)
WOLFSSL_MSG("Bad BN2bin set");
else if (DhAgree((DhKey*)dh->internal, key, &keySz, priv, privSz, pub,
else if (wc_DhAgree((DhKey*)dh->internal, key, &keySz, priv, privSz, pub,
pubSz) < 0)
WOLFSSL_MSG("DhAgree failed");
WOLFSSL_MSG("wc_DhAgree failed");
else
ret = (int)keySz;
}
@ -11373,8 +11373,8 @@ int wolfSSL_RSA_generate_key_ex(WOLFSSL_RSA* rsa, int bits, WOLFSSL_BIGNUM* bn,
if (InitRng(rng) < 0)
WOLFSSL_MSG("RNG init failed");
else if (MakeRsaKey((RsaKey*)rsa->internal, bits, 65537, rng) < 0)
WOLFSSL_MSG("MakeRsaKey failed");
else if (wc_MakeRsaKey((RsaKey*)rsa->internal, bits, 65537, rng) < 0)
WOLFSSL_MSG("wc_MakeRsaKey failed");
else if (SetRsaExternal(rsa) < 0)
WOLFSSL_MSG("SetRsaExternal failed");
else {