summaryrefslogtreecommitdiff
path: root/test/regression/nx_secure_test/nx_secure_ecjpake_self_test.c
blob: 0338f8fd977c08d351b216faca1c1e69f5742a61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
/***************************************************************************/
/* Copyright (c) 2024 Microsoft Corporation                                */
/* Copyright (c) 2026 Eclipse ThreadX contributors                         */
/*                                                                         */
/* This program and the accompanying materials are made available under    */
/* the terms of the MIT License which is available at                      */
/* https://opensource.org/licenses/MIT.                                    */
/*                                                                         */
/* SPDX-License-Identifier: MIT                                            */
/***************************************************************************/


#include <stdio.h>
#include <time.h>
#include "nx_crypto_ecjpake.h"
#include "nx_crypto_ec.h"
#include "nx_crypto_sha2.h"
#include "tls_test_utility.h"
#ifndef NX_CRYPTO_STANDALONE_ENABLE
#include "nx_secure_tls.h"
#endif

#define LOOP 100

/* Declare a crypto method for ECJ-PAKE. */
NX_CRYPTO_METHOD crypto_method_ecjpake =
{
    NX_CRYPTO_KEY_EXCHANGE_ECJPAKE,           /* ECJ-PAKE placeholder                   */
    0,                                        /* Key size in bits                       */
    0,                                        /* IV size in bits                        */
    0,                                        /* ICV size in bits, not used.            */
    0,                                        /* Block size in bytes.                   */
    sizeof(NX_CRYPTO_ECJPAKE),                /* Metadata size in bytes                 */
    _nx_crypto_method_ecjpake_init,           /* Initialization routine.                */
    _nx_crypto_method_ecjpake_cleanup,        /* Cleanup routine, not used.             */
    _nx_crypto_method_ecjpake_operation,      /* Operation                              */
};

/* Define software SHA256 method. */
static NX_CRYPTO_METHOD crypto_method_sha256 =
{
    NX_CRYPTO_AUTHENTICATION_HMAC_SHA2_256,   /* SHA crypto algorithm                   */
    0,                                        /* Key size in bits                       */
    0,                                        /* IV size in bits                        */
    256,                                      /* ICV size in bits, not used.            */
    0,                                        /* Block size in bytes.                   */
    sizeof(NX_SHA256),                        /* Metadata size in bytes                 */
    NX_CRYPTO_NULL,                           /* SHA initialization routine.            */
    NX_CRYPTO_NULL,                           /* SHA cleanup routine, not used.         */
    _nx_crypto_method_sha256_operation,       /* SHA operation                          */
};

extern NX_CRYPTO_METHOD crypto_method_ec_secp192;
extern NX_CRYPTO_METHOD crypto_method_ec_secp224;
extern NX_CRYPTO_METHOD crypto_method_ec_secp256;
extern NX_CRYPTO_METHOD crypto_method_ec_secp384;
extern NX_CRYPTO_METHOD crypto_method_ec_secp521;

/* ECJPAKE context. */
static NX_CRYPTO_ECJPAKE ecjpake_ctx_client;
static NX_CRYPTO_ECJPAKE ecjpake_ctx_server;

/* SHA context. */
static NX_SHA256 sha256_ctx;


static UCHAR psk_data[32];


/* Output. */
static UCHAR client_hello[330];
static UCHAR server_hello[330];
static UCHAR client_ke[165];
static UCHAR server_ke[165];
static UCHAR client_pms[32];
static UCHAR server_pms[32];

static NX_CRYPTO_METHOD *ecc_methods[] =
{
    /* FIXME: Due to hard coded length, only secp256 is supported. */
#if 0
    &crypto_method_ec_secp192,
    &crypto_method_ec_secp224,
#endif
    &crypto_method_ec_secp256,
#if 0
    &crypto_method_ec_secp384,
    &crypto_method_ec_secp521
#endif
};


#ifndef NX_CRYPTO_STANDALONE_ENABLE
static TX_THREAD thread_0;
#endif

static VOID thread_0_entry(ULONG thread_input);

