Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: P-H-C/phc-winner-argon2
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: nanocurrency/phc-winner-argon2
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 3 commits
  • 7 files changed
  • 1 contributor

Commits on Aug 16, 2018

  1. Copy the full SHA
    be234c6 View commit details

Commits on Dec 28, 2018

  1. Copy the full SHA
    d15c391 View commit details

Commits on Oct 18, 2019

  1. Verified

    This commit was signed with the committer’s verified signature.
    SergiySW Dani (Sergey) K
    Copy the full SHA
    65b4d35 View commit details
Showing with 69 additions and 640 deletions.
  1. +0 −156 src/blake2/blake2-impl.h
  2. +0 −89 src/blake2/blake2.h
  3. +0 −390 src/blake2/blake2b.c
  4. +62 −2 src/core.c
  5. +4 −0 src/core.h
  6. +1 −1 src/opt.c
  7. +2 −2 src/ref.c
156 changes: 0 additions & 156 deletions src/blake2/blake2-impl.h

This file was deleted.

89 changes: 0 additions & 89 deletions src/blake2/blake2.h

This file was deleted.

390 changes: 0 additions & 390 deletions src/blake2/blake2b.c

This file was deleted.

64 changes: 62 additions & 2 deletions src/core.c
Original file line number Diff line number Diff line change
@@ -34,8 +34,8 @@

#include "core.h"
#include "thread.h"
#include "blake2/blake2.h"
#include "blake2/blake2-impl.h"
#include "blake2.h"
#include "blake2-impl.h"

#ifdef GENKAT
#include "genkat.h"
@@ -646,3 +646,63 @@ int initialize(argon2_instance_t *instance, argon2_context *context) {

return ARGON2_OK;
}

/* Argon2 Team - Begin Code */
int blake2b_long(void *pout, size_t outlen, const void *in, size_t inlen) {
uint8_t *out = (uint8_t *)pout;
blake2b_state blake_state;
uint8_t outlen_bytes[sizeof(uint32_t)] = {0};
int ret = -1;

if (outlen > UINT32_MAX) {
goto fail;
}

/* Ensure little-endian byte order! */
store32(outlen_bytes, (uint32_t)outlen);

#define TRY(statement) \
do { \
ret = statement; \
if (ret < 0) { \
goto fail; \
} \
} while ((void)0, 0)

if (outlen <= BLAKE2B_OUTBYTES) {
TRY(blake2b_init(&blake_state, outlen));
TRY(blake2b_update(&blake_state, outlen_bytes, sizeof(outlen_bytes)));
TRY(blake2b_update(&blake_state, in, inlen));
TRY(blake2b_final(&blake_state, out, outlen));
} else {
uint32_t toproduce;
uint8_t out_buffer[BLAKE2B_OUTBYTES];
uint8_t in_buffer[BLAKE2B_OUTBYTES];
TRY(blake2b_init(&blake_state, BLAKE2B_OUTBYTES));
TRY(blake2b_update(&blake_state, outlen_bytes, sizeof(outlen_bytes)));
TRY(blake2b_update(&blake_state, in, inlen));
TRY(blake2b_final(&blake_state, out_buffer, BLAKE2B_OUTBYTES));
memcpy(out, out_buffer, BLAKE2B_OUTBYTES / 2);
out += BLAKE2B_OUTBYTES / 2;
toproduce = (uint32_t)outlen - BLAKE2B_OUTBYTES / 2;

while (toproduce > BLAKE2B_OUTBYTES) {
memcpy(in_buffer, out_buffer, BLAKE2B_OUTBYTES);
TRY(blake2b(out_buffer, BLAKE2B_OUTBYTES, in_buffer,
BLAKE2B_OUTBYTES, NULL, 0));
memcpy(out, out_buffer, BLAKE2B_OUTBYTES / 2);
out += BLAKE2B_OUTBYTES / 2;
toproduce -= BLAKE2B_OUTBYTES / 2;
}

memcpy(in_buffer, out_buffer, BLAKE2B_OUTBYTES);
TRY(blake2b(out_buffer, toproduce, in_buffer, BLAKE2B_OUTBYTES, NULL,
0));
memcpy(out, out_buffer, toproduce);
}
fail:
clear_internal_memory(&blake_state, sizeof(blake_state));
return ret;
#undef TRY
}
/* Argon2 Team - End Code */
4 changes: 4 additions & 0 deletions src/core.h
Original file line number Diff line number Diff line change
@@ -226,3 +226,7 @@ void fill_segment(const argon2_instance_t *instance,
int fill_memory_blocks(argon2_instance_t *instance);

#endif

/* Argon2 Team - Begin Code */
ARGON2_LOCAL int blake2b_long(void *out, size_t outlen, const void *in, size_t inlen);
/* Argon2 Team - End Code */
2 changes: 1 addition & 1 deletion src/opt.c
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@
#include "argon2.h"
#include "core.h"

#include "blake2/blake2.h"
#include "blake2.h"
#include "blake2/blamka-round-opt.h"

/*
4 changes: 2 additions & 2 deletions src/ref.c
Original file line number Diff line number Diff line change
@@ -23,8 +23,8 @@
#include "core.h"

#include "blake2/blamka-round-ref.h"
#include "blake2/blake2-impl.h"
#include "blake2/blake2.h"
#include "blake2-impl.h"
#include "blake2.h"


/*