summaryrefslogtreecommitdiff
path: root/tools/docs/crypto/crypto_docs.py
diff options
context:
space:
mode:
authorAdam Vartanian <flooey@google.com>2017-03-16 14:26:08 +0000
committerAdam Vartanian <flooey@google.com>2017-03-16 14:26:08 +0000
commitbefc86a711b876ed6523fbe453dfa7a9adb345af (patch)
treedd1177808bde0e31927055b8b17331f3a1cdfc90 /tools/docs/crypto/crypto_docs.py
parent4980cf459974e7595ae13be09bd4801ffef694f1 (diff)
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
Diffstat (limited to 'tools/docs/crypto/crypto_docs.py')
-rw-r--r--tools/docs/crypto/crypto_docs.py31
1 files changed, 31 insertions, 0 deletions
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