Codebase list openssl / 3c9e644
engine/e_capi.c: more formatting and styling fixes. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit 8f0e5888ea4c577c5a1f0d667786da6376099c86) Andy Polyakov 7 years ago
1 changed file(s) with 33 addition(s) and 33 deletion(s). Raw diff Collapse all Expand all
107107 static void capi_addlasterror(void);
108108 static void capi_adderror(DWORD err);
109109
110 static void CAPI_trace(CAPI_CTX * ctx, char *format, ...);
111
112 static int capi_list_providers(CAPI_CTX * ctx, BIO *out);
113 static int capi_list_containers(CAPI_CTX * ctx, BIO *out);
114 int capi_list_certs(CAPI_CTX * ctx, BIO *out, char *storename);
115 void capi_free_key(CAPI_KEY * key);
116
117 static PCCERT_CONTEXT capi_find_cert(CAPI_CTX * ctx, const char *id,
110 static void CAPI_trace(CAPI_CTX *ctx, char *format, ...);
111
112 static int capi_list_providers(CAPI_CTX *ctx, BIO *out);
113 static int capi_list_containers(CAPI_CTX *ctx, BIO *out);
114 int capi_list_certs(CAPI_CTX *ctx, BIO *out, char *storename);
115 void capi_free_key(CAPI_KEY *key);
116
117 static PCCERT_CONTEXT capi_find_cert(CAPI_CTX *ctx, const char *id,
118118 HCERTSTORE hstore);
119119
120 CAPI_KEY *capi_find_key(CAPI_CTX * ctx, const char *id);
120 CAPI_KEY *capi_find_key(CAPI_CTX *ctx, const char *id);
121121
122122 static EVP_PKEY *capi_load_privkey(ENGINE *eng, const char *key_id,
123123 UI_METHOD *ui_method, void *callback_data);
192192 };
193193
194194 static CAPI_CTX *capi_ctx_new(void);
195 static void capi_ctx_free(CAPI_CTX * ctx);
196 static int capi_ctx_set_provname(CAPI_CTX * ctx, LPSTR pname, DWORD type,
195 static void capi_ctx_free(CAPI_CTX *ctx);
196 static int capi_ctx_set_provname(CAPI_CTX *ctx, LPSTR pname, DWORD type,
197197 int check);
198 static int capi_ctx_set_provname_idx(CAPI_CTX * ctx, int idx);
198 static int capi_ctx_set_provname_idx(CAPI_CTX *ctx, int idx);
199199
200200 # define CAPI_CMD_LIST_CERTS ENGINE_CMD_BASE
201201 # define CAPI_CMD_LOOKUP_CERT (ENGINE_CMD_BASE + 1)
621621
622622 /* Given a CAPI_KEY get an EVP_PKEY structure */
623623
624 static EVP_PKEY *capi_get_pkey(ENGINE *eng, CAPI_KEY * key)
624 static EVP_PKEY *capi_get_pkey(ENGINE *eng, CAPI_KEY *key)
625625 {
626626 unsigned char *pubkey = NULL;
627627 DWORD len;
10491049 }
10501050 # endif
10511051
1052 static void capi_vtrace(CAPI_CTX * ctx, int level, char *format,
1052 static void capi_vtrace(CAPI_CTX *ctx, int level, char *format,
10531053 va_list argptr)
10541054 {
10551055 BIO *out;
10651065 BIO_free(out);
10661066 }
10671067
1068 static void CAPI_trace(CAPI_CTX * ctx, char *format, ...)
1068 static void CAPI_trace(CAPI_CTX *ctx, char *format, ...)
10691069 {
10701070 va_list args;
10711071 va_start(args, format);
11111111 return str;
11121112 }
11131113
1114 static int capi_get_provname(CAPI_CTX * ctx, LPSTR * pname, DWORD * ptype,
1114 static int capi_get_provname(CAPI_CTX *ctx, LPSTR *pname, DWORD *ptype,
11151115 DWORD idx)
11161116 {
11171117 DWORD len, err;
11531153 return 1;
11541154 }
11551155
1156 static int capi_list_providers(CAPI_CTX * ctx, BIO *out)
1156 static int capi_list_providers(CAPI_CTX *ctx, BIO *out)
11571157 {
11581158 DWORD idx, ptype;
11591159 int ret;
11721172 return 1;
11731173 }
11741174
1175 static int capi_list_containers(CAPI_CTX * ctx, BIO *out)
1175 static int capi_list_containers(CAPI_CTX *ctx, BIO *out)
11761176 {
11771177 int ret = 1;
11781178 HCRYPTPROV hprov;
12561256 return ret;
12571257 }
12581258
1259 static CRYPT_KEY_PROV_INFO *capi_get_prov_info(CAPI_CTX * ctx,
1259 static CRYPT_KEY_PROV_INFO *capi_get_prov_info(CAPI_CTX *ctx,
12601260 PCCERT_CONTEXT cert)
12611261 {
12621262 DWORD len;
12811281 return pinfo;
12821282 }
12831283
1284 static void capi_dump_prov_info(CAPI_CTX * ctx, BIO *out,
1285 CRYPT_KEY_PROV_INFO * pinfo)
1284 static void capi_dump_prov_info(CAPI_CTX *ctx, BIO *out,
1285 CRYPT_KEY_PROV_INFO *pinfo)
12861286 {
12871287 char *provname = NULL, *contname = NULL;
12881288 if (!pinfo) {
13041304 OPENSSL_free(contname);
13051305 }
13061306
1307 static char *capi_cert_get_fname(CAPI_CTX * ctx, PCCERT_CONTEXT cert)
1307 static char *capi_cert_get_fname(CAPI_CTX *ctx, PCCERT_CONTEXT cert)
13081308 {
13091309 LPWSTR wfname;
13101310 DWORD dlen;
13291329 return NULL;
13301330 }
13311331
1332 static void capi_dump_cert(CAPI_CTX * ctx, BIO *out, PCCERT_CONTEXT cert)
1332 static void capi_dump_cert(CAPI_CTX *ctx, BIO *out, PCCERT_CONTEXT cert)
13331333 {
13341334 X509 *x;
13351335 const unsigned char *p;
13711371 X509_free(x);
13721372 }
13731373
1374 static HCERTSTORE capi_open_store(CAPI_CTX * ctx, char *storename)
1374 static HCERTSTORE capi_open_store(CAPI_CTX *ctx, char *storename)
13751375 {
13761376 HCERTSTORE hstore;
13771377
13901390 return hstore;
13911391 }
13921392
1393 int capi_list_certs(CAPI_CTX * ctx, BIO *out, char *id)
1393 int capi_list_certs(CAPI_CTX *ctx, BIO *out, char *id)
13941394 {
13951395 char *storename;
13961396 int idx;
14281428 return ret;
14291429 }
14301430
1431 static PCCERT_CONTEXT capi_find_cert(CAPI_CTX * ctx, const char *id,
1431 static PCCERT_CONTEXT capi_find_cert(CAPI_CTX *ctx, const char *id,
14321432 HCERTSTORE hstore)
14331433 {
14341434 PCCERT_CONTEXT cert = NULL;
14591459 }
14601460 }
14611461
1462 static CAPI_KEY *capi_get_key(CAPI_CTX * ctx, const TCHAR *contname,
1462 static CAPI_KEY *capi_get_key(CAPI_CTX *ctx, const TCHAR *contname,
14631463 TCHAR *provname, DWORD ptype, DWORD keyspec)
14641464 {
14651465 DWORD dwFlags = 0;
15071507 return NULL;
15081508 }
15091509
1510 static CAPI_KEY *capi_get_cert_key(CAPI_CTX * ctx, PCCERT_CONTEXT cert)
1510 static CAPI_KEY *capi_get_cert_key(CAPI_CTX *ctx, PCCERT_CONTEXT cert)
15111511 {
15121512 CAPI_KEY *key = NULL;
15131513 CRYPT_KEY_PROV_INFO *pinfo = NULL;
15351535 return key;
15361536 }
15371537
1538 CAPI_KEY *capi_find_key(CAPI_CTX * ctx, const char *id)
1538 CAPI_KEY *capi_find_key(CAPI_CTX *ctx, const char *id)
15391539 {
15401540 PCCERT_CONTEXT cert;
15411541 HCERTSTORE hstore;
15791579 return key;
15801580 }
15811581
1582 void capi_free_key(CAPI_KEY * key)
1582 void capi_free_key(CAPI_KEY *key)
15831583 {
15841584 if (!key)
15851585 return;
16101610 return ctx;
16111611 }
16121612
1613 static void capi_ctx_free(CAPI_CTX * ctx)
1613 static void capi_ctx_free(CAPI_CTX *ctx)
16141614 {
16151615 CAPI_trace(ctx, "Calling capi_ctx_free with %lx\n", ctx);
16161616 if (!ctx)
16221622 OPENSSL_free(ctx);
16231623 }
16241624
1625 static int capi_ctx_set_provname(CAPI_CTX * ctx, LPSTR pname, DWORD type,
1625 static int capi_ctx_set_provname(CAPI_CTX *ctx, LPSTR pname, DWORD type,
16261626 int check)
16271627 {
16281628 LPSTR tmpcspname;
16611661 return 1;
16621662 }
16631663
1664 static int capi_ctx_set_provname_idx(CAPI_CTX * ctx, int idx)
1664 static int capi_ctx_set_provname_idx(CAPI_CTX *ctx, int idx)
16651665 {
16661666 LPSTR pname;
16671667 DWORD type;