Skip to content
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

Autogenerate cgo wrappers #230

Draft
wants to merge 20 commits into
base: v2
Choose a base branch
from
Draft

Autogenerate cgo wrappers #230

wants to merge 20 commits into from

Conversation

qmuntal
Copy link
Collaborator

@qmuntal qmuntal commented Dec 5, 2024

PoC, do not review yet.

@qmuntal qmuntal requested a review from Copilot December 5, 2024 11:11
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 31 out of 46 changed files in this pull request and generated 3 suggestions.

Files not reviewed (15)
  • goopenssl.c: Language not supported
  • goopenssl.h: Language not supported
  • export_test.go: Evaluated as low risk
  • ed25519.go: Evaluated as low risk
  • ecdsa.go: Evaluated as low risk
  • ec.go: Evaluated as low risk
  • ecdh.go: Evaluated as low risk
  • aes.go: Evaluated as low risk
  • des.go: Evaluated as low risk
  • evp.go: Evaluated as low risk
  • hkdf.go: Evaluated as low risk
  • hash.go: Evaluated as low risk
  • cipher.go: Evaluated as low risk
  • hmac.go: Evaluated as low risk
  • init.go: Evaluated as low risk
Comments skipped due to low confidence (8)

internal/mkcgo/parse.go:191

  • The extractSection function does not handle cases where the start or end strings are not found properly. It might return incorrect results.
func extractSection(s string, start, end string) (prefix, body, suffix string, found bool) {

internal/mkcgo/parse.go:137

  • The newFn function has a lot of string manipulation which could be error-prone. Ensure that it handles edge cases properly.
func newFn(s string, opts fnOptions) (*fn, error) {

internal/mkcgo/mkcgo.go:62

  • Handle the case where fileName is empty to avoid unexpected behavior.
err = os.WriteFile(*fileName, data, 0644)

internal/mkcgo/mkcgo.go:64

  • Ensure fileName ends with .go before using TrimSuffix to avoid incorrect file naming.
cfileName := strings.TrimSuffix(*fileName, ".go") + ".c"

internal/mkcgo/mkcgo.go:132

  • [nitpick] Simplify the error handling for better readability.
if closeErr := f.Close(); err == nil { err = closeErr }

internal/mkcgo/generate.go:244

  • The function libArgList in the param struct returns a slice with a single string element, which is unnecessary. It should return a string directly.
return []string{s}

dsa.go:58

  • The function signature for withKey has been changed from func(C.GO_EVP_PKEY_PTR) C.int to func(ossl.EVP_PKEY_PTR) error. Ensure that the functions passed to withKey are updated to handle errors correctly.
func (k *PrivateKeyDSA) withKey(f func(ossl.EVP_PKEY_PTR) error) error {

ecdsa_test.go:25

  • The removal of t.Parallel() should be justified. If there were no issues with parallel execution, consider adding it back to improve test performance.
t.Parallel()

internal/mkcgo/generate.go Outdated Show resolved Hide resolved
internal/mkcgo/generate.go Show resolved Hide resolved
dsa.go Outdated Show resolved Hide resolved
@qmuntal qmuntal force-pushed the dev/qmuntal/osslwrap branch from 044ae27 to 13e70e5 Compare December 5, 2024 11:29
Base automatically changed from pkeyoneshot to v2 December 10, 2024 09:35
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.

1 participant