switch (hashBitLen) { /* use pre-computed values, where available */
#ifndef SKEIN_NO_PRECOMP
case 256:
- bcopy(SKEIN_256_IV_256, ctx->X, sizeof (ctx->X));
+ memcpy(ctx->X, SKEIN_256_IV_256, sizeof (ctx->X));
break;
case 224:
- bcopy(SKEIN_256_IV_224, ctx->X, sizeof (ctx->X));
+ memcpy(ctx->X, SKEIN_256_IV_224, sizeof (ctx->X));
break;
case 160:
- bcopy(SKEIN_256_IV_160, ctx->X, sizeof (ctx->X));
+ memcpy(ctx->X, SKEIN_256_IV_160, sizeof (ctx->X));
break;
case 128:
- bcopy(SKEIN_256_IV_128, ctx->X, sizeof (ctx->X));
+ memcpy(ctx->X, SKEIN_256_IV_128, sizeof (ctx->X));
break;
#endif
default:
cfg.w[1] = Skein_Swap64(hashBitLen);
cfg.w[2] = Skein_Swap64(SKEIN_CFG_TREE_INFO_SEQUENTIAL);
/* zero pad config block */
- bzero(&cfg.w[3], sizeof (cfg) - 3 * sizeof (cfg.w[0]));
+ memset(&cfg.w[3], 0, sizeof (cfg) - 3 * sizeof (cfg.w[0]));
/* compute the initial chaining values from config block */
/* zero the chaining variables */
- bzero(ctx->X, sizeof (ctx->X));
+ memset(ctx->X, 0, sizeof (ctx->X));
Skein_256_Process_Block(ctx, cfg.b, 1, SKEIN_CFG_STR_LEN);
break;
}
/* compute the initial chaining values ctx->X[], based on key */
if (keyBytes == 0) { /* is there a key? */
/* no key: use all zeroes as key for config block */
- bzero(ctx->X, sizeof (ctx->X));
+ memset(ctx->X, 0, sizeof (ctx->X));
} else { /* here to pre-process a key */
Skein_assert(sizeof (cfg.b) >= sizeof (ctx->X));
/* set tweaks: T0 = 0; T1 = KEY type */
Skein_Start_New_Type(ctx, KEY);
/* zero the initial chaining variables */
- bzero(ctx->X, sizeof (ctx->X));
+ memset(ctx->X, 0, sizeof (ctx->X));
/* hash the key */
(void) Skein_256_Update(ctx, key, keyBytes);
/* put result into cfg.b[] */
(void) Skein_256_Final_Pad(ctx, cfg.b);
/* copy over into ctx->X[] */
- bcopy(cfg.b, ctx->X, sizeof (cfg.b));
+ memcpy(ctx->X, cfg.b, sizeof (cfg.b));
#if SKEIN_NEED_SWAP
{
uint_t i;
ctx->h.hashBitLen = hashBitLen; /* output hash bit count */
Skein_Start_New_Type(ctx, CFG_FINAL);
- bzero(&cfg.w, sizeof (cfg.w)); /* pre-pad cfg.w[] with zeroes */
+ memset(&cfg.w, 0, sizeof (cfg.w)); /* pre-pad cfg.w[] with zeroes */
cfg.w[0] = Skein_Swap64(SKEIN_SCHEMA_VER);
cfg.w[1] = Skein_Swap64(hashBitLen); /* hash result length in bits */
/* tree hash config info (or SKEIN_CFG_TREE_INFO_SEQUENTIAL) */
if (n) {
/* check on our logic here */
Skein_assert(n < msgByteCnt);
- bcopy(msg, &ctx->b[ctx->h.bCnt], n);
+ memcpy(&ctx->b[ctx->h.bCnt], msg, n);
msgByteCnt -= n;
msg += n;
ctx->h.bCnt += n;
/* copy any remaining source message data bytes into b[] */
if (msgByteCnt) {
Skein_assert(msgByteCnt + ctx->h.bCnt <= SKEIN_256_BLOCK_BYTES);
- bcopy(msg, &ctx->b[ctx->h.bCnt], msgByteCnt);
+ memcpy(&ctx->b[ctx->h.bCnt], msg, msgByteCnt);
ctx->h.bCnt += msgByteCnt;
}
ctx->h.T[1] |= SKEIN_T1_FLAG_FINAL; /* tag as the final block */
/* zero pad b[] if necessary */
if (ctx->h.bCnt < SKEIN_256_BLOCK_BYTES)
- bzero(&ctx->b[ctx->h.bCnt],
+ memset(&ctx->b[ctx->h.bCnt], 0,
SKEIN_256_BLOCK_BYTES - ctx->h.bCnt);
/* process the final block */
/* run Threefish in "counter mode" to generate output */
/* zero out b[], so it can hold the counter */
- bzero(ctx->b, sizeof (ctx->b));
+ memset(ctx->b, 0, sizeof (ctx->b));
/* keep a local copy of counter mode "key" */
- bcopy(ctx->X, X, sizeof (X));
+ memcpy(X, ctx->X, sizeof (X));
for (i = 0; i * SKEIN_256_BLOCK_BYTES < byteCnt; i++) {
/* build the counter block */
- uint64_t tmp = Skein_Swap64((uint64_t)i);
- bcopy(&tmp, ctx->b, sizeof (tmp));
+ *(uint64_t *)ctx->b = Skein_Swap64((uint64_t)i);
Skein_Start_New_Type(ctx, OUT_FINAL);
/* run "counter mode" */
Skein_256_Process_Block(ctx, ctx->b, 1, sizeof (uint64_t));
Skein_Show_Final(256, &ctx->h, n,
hashVal + i * SKEIN_256_BLOCK_BYTES);
/* restore the counter mode key for next time */
- bcopy(X, ctx->X, sizeof (X));
+ memcpy(ctx->X, X, sizeof (X));
}
return (SKEIN_SUCCESS);
}
switch (hashBitLen) { /* use pre-computed values, where available */
#ifndef SKEIN_NO_PRECOMP
case 512:
- bcopy(SKEIN_512_IV_512, ctx->X, sizeof (ctx->X));
+ memcpy(ctx->X, SKEIN_512_IV_512, sizeof (ctx->X));
break;
case 384:
- bcopy(SKEIN_512_IV_384, ctx->X, sizeof (ctx->X));
+ memcpy(ctx->X, SKEIN_512_IV_384, sizeof (ctx->X));
break;
case 256:
- bcopy(SKEIN_512_IV_256, ctx->X, sizeof (ctx->X));
+ memcpy(ctx->X, SKEIN_512_IV_256, sizeof (ctx->X));
break;
case 224:
- bcopy(SKEIN_512_IV_224, ctx->X, sizeof (ctx->X));
+ memcpy(ctx->X, SKEIN_512_IV_224, sizeof (ctx->X));
break;
#endif
default:
cfg.w[1] = Skein_Swap64(hashBitLen);
cfg.w[2] = Skein_Swap64(SKEIN_CFG_TREE_INFO_SEQUENTIAL);
/* zero pad config block */
- bzero(&cfg.w[3], sizeof (cfg) - 3 * sizeof (cfg.w[0]));
+ memset(&cfg.w[3], 0, sizeof (cfg) - 3 * sizeof (cfg.w[0]));
/* compute the initial chaining values from config block */
/* zero the chaining variables */
- bzero(ctx->X, sizeof (ctx->X));
+ memset(ctx->X, 0, sizeof (ctx->X));
Skein_512_Process_Block(ctx, cfg.b, 1, SKEIN_CFG_STR_LEN);
break;
}
/* compute the initial chaining values ctx->X[], based on key */
if (keyBytes == 0) { /* is there a key? */
/* no key: use all zeroes as key for config block */
- bzero(ctx->X, sizeof (ctx->X));
+ memset(ctx->X, 0, sizeof (ctx->X));
} else { /* here to pre-process a key */
Skein_assert(sizeof (cfg.b) >= sizeof (ctx->X));
/* set tweaks: T0 = 0; T1 = KEY type */
Skein_Start_New_Type(ctx, KEY);
/* zero the initial chaining variables */
- bzero(ctx->X, sizeof (ctx->X));
+ memset(ctx->X, 0, sizeof (ctx->X));
(void) Skein_512_Update(ctx, key, keyBytes); /* hash the key */
/* put result into cfg.b[] */
(void) Skein_512_Final_Pad(ctx, cfg.b);
/* copy over into ctx->X[] */
- bcopy(cfg.b, ctx->X, sizeof (cfg.b));
+ memcpy(ctx->X, cfg.b, sizeof (cfg.b));
#if SKEIN_NEED_SWAP
{
uint_t i;
ctx->h.hashBitLen = hashBitLen; /* output hash bit count */
Skein_Start_New_Type(ctx, CFG_FINAL);
- bzero(&cfg.w, sizeof (cfg.w)); /* pre-pad cfg.w[] with zeroes */
+ memset(&cfg.w, 0, sizeof (cfg.w)); /* pre-pad cfg.w[] with zeroes */
cfg.w[0] = Skein_Swap64(SKEIN_SCHEMA_VER);
cfg.w[1] = Skein_Swap64(hashBitLen); /* hash result length in bits */
/* tree hash config info (or SKEIN_CFG_TREE_INFO_SEQUENTIAL) */
if (n) {
/* check on our logic here */
Skein_assert(n < msgByteCnt);
- bcopy(msg, &ctx->b[ctx->h.bCnt], n);
+ memcpy(&ctx->b[ctx->h.bCnt], msg, n);
msgByteCnt -= n;
msg += n;
ctx->h.bCnt += n;
/* copy any remaining source message data bytes into b[] */
if (msgByteCnt) {
Skein_assert(msgByteCnt + ctx->h.bCnt <= SKEIN_512_BLOCK_BYTES);
- bcopy(msg, &ctx->b[ctx->h.bCnt], msgByteCnt);
+ memcpy(&ctx->b[ctx->h.bCnt], msg, msgByteCnt);
ctx->h.bCnt += msgByteCnt;
}
ctx->h.T[1] |= SKEIN_T1_FLAG_FINAL; /* tag as the final block */
/* zero pad b[] if necessary */
if (ctx->h.bCnt < SKEIN_512_BLOCK_BYTES)
- bzero(&ctx->b[ctx->h.bCnt],
+ memset(&ctx->b[ctx->h.bCnt], 0,
SKEIN_512_BLOCK_BYTES - ctx->h.bCnt);
/* process the final block */
/* run Threefish in "counter mode" to generate output */
/* zero out b[], so it can hold the counter */
- bzero(ctx->b, sizeof (ctx->b));
+ memset(ctx->b, 0, sizeof (ctx->b));
/* keep a local copy of counter mode "key" */
- bcopy(ctx->X, X, sizeof (X));
+ memcpy(X, ctx->X, sizeof (X));
for (i = 0; i * SKEIN_512_BLOCK_BYTES < byteCnt; i++) {
/* build the counter block */
- uint64_t tmp = Skein_Swap64((uint64_t)i);
- bcopy(&tmp, ctx->b, sizeof (tmp));
+ *(uint64_t *)ctx->b = Skein_Swap64((uint64_t)i);
Skein_Start_New_Type(ctx, OUT_FINAL);
/* run "counter mode" */
Skein_512_Process_Block(ctx, ctx->b, 1, sizeof (uint64_t));
Skein_Show_Final(512, &ctx->h, n,
hashVal + i * SKEIN_512_BLOCK_BYTES);
/* restore the counter mode key for next time */
- bcopy(X, ctx->X, sizeof (X));
+ memcpy(ctx->X, X, sizeof (X));
}
return (SKEIN_SUCCESS);
}
switch (hashBitLen) { /* use pre-computed values, where available */
#ifndef SKEIN_NO_PRECOMP
case 512:
- bcopy(SKEIN1024_IV_512, ctx->X, sizeof (ctx->X));
+ memcpy(ctx->X, SKEIN1024_IV_512, sizeof (ctx->X));
break;
case 384:
- bcopy(SKEIN1024_IV_384, ctx->X, sizeof (ctx->X));
+ memcpy(ctx->X, SKEIN1024_IV_384, sizeof (ctx->X));
break;
case 1024:
- bcopy(SKEIN1024_IV_1024, ctx->X, sizeof (ctx->X));
+ memcpy(ctx->X, SKEIN1024_IV_1024, sizeof (ctx->X));
break;
#endif
default:
cfg.w[1] = Skein_Swap64(hashBitLen);
cfg.w[2] = Skein_Swap64(SKEIN_CFG_TREE_INFO_SEQUENTIAL);
/* zero pad config block */
- bzero(&cfg.w[3], sizeof (cfg) - 3 * sizeof (cfg.w[0]));
+ memset(&cfg.w[3], 0, sizeof (cfg) - 3 * sizeof (cfg.w[0]));
/* compute the initial chaining values from config block */
/* zero the chaining variables */
- bzero(ctx->X, sizeof (ctx->X));
+ memset(ctx->X, 0, sizeof (ctx->X));
Skein1024_Process_Block(ctx, cfg.b, 1, SKEIN_CFG_STR_LEN);
break;
}
/* compute the initial chaining values ctx->X[], based on key */
if (keyBytes == 0) { /* is there a key? */
/* no key: use all zeroes as key for config block */
- bzero(ctx->X, sizeof (ctx->X));
+ memset(ctx->X, 0, sizeof (ctx->X));
} else { /* here to pre-process a key */
Skein_assert(sizeof (cfg.b) >= sizeof (ctx->X));
/* do a mini-Init right here */
/* set tweaks: T0 = 0; T1 = KEY type */
Skein_Start_New_Type(ctx, KEY);
/* zero the initial chaining variables */
- bzero(ctx->X, sizeof (ctx->X));
+ memset(ctx->X, 0, sizeof (ctx->X));
(void) Skein1024_Update(ctx, key, keyBytes); /* hash the key */
/* put result into cfg.b[] */
(void) Skein1024_Final_Pad(ctx, cfg.b);
/* copy over into ctx->X[] */
- bcopy(cfg.b, ctx->X, sizeof (cfg.b));
+ memcpy(ctx->X, cfg.b, sizeof (cfg.b));
#if SKEIN_NEED_SWAP
{
uint_t i;
ctx->h.hashBitLen = hashBitLen; /* output hash bit count */
Skein_Start_New_Type(ctx, CFG_FINAL);
- bzero(&cfg.w, sizeof (cfg.w)); /* pre-pad cfg.w[] with zeroes */
+ memset(&cfg.w, 0, sizeof (cfg.w)); /* pre-pad cfg.w[] with zeroes */
cfg.w[0] = Skein_Swap64(SKEIN_SCHEMA_VER);
/* hash result length in bits */
cfg.w[1] = Skein_Swap64(hashBitLen);
if (n) {
/* check on our logic here */
Skein_assert(n < msgByteCnt);
- bcopy(msg, &ctx->b[ctx->h.bCnt], n);
+ memcpy(&ctx->b[ctx->h.bCnt], msg, n);
msgByteCnt -= n;
msg += n;
ctx->h.bCnt += n;
/* copy any remaining source message data bytes into b[] */
if (msgByteCnt) {
Skein_assert(msgByteCnt + ctx->h.bCnt <= SKEIN1024_BLOCK_BYTES);
- bcopy(msg, &ctx->b[ctx->h.bCnt], msgByteCnt);
+ memcpy(&ctx->b[ctx->h.bCnt], msg, msgByteCnt);
ctx->h.bCnt += msgByteCnt;
}
ctx->h.T[1] |= SKEIN_T1_FLAG_FINAL; /* tag as the final block */
/* zero pad b[] if necessary */
if (ctx->h.bCnt < SKEIN1024_BLOCK_BYTES)
- bzero(&ctx->b[ctx->h.bCnt],
+ memset(&ctx->b[ctx->h.bCnt], 0,
SKEIN1024_BLOCK_BYTES - ctx->h.bCnt);
/* process the final block */
/* run Threefish in "counter mode" to generate output */
/* zero out b[], so it can hold the counter */
- bzero(ctx->b, sizeof (ctx->b));
+ memset(ctx->b, 0, sizeof (ctx->b));
/* keep a local copy of counter mode "key" */
- bcopy(ctx->X, X, sizeof (X));
+ memcpy(X, ctx->X, sizeof (X));
for (i = 0; i * SKEIN1024_BLOCK_BYTES < byteCnt; i++) {
/* build the counter block */
- uint64_t tmp = Skein_Swap64((uint64_t)i);
- bcopy(&tmp, ctx->b, sizeof (tmp));
+ *(uint64_t *)ctx->b = Skein_Swap64((uint64_t)i);
Skein_Start_New_Type(ctx, OUT_FINAL);
/* run "counter mode" */
Skein1024_Process_Block(ctx, ctx->b, 1, sizeof (uint64_t));
Skein_Show_Final(1024, &ctx->h, n,
hashVal + i * SKEIN1024_BLOCK_BYTES);
/* restore the counter mode key for next time */
- bcopy(X, ctx->X, sizeof (X));
+ memcpy(ctx->X, X, sizeof (X));
}
return (SKEIN_SUCCESS);
}
ctx->h.T[1] |= SKEIN_T1_FLAG_FINAL; /* tag as the final block */
/* zero pad b[] if necessary */
if (ctx->h.bCnt < SKEIN_256_BLOCK_BYTES)
- bzero(&ctx->b[ctx->h.bCnt],
+ memset(&ctx->b[ctx->h.bCnt], 0,
SKEIN_256_BLOCK_BYTES - ctx->h.bCnt);
/* process the final block */
Skein_256_Process_Block(ctx, ctx->b, 1, ctx->h.bCnt);
ctx->h.T[1] |= SKEIN_T1_FLAG_FINAL; /* tag as the final block */
/* zero pad b[] if necessary */
if (ctx->h.bCnt < SKEIN_512_BLOCK_BYTES)
- bzero(&ctx->b[ctx->h.bCnt],
+ memset(&ctx->b[ctx->h.bCnt], 0,
SKEIN_512_BLOCK_BYTES - ctx->h.bCnt);
/* process the final block */
Skein_512_Process_Block(ctx, ctx->b, 1, ctx->h.bCnt);
ctx->h.T[1] |= SKEIN_T1_FLAG_FINAL;
/* zero pad b[] if necessary */
if (ctx->h.bCnt < SKEIN1024_BLOCK_BYTES)
- bzero(&ctx->b[ctx->h.bCnt],
+ memset(&ctx->b[ctx->h.bCnt], 0,
SKEIN1024_BLOCK_BYTES - ctx->h.bCnt);
/* process the final block */
Skein1024_Process_Block(ctx, ctx->b, 1, ctx->h.bCnt);
/* run Threefish in "counter mode" to generate output */
/* zero out b[], so it can hold the counter */
- bzero(ctx->b, sizeof (ctx->b));
+ memset(ctx->b, 0, sizeof (ctx->b));
/* keep a local copy of counter mode "key" */
- bcopy(ctx->X, X, sizeof (X));
+ memcpy(X, ctx->X, sizeof (X));
for (i = 0; i * SKEIN_256_BLOCK_BYTES < byteCnt; i++) {
/* build the counter block */
- uint64_t tmp = Skein_Swap64((uint64_t)i);
- bcopy(&tmp, ctx->b, sizeof (tmp));
+ *(uint64_t *)ctx->b = Skein_Swap64((uint64_t)i);
Skein_Start_New_Type(ctx, OUT_FINAL);
/* run "counter mode" */
Skein_256_Process_Block(ctx, ctx->b, 1, sizeof (uint64_t));
Skein_Show_Final(256, &ctx->h, n,
hashVal + i * SKEIN_256_BLOCK_BYTES);
/* restore the counter mode key for next time */
- bcopy(X, ctx->X, sizeof (X));
+ memcpy(ctx->X, X, sizeof (X));
}
return (SKEIN_SUCCESS);
}
/* run Threefish in "counter mode" to generate output */
/* zero out b[], so it can hold the counter */
- bzero(ctx->b, sizeof (ctx->b));
+ memset(ctx->b, 0, sizeof (ctx->b));
/* keep a local copy of counter mode "key" */
- bcopy(ctx->X, X, sizeof (X));
+ memcpy(X, ctx->X, sizeof (X));
for (i = 0; i * SKEIN_512_BLOCK_BYTES < byteCnt; i++) {
/* build the counter block */
- uint64_t tmp = Skein_Swap64((uint64_t)i);
- bcopy(&tmp, ctx->b, sizeof (tmp));
+ *(uint64_t *)ctx->b = Skein_Swap64((uint64_t)i);
Skein_Start_New_Type(ctx, OUT_FINAL);
/* run "counter mode" */
Skein_512_Process_Block(ctx, ctx->b, 1, sizeof (uint64_t));
Skein_Show_Final(256, &ctx->h, n,
hashVal + i * SKEIN_512_BLOCK_BYTES);
/* restore the counter mode key for next time */
- bcopy(X, ctx->X, sizeof (X));
+ memcpy(ctx->X, X, sizeof (X));
}
return (SKEIN_SUCCESS);
}
/* run Threefish in "counter mode" to generate output */
/* zero out b[], so it can hold the counter */
- bzero(ctx->b, sizeof (ctx->b));
+ memset(ctx->b, 0, sizeof (ctx->b));
/* keep a local copy of counter mode "key" */
- bcopy(ctx->X, X, sizeof (X));
+ memcpy(X, ctx->X, sizeof (X));
for (i = 0; i * SKEIN1024_BLOCK_BYTES < byteCnt; i++) {
/* build the counter block */
- uint64_t tmp = Skein_Swap64((uint64_t)i);
- bcopy(&tmp, ctx->b, sizeof (tmp));
+ *(uint64_t *)ctx->b = Skein_Swap64((uint64_t)i);
Skein_Start_New_Type(ctx, OUT_FINAL);
/* run "counter mode" */
Skein1024_Process_Block(ctx, ctx->b, 1, sizeof (uint64_t));
Skein_Show_Final(256, &ctx->h, n,
hashVal + i * SKEIN1024_BLOCK_BYTES);
/* restore the counter mode key for next time */
- bcopy(X, ctx->X, sizeof (X));
+ memcpy(ctx->X, X, sizeof (X));
}
return (SKEIN_SUCCESS);
}