test/crypto.c

Sun, 11 Jun 2023 21:30:11 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 11 Jun 2023 21:30:11 +0200
changeset 757
7ced4052e8ca
parent 747
efbd59642577
child 816
839fefbdedc7
permissions
-rw-r--r--

fix uninitialized buffer access

305
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 /*
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 *
470
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 308
diff changeset
4 * Copyright 2018 Olaf Wintermann. All rights reserved.
305
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 *
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 * Redistribution and use in source and binary forms, with or without
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 * modification, are permitted provided that the following conditions are met:
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 *
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 * 1. Redistributions of source code must retain the above copyright
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 * notice, this list of conditions and the following disclaimer.
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 *
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 * 2. Redistributions in binary form must reproduce the above copyright
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 * notice, this list of conditions and the following disclaimer in the
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 * documentation and/or other materials provided with the distribution.
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 *
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
26 * POSSIBILITY OF SUCH DAMAGE.
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 */
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29 #include <stdio.h>
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
30 #include <stdlib.h>
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
31 #include <string.h>
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
32 #include <inttypes.h>
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
33
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
34 #include "crypto.h"
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
35
747
efbd59642577 ucx 3 update, basic dav commands work, most stuff is still broken
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 688
diff changeset
36 #include <cx/string.h>
efbd59642577 ucx 3 update, basic dav commands work, most stuff is still broken
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 688
diff changeset
37 #include <cx/utils.h>
efbd59642577 ucx 3 update, basic dav commands work, most stuff is still broken
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 688
diff changeset
38 #include <cx/buffer.h>
305
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
39 #include <libidav/utils.h>
308
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
40 #include <libidav/crypto.h>
305
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
41
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
42 static DavKey keys256[16];
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
43 static DavKey keys128[16];
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
44
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
45 static char *strings[] = {
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
46 "a",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
47 "ab",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
48 "abc",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
49 "abcd",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
50 "a string",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
51 "hello world",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
52 "0 1",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
53 "0123 abcd XXXX <>",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
54 "libidav+dav+dav-sync",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
55 "R2xd1dI9o0HHd3aDuQrvuPyB",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
56 "7XxUqWvOvQOFo0SlKyEWzerR",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
57 "Ert2g8bjjyKpAebBNxdaJ5o7",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
58 "C0jReDRLHxF6MW1stR00OFiF",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
59 "eRD76vIQIUNRRFrnUrGtTI13",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
60 "VmfdNDkSzLKiEgCkWQ4Es4XaiY7TlW3LCm1gt3r66uJ0TeQm",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
61 "AdeoBAIo8Q54yO1Pwe1WH3rgDe4m5ZBUSgNUlrNqGjtN4UNN",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
62 "Ajkt3kmdG9uPRi41Q5299yuW9DJNKc0yGlF08K6PfodpYyOxzOiL7TbeDML0RbJAOaL2fpCC",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
63 "mmGmeUTxxAEyhx1Qw9CAodQ550rQpQhSR4ZuC4im9SDSl5ykGJOEJrdrTPciaIdyY9M6WSmg",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
64 "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
65 "--aabb2234000000001ffffffffffffffffas"
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
66 "very long string ..............................................."
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
67 "----------------------------------------------------------------"
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
68 "0000000000000000000000000000000000000000000000000000000000000000"
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
69 ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
70 };
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
71
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
72 static char *cryptkey0aes256strings[] = {
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
73 "UtIyzMm3e39YFEccglOxyJ4WPlqA01tohXCJSeaVKIA=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
74 "rfHc8KMEp9HoGAHz08gyne+YH053EIoiheacHe0yiOY=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
75 "C6oaFjGiPe0aN3SAC146ptKyyGbWO1X2hHDOHtV5PBU=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
76 "y+bwmzxtjepi1Gpm1dwI7qJywu32hErGLCxFv4K5Zz4=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
77 "I1uRSZ/fOvJ4Ng2VhBYMGAhfejhdJdu5Sjc67qdyHIY=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
78 "J0s/JwsBebiBEhUJUjm9aliuX6NsMxfkHyD8t1yZqeA=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
79 "riCsL+VoMX9Np+zHJ6sBf7YJxNPtubGWvpIf2vQ3Cfj46bJ+OtbQWjEr4qEreYSi",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
80 "2RtZKgawmf2ZhSE4a58WW2Vqq1She3+IK2PkthWsH9CsDUBTGjcLtng2Csj6IVsQ",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
81 "G+iHYAcw26KdN4P/ZtJmUsPq/NrVkTyT0S8bAKtJe8b4/ZrD3lFVoujVFebxvAsW",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
82 "sEqfG73duZVlWpgMs4PrgMmw2gaFc3n5SyxLTL3km50Uhc/SfmSbNa8x3J1CdrYH",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
83 "TvdiTxgZ3ojjhLDfD5EHDGi98PXFmwXDCkzBYojYchyEplAfSYBALgYwQpw03/EE",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
84 "rQdJ83pmLinsaViwJN2X6cC/WNvuJF5SpKdvx7Isc8nJAHZxPqZMwGdGutGsCcZp",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
85 "CKnjU5Bw1xUrhCqR9i1PHQr7W8N/D0gx6lbj8+f40fNPoJSHxPl53fpxjXUj0a+f",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
86 "iM4cKOKnFh2mNqqETilnyCSE2VuLxoMac1q40wcHtGLdwHEXRjx/GLouhA+sksyZ",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
87 "iEQt7tHNNs+C4fM1ioPLRtdxBB0prCYX6147r7DOgaJO3I3nLKRjdVhxCMTu6vtEbQEdldtPOAai1AQvGUIHCR0vysUEpuaHW1jL/nbdos4=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
88 "N7l3vRd0PNGdj5qwNGpxpGy4TvTd59jPSqMsfkMSP44Qb/UwmJF+WwN6OMSuy8OAkSz8oXPNnozYv1neE40IbT+eNEtX2+VNLLcoyRvLIko=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
89 "THUKZwEFfYdhkObEaagcR1fLLxusTP0kFYdovNWl/XdBTTiKIrG+RMIod5VrFUe0bx3yZDZJtuAn1J/E+5F8/CXQ5WoxQM66B8BzXVC/EaSJlFJcG9MNstx4HXQPiBq3",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
90 "YMk6nlKxsLqXwXwFiIXJNZR/m5Gqd6h2R5ddN0UEjDBNkCWBnrnMyE22rrcz6oogVZCh1mWYYO0WiqhG3qqWSzJcb7lGrbdFl4rfD+ogQPkM3c0jgEnV2/rLHyu3x57l",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
91 "tkaz9523cM6fYJDW4E/Q99cxy1ZpRO3hoFtV2iCQ/zWqvhfL96GjbV2yiqMY2iX2bJ+4iXKerrQMmxDUAYJYzQ==",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
92 "GrRF4S9W75f6Y82Bw1PS3ZfMs0sSY8yc5F7zwJ6YtAUCWvCpgLJ2fd1UGAdYrMoB9f8R2gXXM4ROGD1N/tWo5vDgQDFrzSttN6J+4n9yg18JuQ5Kna2P9sEOkPTSgZDmB9wjOAQ5U4LlmHI35ykcc0LjFkwy9qxXw1GbsATeD4WY+wq800ru6E158a9Fb6teRQUteNZCtgwTqPSr2sYJIQAaJO4Yv0vNp/7BgxI9CZM/Hvr+05GVVRA9YE3qwed3Hk1RMd15cfBo/+bsttTDg1sKtviPHtkBV88codPfoWYZjd8UPYE+q9P0zOM/wRvb5b2sUccRKbmRNmM+OKQySyG/lyCb+HedxjPQ+24i8NLjku3GWJG3egDnRQHY/nb1TBmOFjpNtARq4QhLf0HwDaGcZwchhGn0xpggcrqTuv4="
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
93 };
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
94
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
95 static char *cryptkey1aes256strings[] = {
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
96 "zAkuGJUT4tkdbYg/oxLROlzHNWQPojgyFSGhEw3FpNE=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
97 "RiDdDBabx2dxPWH/Hu+FRHN9e8dnoaX2sjNae81VoTU=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
98 "ocdZlAi8uGD7JvmVNGA94BhZ7RoJrYWgjwENZ7+CmVQ=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
99 "HMtoE2bd6VdJGtcRICoCI1o51jeoWoJyGVPhLLNzFc0=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
100 "/lTX94wq8KMKK6IAO+/TxZbE9hCIXd+aribRzIzEcSs=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
101 "GKZjuYqJXFyNd26SHrd+kgeHTq7SlDB11igXyyulJ9c=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
102 "0il4W1FjrMzDeyaBkswYG+UYgKUBGAhNivzDAPngH3ENN8pSr8cE2m9Q1AKIyKcQ",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
103 "Can1I90vUnRynV74Y10EFEX7TGtaYKeUgkSLLG2UBOX1gspDeDK5Mea3ajPYT8GU",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
104 "6/jEE+HPx5CIr/NqK8mZ9jLeOJXqol6F8Dwzg+uGsDChoXwVwcuKdWBpCHwPDSpE",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
105 "BE8YyUqrqKnjIYP3NYvyPToaSj5Sy8OW3DAFdrPpbCKG1wmyYo7E6pSO9/7DPrQ6",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
106 "pKMowelyCqYG9hC1xVYwSNMcz4BxU+wSJCWeuqNf2gfin7O2GbzRGN4ZOQjHT/5z",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
107 "DHgqVkKZ1vRkM4wqmAy89vZySNDi4HUAf0lzhE/6szzsP1H6vEFCetsTcEcx2umH",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
108 "wmv89rc6xO6b2PrOYtVBurnJvbWRElqpeV2bV3+gTOMnaq7M7kdwty0zT2S9aCAq",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
109 "BTJqEnCTkmX9e7bXxGHsRMsHPincVlFnrL1r513BSnX4e+T4N4vwua1VCiVhLbCX",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
110 "lNH6ysiyVl7ulQIkeWwfF4KDmOgOFSuYqsexMCichTPfoPW66UM5OIN5z2GKJVQbJ8QIgIVHJ2z8b7/xpx1FEyEwHhhasjmnlgTJzbFtR/Y=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
111 "mByn4m8cJzGAJTJcq7WoBWjmUpcyET9WcZopRJYKzzg6WMdpqb0Hd6KWxnojRY15zGsDlftTCSUVCMvN978fuve2tUcH0vDrwA3VW7cplag=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
112 "Qm1cteXs4h2veYPmq6+go+zIp3spUwhbO4/FTIKIx3FG/iloAeyNCHvE75uwQ35qUvsDKNfaLme/HNoLPIy1Ss2z3HezdmbMK5bL5GYfOFqUwk4UN2LNosidWyHhREqR",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
113 "3+0fmdc8ifQ9ETG+1rc7OYeyMZzYIcl9o1qqZ/DSzZGwrSZJoLaBobwLvkHPOY5UFC3k8YHXGZZfd3OvhCth9fEA7xEkxH070VXczZu+k5iDNFlwps9SSIIlsR5WAMBr",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
114 "w+8brnAHAorhX9iX/YeYNxJHGRCiyAp8iWshWlw+QU2n+IqNBkINYRj389A+HPcEus7kqqQuITRoCicaykYoGA==",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
115 "2yVLOZEMpy2kXSqtmgGJ10FwIVs1I8sPkDuSQmSb3nwBw5NA96A7ul9N9Z8Qxr7oxiYi+1ZADEdKRUOlIbntSHel6zW8XJAdnP8fqfV/HFv6DdwNbdc9Ofm3PkfkKcudkLhofGr8Tma5kIyESGmA7jLUrLLPtXvM4jneCZoUh/DpWwTcfgeaAuujNO/FPSJsheEZu4ck2wv5qvlYaQx716xkTsXugnpecOSOq5uQkqmSGI0O+aVJ8sgel/JsiGEJew3JDh+jnuK/lKHnsKxhHcX/ZX+OluGK0KbCHYM5RWl5Fb2zJA1SDaDneFqgOqLdSryBOKJeLoNdiFsL7LQY+RK/ElUZn07QoQDLk+xJwFMbF/KTH9KjWA3vEVdh9C0Wc02Jf3AwpaRmrq9/q62dhm+bc+I4NRH1BmROll8PS5Y="
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
116 };
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
117
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
118 static char *cryptkey0aes128strings[] = {
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
119 "yWwheGMLOFi7bUia+105EHpuS2Tv4shfRZh3T0CaXts=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
120 "wdpntIG/wpTGUOzgt7Pi6GSnc8dVOtvHbjyF6h1p1LY=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
121 "IJnMdm2WinhlDsQItx/DSW3CFygtEtxAw7cEacoP9j8=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
122 "vd3IRIru28Xb35+3jKA7PfftbBMvF2z/Cb4e7/2e1vE=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
123 "ub3TJHUtIsc2Sb1ZeNDfcDYEq9qDcAb6j+qm7Xyg1VA=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
124 "tXgBCUyxvh7AXiw5ysbMM75v36aeoDniDLUjH723xsA=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
125 "8g/Vj58LmuGz64biZiA+Oz8nG/e7s0EyF3kcWd5Lmgy86K+AG8c4FlQiAHk7Bscb",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
126 "BuEFNArQgT2uSrK6IsXeFiGlSz9Y3Sh1O7Xgqy6TzGt3XKx6Ixubv7sU8Xo0nKDz",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
127 "jjr0Qliga7PjqJ4rdTqCbd6p3jt3tIQ0xCftctoxaPFZQuiumWT47CxV+alclgV9",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
128 "G0rsiGmM4HZlpnkrPdjEI2+K1d/unmn2QAkl8I68j2+rswPY9VY1zPsRV3x0SfVZ",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
129 "WaoJI8oySoB3sgBSzdflISJRBz0zHarnkrV9wIn0wbKIeN2xxlzxQmUp/RtNnQZq",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
130 "YQNtCIRW0oeTbHPBRMCnfHlm6Xr8uvRgODhv3aVm5OPLmxtlEYAFPja1XvJEcsD6",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
131 "pAdDt3gDc+IsFkzya1cBEV+hi0kYGGDn8HYAq6gs8/sL1i6BjLX8EV1y0oxMIhZk",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
132 "RpOaTK9gAoboRy0oc2y/EY0ZinuG2Cnntc0KvWe7p7QpHqFdOgvhPy5PxF/OImIb",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
133 "bK71oogoMekXTWBycpiBZQ9tz13LDKePfYmsMTZWr1g4Z/9/baSBVHzJvZ2td253310QNVN7elQh5YBLauEaf6nqnRCfhFJjCbAaTMLNN8w=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
134 "MyypcyOCy39DQJbUsy0fggduPkJVslSRizUqXQZUpuMQf6bDICuXjNBARV6HTBUqhWqatC+35wDBL771udPDPacy3UutZ/nJWQh1nEX0ffE=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
135 "ps6CbvSuEhuQdzQCr77rgfpHKjWlyDLTPSlDN1ziLlfK4NOgzLRbhQNNfLzoSkGj4eMTqPDoOzeKrbpbpbisxdjUeylPYznuLcFyBVyZn9CRuOOJdkwkkhnooWDpMzSE",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
136 "oQ+IOj9HRGhv0FSpqsVfsHU50TYncFELLRFILA/JQUP9esKYNVjJG1c6uUaRtwCU9dtenBkKP/e/zh+3RSKY26GO/vxG3RWDnYUD1HvJDSR+W7xNUaakFMpGRPCBv6cK",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
137 "aiL1TCWid4j6F/UIPrpz4cq54SHfcp7KLTSaDrcGNIXnLHctbWU1aWHdBjmyZyACIAmQ5l8ul5KafKqaFqPbsw==",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
138 "cOLQc1zi9/l/02FVMBp9D98jnZhwrLLs/1Hn+XT1XxWO2lD56dYiGjMMwjJ0zuHvOGA4wmUwyL0z8kKK3XGhfQqu046i1GXCK/qdHB2b1hnBEEyv0PmKTr28RINP0xckxMk45SYq+HSfeiAyqdupiIHu3Wzx5aBbOjPd9aoGEx7mXRywgzJ56h6jwcNGv7UP3tKaTjkuUDvwhB2Lo875nd9cytC5kj4HLeSXBhtUcxaMxDEWTFK67pqMT6q51t2BV83eAp/BXkis8wpamhYqdv0yiSt4yamLm8IecGfPsHgfCcrnTtK220xbVBRvHMEbP3gui1nApB2vQiweE6Gk5IXIgwN+P/YrihjUzKtJgqCoQ0FigNTQemUGkNalg9+LxiXSg4AFundZQMaRNMNJA/MRKKvHcCps6POwENtYfBY="
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
139 };
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
140
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
141 static char *cryptkey1aes128strings[] = {
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
142 "jJyZsBeggvHnPFCt4ABzJPPI88RHWXLREw760Pwh5VU=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
143 "R+NDojkR6jmLQBKNk0lu11Ks5OpcOhhnNEh1st5bUB8=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
144 "ZPjJ09PT65Nb/avJZ/rKiKdTQh2EqFj8C4SCggP8Tdo=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
145 "Wq4poohvLvgTH07olEbU+1DJ+X5R+rxpeWwHJjeD6/w=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
146 "mJy65R4TKUIaavlMi06zNxEWHFe+emV9y/EpqGfiR4c=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
147 "X9ukqaTv+yl8P0xq3+lsSnq0Kq2Vra9QStpT7NWrSUo=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
148 "2wZ4OBX6UlQ8BKdqVgM4zxfdHhh/GPdWqob0/ryBz9mp4w15omTd1Yy8+1xZ/saz",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
149 "5TV7mnMX48QTjJ3mvn1QQnQCj8OfMbx4mRy1r+OJS/p5lPB3kzGaikaxhtVPuOIU",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
150 "wm5Wx9IhOwteBXjoO4UI79gxBd8LHYfp98akutwmOqYLSz2mJ1ZJPjhlu+fB84Jc",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
151 "3m+JFgTgi0djCnU/hcsFFh4AefpkJ5S1ucX1EDhukm0Dbmxtlw8SWO6sIyA8UsUp",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
152 "G96QAM7L9XHn7/z50CAPadqDEyxHQvJJvvHkiL9VZ7LA2WYfm6/gmJIOPgMZfSxT",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
153 "ZxnZLW2M2P1pYIS6JcTwG3qIA5NlcFsLZvQWpiDTwSGZWcOq5mv+fo6i+sDFu3Gl",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
154 "jXgcKe5k6+B7Jgv5erI571JoR39QlaCtv7IJbYb3Y8C1jTq1DLLgYM7mvBiOaCDT",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
155 "rUWtaNg3xqeRqKl/F6Pjg0C6+uPLOX1DXVwwql6Izer89E1vQTGGpjvN5O0UmWNb",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
156 "LRS2XeeIGPzuMFn3ClMS6HRqnfKqmNQcJx41jkL0JitnufZtnyQYojp4LRf331Z0uE3ZCxwCMxJ+GqX8CLpbR6KVWEdhBmnOXjWFY1nZsiw=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
157 "jg4aA6BJ7RVy4l9sLz/WPGZfSfUxnFbmfGErnMy6LWJGIQzPvISHkLY6pSH3FSMZMUtnLLDW8KVIGstt5lo8AcflSryGrOwvzm+88HUO5Z8=",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
158 "hkS1WQs4SvLTzr95MaIzV56inCkHMWAt1prL6mzv9UadUYEkpPQK/w3Sq9N/3oeNCb21TqF1I9tAbWJOhRqTj098EnmnmJVI6p2mfRESEBEJULBYKsdQPE85CdL2b0Sh",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
159 "wscy5Q5mi1l8tdA/8v6MrdFQY1PuS10uQNFe/FXnnJS/MRcbcA/R9wlLuWiMt7cUg9Zs74lXc8w7tKkOrSX6zMOHu3hpDjCJA+ZE9gkbP70KIGRnddW5aFhXNy/Sz808",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
160 "92S3C7m5lQnj5Gpjz9zbPyYdPO5j03b/AZ5sSPHbuM/HIlIfcj289sNnFz08MLgDSxLqZsJnlVjLLahWWo1KSA==",
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
161 "0WQozX4DdbVUATNnxn8kzkG30QGLB0kCUMmm1wdbPCqCWzOqo/id98xh++8PHfD/gmOHwIeZgcW6PTsIT7KI17LRq+ryHI8xdRYMW/oPzXQcaKCis0MbBYpaS9OZp6Wbrkbk9NUShqV340DdydBCtl3RXGhEJLyLWqF2XTyuXNL4srNPFP934rHLSSkU7eUD7FzNiE7mTgQ73E5o/h8porPRtNRnbH1hT5SZK71qC8pRlJjMSVBdMgNHfOJDvjFd0Xv+QwDqm3QqcrpirYhkP5M1ofiwBsuFNra1bnojMPiyXgduhUpxsJ0StvBlzEixrtA2NsxfEgDtrJik8ScOQ7GkB8alHPn3jEFa8KsucyQwxuoJ7W1pIzBYKQqZ3QU3I75aSZ5mAM8PxVVxLdC75iZuBe1PvUNle/bljmKJ3QA="
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
162 };
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
163
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
164 static char *d0 = "01234567890123456789012345678901";
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
165 static char *d1 = "gfXa3IJa;.d-afHS1237.:_A12=$%&%!";
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
166 static char *d2 = "%$dhXfdhgf(z@pWqoiv)Zal=di}weQ<c";
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
167 static char *d3 = "%$dhXfdhgf(z@pWqoiv)Zal=di}weQ<c";
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
168 static char *d4 = "<>/(!'§)._,;*++-<Qq@,.=)($%§1aX:";
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
169 static char *d5 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
170 static char *d6 = ".-.-.-.-.-.-.-.-.-$$$$$$$$$$$$$$";
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
171 static char *d7 = "uAh281._;(12<?2@@$2..;---assf34v";
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
172 static uint32_t d8[] = {17635, 0, 4274927276, 76546, 6098723, 516, 4193367221, 1224964255};
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
173 static uint32_t d9[] = {2234966275, 643123, 427492276, 3334964712, 1337123, 722464014, 4193367111, 3234966518};
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
174 static uint32_t d10[] = {3231664275, 1578414324, 427496129, 4034960712, 93371873, 1722499994, 4193300111, 8765678};
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
175 static uint32_t d11[] = {764564, 12348792, 999432723, 128943278, 664512343, 84327634, 709712334};
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
176 static uint8_t d12[] = {14, 94, 240, 253, 14, 0, 123, 94, 72, 197, 71, 56, 64, 156, 204, 231, 17, 18, 101, 24, 200, 15, 208, 150, 1, 85, 171, 18, 205, 30, 231, 7};
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
177 static uint8_t d13[] = {25, 43, 219, 253, 14, 0, 223, 94, 87, 127, 171, 56, 34, 26, 204, 31, 64, 18, 151, 124, 233, 12, 118, 154, 1, 185, 11, 18, 25, 30, 231, 207};
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
178 static uint8_t d14[] = {15, 0, 220, 253, 14, 5, 223, 234, 157, 157, 121, 56, 71, 216, 254, 31, 61, 192, 151, 255, 0, 12, 118, 14, 5, 185, 124, 18, 25, 54, 131, 227};
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
179 static uint8_t d15[] = {0, 43, 210, 25, 14, 0, 243, 94, 87, 0, 1, 156, 234, 6, 214, 31, 64, 18, 151, 124, 3, 12, 118, 154, 1, 18, 111, 18, 225, 31, 251, 207};
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
180
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
181 static void create_keys() {
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
182 void *data[16] = {d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15};
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
183
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
184 for(int i=0;i<16;i++) {
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
185 keys256[i].length = 32;
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
186 keys256[i].type = DAV_KEY_AES256;
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
187 keys256[i].data = data[i];
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
188
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
189 keys128[i].length = 16;
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
190 keys128[i].type = DAV_KEY_AES128;
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
191 keys128[i].data = data[i];
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
192 }
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
193 }
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
194
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
195 UCX_TEST(test_util_decrypt_str_k) {
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
196 create_keys();
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
197
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
198 DavContext *ctx = dav_context_new();
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
199 DavSession *sn = dav_session_new(ctx, "http://localhost/");
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
200
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
201 UCX_TEST_BEGIN;
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
202
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
203 for(int k=0;k<2;k++) {
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
204 for(int i=0;i<20;i++) {
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
205 char *c1;
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
206 char *c2;
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
207 if(k == 0) {
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
208 c1 = cryptkey0aes128strings[i];
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
209 c2 = cryptkey0aes256strings[i];
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
210 } else {
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
211 c1 = cryptkey1aes128strings[i];
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
212 c2 = cryptkey1aes256strings[i];
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
213 }
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
214
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
215 char *s128 = util_decrypt_str_k(sn, c1, &keys128[k]);
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
216 char *s256 = util_decrypt_str_k(sn, c2, &keys256[k]);
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
217
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
218 UCX_TEST_ASSERT(!strcmp(s128, strings[i]), "s128 wrong");
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
219 UCX_TEST_ASSERT(!strcmp(s256, strings[i]), "s256 wrong");
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
220 }
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
221 }
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
222
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
223 UCX_TEST_END;
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
224
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
225 dav_context_destroy(ctx);
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
226 }
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
227
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
228 UCX_TEST(test_util_encrypt_str_k) {
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
229 DavContext *ctx = dav_context_new();
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
230 DavSession *sn = dav_session_new(ctx, "http://localhost/");
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
231
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
232 UCX_TEST_BEGIN;
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
233
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
234 for(int k=0;k<16;k++) {
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
235 for(int i=0;i<20;i++) {
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
236 char *aes128 = util_encrypt_str_k(sn, strings[i], &keys128[k]);
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
237 char *aes256 = util_encrypt_str_k(sn, strings[i], &keys256[k]);
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
238
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
239 char *d1 = util_decrypt_str_k(sn, aes128, &keys128[k]);
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
240 char *d2 = util_decrypt_str_k(sn, aes256, &keys256[k]);
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
241
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
242 UCX_TEST_ASSERT(!strcmp(d1, strings[i]), "aes128 encrypt failed");
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
243 UCX_TEST_ASSERT(!strcmp(d2, strings[i]), "aes256 encrypt failed");
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
244 }
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
245 }
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
246
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
247 UCX_TEST_END;
c3d98b2cccf3 adds tests for crypto util functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
248 }
308
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
249
470
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 308
diff changeset
250 UCX_TEST(test_crypto_buffer) {
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 308
diff changeset
251 UCX_TEST_BEGIN;
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 308
diff changeset
252
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 308
diff changeset
253 for(int i=0;i<32;i++) {
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 308
diff changeset
254 DavKey *key = i < 16 ? &keys256[i] : &keys128[i%16];
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 308
diff changeset
255
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 308
diff changeset
256 for(int j=0;j<20;j++) {
747
efbd59642577 ucx 3 update, basic dav commands work, most stuff is still broken
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 688
diff changeset
257 CxBuffer *content = cxBufferCreate(NULL, 256, cxDefaultAllocator, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
efbd59642577 ucx 3 update, basic dav commands work, most stuff is still broken
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 688
diff changeset
258 cxBufferPutString(content, strings[j]);
470
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 308
diff changeset
259 content->pos = 0;
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 308
diff changeset
260
747
efbd59642577 ucx 3 update, basic dav commands work, most stuff is still broken
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 688
diff changeset
261 CxBuffer *enc = aes_encrypt_buffer(content, key);
470
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 308
diff changeset
262 UCX_TEST_ASSERT(enc->size >= content->size + 16, "aes_encrypt_buffer failed");
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 308
diff changeset
263
688
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 515
diff changeset
264 char *base64 = util_base64encode(enc->space, enc->size);
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 515
diff changeset
265 size_t plainlen = 0;
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 515
diff changeset
266 char *plain = aes_decrypt(base64, &plainlen, key);
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 515
diff changeset
267
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 515
diff changeset
268 UCX_TEST_ASSERT(plain, "aes_decrypt failed");
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 515
diff changeset
269 UCX_TEST_ASSERT(plainlen == content->size, "aes_decrypt: wrong length");
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 515
diff changeset
270 UCX_TEST_ASSERT(!memcmp(plain, content->space, plainlen), "aes_decrypt: wrong content");
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 515
diff changeset
271
747
efbd59642577 ucx 3 update, basic dav commands work, most stuff is still broken
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 688
diff changeset
272 CxBuffer *dec = aes_decrypt_buffer(enc, key);
470
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 308
diff changeset
273 UCX_TEST_ASSERT(dec->size == content->size, "aes_decrypt_buffer failed");
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 308
diff changeset
274
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 308
diff changeset
275 UCX_TEST_ASSERT(!memcmp(content->space, dec->space, dec->size), "decrypted buffer has wrong content");
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 308
diff changeset
276
747
efbd59642577 ucx 3 update, basic dav commands work, most stuff is still broken
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 688
diff changeset
277 cxBufferFree(content);
efbd59642577 ucx 3 update, basic dav commands work, most stuff is still broken
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 688
diff changeset
278 cxBufferFree(enc);
efbd59642577 ucx 3 update, basic dav commands work, most stuff is still broken
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 688
diff changeset
279 cxBufferFree(dec);
688
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 515
diff changeset
280 free(base64);
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 515
diff changeset
281 free(plain);
470
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 308
diff changeset
282 }
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 308
diff changeset
283 }
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 308
diff changeset
284
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 308
diff changeset
285 UCX_TEST_END;
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 308
diff changeset
286 }
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 308
diff changeset
287
308
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
288 UCX_TEST(test_crypto_stream) {
747
efbd59642577 ucx 3 update, basic dav commands work, most stuff is still broken
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 688
diff changeset
289 CxBuffer *data = cxBufferCreate(NULL, 1024, cxDefaultAllocator, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
efbd59642577 ucx 3 update, basic dav commands work, most stuff is still broken
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 688
diff changeset
290 CxBuffer *cbuf = cxBufferCreate(NULL, 1024, cxDefaultAllocator, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
efbd59642577 ucx 3 update, basic dav commands work, most stuff is still broken
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 688
diff changeset
291 CxBuffer *pbuf = cxBufferCreate(NULL, 1024, cxDefaultAllocator, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
308
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
292
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
293 UCX_TEST_BEGIN;
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
294
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
295 for(int i=0;i<32;i++) {
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
296 DavKey *key = i < 16 ? &keys256[i] : &keys128[i%16];
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
297 for(int j=0;j<20;j++) {
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
298 data->pos = 0;
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
299 data->size = 0;
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
300 size_t slen = strlen(strings[j]);
747
efbd59642577 ucx 3 update, basic dav commands work, most stuff is still broken
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 688
diff changeset
301 cxBufferWrite(strings[j], 1, slen, data);
efbd59642577 ucx 3 update, basic dav commands work, most stuff is still broken
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 688
diff changeset
302 cxBufferSeek(data, 0, SEEK_SET);
308
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
303
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
304 cbuf->pos = 0;
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
305 cbuf->size = 0;
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
306 pbuf->pos = 0;
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
307 pbuf->size = 0;
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
308
747
efbd59642577 ucx 3 update, basic dav commands work, most stuff is still broken
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 688
diff changeset
309 AESEncrypter *enc = aes_encrypter_new(key, data, (dav_read_func)cxBufferRead, NULL);
308
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
310 char buf[1024];
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
311 size_t r = 0;
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
312 while((r = aes_read(buf, 1, 1024, enc)) != 0) {
747
efbd59642577 ucx 3 update, basic dav commands work, most stuff is still broken
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 688
diff changeset
313 cxBufferWrite(buf, 1, r, cbuf);
308
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
314 }
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
315 aes_encrypter_close(enc);
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
316
747
efbd59642577 ucx 3 update, basic dav commands work, most stuff is still broken
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 688
diff changeset
317 AESDecrypter *dec = aes_decrypter_new(key, pbuf, (dav_write_func)cxBufferWrite);
308
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
318 aes_write(cbuf->space, 1, cbuf->pos, dec);
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
319 aes_decrypter_shutdown(dec);
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
320 aes_decrypter_close(dec);
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
321
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
322 UCX_TEST_ASSERT(slen == pbuf->pos, "wrong length after enc-dec");
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
323 UCX_TEST_ASSERT(!memcmp(strings[j], pbuf->space, slen), "wrong content after enc-dec");
470
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 308
diff changeset
324
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 308
diff changeset
325 data->pos = 0;
747
efbd59642577 ucx 3 update, basic dav commands work, most stuff is still broken
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 688
diff changeset
326 CxBuffer *enc2 = aes_encrypt_buffer(data, key);
efbd59642577 ucx 3 update, basic dav commands work, most stuff is still broken
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 688
diff changeset
327 CxBuffer *dec2 = aes_decrypt_buffer(enc2, key);
470
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 308
diff changeset
328
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 308
diff changeset
329 UCX_TEST_ASSERT(dec2->size == data->size, "dec2 has wrong size");
6bf798ad3aec adds encrypted password store
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 308
diff changeset
330 UCX_TEST_ASSERT(!memcmp(strings[j], dec2->space, dec2->size), "dec2 has wrong content");
308
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
331 }
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
332 }
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
333
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
334 UCX_TEST_END;
82275f589d8d adds test for crypto streams
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 305
diff changeset
335 }
487
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
336
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
337 static char *pws[] = {
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
338 "1234",
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
339 "abdefgh",
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
340 "AAAAAAAAAAAAAAAAA",
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
341 "5478FFJD:Loire923!$$123sd;fhgfdee432ASDAfd432"
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
342 };
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
343
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
344 static uint8_t salt[][16] = {
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
345 { 1, 10, 100, 222},
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
346 { 123, 12, 92, 14, 11, 0, 255, 190 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
347 { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
348 { 100, 240, 1, 190, 17, 0, 189, 50, 31, 13, 37, 25, 01, 0, 0, 7}
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
349 };
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
350 static int saltlen[] = { 4, 8, 12, 16 };
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
351
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
352 static uint8_t pwgenkeys[][32] = {
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
353
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
354 { 94, 67, 10, 1, 46, 198, 81, 162, 236, 220, 211, 196, 141, 127, 122, 39 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
355 { 94, 67, 10, 1, 46, 198, 81, 162, 236, 220, 211, 196, 141, 127, 122, 39, 96, 93, 105, 0, 131, 184, 21, 87, 165, 76, 247, 96, 74, 130, 90, 81 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
356 { 23, 185, 87, 96, 109, 149, 18, 87, 24, 246, 70, 196, 142, 67, 187, 156 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
357 { 23, 185, 87, 96, 109, 149, 18, 87, 24, 246, 70, 196, 142, 67, 187, 156, 131, 104, 108, 119, 175, 221, 108, 220, 75, 83, 91, 205, 157, 142, 132, 175 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
358 { 224, 80, 236, 51, 156, 38, 77, 11, 198, 205, 190, 210, 193, 40, 188, 215 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
359 { 224, 80, 236, 51, 156, 38, 77, 11, 198, 205, 190, 210, 193, 40, 188, 215, 247, 201, 231, 19, 243, 61, 20, 166, 155, 147, 234, 3, 148, 240, 255, 190 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
360 { 29, 209, 169, 101, 7, 80, 162, 82, 196, 20, 110, 36, 66, 41, 189, 16 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
361 { 29, 209, 169, 101, 7, 80, 162, 82, 196, 20, 110, 36, 66, 41, 189, 16, 65, 37, 90, 2, 226, 228, 201, 21, 87, 230, 115, 201, 87, 157, 53, 251 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
362 { 107, 129, 5, 22, 175, 18, 160, 61, 29, 249, 96, 108, 136, 1, 238, 168 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
363 { 107, 129, 5, 22, 175, 18, 160, 61, 29, 249, 96, 108, 136, 1, 238, 168, 32, 208, 199, 177, 44, 251, 145, 195, 189, 18, 119, 161, 167, 101, 248, 83 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
364 { 14, 193, 58, 165, 156, 202, 237, 35, 113, 184, 24, 180, 221, 81, 213, 62 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
365 { 14, 193, 58, 165, 156, 202, 237, 35, 113, 184, 24, 180, 221, 81, 213, 62, 211, 25, 211, 30, 47, 253, 168, 169, 84, 31, 162, 185, 75, 136, 22, 244 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
366 { 83, 193, 218, 177, 173, 5, 134, 61, 45, 14, 141, 225, 194, 114, 91, 221 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
367 { 83, 193, 218, 177, 173, 5, 134, 61, 45, 14, 141, 225, 194, 114, 91, 221, 61, 56, 69, 123, 1, 149, 247, 141, 71, 48, 55, 182, 237, 32, 20, 20 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
368 { 223, 221, 209, 7, 249, 39, 34, 180, 121, 44, 144, 153, 47, 188, 104, 33 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
369 { 223, 221, 209, 7, 249, 39, 34, 180, 121, 44, 144, 153, 47, 188, 104, 33, 29, 159, 51, 8, 200, 85, 137, 129, 97, 255, 26, 23, 147, 133, 11, 240 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
370 { 142, 13, 212, 33, 112, 149, 245, 39, 20, 237, 141, 46, 35, 253, 228, 43 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
371 { 142, 13, 212, 33, 112, 149, 245, 39, 20, 237, 141, 46, 35, 253, 228, 43, 219, 69, 181, 28, 235, 85, 202, 135, 6, 215, 130, 67, 235, 114, 91, 79 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
372 { 53, 10, 18, 131, 28, 151, 84, 93, 2, 102, 69, 224, 174, 140, 2, 168 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
373 { 53, 10, 18, 131, 28, 151, 84, 93, 2, 102, 69, 224, 174, 140, 2, 168, 213, 236, 43, 135, 148, 195, 134, 160, 143, 216, 109, 167, 150, 72, 162, 22 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
374 { 26, 199, 244, 1, 219, 53, 16, 109, 121, 230, 129, 204, 69, 120, 246, 83 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
375 { 26, 199, 244, 1, 219, 53, 16, 109, 121, 230, 129, 204, 69, 120, 246, 83, 93, 9, 117, 21, 49, 67, 56, 255, 147, 16, 18, 39, 245, 93, 20, 201 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
376 { 195, 217, 248, 6, 86, 212, 115, 132, 32, 81, 238, 97, 116, 173, 176, 250 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
377 { 195, 217, 248, 6, 86, 212, 115, 132, 32, 81, 238, 97, 116, 173, 176, 250, 207, 152, 10, 150, 113, 90, 246, 88, 41, 9, 195, 244, 70, 190, 165, 251 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
378 { 60, 114, 156, 195, 119, 103, 167, 179, 70, 3, 11, 189, 25, 27, 175, 30 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
379 { 60, 114, 156, 195, 119, 103, 167, 179, 70, 3, 11, 189, 25, 27, 175, 30, 115, 175, 250, 36, 181, 250, 22, 148, 210, 198, 36, 182, 207, 10, 150, 104 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
380 { 204, 63, 177, 165, 41, 0, 40, 99, 117, 9, 245, 59, 176, 66, 3, 234 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
381 { 204, 63, 177, 165, 41, 0, 40, 99, 117, 9, 245, 59, 176, 66, 3, 234, 106, 50, 241, 16, 254, 158, 60, 115, 221, 22, 141, 140, 220, 241, 69, 59 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
382 { 253, 68, 7, 137, 52, 78, 146, 207, 4, 68, 42, 89, 166, 74, 108, 34 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
383 { 253, 68, 7, 137, 52, 78, 146, 207, 4, 68, 42, 89, 166, 74, 108, 34, 183, 51, 183, 187, 192, 254, 20, 197, 159, 173, 10, 2, 137, 81, 148, 147 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
384 { 242, 67, 91, 24, 61, 250, 13, 44, 131, 236, 224, 118, 37, 250, 67, 160 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
385 { 242, 67, 91, 24, 61, 250, 13, 44, 131, 236, 224, 118, 37, 250, 67, 160, 57, 53, 134, 248, 210, 25, 218, 240, 124, 195, 151, 234, 220, 136, 193, 14 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
386 { 226, 55, 98, 79, 192, 117, 212, 68, 109, 46, 58, 233, 95, 180, 2, 154 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
387 { 226, 55, 98, 79, 192, 117, 212, 68, 109, 46, 58, 233, 95, 180, 2, 154, 135, 111, 74, 105, 94, 113, 77, 37, 133, 53, 72, 43, 15, 131, 69, 209 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
388 { 36, 177, 96, 156, 175, 123, 208, 63, 203, 224, 204, 179, 152, 35, 5, 115 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
389 { 36, 177, 96, 156, 175, 123, 208, 63, 203, 224, 204, 179, 152, 35, 5, 115, 142, 221, 213, 107, 223, 91, 99, 91, 126, 121, 22, 199, 195, 202, 123, 181 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
390 { 223, 189, 161, 102, 183, 210, 183, 174, 247, 101, 81, 10, 73, 169, 246, 255 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
391 { 223, 189, 161, 102, 183, 210, 183, 174, 247, 101, 81, 10, 73, 169, 246, 255, 248, 174, 81, 251, 70, 4, 221, 232, 147, 106, 138, 118, 156, 196, 58, 244 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
392 { 175, 105, 140, 110, 225, 120, 1, 72, 76, 149, 8, 203, 116, 79, 187, 131 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
393 { 175, 105, 140, 110, 225, 120, 1, 72, 76, 149, 8, 203, 116, 79, 187, 131, 218, 82, 5, 84, 22, 185, 236, 252, 165, 72, 154, 6, 50, 0, 89, 33 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
394 { 90, 125, 87, 16, 162, 186, 98, 211, 44, 165, 26, 118, 138, 83, 6, 121 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
395 { 90, 125, 87, 16, 162, 186, 98, 211, 44, 165, 26, 118, 138, 83, 6, 121, 66, 33, 63, 5, 235, 119, 12, 150, 13, 118, 198, 35, 176, 99, 252, 232 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
396 { 97, 17, 86, 48, 46, 241, 84, 19, 149, 72, 120, 235, 239, 7, 165, 117 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
397 { 97, 17, 86, 48, 46, 241, 84, 19, 149, 72, 120, 235, 239, 7, 165, 117, 226, 124, 56, 147, 68, 13, 49, 222, 211, 30, 121, 158, 74, 98, 244, 10 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
398 { 20, 216, 59, 111, 87, 145, 3, 117, 255, 156, 25, 154, 190, 118, 78, 20 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
399 { 20, 216, 59, 111, 87, 145, 3, 117, 255, 156, 25, 154, 190, 118, 78, 20, 248, 214, 78, 139, 61, 192, 140, 235, 59, 160, 40, 78, 54, 47, 25, 109 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
400 { 32, 229, 86, 178, 39, 205, 7, 101, 40, 38, 134, 141, 19, 69, 80, 243 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
401 { 32, 229, 86, 178, 39, 205, 7, 101, 40, 38, 134, 141, 19, 69, 80, 243, 28, 53, 160, 113, 203, 108, 57, 9, 231, 117, 86, 17, 206, 148, 110, 224 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
402 { 210, 190, 211, 92, 237, 193, 7, 64, 87, 132, 86, 141, 30, 125, 82, 106 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
403 { 210, 190, 211, 92, 237, 193, 7, 64, 87, 132, 86, 141, 30, 125, 82, 106, 25, 187, 172, 61, 235, 190, 17, 208, 203, 92, 238, 153, 58, 16, 49, 223 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
404 { 244, 127, 138, 189, 35, 167, 166, 55, 4, 191, 212, 31, 233, 227, 153, 170 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
405 { 244, 127, 138, 189, 35, 167, 166, 55, 4, 191, 212, 31, 233, 227, 153, 170, 40, 148, 206, 207, 252, 157, 92, 212, 241, 88, 224, 141, 179, 209, 252, 43 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
406 { 144, 204, 246, 93, 75, 176, 77, 125, 131, 249, 85, 13, 133, 132, 179, 13 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
407 { 144, 204, 246, 93, 75, 176, 77, 125, 131, 249, 85, 13, 133, 132, 179, 13, 49, 133, 237, 34, 95, 96, 223, 131, 7, 116, 177, 234, 58, 175, 154, 61 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
408 { 168, 143, 20, 221, 217, 4, 182, 225, 236, 110, 92, 32, 110, 49, 20, 94 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
409 { 168, 143, 20, 221, 217, 4, 182, 225, 236, 110, 92, 32, 110, 49, 20, 94, 184, 23, 40, 57, 120, 148, 146, 245, 154, 136, 43, 183, 113, 171, 180, 149 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
410 { 187, 226, 167, 37, 42, 163, 119, 0, 115, 104, 56, 58, 207, 206, 35, 0 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
411 { 187, 226, 167, 37, 42, 163, 119, 0, 115, 104, 56, 58, 207, 206, 35, 0, 93, 176, 200, 184, 33, 23, 15, 179, 21, 58, 210, 183, 59, 173, 205, 98 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
412 { 46, 112, 16, 101, 211, 3, 163, 33, 2, 36, 37, 139, 46, 0, 29, 198 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
413 { 46, 112, 16, 101, 211, 3, 163, 33, 2, 36, 37, 139, 46, 0, 29, 198, 128, 252, 22, 247, 105, 129, 84, 50, 252, 218, 215, 235, 200, 254, 34, 109 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
414 { 115, 186, 123, 201, 63, 21, 207, 229, 86, 0, 7, 254, 45, 115, 84, 8 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
415 { 115, 186, 123, 201, 63, 21, 207, 229, 86, 0, 7, 254, 45, 115, 84, 8, 39, 27, 113, 37, 108, 123, 230, 153, 209, 218, 180, 77, 66, 207, 239, 26 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
416 { 252, 208, 199, 95, 179, 33, 229, 155, 159, 226, 234, 213, 21, 83, 30, 206 },
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
417 { 252, 208, 199, 95, 179, 33, 229, 155, 159, 226, 234, 213, 21, 83, 30, 206, 174, 151, 174, 207, 58, 169, 148, 244, 37, 88, 44, 46, 72, 172, 15, 214 }
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
418 };
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
419
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
420
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
421 UCX_TEST(test_dav_pw2key) {
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
422
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
423
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
424 UCX_TEST_BEGIN;
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
425
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
426 for(int p=0;p<4;p++) {
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
427 for(int s=0;s<4;s++) {
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
428 DavKey *keys[4];
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
429 keys[0] = dav_pw2key(
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
430 pws[p],
515
2465dd550bb5 fixes signedness of salt in dav_pw2key()
Mike Becker <universe@uap-core.de>
parents: 488
diff changeset
431 salt[s],
487
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
432 saltlen[s],
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
433 DAV_PWFUNC_PBKDF2_SHA256,
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
434 DAV_KEY_AES128);
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
435 keys[1] = dav_pw2key(
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
436 pws[p],
515
2465dd550bb5 fixes signedness of salt in dav_pw2key()
Mike Becker <universe@uap-core.de>
parents: 488
diff changeset
437 salt[s],
487
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
438 saltlen[s],
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
439 DAV_PWFUNC_PBKDF2_SHA256,
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
440 DAV_KEY_AES256);
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
441 keys[2] = dav_pw2key(
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
442 pws[p],
515
2465dd550bb5 fixes signedness of salt in dav_pw2key()
Mike Becker <universe@uap-core.de>
parents: 488
diff changeset
443 salt[s],
487
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
444 saltlen[s],
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
445 DAV_PWFUNC_PBKDF2_SHA512,
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
446 DAV_KEY_AES128);
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
447 keys[3] = dav_pw2key(
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
448 pws[p],
515
2465dd550bb5 fixes signedness of salt in dav_pw2key()
Mike Becker <universe@uap-core.de>
parents: 488
diff changeset
449 salt[s],
487
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
450 saltlen[s],
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
451 DAV_PWFUNC_PBKDF2_SHA512,
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
452 DAV_KEY_AES256);
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
453
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
454 for(int i=0;i<4;i++) {
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
455 DavKey *key = keys[i];
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
456
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
457 int index = 16*p + 4*s + i;
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
458 int keylen = index % 2 == 0 ? 16 : 32;
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
459
688
d405d2ac78e6 replace openssl on windows with cng/bcrypt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 515
diff changeset
460 UCX_TEST_ASSERT(key, "no key");
487
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
461 UCX_TEST_ASSERT(keylen == key->length, "wrong key length");
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
462 UCX_TEST_ASSERT(!memcmp(key->data, pwgenkeys[index], keylen), "wrong key data");
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
463 }
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
464 }
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
465 }
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
466
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
467 UCX_TEST_END;
a2fc5b1cd476 adds test for dav_pw2key
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 478
diff changeset
468 }

mercurial