mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-14 03:30:02 +00:00
use 4096 pbkdf2 rounds for bip39
This commit is contained in:
parent
97067c918e
commit
3589cf5cbf
4
bip39.c
4
bip39.c
@ -7,7 +7,7 @@
|
||||
#include "pbkdf2.h"
|
||||
#include "bip39_english.h"
|
||||
|
||||
#define ROUNDS 10000
|
||||
#define PBKDF2_ROUNDS 4096
|
||||
|
||||
const char *mnemonic_generate(int strength)
|
||||
{
|
||||
@ -71,5 +71,5 @@ void mnemonic_to_seed(const char *mnemonic, const char *passphrase, uint8_t seed
|
||||
memcpy(salt, "mnemonic", 8);
|
||||
memcpy(salt + 8, passphrase, saltlen);
|
||||
saltlen += 8;
|
||||
pbkdf2((const uint8_t *)mnemonic, strlen(mnemonic), salt, saltlen, ROUNDS, seed, 512 / 8);
|
||||
pbkdf2((const uint8_t *)mnemonic, strlen(mnemonic), salt, saltlen, PBKDF2_ROUNDS, seed, 512 / 8);
|
||||
}
|
||||
|
96
tests.c
96
tests.c
@ -320,76 +320,76 @@ START_TEST(test_mnemonic)
|
||||
static const char *vectors[] = {
|
||||
"00000000000000000000000000000000",
|
||||
"abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about",
|
||||
"a3c9324fab99733ef7b5f9313e49cd45a134ee77da9aa176a84458d4b73e46f00a59361709d71d6b68338c957366937942b8f2ce2bd306b4ab0ae63c6b4ff7f5",
|
||||
"3d39670caaa237f5fb2999474413733b59d9dfe12b2cccfe878069a2f605ae467a669619a0a45c7b3378c4c812b80be677c1b8f8f60db9383f1ed265c45eb41c",
|
||||
"7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f",
|
||||
"legal winner thank year wave sausage worth useful legal winner thank yellow",
|
||||
"f48f158e9689580f91ae0c813f4353ba2f90cd242e811ec27b2d79f97eb21fcfaf54a0b546c27c3b0a60285df2b064b3eef84fa7269d93ab013af10a20adc758",
|
||||
"34eb04e0d4d60d00217f1c0150d8b0d6ffc6086e365a8a94fcceae8614e38274e719ebe7a693356426d1c62fdf90c84eaaac3d920743f3e79e0970a295886a08",
|
||||
"80808080808080808080808080808080",
|
||||
"letter advice cage absurd amount doctor acoustic avoid letter advice cage above",
|
||||
"7804de4eb059484ebd7c384e3bd99654763ff1f736abf4e8a5053b12594ea7389beefd967031f03416fa03994cf6be7d3f2fbe37709a27cd091f9e3d310f16d0",
|
||||
"acd45eb0b06e53d2e0fa6d1b3e8b3c33f200d2be6013fc5f8796c8c1d238552a615a01f325d78a10e633991d92f1236e21c24afe7c679fa1ecbc67fe71a5337d",
|
||||
"ffffffffffffffffffffffffffffffff",
|
||||
"zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong",
|
||||
"ce2467164ca78cbce7c368bf35a390474d0e3af6afc4cc47214d215dcfc52ee567fd9921e66c32fc34e8f37abc468e7ba6cc744a96e815c95c583ad849d1c372",
|
||||
"d20f4e7902c3fd2f7716a533b131042036e6df2e44b14c8d65eb57403d002e4a12fa9be5325b257637ad1209e850188ffb061b3033a315b236ffc70c4ab4ea96",
|
||||
"000000000000000000000000000000000000000000000000",
|
||||
"abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon agent",
|
||||
"e6fa0d745f5b841a4c90f1487dea80d5e5cc64c46c7aebe115b10ac333066f37b6d34ae514b8a1acb21b38c3836c248aec81c10874c2323bee98e70443cb2e2c",
|
||||
"55fb6d9683e16f71025b73efa1a297d522010e37a4fc5b54770b09173e4f7fed85f83b075142965015d17c8f7a365e589ac943ed83cfbf76dcaf301c6c53b9d6",
|
||||
"7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f",
|
||||
"legal winner thank year wave sausage worth useful legal winner thank year wave sausage worth useful legal will",
|
||||
"b829d8809875e7cae49114971e6ab87f13bd133c8d676972fb7a7ce8a9604b57759137091f21018ecd757906331c7e5466c8d9bc31b705e96e959beba111acc5",
|
||||
"a2455beee8e73686d56f92979ed8a69011772f68e8329a437f47e55d79eaeec25afc2ac5ff636ac8578161a09a2ea690747575653f9d91016b09b71227a53791",
|
||||
"808080808080808080808080808080808080808080808080",
|
||||
"letter advice cage absurd amount doctor acoustic avoid letter advice cage absurd amount doctor acoustic avoid letter always",
|
||||
"e8716279b6e74e876477061b83c4b29eeab288ea85ea196d95281dc0504c3edb1c70c86042e66f56ad27fb93d24c0a64294eac9668f0bba6d13a13882de542dd",
|
||||
"dd53ab268c524bad304e3decf4298ba1413a785bc866c2118988d1634bddf5a1301718191b247761060bc6dce3c62f833b22c062e51e7508fc04201cd7f8515b",
|
||||
"ffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo when",
|
||||
"417b80e3489de48dc644d9bf8e32ed907f918efdaf78541c219e6e1b6e7e17ed38448e7d2ef311ad4446f8be779507d288285eb5eff32ce723d4b3692a26d6a4",
|
||||
"f0747118b52dcd33d383e5f3d6dddc94f66accd38b6d48f8a07fed9752fa8457dcb40bba5f40399814dcbd1a3f5cfaead1cf26c72268d1aa71561611421d4aaf",
|
||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon art",
|
||||
"c716b0c6e051b60f819ba04bc5c402ac15e3aa4071c99735dfecce05d41b550155ae3511789a0ccf2cb245050f53e48292e8d88864e7c46eaa2fe626373e6fc8",
|
||||
"681088fbeaf5e4c29de23f55967a942bcb3400dc5b6e507477dfdcb493d921902352e015cd1235279c61ddf26b9536e6cf87fccb3cf2e142db44689f78ccad12",
|
||||
"7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f",
|
||||
"legal winner thank year wave sausage worth useful legal winner thank year wave sausage worth useful legal winner thank year wave sausage worth title",
|
||||
"8d80646b3677f02a56efc2977dc5972dadddd96dc34309119fbd44f5f939344df0e6c0aa924fabfe858c123283f904e1fcb24a5e20b70d69ec82a40e3e010c12",
|
||||
"0881d39ee42046f433bff48ae0520128b79c0b9ff376c805b384340bd73767cdd8d1583606bafe2879be99ff44847e83057dbe521415a6067e8e4d7334e35a6c",
|
||||
"8080808080808080808080808080808080808080808080808080808080808080",
|
||||
"letter advice cage absurd amount doctor acoustic avoid letter advice cage absurd amount doctor acoustic avoid letter advice cage absurd amount doctor acoustic bless",
|
||||
"fd544f531a25958d2980925b10e7146290dd8615fd9241a66b0681cf3afb44e607a279cc88fa4afe65779b07b3ba441dcfb13be42266642c474fb4787683556c",
|
||||
"63362d97a394e67674c5e337b8b8221f242cdf84eac057e08e8d522ac458e0c8b577c487bf82255d41e2ecfaf9326be2b3b31534a990608950b05a5d849e0603",
|
||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo vote",
|
||||
"024a5866efbd866885915e8eb2fc743af294c1b69285d2d62efff4228d6b3eb53bfc2ecd97048fc9691b200ee4f11af4e51fab23aa0ac674dd187235b4e3283f",
|
||||
"7dce4ed2284c9134d026608ab684c05c",
|
||||
"lava include region explain simple omit dog slot melt reflect copy reward",
|
||||
"bf010975d766bec901a632c0eadc9461de1ff89c20e37e49a67ae03730681a08122004304ed92bff0592db5271254967de4bc7f3a20de9b3becc5ab951c28d7c",
|
||||
"0ce452419635c1a5faf44d60f2029f73fdc43419b4de1f03",
|
||||
"artefact card motor cluster foster spray type meadow genius mosquito pond tree sword borrow grocery orange business burger",
|
||||
"fd81692c4b0341a73bdb479ad5f572444658c68e11e693c06cafbda8d27f31eed03f32fa6e02744fcf902b8383253c64f98ffd659ba12fcb7dff47991d811fb0",
|
||||
"00ac97c48106f0aeb8ba061e0250a559b3251dc35854e694780ba51d53a50120",
|
||||
"absent gorilla van acoustic humor firm title dolphin bulk barely citizen recall crane moment aspect appear track phrase actual enforce steel spoon afraid benefit",
|
||||
"97a796e70d1ba31176e0ace6feffa6bdcda6233648deb83b7a92e0dd01ad133d0b545a4d1283e5d5bef984b6b055fe9ebb99f4063607a7f17cdcee20a5fde35f",
|
||||
"5baf069620eff15c71dd97c9a6ee328f",
|
||||
"forum join pitch dove yellow purchase shuffle real situate danger million bunker",
|
||||
"8e6416b101bc429d59becfdeef9b4ca40b4dd938efca1d3dabb54dfcbd48a78a65a2a28fdf4732f94806f2e8aa2e40fadff71fa7060883ce50eea7a90fbe4bd3",
|
||||
"977f8287f9ed670b8489838ab0476a63b65d4df12f406e68",
|
||||
"number winter peanut video stool magic banana corn melt lion surround shuffle grape plunge seven trend hover dwarf",
|
||||
"bb63f0b3e0f9a1ed6afa0a694e6e3673f669ec8ac16b36bb6c3d273db387357b83e0c09e05c9dfc58b09a226a84e93a6bba558050b7b73c3a9b8f1bd8f3b7c33",
|
||||
"3edc83b60740d77af3afa2fcb82c2f1bc541ee4e2518ddef4996d32453f54a3c",
|
||||
"disagree tomato unique attend aspect runway solid violin witness scrap armed daring favorite warm decade perfect target kid grant play early wide cigar night",
|
||||
"fdd3a53afaaf299cb3c5c1f9a2bb69627a03da65106deca4301859cda102d34eece0ad49558f145fb8986cf39b4ce88aad96c21ae9be2894da97a6379659ad25",
|
||||
"63deb1e7f0c3de56f4ab43c9d2ae6c86",
|
||||
"glow void ketchup thunder digital clock sport half six nice open artefact",
|
||||
"68ce9777c0adc97c85ff636fd0c677b00c5f1dab44c4090a5f60c516ccb50a8b8a3f59afeaf85a935d986ad37dcea8e921e9ecde3bb6649c4cbc843b19e2b8a5",
|
||||
"e77c6500b49072aefdf0a8aa787cf557d1920e94103e0597",
|
||||
"trash tobacco dizzy hard already first water bench price sentence diary quick bomb also expect amazing airport royal",
|
||||
"4c9e646357ea442fb2734018662e7473b5870ef7dc9f5048f9460ec22f08aeea561def3664e8f8a96759eaf1aeedb2b113fb820b96e8dc5853fd7de6293568de",
|
||||
"89bb4bc5555992cdaf3444c5e7ca5a6e9f27efab894f1990bae41be8b2a26ea4",
|
||||
"meadow surge vanish primary odor grocery rubber mass shine dinner notable tag venue water purchase clarify book magic ribbon daughter menu eye ritual orchard",
|
||||
"71ce132d69f9bd4ebd7a3f8b4c45d057341670f9093fb22ce4855ee1672119d6a430f203ebcde5767e53f7c3ff64a5ad29ccd41f31d5d4f9db59e21f65b02cd0",
|
||||
"00641669f095b433a304ed0f953f28eb",
|
||||
"about camera omit thrive forget border metal oval auto prepare sketch stomach",
|
||||
"016837c6355b0e8998a2fe8e10294a8b5dc0d9bc87e545e38f1ae77b4ade3247998a101ac1146f52414c9c8e0442f610fd7f0af25b60823fd044dc6902c865c8",
|
||||
"b8b0ff94389d3ec591c7d2fb72d8d3666e4e52b8cdf5471d",
|
||||
"reward margin topic illness stadium glare either where window nothing crumble smoke top citizen tobacco salt either truth",
|
||||
"366e1ba1ab99d840505b94a20d9c63f1e17ec330ff77a7e2db399b57be5d34971ca33d7dea361f5bc9f3e6c939f0624f7231d62f53b9963d9632c8926a031abe",
|
||||
"911fec0fbd88029f6fa99164896c18d898c9232af18bdcca3e42d53b86493104",
|
||||
"much youth advance kitchen lens exile salt cram goose enter alert raise milk muscle profit cousin system faint mouse price reveal cause series long",
|
||||
"ed60c0f8ee61d91be8c96dbe8fd999c21d77c162e682fff73e904bf138d6f4b48e69becf69d4c72fd0e630179238acc9dd037eaec55eca077e0ad379249dc456",
|
||||
"3c22432ca0b5c9572a631b1068749bb6b663a78390322ab4b763c3ee21d81a7774f8ecdbc6ec73932b961c7374c7d14156cd61f81e433de3953fad23ea407e58",
|
||||
"b71edfa823c78c5f8d6cade654e298b4",
|
||||
"require want tube elegant juice cool cup noble town poem plate harsh",
|
||||
"b424ec5ee4eb4127c3ce0722572c456a47084cda617a26fb647f9a02f43fcc3d11a84dadb6e892ec2641d8592149018a39c8bd9c1cadc969188da4b820bf3371",
|
||||
"8ffd2ff2b2fa4dd7c61f019698893918dfd72c0ea37d0027",
|
||||
"morning truly witness grass pill typical blur then notable session exact coyote word noodle dentist hurry ability dignity",
|
||||
"d20f3879eebf9858443a6ca0f04f568aac06e74fb542475824101855133ed5f54d0805d0fc9bc0e6f03c1f820ee01a462b291caeba7cbf659b670afd00e0db42",
|
||||
"9b655bc7d4e380bad6148df1cf8d8a6b023b781b05c2e823c5b5dd05139d30f6",
|
||||
"opinion client vehicle prefer day frost flame museum vault ladder glad stock casual rose hire reunion trial bullet hope ring eye soldier sense stereo",
|
||||
"3c6d3843502c73e29d7e9ddc3e81354d3467121244e0b713cdb8e0e76c357d6db2f738c43bc2550bb85c9d5c900fbd7fbba10c76e7a8b920e0d450ef5a6750eb",
|
||||
"bdc823540d4ff8d372d29f4265fe5cf8",
|
||||
"saddle donate steak box zebra have slender fault draw copper now various",
|
||||
"0c960d7d54415e5d3ae41ea805bc961f14d7031ea0b92058c19cecab7b7e51f82a4d987dbe63dfaed30805bd746d93e645fd5dffea8354b90688711d6fa570bd",
|
||||
"53de16bcad3ea92c691f5d069de6f1870a9adfe764b1aa33",
|
||||
"fatigue vague quality foil tunnel normal piece two alley upset round asthma predict husband outside normal pretty oppose",
|
||||
"fa384e2775768bc4905a5f7a014cdb62bbf77f751a039d5a124191099970dafc02e679232aeab769cb1582038907829baa3995255be01fe042b462539b26f1af",
|
||||
"29932ac2fbba5682ef711bd7429068ac7f90fe6132c9f1a722e8441240cb9a96",
|
||||
"civil off radar wash pistol door saddle casino struggle behind boss flight weekend left luggage float vast decorate ring market catch grape heart sport",
|
||||
"777122f7b4e1dd21d385e71b9811d7d8d2adffcb8d0cebb667c93346156d4baec6b23adc519515742a4f6a712cbbef3e03e528f912498a3104206f33259d8823",
|
||||
"498e5f6f8039399a5e307406f448f846",
|
||||
"end indicate swim about near snake juice attend alone pelican dignity mimic",
|
||||
"551e36122e37276b2840ab5c71b2a33888a6efa501a47b8323b313bf03f6dec1fb3d2ef11bfb35ec41580c5c0be3f881907fe2a3154b6e0ba8e05177b8e928a6",
|
||||
"7d205696a272051f60c14f146808a2c83bb0f7ef95037b4e",
|
||||
"large actor pizza eager cake moral loan clarify behave doctor chunk motor roast know salad parrot kitten item",
|
||||
"d8bb3b18a5b9844ae1117b680986d93074efc691d9084dc5ef9d3570d9f9bcaffc9c319fb53d6c728564ee0e4494953245607688adb2efbbe77b912835f40e8c",
|
||||
"d10c1c341f19c89a5c8c505cabfa027422ea6cb4cb6c28003898676ef7611cd2",
|
||||
"speed genius artist dilemma orient essay impulse meat frequent garlic letter tribe concert curve spring horn chimney achieve champion solution urge rack infant furnace",
|
||||
"a2f0b91b238ca1df0c4ac89eaa628701800f70732a1952982f3021e94bf7c3aafa0bb51bbdcc210f1e433d3e740660d1e4053c12edfdc1eb77ceafbe6a32723e",
|
||||
"719ddb2a59b10066c74d26954da2dc2e",
|
||||
"immense uphold skin recall avoid cricket brush pill next home require friend",
|
||||
"9be5826432f915ace1f77827028a0ab7098dd3776304aa17e03698b09e5e93914e3e3f0d3d38c9b265ec2cc4bba1da8c9d9a97c8a3b1ec05add8e34a1c676490",
|
||||
"5746a7704cd3b9dc0a022f2a9025618d813c8ca873b8008c",
|
||||
"firm cry swing often describe unlock chimney echo clever license flash brand because edge peace jacket above gentle",
|
||||
"06f5b2d7af46c2e7b7b99c87aa52d17c27925ba685ba5e572b4e978da2adee44fe7d5726966cd2ee1ae47b65790baa4b3f7952505b0b45d9c8673a29e6a57ffc",
|
||||
"8fdda21cc1b39a6fb264ab3c007995cf9ed9efcfebc07652951e769b6bcbfad4",
|
||||
"more unfair mango lock defy daughter sister nice despair adult grace palace unique wave distance job iron net elegant unfold repeat tourist twice number",
|
||||
"c37ae2956e1396b03a722d647dbcf2672cb8db1493c2c136ab9370a62c19c8f45023a635b7c2646a9748ff28c7ef64d93d089c315d390c50cee19cb46a01927f",
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
|
Loading…
Reference in New Issue
Block a user