Skip to content

Commit

Permalink
fix property getter/setter
Browse files Browse the repository at this point in the history
  • Loading branch information
qmuntal committed Mar 16, 2022
1 parent 61856d0 commit a5be7e4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cng/aes.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func loadAes(id string, mode string) (h aesAlgorithm, err error) {
}
var info bcrypt.KEY_LENGTHS_STRUCT
var discard uint32
err = bcrypt.GetProperty(bcrypt.HANDLE(h.h), utf16PtrFromString(bcrypt.KEY_LENGTHS), uintptr(unsafe.Pointer(&info)), uint32(unsafe.Sizeof(info)), &discard, 0)
err = bcrypt.GetProperty(bcrypt.HANDLE(h.h), utf16PtrFromString(bcrypt.KEY_LENGTHS), unsafe.Pointer(&info), uint32(unsafe.Sizeof(info)), &discard, 0)
if err != nil {
return
}
Expand Down
4 changes: 2 additions & 2 deletions cng/cng.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ func utf16PtrFromString(s string) *uint16 {
}

func setString(h bcrypt.HANDLE, name, val string) error {
return bcrypt.SetProperty(h, utf16PtrFromString(name), uintptr(unsafe.Pointer(utf16PtrFromString(val))), uint32(len(val))+1, 0)
return bcrypt.SetProperty(h, utf16PtrFromString(name), unsafe.Pointer(utf16PtrFromString(val)), uint32(len(val))+1, 0)
}

func getUint32(h bcrypt.HANDLE, name string) (uint32, error) {
var prop, discard uint32
err := bcrypt.GetProperty(h, utf16PtrFromString(name), uintptr(unsafe.Pointer(&prop)), 4, &discard, 0)
err := bcrypt.GetProperty(h, utf16PtrFromString(name), unsafe.Pointer(&prop), 4, &discard, 0)
return prop, err
}
4 changes: 2 additions & 2 deletions internal/bcrypt/bcrypt_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ func NewAUTHENTICATED_CIPHER_MODE_INFO(nonce, additionalData, tag []byte) *AUTHE
return &info
}

//sys GetProperty(hObject HANDLE, pszProperty *uint16, pbOutput uintptr, cbOutput uint32, pcbResult *uint32, dwFlags uint32) (s error) = bcrypt.BCryptGetProperty
//sys SetProperty(hObject HANDLE, pszProperty *uint16, pbInput uintptr, cbInput uint32, dwFlags uint32) (s error) = bcrypt.BCryptSetProperty
//sys GetProperty(hObject HANDLE, pszProperty *uint16, pbOutput unsafe.Pointer, cbOutput uint32, pcbResult *uint32, dwFlags uint32) (s error) = bcrypt.BCryptGetProperty
//sys SetProperty(hObject HANDLE, pszProperty *uint16, pbInput unsafe.Pointer, cbInput uint32, dwFlags uint32) (s error) = bcrypt.BCryptSetProperty
//sys OpenAlgorithmProvider(phAlgorithm *ALG_HANDLE, pszAlgId *uint16, pszImplementation *uint16, dwFlags AlgorithmProviderFlags) (s error) = bcrypt.BCryptOpenAlgorithmProvider
//sys CloseAlgorithmProvider(hAlgorithm ALG_HANDLE, dwFlags uint32) (s error) = bcrypt.BCryptCloseAlgorithmProvider

Expand Down
4 changes: 2 additions & 2 deletions internal/bcrypt/zsyscall_windows.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a5be7e4

Please sign in to comment.