From befc86a711b876ed6523fbe453dfa7a9adb345af Mon Sep 17 00:00:00 2001 From: Adam Vartanian Date: Thu, 16 Mar 2017 14:26:08 +0000 Subject: Add special table formatting for Cipher. Extracts a new file for JSON loading and cleans up a couple style issues. Updates the support for GCM to 10+, it was available at least in that version. Bug: 35793879 Test: Manual inspection of output Change-Id: I84f74fd14506cb36e0744a77c0223f5e3b86ca1b --- tools/docs/crypto/crypto_docs.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tools/docs/crypto/crypto_docs.py (limited to 'tools/docs/crypto/crypto_docs.py') diff --git a/tools/docs/crypto/crypto_docs.py b/tools/docs/crypto/crypto_docs.py new file mode 100644 index 0000000000..d1f220dc87 --- /dev/null +++ b/tools/docs/crypto/crypto_docs.py @@ -0,0 +1,31 @@ +# Copyright (C) 2017 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +'''Utility functions for crypto doc updating tools.''' + +import json + + +def load_json(filename): + '''Returns an object containing the JSON data from the provided file.''' + f = open(filename) + # JSON doesn't allow comments, but we have some header docs in our file, + # so strip comments out before parsing + stripped_contents = '' + for line in f: + if not line.strip().startswith('#'): + stripped_contents += line + data = json.loads(stripped_contents) + f.close() + return data -- cgit v1.2.3