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
|
/* t-getfunctionlist.c - Regression test.
* Copyright (C) 2006 g10 Code GmbH
*
* This file is part of Scute.
*
* Scute is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* Scute is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, see <https://gnu.org/licenses/>.
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include <stdio.h>
#include <stdbool.h>
#include "t-support.h"
bool mismatch = false;
CK_FUNCTION_LIST_PTR fl;
#define DO_ONE(fnc) printf (#fnc ": %p %c= %p \n", fnc, \
fl->fnc == fnc ? '=' : (mismatch = true, '!'), fl->fnc)
int
main (int argc, char *argv[])
{
CK_RV err;
(void) argc;
(void) argv;
/* This is the only function that can be called without
initialization. */
err = C_GetFunctionList (&fl);
fail_if_err (err);
/* Check for each function if the member in the function list is
identical to the exported symbol. */
DO_ONE (C_CancelFunction);
DO_ONE (C_CloseAllSessions);
DO_ONE (C_CloseSession);
DO_ONE (C_CopyObject);
DO_ONE (C_CreateObject);
DO_ONE (C_Decrypt);
DO_ONE (C_DecryptDigestUpdate);
DO_ONE (C_DecryptFinal);
DO_ONE (C_DecryptInit);
DO_ONE (C_DecryptUpdate);
DO_ONE (C_DecryptVerifyUpdate);
DO_ONE (C_DeriveKey);
DO_ONE (C_DestroyObject);
DO_ONE (C_Digest);
DO_ONE (C_DigestEncryptUpdate);
DO_ONE (C_DigestFinal);
DO_ONE (C_DigestInit);
DO_ONE (C_DigestKey);
DO_ONE (C_DigestUpdate);
DO_ONE (C_Encrypt);
DO_ONE (C_EncryptFinal);
DO_ONE (C_EncryptInit);
DO_ONE (C_EncryptUpdate);
DO_ONE (C_Finalize);
DO_ONE (C_FindObjects);
DO_ONE (C_FindObjectsFinal);
DO_ONE (C_FindObjectsInit);
DO_ONE (C_GenerateKey);
DO_ONE (C_GenerateKeyPair);
DO_ONE (C_GenerateRandom);
DO_ONE (C_GetAttributeValue);
DO_ONE (C_GetFunctionList);
DO_ONE (C_GetFunctionStatus);
DO_ONE (C_GetInfo);
DO_ONE (C_GetMechanismInfo);
DO_ONE (C_GetMechanismList);
DO_ONE (C_GetObjectSize);
DO_ONE (C_GetOperationState);
DO_ONE (C_GetSessionInfo);
DO_ONE (C_GetSlotInfo);
DO_ONE (C_GetSlotList);
DO_ONE (C_GetTokenInfo);
DO_ONE (C_InitPIN);
DO_ONE (C_InitToken);
DO_ONE (C_Initialize);
DO_ONE (C_Login);
DO_ONE (C_Logout);
DO_ONE (C_OpenSession);
DO_ONE (C_SeedRandom);
DO_ONE (C_SetAttributeValue);
DO_ONE (C_SetOperationState);
DO_ONE (C_SetPIN);
DO_ONE (C_Sign);
DO_ONE (C_SignEncryptUpdate);
DO_ONE (C_SignFinal);
DO_ONE (C_SignInit);
DO_ONE (C_SignRecover);
DO_ONE (C_SignRecoverInit);
DO_ONE (C_SignUpdate);
DO_ONE (C_UnwrapKey);
DO_ONE (C_Verify);
DO_ONE (C_VerifyFinal);
DO_ONE (C_VerifyInit);
DO_ONE (C_VerifyRecover);
DO_ONE (C_VerifyRecoverInit);
DO_ONE (C_VerifyUpdate);
DO_ONE (C_WaitForSlotEvent);
DO_ONE (C_WrapKey);
if (mismatch)
fail ("Some members of the function list do not match symbol value");
return 0;
}
|