-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add RSA AES key wrap mechanism parameters #166
Conversation
Hi @miekg, |
params.go
Outdated
@@ -26,6 +26,11 @@ static inline void putECDH1PublicParams(CK_ECDH1_DERIVE_PARAMS_PTR params, CK_VO | |||
params->pPublicData = pPublicData; | |||
params->ulPublicDataLen = ulPublicDataLen; | |||
} | |||
|
|||
static inline void putRsaAesKeyWrapParams(CK_RSA_AES_KEY_WRAP_PARAMS_PTR params, CK_VOID_PTR pOAEPParams) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static inline void putRsaAesKeyWrapParams(CK_RSA_AES_KEY_WRAP_PARAMS_PTR params, CK_VOID_PTR pOAEPParams) | |
static inline void putRSAAESKeyWrapParams(CK_RSA_AES_KEY_WRAP_PARAMS_PTR params, CK_VOID_PTR pOAEPParams) |
to keep in-line with the usage of RSA and AES in this pkg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
params.go
Outdated
@@ -188,3 +193,23 @@ func cECDH1DeriveParams(p *ECDH1DeriveParams, arena arena) ([]byte, arena) { | |||
|
|||
return memBytes(unsafe.Pointer(¶ms), unsafe.Sizeof(params)), arena | |||
} | |||
|
|||
type RsaAesKeyWrapParams struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same: s/Rsa/RSA en for AES
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
params.go
Outdated
OAEPParams OAEPParams | ||
} | ||
|
||
func cRsaAesKeyWrapParams(p *RsaAesKeyWrapParams, arena arena) ([]byte, arena) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
some style stuff, otherwise lgtm |
pkcs11-spec-v3.1-cs01 6.1.23 RSA AES KEY WRAP The RSA AES key wrap mechanism based on the RSA public-key cryptosystem and the AES key wrap mechanism. It supports single-part key wrapping and key unwrapping. How to use: params := &pkcs11.RSAAESKeyWrapParams{ AESKeyBits: 256, OAEPParams: pkcs11.OAEPParams{ HashAlg: pkcs11.CKM_SHA256, MGF: pkcs11.CKG_MGF1_SHA256, SourceType: pkcs11.CKZ_DATA_SPECIFIED, }, } mechanism := []*pkcs11.Mechanism { pkcs11.NewMechanism(pkcs11.CKM_RSA_AES_KEY_WRAP, params) } unwrappedKey, err := ctx.UnwrapKey(session, mechanism, wrappingKeyObj, wrappedKey, unwrappedKeyAttributes) Signed-off-by: Valerii Chubar <valerii_chubar@epam.com>
Mechanism implementation:
OP-TEE/optee_os#5647
pkcs11-spec-v3.1-cs01
6.1.23 RSA AES KEY WRAP
The RSA AES key wrap mechanism based on the RSA public-key cryptosystem and the AES key wrap mechanism. It supports single-part key wrapping and key unwrapping.
How to use: