Skip to content

Commit

Permalink
Merge pull request grpc#665 from nicolasnoble/ssl-prefix
Browse files Browse the repository at this point in the history
Defining an installation prefix for grpc's root certs at compilation time.
  • Loading branch information
jboeuf committed Feb 20, 2015
2 parents 3c472d2 + 7274382 commit cc07b2d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ HOST_LD = $(LD)
HOST_LDXX = $(LDXX)

CPPFLAGS += $(CPPFLAGS_$(CONFIG))
DEFINES += $(DEFINES_$(CONFIG))
DEFINES += $(DEFINES_$(CONFIG)) INSTALL_PREFIX=\"$(prefix)\"
LDFLAGS += $(LDFLAGS_$(CONFIG))

CFLAGS += -std=c89 -pedantic
Expand Down
7 changes: 7 additions & 0 deletions src/core/security/security_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@
"AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-" \
"SHA256:AES256-SHA256"

#ifndef INSTALL_PREFIX
static const char *installed_roots_path = "/etc/grpc/roots.pem";
#else
static const char *installed_roots_path = INSTALL_PREFIX "/etc/grpc/roots.pem";
#endif

/* -- Common methods. -- */

grpc_security_status grpc_security_context_create_handshaker(
Expand Down Expand Up @@ -404,6 +410,7 @@ static void init_default_pem_root_certs(void) {
default_pem_root_certs = gpr_load_file(default_root_certs_path, NULL);
gpr_free(default_root_certs_path);
}
(void) installed_roots_path;
}

size_t grpc_get_default_ssl_roots(const unsigned char **pem_root_certs) {
Expand Down
2 changes: 1 addition & 1 deletion templates/Makefile.template
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ HOST_LD = $(LD)
HOST_LDXX = $(LDXX)

CPPFLAGS += $(CPPFLAGS_$(CONFIG))
DEFINES += $(DEFINES_$(CONFIG))
DEFINES += $(DEFINES_$(CONFIG)) INSTALL_PREFIX=\"$(prefix)\"
LDFLAGS += $(LDFLAGS_$(CONFIG))

CFLAGS += -std=c89 -pedantic
Expand Down

0 comments on commit cc07b2d

Please sign in to comment.