#ifdef CTEST
void test_application_define(void *first_unused_memory);
void test_application_define(void *first_unused_memory)
#else
void nx_secure_ecjpake_self_test_application_define(void *first_unused_memory)
#endif
{
#ifndef NX_CRYPTO_STANDALONE_ENABLE
    tx_thread_create(&thread_0, "Thread 0", thread_0_entry, 0,
                     first_unused_memory, 4096,
                     16, 16, 4, TX_AUTO_START);
#else
    thread_0_entry(0);
#endif
}

static VOID thread_0_entry(ULONG thread_input)
{
UINT i, j;
UINT psk_len;
UINT status;
NX_CRYPTO_METHOD *ecc_method;
NX_CRYPTO_EXTENDED_OUTPUT extended_output[2];
UCHAR buffer[32];

    /* Print out test information banner.  */
    printf("NetX Secure Test:   ECJPAKE Self Test..................................");

    srand(time(0));

    for (i = 0; i < LOOP; i++)
    {

        memset(client_pms, 0xFF, sizeof(client_pms));
        memset(server_pms, 0, sizeof(server_pms));

        memset(&ecjpake_ctx_client, 0, sizeof(ecjpake_ctx_client));
        memset(&ecjpake_ctx_server, 0, sizeof(ecjpake_ctx_server));

        psk_len = rand() & 0x1F;
        if (psk_len == 0)
        {
            psk_len = 1;
        }
        for (j = 0; j < psk_len; j++)
        {
            psk_data[j] = 1 + (rand() % 254);
        }

        ecc_method = ecc_methods[i % (sizeof(ecc_methods) / sizeof(NX_CRYPTO_METHOD *))];

        status = crypto_method_ecjpake.nx_crypto_init(&crypto_method_ecjpake,
                                                      psk_data,
                                                      (USHORT)(psk_len << 3),
                                                      NX_CRYPTO_NULL,
                                                      &ecjpake_ctx_client,
                                                      sizeof(ecjpake_ctx_client));
        EXPECT_EQ(NX_CRYPTO_SUCCESS, status);

        status = crypto_method_ecjpake.nx_crypto_operation(NX_CRYPTO_ECJPAKE_HASH_METHOD_SET,
                                                          NX_CRYPTO_NULL,
                                                          &crypto_method_ecjpake,
                                                          NX_CRYPTO_NULL,
                                                          (USHORT)(sizeof(NX_SHA256) << 3),
                                                          (UCHAR *)&crypto_method_sha256,
                                                          sizeof(NX_CRYPTO_METHOD),
                                                          NX_CRYPTO_NULL, NX_CRYPTO_NULL, 0,
                                                          &ecjpake_ctx_client,
                                                          sizeof(ecjpake_ctx_client),
                                                          NX_CRYPTO_NULL, NX_CRYPTO_NULL);
        EXPECT_EQ(NX_CRYPTO_SUCCESS, status);

        status = crypto_method_ecjpake.nx_crypto_operation(NX_CRYPTO_ECJPAKE_CURVE_SET,
                                                           NX_CRYPTO_NULL,
                                                           &crypto_method_ecjpake,
                                                           NX_CRYPTO_NULL, 0,
                                                           (UCHAR *)ecc_method,
                                                           sizeof(NX_CRYPTO_METHOD),
                                                           NX_CRYPTO_NULL, NX_CRYPTO_NULL, 0,
                                                           &ecjpake_ctx_client,
                                                           sizeof(ecjpake_ctx_client),
                                                           NX_CRYPTO_NULL, NX_CRYPTO_NULL);
        EXPECT_EQ(NX_CRYPTO_SUCCESS, status);

        status = crypto_method_ecjpake.nx_crypto_init(&crypto_method_ecjpake,
                                                      psk_data,
                                                      (USHORT)(psk_len << 3),
                                                      NX_CRYPTO_NULL,
                                                      &ecjpake_ctx_server,
                                                      sizeof(ecjpake_ctx_server));
        EXPECT_EQ(NX_CRYPTO_SUCCESS, status);

        status = crypto_method_ecjpake.nx_crypto_operation(NX_CRYPTO_ECJPAKE_HASH_METHOD_SET,
                                                           NX_CRYPTO_NULL,
                                                           &crypto_method_ecjpake,
                                                           NX_CRYPTO_NULL,
                                                           (USHORT)(sizeof(NX_SHA256) << 3),
                                                           (UCHAR *)&crypto_method_sha256,
                                                           sizeof(NX_CRYPTO_METHOD),
                                                           NX_CRYPTO_NULL, NX_CRYPTO_NULL, 0,
                                                           &ecjpake_ctx_server,
                                                           sizeof(ecjpake_ctx_server),
                                                           NX_CRYPTO_NULL, NX_CRYPTO_NULL);
        EXPECT_EQ(NX_CRYPTO_SUCCESS, status);

        status = crypto_method_ecjpake.nx_crypto_operation(NX_CRYPTO_ECJPAKE_CURVE_SET,
                                                           NX_CRYPTO_NULL,
                                                           &crypto_method_ecjpake,
                                                           NX_CRYPTO_NULL, 0,
                                                           (UCHAR *)ecc_method,
                                                           sizeof(NX_CRYPTO_METHOD),
                                                           NX_CRYPTO_NULL, NX_CRYPTO_NULL, 0,
                                                           &ecjpake_ctx_server,
                                                           sizeof(ecjpake_ctx_server),
                                                           NX_CRYPTO_NULL, NX_CRYPTO_NULL);
        EXPECT_EQ(NX_CRYPTO_SUCCESS, status);


        extended_output[0].nx_crypto_extended_output_data = client_hello;
        extended_output[0].nx_crypto_extended_output_length_in_byte = sizeof(client_hello);
        extended_output[0].nx_crypto_extended_output_actual_size = 0;
        status = crypto_method_ecjpake.nx_crypto_operation(NX_CRYPTO_ECJPAKE_CLIENT_HELLO_GENERATE,
                                                           NX_CRYPTO_NULL,
                                                           &crypto_method_ecjpake,
                                                           NX_CRYPTO_NULL, 0,
                                                           NX_CRYPTO_NULL, 0, NX_CRYPTO_NULL,
                                                           (UCHAR *)&extended_output[0],
                                                           sizeof(extended_output[0]),
                                                           &ecjpake_ctx_client,
                                                           sizeof(ecjpake_ctx_client),
                                                           NX_CRYPTO_NULL, NX_CRYPTO_NULL);
        EXPECT_EQ(NX_CRYPTO_SUCCESS, status);

        extended_output[1].nx_crypto_extended_output_data = server_hello;
        extended_output[1].nx_crypto_extended_output_length_in_byte = sizeof(server_hello);
        extended_output[1].nx_crypto_extended_output_actual_size = 0;
        status = crypto_method_ecjpake.nx_crypto_operation(NX_CRYPTO_ECJPAKE_SERVER_HELLO_GENERATE,
                                                           NX_CRYPTO_NULL,
                                                           &crypto_method_ecjpake,
                                                           NX_CRYPTO_NULL, 0,
                                                           NX_CRYPTO_NULL, 0, NX_CRYPTO_NULL,
                                                           (UCHAR *)&extended_output[1],
                                                           sizeof(extended_output[1]),
                                                           &ecjpake_ctx_server,
                                                           sizeof(ecjpake_ctx_server),
                                                           NX_CRYPTO_NULL, NX_CRYPTO_NULL);
        EXPECT_EQ(NX_CRYPTO_SUCCESS, status);


        status = crypto_method_ecjpake.nx_crypto_operation(NX_CRYPTO_ECJPAKE_SERVER_HELLO_PROCESS,
                                                           NX_CRYPTO_NULL,
                                                           &crypto_method_ecjpake,
                                                           NX_CRYPTO_NULL, 0,
                                                           server_hello,
                                                           extended_output[1].nx_crypto_extended_output_actual_size,
                                                           NX_CRYPTO_NULL, NX_CRYPTO_NULL, 0,
                                                           &ecjpake_ctx_client,
                                                           sizeof(ecjpake_ctx_client),
                                                           NX_CRYPTO_NULL, NX_CRYPTO_NULL);
        EXPECT_EQ(NX_CRYPTO_SUCCESS, status);

        status = crypto_method_ecjpake.nx_crypto_operation(NX_CRYPTO_ECJPAKE_CLIENT_HELLO_PROCESS,
                                                           NX_CRYPTO_NULL,
                                                           &crypto_method_ecjpake,
                                                           NX_CRYPTO_NULL, 0,
                                                           client_hello,
                                                           extended_output[0].nx_crypto_extended_output_actual_size,
                                                           NX_CRYPTO_NULL, NX_CRYPTO_NULL, 0,
                                                           &ecjpake_ctx_server,
                                                           sizeof(ecjpake_ctx_server),
                                                           NX_CRYPTO_NULL, NX_CRYPTO_NULL);
        EXPECT_EQ(NX_CRYPTO_SUCCESS, status);


        extended_output[0].nx_crypto_extended_output_data = client_ke;
        extended_output[0].nx_crypto_extended_output_length_in_byte = sizeof(client_ke);
        extended_output[0].nx_crypto_extended_output_actual_size = 0;
        status = crypto_method_ecjpake.nx_crypto_operation(NX_CRYPTO_ECJPAKE_CLIENT_KEY_EXCHANGE_GENERATE,
                                                           NX_CRYPTO_NULL,
                                                           &crypto_method_ecjpake,
                                                           NX_CRYPTO_NULL, 0,
                                                           NX_CRYPTO_NULL, 0, NX_CRYPTO_NULL,
                                                           (UCHAR *)&extended_output[0],
                                                           sizeof(extended_output[0]),
                                                           &ecjpake_ctx_client,
                                                           sizeof(ecjpake_ctx_client),
                                                           NX_CRYPTO_NULL, NX_CRYPTO_NULL);
        EXPECT_EQ(NX_CRYPTO_SUCCESS, status);

        extended_output[1].nx_crypto_extended_output_data = server_ke;
        extended_output[1].nx_crypto_extended_output_length_in_byte = sizeof(server_ke);
        extended_output[1].nx_crypto_extended_output_actual_size = 0;
        status = crypto_method_ecjpake.nx_crypto_operation(NX_CRYPTO_ECJPAKE_SERVER_KEY_EXCHANGE_GENERATE,
                                                           NX_CRYPTO_NULL,
                                                           &crypto_method_ecjpake,
                                                           NX_CRYPTO_NULL, 0,
                                                           NX_CRYPTO_NULL, 0, NX_CRYPTO_NULL,
                                                           (UCHAR *)&extended_output[1],
                                                           sizeof(extended_output[1]),
                                                           &ecjpake_ctx_server,
                                                           sizeof(ecjpake_ctx_server),
                                                           NX_CRYPTO_NULL, NX_CRYPTO_NULL);
        EXPECT_EQ(NX_CRYPTO_SUCCESS, status);


        status = crypto_method_ecjpake.nx_crypto_operation(NX_CRYPTO_ECJPAKE_SERVER_KEY_EXCHANGE_PROCESS,
                                                           NX_CRYPTO_NULL,
                                                           &crypto_method_ecjpake,
                                                           NX_CRYPTO_NULL, 0,
                                                           server_ke,
                                                           extended_output[1].nx_crypto_extended_output_actual_size,
                                                           NX_CRYPTO_NULL,
                                                           client_pms,
                                                           sizeof(client_pms),
                                                           &ecjpake_ctx_client,
                                                           sizeof(ecjpake_ctx_client),
                                                           NX_CRYPTO_NULL, NX_CRYPTO_NULL);
        EXPECT_EQ(NX_CRYPTO_SUCCESS, status);

        status = crypto_method_ecjpake.nx_crypto_operation(NX_CRYPTO_ECJPAKE_CLIENT_KEY_EXCHANGE_PROCESS,
                                                           NX_CRYPTO_NULL,
                                                           &crypto_method_ecjpake,
                                                           NX_CRYPTO_NULL, 0,
                                                           client_ke,
                                                           extended_output[0].nx_crypto_extended_output_actual_size,
                                                           NX_CRYPTO_NULL,
                                                           server_pms,
                                                           sizeof(server_pms),
                                                           &ecjpake_ctx_server,
                                                           sizeof(ecjpake_ctx_server),
                                                           NX_CRYPTO_NULL, NX_CRYPTO_NULL);
        EXPECT_EQ(NX_CRYPTO_SUCCESS, status);
        EXPECT_EQ(0, memcmp(client_pms, server_pms, sizeof(server_pms)));

    }

    /* PSK length is zero. */
    status = _nx_crypto_method_ecjpake_init(NX_CRYPTO_NULL, NX_CRYPTO_NULL, 0, NX_CRYPTO_NULL, NX_CRYPTO_NULL, 0);
    EXPECT_EQ(NX_CRYPTO_NOT_SUCCESSFUL, status);

    /* NULL method pointer. */
    status = _nx_crypto_method_ecjpake_init(NX_CRYPTO_NULL, NX_CRYPTO_NULL, 1, NX_CRYPTO_NULL, NX_CRYPTO_NULL, 0);
    EXPECT_EQ(NX_CRYPTO_PTR_ERROR, status);

    /* NULL key pointer. */
    status = _nx_crypto_method_ecjpake_init(&crypto_method_ecjpake, NX_CRYPTO_NULL, 1, NX_CRYPTO_NULL, NX_CRYPTO_NULL, 0);
    EXPECT_EQ(NX_CRYPTO_PTR_ERROR, status);

    /* NULL metadata pointer. */
    status = _nx_crypto_method_ecjpake_init(&crypto_method_ecjpake, (VOID *)0x04, 1, NX_CRYPTO_NULL, NX_CRYPTO_NULL, 0);
    EXPECT_EQ(NX_CRYPTO_PTR_ERROR, status);

    /* Metadata address is not 4-byte aligned. */
    status = _nx_crypto_method_ecjpake_init(&crypto_method_ecjpake, (VOID *)0x04, 1, NX_CRYPTO_NULL, (VOID *)0x03, 0);
    EXPECT_EQ(NX_CRYPTO_PTR_ERROR, status);

    /* Metadata size is not enough. */
    status = _nx_crypto_method_ecjpake_init(&crypto_method_ecjpake, (VOID *)0x04, 1, NX_CRYPTO_NULL, (VOID *)0x04, 0);
    EXPECT_EQ(NX_CRYPTO_PTR_ERROR, status);

    /* An NULL character is in the psk key. */
    buffer[0] = 0;
    status = _nx_crypto_method_ecjpake_init(&crypto_method_ecjpake, buffer, 32, NX_CRYPTO_NULL, &ecjpake_ctx_server, sizeof(ecjpake_ctx_server));
    EXPECT_EQ(NX_CRYPTO_NOT_SUCCESSFUL, status);

    /* Invoke crypto_method_cleanup. */
    status = _nx_crypto_method_ecjpake_cleanup(&ecjpake_ctx_server);
    EXPECT_EQ(NX_CRYPTO_SUCCESS, status);

    /* NULL metadata pointer. */
    status = _nx_crypto_method_ecjpake_cleanup(NX_CRYPTO_NULL);
    EXPECT_EQ(NX_CRYPTO_SUCCESS, status);

    /* NULL method pointer. */
    status = _nx_crypto_method_ecjpake_operation(0, NX_CRYPTO_NULL,
                                                 NX_CRYPTO_NULL, /* method */
                                                 NX_CRYPTO_NULL, 0, /* key */
                                                 NX_CRYPTO_NULL, 0, /* input */
                                                 NX_CRYPTO_NULL, /* iv */
                                                 NX_CRYPTO_NULL, 0, /* output */
                                                 NX_CRYPTO_NULL, 0, /* crypto metadata */
                                                 NX_CRYPTO_NULL, NX_CRYPTO_NULL);
    EXPECT_EQ(NX_CRYPTO_PTR_ERROR, status);

    /* NULL metadata pointer. */
    status = _nx_crypto_method_ecjpake_operation(0, NX_CRYPTO_NULL,
                                                 &crypto_method_ecjpake, /* method */
                                                 NX_CRYPTO_NULL, 0, /* key */
                                                 NX_CRYPTO_NULL, 0, /* input */
                                                 NX_CRYPTO_NULL, /* iv */
                                                 NX_CRYPTO_NULL, 0, /* output */
                                                 NX_CRYPTO_NULL, 0, /* crypto metadata */
                                                 NX_CRYPTO_NULL, NX_CRYPTO_NULL);
    EXPECT_EQ(NX_CRYPTO_PTR_ERROR, status);

    /* Metadata address is not 4-byte aligned. */
    status = _nx_crypto_method_ecjpake_operation(0, NX_CRYPTO_NULL,
                                                 &crypto_method_ecjpake, /* method */
                                                 NX_CRYPTO_NULL, 0, /* key */
                                                 NX_CRYPTO_NULL, 0, /* input */
                                                 NX_CRYPTO_NULL, /* iv */
                                                 NX_CRYPTO_NULL, 0, /* output */
                                                 (VOID *)0x03, 0, /* crypto metadata */
                                                 NX_CRYPTO_NULL, NX_CRYPTO_NULL);
    EXPECT_EQ(NX_CRYPTO_PTR_ERROR, status);

    /* Metadata size is not enough. */
    status = _nx_crypto_method_ecjpake_operation(0, NX_CRYPTO_NULL,
                                                 &crypto_method_ecjpake, /* method */
                                                 NX_CRYPTO_NULL, 0, /* key */
                                                 NX_CRYPTO_NULL, 0, /* input */
                                                 NX_CRYPTO_NULL, /* iv */
                                                 NX_CRYPTO_NULL, 0, /* output */
                                                 (VOID *)0x04, 0, /* crypto metadata */
                                                 NX_CRYPTO_NULL, NX_CRYPTO_NULL);
    EXPECT_EQ(NX_CRYPTO_PTR_ERROR, status);

    /* Invalid op parameter. */
    status = _nx_crypto_method_ecjpake_operation(0, NX_CRYPTO_NULL,
                                                 &crypto_method_ecjpake, /* method */
                                                 NX_CRYPTO_NULL, 0, /* key */
                                                 NX_CRYPTO_NULL, 0, /* input */
                                                 NX_CRYPTO_NULL, /* iv */
                                                 NX_CRYPTO_NULL, 0, /* output */
                                                 &ecjpake_ctx_server, sizeof(ecjpake_ctx_server), /* crypto metadata */
                                                 NX_CRYPTO_NULL, NX_CRYPTO_NULL);
    EXPECT_EQ(NX_CRYPTO_NOT_SUCCESSFUL, status);

    ecjpake_ctx_server.nx_crypto_ecjpake_curve = (NX_CRYPTO_EC *)&_nx_crypto_ec_secp192r1;
    status = _nx_crypto_method_ecjpake_operation(NX_CRYPTO_ECJPAKE_HASH_METHOD_SET, NX_CRYPTO_NULL,
                                                 &crypto_method_ecjpake, /* method */
                                                 NX_CRYPTO_NULL, 0, /* key */
                                                 NX_CRYPTO_NULL, 0, /* input */
                                                 NX_CRYPTO_NULL, /* iv */
                                                 NX_CRYPTO_NULL, 0, /* output */
                                                 &ecjpake_ctx_server, sizeof(ecjpake_ctx_server), /* crypto metadata */
                                                 NX_CRYPTO_NULL, NX_CRYPTO_NULL);
    EXPECT_EQ(NX_CRYPTO_SUCCESS, status);

    printf("SUCCESS!\n");
    test_control_return(0);
}