aws-samples / aws-cloudhsm-pkcs11-examples
Conditional Complexity

The distribution of complexity of units (measured with McCabe index).

Intro
  • Conditional complexity (also called cyclomatic complexity) is a term used to measure the complexity of software. The term refers to the number of possible paths through a program function. A higher value ofter means higher maintenance and testing costs (infosecinstitute.com).
  • Conditional complexity is calculated by counting all conditions in the program that can affect the execution path (e.g. if statement, loops, switches, and/or operators, try and catch blocks...).
  • Conditional complexity is measured at the unit level (methods, functions...).
  • Units are classified in four categories based on the measured McCabe index: 1-5 (simple units), 6-10 (medium complex units), 11-25 (complex units), 26+ (very complex units).
Learn more...
Conditional Complexity Overall
  • There are 118 units with 3,932 lines of code in units (57.5% of code).
    • 0 very complex units (0 lines of code)
    • 2 complex units (269 lines of code)
    • 17 medium complex units (1,244 lines of code)
    • 20 simple units (662 lines of code)
    • 79 very simple units (1,757 lines of code)
0% | 6% | 31% | 16% | 44%
Legend:
51+
26-50
11-25
6-10
1-5
Alternative Visuals
Conditional Complexity per Extension
51+
26-50
11-25
6-10
1-5
c0% | 6% | 31% | 16% | 44%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
src/tools0% | 46% | 16% | 18% | 19%
src/common0% | 38% | 0% | 24% | 37%
src/encrypt0% | 0% | 77% | 4% | 18%
src/wrapping0% | 0% | 36% | 9% | 54%
src/derivation0% | 0% | 36% | 11% | 52%
src/attributes0% | 0% | 51% | 37% | 11%
src/find_objects0% | 0% | 21% | 37% | 40%
src/digest0% | 0% | 0% | 58% | 41%
src/mechanism_info0% | 0% | 0% | 100% | 0%
src/generate0% | 0% | 0% | 25% | 74%
src/sign0% | 0% | 0% | 6% | 93%
src/destroy0% | 0% | 0% | 55% | 44%
src/generate_random0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
int main()
in src/tools/wrap_with_imported_rsa_key.c
140 27 2
int gopt()
in src/common/gopt.c
129 27 2
CK_RV aes_cbc_multipart_sample()
in src/encrypt/aes_cbc.c
106 16 1
CK_RV attributes_output_all()
in src/attributes/attributes.c
88 16 3
CK_RV aes_ctr_sample()
in src/encrypt/aes_ctr.c
87 14 1
CK_RV aes_gcm_sample()
in src/encrypt/aes_gcm.c
112 14 1
CK_RV aes_gcm_sample()
in src/derivation/ecdh.c
106 13 2
CK_RV aes_gcm_wrapping()
in src/wrapping/aes_gcm_wrapping.c
72 13 1
CK_RV rsa_oaep_wrap()
in src/wrapping/rsa_wrapping.c
62 12 1
CK_RV rsa_aes_wrap()
in src/wrapping/rsa_wrapping.c
62 12 1
CK_RV des_ecb_sample()
in src/encrypt/des_ecb.c
73 12 1
CK_RV aes_ecb_sample()
in src/encrypt/aes_ecb.c
73 12 1
CK_RV aes_cbc_sample()
in src/encrypt/aes_cbc.c
75 12 1
CK_RV aes_wrap_unwrap_with_trusted()
in src/wrapping/unwrap_with_template.c
60 11 2
CK_RV aes_pkcs5_padding_wrapping()
in src/wrapping/aes_wrapping.c
59 11 1
CK_RV aes_zero_padding_wrapping()
in src/wrapping/aes_zero_padding_wrapping.c
59 11 1
CK_RV aes_no_padding_wrapping()
in src/wrapping/aes_no_padding_wrapping.c
58 11 1
static int get_import_args()
in src/tools/import_pub_key.c
49 11 3
CK_RV find_by_attr()
in src/find_objects/find_objects.c
43 11 5
CK_RV wrap_key_with_template()
in src/wrapping/wrap_with_template.c
42 8 3