Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Unified Diff: SConstruct

Issue 3592008: AU: Verify delta payload signature and signed hash. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: move /tmp files to /var/run Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « .gitignore ('k') | action_processor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: SConstruct
diff --git a/SConstruct b/SConstruct
index 70803e761f94366ec192effc2cd8d29088fb3865..87c33f2850e433677ee81b01c694e19dd5f2e304 100644
--- a/SConstruct
+++ b/SConstruct
@@ -119,6 +119,44 @@ glib_marshal_builder = Builder(generator = GlibMarshalGenerator,
single_source = 1,
suffix = 'glibmarshal.c')
+# Public key generation
+def PublicKeyEmitter(target, source, env):
+ """ Inputs:
+ target: list of targets to compile to
+ source: list of sources to compile
+ env: the scons environment in which we are compiling
+ Outputs:
+ target: the list of targets we'll emit
+ source: the list of sources we'll compile"""
+ targets = []
+ for source_file in source:
+ output = str(source_file)
+ output = output[0:output.rfind('.pem')]
+ output += '.pub.pem'
+ targets.append(output)
+ return targets, source
+
+def PublicKeyGenerator(source, target, env, for_signature):
+ """ Inputs:
+ source: list of sources to process
+ target: list of targets to generate
+ env: scons environment in which we are working
+ for_signature: unused
+ Outputs: a list of commands to execute to generate the targets from
+ the sources."""
+ commands = []
+ for source_file in source:
+ output = str(source_file)
+ output = output[0:output.rfind('.pem')]
+ output += '.pub.pem'
+ cmd = '/usr/bin/openssl rsa -in %s -pubout -out %s' % (source_file, output)
+ commands.append(cmd)
+ return commands
+
+public_key_builder = Builder(generator = PublicKeyGenerator,
+ emitter = PublicKeyEmitter,
+ suffix = '.pub.pem')
+
env = Environment()
for key in Split('CC CXX AR RANLIB LD NM'):
value = os.environ.get(key)
@@ -174,6 +212,7 @@ env['CPPPATH'] = ['..']
env['BUILDERS']['ProtocolBuffer'] = proto_builder
env['BUILDERS']['DbusBindings'] = dbus_bindings_builder
env['BUILDERS']['GlibMarshal'] = glib_marshal_builder
+env['BUILDERS']['PublicKey'] = public_key_builder
# Fix issue with scons not passing pkg-config vars through the environment.
for key in Split('PKG_CONFIG_LIBDIR PKG_CONFIG_PATH'):
@@ -183,6 +222,7 @@ for key in Split('PKG_CONFIG_LIBDIR PKG_CONFIG_PATH'):
env.ParseConfig('pkg-config --cflags --libs '
'dbus-1 dbus-glib-1 gio-2.0 gio-unix-2.0 glib-2.0')
env.ProtocolBuffer('update_metadata.pb.cc', 'update_metadata.proto')
+env.PublicKey('unittest_key.pub.pem', 'unittest_key.pem')
env.DbusBindings('update_engine.dbusclient.h', 'update_engine.xml')
@@ -283,6 +323,8 @@ all_sources.extend(unittest_main)
all_sources.extend(client_main)
all_sources.extend(delta_generator_main)
for source in all_sources:
+ if source.endswith('_unittest.cc'):
+ env.Depends(source, 'unittest_key.pub.pem')
if source.endswith('.glibmarshal.c') or source.endswith('.pb.cc'):
continue
env.Depends(source, 'update_metadata.pb.cc')
« no previous file with comments | « .gitignore ('k') | action_processor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698