diff options
author | reyk <> | 2015-01-22 09:06:39 +0000 |
---|---|---|
committer | reyk <> | 2015-01-22 09:06:39 +0000 |
commit | ca23f8d50feee83817e664343b752ce0b985dfb5 (patch) | |
tree | 36f1b0fc5da8868b5097698833f099e006a10cb8 /src/lib/libcrypto/x509/x509_vfy.h | |
parent | 65761bc9c2faf702c095e77e75e6c713cb579cd8 (diff) | |
download | openbsd-ca23f8d50feee83817e664343b752ce0b985dfb5.tar.gz openbsd-ca23f8d50feee83817e664343b752ce0b985dfb5.tar.bz2 openbsd-ca23f8d50feee83817e664343b752ce0b985dfb5.zip |
Add X509_STORE_load_mem() to load certificates from a memory buffer
instead of disk. OpenSSL didn't provide a built-in API from loading
certificates in a chroot'ed process that doesn't have direct access to
the files. X509_STORE_load_mem() provides a new backend that will be
used by libssl and libtls to implement such privsep-friendly
functionality.
Adopted for LibreSSL based on older code from relayd (by pyr@ and myself)
With feedback and OK bluhm@
Diffstat (limited to 'src/lib/libcrypto/x509/x509_vfy.h')
-rw-r--r-- | src/lib/libcrypto/x509/x509_vfy.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/lib/libcrypto/x509/x509_vfy.h b/src/lib/libcrypto/x509/x509_vfy.h index 5b411ca678..500b520495 100644 --- a/src/lib/libcrypto/x509/x509_vfy.h +++ b/src/lib/libcrypto/x509/x509_vfy.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x509_vfy.h,v 1.13 2014/07/10 22:45:58 jsing Exp $ */ | 1 | /* $OpenBSD: x509_vfy.h,v 1.14 2015/01/22 09:06:39 reyk Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -286,6 +286,7 @@ void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth); | |||
286 | 286 | ||
287 | #define X509_L_FILE_LOAD 1 | 287 | #define X509_L_FILE_LOAD 1 |
288 | #define X509_L_ADD_DIR 2 | 288 | #define X509_L_ADD_DIR 2 |
289 | #define X509_L_MEM 3 | ||
289 | 290 | ||
290 | #define X509_LOOKUP_load_file(x,name,type) \ | 291 | #define X509_LOOKUP_load_file(x,name,type) \ |
291 | X509_LOOKUP_ctrl((x),X509_L_FILE_LOAD,(name),(long)(type),NULL) | 292 | X509_LOOKUP_ctrl((x),X509_L_FILE_LOAD,(name),(long)(type),NULL) |
@@ -293,6 +294,10 @@ void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth); | |||
293 | #define X509_LOOKUP_add_dir(x,name,type) \ | 294 | #define X509_LOOKUP_add_dir(x,name,type) \ |
294 | X509_LOOKUP_ctrl((x),X509_L_ADD_DIR,(name),(long)(type),NULL) | 295 | X509_LOOKUP_ctrl((x),X509_L_ADD_DIR,(name),(long)(type),NULL) |
295 | 296 | ||
297 | #define X509_LOOKUP_add_mem(x,iov,type) \ | ||
298 | X509_LOOKUP_ctrl((x),X509_L_MEM,(const char *)(iov),\ | ||
299 | (long)(type),NULL) | ||
300 | |||
296 | #define X509_V_OK 0 | 301 | #define X509_V_OK 0 |
297 | /* illegal error (for uninitialized values, to avoid X509_V_OK): 1 */ | 302 | /* illegal error (for uninitialized values, to avoid X509_V_OK): 1 */ |
298 | 303 | ||
@@ -436,6 +441,7 @@ X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m); | |||
436 | 441 | ||
437 | X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void); | 442 | X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void); |
438 | X509_LOOKUP_METHOD *X509_LOOKUP_file(void); | 443 | X509_LOOKUP_METHOD *X509_LOOKUP_file(void); |
444 | X509_LOOKUP_METHOD *X509_LOOKUP_mem(void); | ||
439 | 445 | ||
440 | int X509_STORE_add_cert(X509_STORE *ctx, X509 *x); | 446 | int X509_STORE_add_cert(X509_STORE *ctx, X509 *x); |
441 | int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x); | 447 | int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x); |
@@ -466,6 +472,7 @@ int X509_LOOKUP_shutdown(X509_LOOKUP *ctx); | |||
466 | 472 | ||
467 | int X509_STORE_load_locations (X509_STORE *ctx, | 473 | int X509_STORE_load_locations (X509_STORE *ctx, |
468 | const char *file, const char *dir); | 474 | const char *file, const char *dir); |
475 | int X509_STORE_load_mem(X509_STORE *ctx, void *buf, int len); | ||
469 | int X509_STORE_set_default_paths(X509_STORE *ctx); | 476 | int X509_STORE_set_default_paths(X509_STORE *ctx); |
470 | 477 | ||
471 | int X509_STORE_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | 478 | int X509_STORE_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, |