Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import from libcperciva and tarsnap #392

Merged
merged 3 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/scryptenc/scryptenc_cpuperf.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,7 @@ scryptenc_cpuperf(double * opps)

/* We can do approximately i salsa20/8 cores per diffd seconds. */
*opps = (double)i / diffd;

/* Success! */
return (SCRYPT_OK);
}
5 changes: 2 additions & 3 deletions libcperciva/alg/sha256_arm.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,11 @@ static const uint32_t Krnd[64] = {
X0 = vsha256su1q_u32(vsha256su0q_u32(X0, X1), X2, X3)

/**
* SHA256_Transform_arm(state, block, W, S):
* SHA256_Transform_arm(state, block):
* Compute the SHA256 block compression function, transforming ${state} using
* the data in ${block}. This implementation uses ARM SHA256 instructions,
* and should only be used if _SHA256 is defined and cpusupport_arm_sha256()
* returns nonzero. The arrays W and S may be filled with sensitive data, and
* should be cleared by the callee.
* returns nonzero.
*/
#ifdef POSIXFAIL_ABSTRACT_DECLARATOR
void
Expand Down
5 changes: 2 additions & 3 deletions libcperciva/alg/sha256_arm.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
#include <stdint.h>

/**
* SHA256_Transform_arm(state, block, W, S):
* SHA256_Transform_arm(state, block):
* Compute the SHA256 block compression function, transforming ${state} using
* the data in ${block}. This implementation uses ARM SHA256 instructions,
* and should only be used if _SHA256 is defined and cpusupport_arm_sha256()
* returns nonzero. The arrays W and S may be filled with sensitive data, and
* should be cleared by the callee.
* returns nonzero.
*/
#ifdef POSIXFAIL_ABSTRACT_DECLARATOR
void SHA256_Transform_arm(uint32_t state[8], const uint8_t block[64]);
Expand Down
4 changes: 2 additions & 2 deletions libcperciva/alg/sha256_sse2.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ mm_bswap_epi32(__m128i a)
{

/* Swap bytes in each 16-bit word. */
a = _mm_or_si128(_mm_slli_epi16(a, 8), _mm_srli_epi16(a, 8));
a = _mm_or_si128(_mm_slli_epi16(a, 8), _mm_srli_epi16(a, 8));

/* Swap all 16-bit words. */
a = _mm_shufflelo_epi16(a, _MM_SHUFFLE(2, 3, 0, 1));
Expand Down Expand Up @@ -167,7 +167,7 @@ MSG4(__m128i X0, __m128i X1, __m128i X2, __m128i X3)
}

/**
* SHA256_Transform_sse2(state, block):
* SHA256_Transform_sse2(state, block, W, S):
* Compute the SHA256 block compression function, transforming ${state} using
* the data in ${block}. This implementation uses x86 SSE2 instructions, and
* should only be used if _SSE2 is defined and cpusupport_x86_sse2() returns
Expand Down
2 changes: 1 addition & 1 deletion libcperciva/alg/sha256_sse2.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <stdint.h>

/**
* SHA256_Transform_sse2(state, block):
* SHA256_Transform_sse2(state, block, W, S):
* Compute the SHA256 block compression function, transforming ${state} using
* the data in ${block}. This implementation uses x86 SSE2 instructions, and
* should only be used if _SSE2 is defined and cpusupport_x86_sse2() returns
Expand Down
2 changes: 1 addition & 1 deletion libcperciva/util/entropy.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ int entropy_read_fill(struct entropy_read_cookie *, uint8_t *, size_t);
* entropy_read_done(er):
* Release any resources used by ${er}.
*/
int entropy_read_done(struct entropy_read_cookie * er);
int entropy_read_done(struct entropy_read_cookie *);

/**
* entropy_read(buf, buflen):
Expand Down
Loading