Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 1446057 Details for
Bug 1584480
cjdns-20.2 won't build on s390x
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
WIP to replace Sign.c with test cases
testsign.c (text/x-csrc), 2.87 KB, created by
Stuart D Gathman
on 2018-05-31 03:24:42 UTC
(
hide
)
Description:
WIP to replace Sign.c with test cases
Filename:
MIME Type:
Creator:
Stuart D Gathman
Created:
2018-05-31 03:24:42 UTC
Size:
2.87 KB
patch
obsolete
>#include <stdio.h> >#include <string.h> >#include <sodium.h> > >#if 1 >#include <nacl/crypto_uint32.h> > >#define ge25519_pack crypto_sign_edwards25519sha512batch_ge25519_pack >#define ge25519_scalarmult_base crypto_sign_edwards25519sha512batch_ge25519_scalarmult_base >#define sc25519_from32bytes crypto_sign_edwards25519sha512batch_sc25519_from32bytes > >typedef struct { > crypto_uint32 v[32]; >} fe25519; > >typedef struct { > crypto_uint32 v[32]; >} sc25519; > >typedef struct { > fe25519 x; > fe25519 y; > fe25519 z; > fe25519 t; >} ge25519; > >void sc25519_from32bytes(sc25519 *r, const unsigned char x[32]); >void ge25519_scalarmult_base(ge25519 *r, const sc25519 *s); >void ge25519_pack(unsigned char r[32], const ge25519 *p); > >static void Sign_signingKeyPairFromCurve25519(uint8_t keypairOut[64], uint8_t secretCryptoKey[32]) >{ > //memmove(keypairOut, secretCryptoKey, 32); > crypto_hash_sha512(keypairOut, secretCryptoKey, 32); > keypairOut[0] &= 248; > keypairOut[31] &= 63; > keypairOut[31] |= 64; > sc25519 sc; > ge25519 A; > sc25519_from32bytes(&sc,keypairOut); > ge25519_scalarmult_base(&A, &sc); > ge25519_pack(&keypairOut[32], &A); >} > >#define crypto_sign_ed25519_seed_keypair my_ed25519_seed_keypair >#define crypto_sign_ed25519_keypair my_ed25519_keypair > >static int >crypto_sign_ed25519_seed_keypair(unsigned char *pk, unsigned char *sk, > const unsigned char *seed) >{ > ge25519 A; > sc25519 sc; > > crypto_hash_sha512(sk, seed, 32); > sk[0] &= 248; > sk[31] &= 63; > sk[31] |= 64; > > sc25519_from32bytes(&sc,sk); > ge25519_scalarmult_base(&A, &sc); > ge25519_pack(pk, &A); > > memmove(sk, seed, 32); > memmove(sk + 32, pk, 32); > > return 0; >} > >static int >crypto_sign_ed25519_keypair(unsigned char *pk, unsigned char *sk) >{ > unsigned char seed[32]; > int ret; > > randombytes_buf(seed, sizeof seed); > ret = crypto_sign_ed25519_seed_keypair(pk, sk, seed); > sodium_memzero(seed, sizeof seed); > > return ret; >} > >#endif > >int main(int argc,char **argv) { > uint8_t msg[] = { 't','e','s','t','i','n','g','1','2','3' }; > uint8_t secretkey[32]; > uint8_t sk[64]; > uint8_t pk[32]; > uint8_t sig[64]; > unsigned long long siglen = sizeof sig; > if (sodium_init() == -1) return 1; > randombytes_buf(secretkey, 32); >#if 0 > Sign_signingKeyPairFromCurve25519(sk,secretkey); > memmove(pk,sk+32,32); >#else > //crypto_sign_ed25519_keypair(pk,sk); > crypto_sign_ed25519_seed_keypair(pk,sk,secretkey); >#endif > if (crypto_sign_ed25519_detached(sig,&siglen, msg, sizeof msg, sk)) { > printf("Sign failed\n"); > return 1; > } > printf("siglen = %lld\n",siglen); > if (crypto_sign_ed25519_verify_detached(sig,msg, sizeof msg, pk)) { > printf("Verify failed\n"); > return 1; > } > if (0 && memcmp(pk,sig+32,32)) { > printf("Pubkey mismatch\n"); > return 1; > } > printf("Verify OK\n"); > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1584480
: 1446057 |
1446213