-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libtomcrypt: add ed25519ctx and ed25519ph support
Support contextualized extension of the Ed25519 scheme. Signed-off-by: Valerii Chubar <[email protected]> Signed-off-by: Sergiy Kibrik <[email protected]>
- Loading branch information
Showing
8 changed files
with
299 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ | ||
/* SPDX-License-Identifier: Unlicense */ | ||
#include "tomcrypt_private.h" | ||
|
||
/** | ||
@file ec25519_crypto_ctx.c | ||
curve25519 crypto context helper | ||
*/ | ||
|
||
#ifdef LTC_CURVE25519 | ||
|
||
int ec25519_crypto_ctx(unsigned char *out, unsigned long *outlen, unsigned char flag, const unsigned char *ctx, unsigned long ctxlen) | ||
{ | ||
unsigned char *buf = out; | ||
|
||
const char *prefix = "SigEd25519 no Ed25519 collisions"; | ||
const unsigned long prefix_len = strlen(prefix); | ||
const unsigned char ctxlen8 = (unsigned char)ctxlen; | ||
|
||
if (ctxlen > 255u) return CRYPT_INPUT_TOO_LONG; | ||
if (*outlen < prefix_len + 2u + ctxlen) return CRYPT_BUFFER_OVERFLOW; | ||
|
||
XMEMCPY(buf, prefix, prefix_len); | ||
buf += prefix_len; | ||
XMEMCPY(buf, &flag, 1); | ||
buf++; | ||
XMEMCPY(buf, &ctxlen8, 1); | ||
buf++; | ||
XMEMCPY(buf, ctx, ctxlen); | ||
buf += ctxlen; | ||
|
||
*outlen = buf-out; | ||
|
||
return CRYPT_OK; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
srcs-y += ec25519_export.c | ||
srcs-y += ec25519_crypto_ctx.c | ||
srcs-y += tweetnacl.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.