Skip to content

refactoring Algorithm definition components into separate encryption, kdf, and authentication algorithm suites#36

Merged
SalusaSecondus merged 4 commits intoaws:masterfrom
mattsb42-aws:algorithm-reorg
Jan 5, 2018
Merged

refactoring Algorithm definition components into separate encryption, kdf, and authentication algorithm suites#36
SalusaSecondus merged 4 commits intoaws:masterfrom
mattsb42-aws:algorithm-reorg

Conversation

@mattsb42-aws
Copy link
Member

This is an idea I've been playing with to try and make the algorithm suites more comprehensible and less error-prone.

Status Quo

Each algorithm suite is composed of a large number of individual values that together form the complete algorithm suite specification.

Problem

These algorithm suite definitions are hard to understand, hard to debug, and easy to mess up.

Solution

Algorithm suites are not conceptually a grouping of a large number of primitives. They are a grouping of a small number of groupings of related values. Each of these groupings define characteristics of the overall algorithm suite.

I have separated these out into three sub-suites:

  1. Encryption : contains only those values that control the encryption behavior
  2. KDF : contains only those values that control the key derivation behavior
  3. Authentication : contains only those values that control the authentication behavior

Each algorithm suite is then defined as a combination of these three sub-suites.

This lets us move from each algorithm suites having 13 distinct characteristics with no innately relations to:

  • Three distinct encryption suites
  • Two distinct KDF suites
  • Three distinct authentication suites

Each algorithm suite now has four important values: algorithm ID, encryption suite, KDF suite, and authentication suite.

For legacy compatibility, when each algorithm suite is constructed, it still sets all of its expected attributes using the attributes of the sub-suites.

@mattsb42-aws mattsb42-aws requested review from a team and SalusaSecondus December 6, 2017 01:21
Copy link
Contributor

@SalusaSecondus SalusaSecondus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I like this, but have a few minor notes.

  1. We aren't (and shouldn't) be changing the specification. Thus what you describe as the "legacy" interface really is the "official" interface and you're just making some (very nice) implementation changes to make life easier.
  2. Please ensure that it is clear that developers don't get to mix and match these sub-components as they see fit and only official AlgorithmSuites are supports and may be used.

self.authentication = authentication
self.allowed = allowed

# Encryption Suite Legacy Compatibility
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove "legacy" comment

self.auth_key_len = self.encryption.auth_key_length
self.auth_len = self.tag_len = self.encryption.auth_length

# KDF Suite Legacy Compatibility
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove "legacy" comment

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove "legacy" comment

@mattsb42-aws
Copy link
Member Author

Updated with requested docs/comments changes.

@SalusaSecondus SalusaSecondus merged commit f98382a into aws:master Jan 5, 2018
@mattsb42-aws mattsb42-aws deleted the algorithm-reorg branch January 5, 2018 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants