|
1 | 1 | private import experimental.quantum.Language |
2 | 2 | private import experimental.quantum.OpenSSL.CtxFlow |
| 3 | +private import experimental.quantum.OpenSSL.KeyFlow |
3 | 4 | private import experimental.quantum.OpenSSL.AlgorithmValueConsumers.OpenSSLAlgorithmValueConsumers |
4 | 5 | // Importing these intializers here to ensure the are part of any model that is |
5 | 6 | // using OpenSSLOperationBase. This futher ensures that initializers are tied to opeartions |
@@ -63,13 +64,29 @@ abstract class EvpAlgorithmInitializer extends EvpInitializer { |
63 | 64 | } |
64 | 65 |
|
65 | 66 | abstract class EvpKeyInitializer extends EvpInitializer { |
66 | | - //, EvpAlgorithmInitializer { |
67 | 67 | abstract Expr getKeyArg(); |
68 | | - // /** |
69 | | - // * Any key arg can potentially be traced to find the algorithm used to generate the key. |
70 | | - // */ |
71 | | - // override Expr getAlgorithmArg(){ |
72 | | - // } |
| 68 | +} |
| 69 | + |
| 70 | +/** |
| 71 | + * Any key initializer may initialize the algorithm and the key size through |
| 72 | + * the key. Extend any instance of key initializer provide initialization |
| 73 | + * of the algorithm and key size from the key. |
| 74 | + */ |
| 75 | +class EvpInitializerThroughKey extends EvpAlgorithmInitializer, EvpKeySizeInitializer instanceof EvpKeyInitializer |
| 76 | +{ |
| 77 | + //TODO: charpred that traces from creation to key arg, grab creator |
| 78 | + override CtxPointerSource getContextArg() { result = EvpKeyInitializer.super.getContextArg() } |
| 79 | + |
| 80 | + override Expr getAlgorithmArg() { |
| 81 | + result = |
| 82 | + getSourceKeyCreationInstanceFromArg(this.getKeyArg()).(OpenSSLOperation).getAlgorithmArg() |
| 83 | + } |
| 84 | + |
| 85 | + override Expr getKeySizeArg() { |
| 86 | + result = getSourceKeyCreationInstanceFromArg(this.getKeyArg()).getKeySizeConsumer().asExpr() |
| 87 | + } |
| 88 | + |
| 89 | + Expr getKeyArg() { result = EvpKeyInitializer.super.getKeyArg() } |
73 | 90 | } |
74 | 91 |
|
75 | 92 | abstract class EvpIVInitializer extends EvpInitializer { |
|
0 commit comments