forked from corretto/amazon-corretto-crypto-provider
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add more debug logic * Apply suggestions from code review Co-authored-by: Alex Chew <alex-chew@users.noreply.github.com> Co-authored-by: Alex Chew <alex-chew@users.noreply.github.com>
- Loading branch information
1 parent
a72c6de
commit 23d692f
Showing
9 changed files
with
124 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package com.amazon.corretto.crypto.provider; | ||
|
||
import java.util.EnumSet; | ||
|
||
/** | ||
* Indicates whether a given debug mode is enabled for ACCP. None of these modes | ||
* may compromise the security of ACCP but they are permitted to have | ||
* significant performance costs. | ||
* | ||
* These are used by passing them by name (case-insensitive) to the | ||
* {@code com.amazon.corretto.crypto.provider.debug} system property. Example: | ||
* {@code -Dcom.amazon.corretto.crypto.provider.debug=FreeTrace}. | ||
* | ||
* Alternatively you can enable all debug flags with the magic value of "ALL". | ||
*/ | ||
enum DebugFlag { | ||
/** Trace when native values are created and freed. */ | ||
FREETRACE, | ||
/** | ||
* Increases the verbosity of logs. | ||
* May still need to be combined with increasing the log level of your configured logger. | ||
*/ | ||
VERBOSELOGS; | ||
|
||
private static final EnumSet<DebugFlag> ENABLED_FLAGS = EnumSet.noneOf(DebugFlag.class); | ||
|
||
static { | ||
Utils.optionsFromProperty(DebugFlag.class, ENABLED_FLAGS, "debug"); | ||
} | ||
|
||
static boolean isEnabled(final DebugFlag flag) { | ||
return ENABLED_FLAGS.contains(flag); | ||
} | ||
|
||
boolean isEnabled() { | ||
return isEnabled(this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters