From a3c0336b974073784851939c09be7f652f2a1d90 Mon Sep 17 00:00:00 2001 From: qmuntal Date: Wed, 5 Mar 2025 10:24:01 +0100 Subject: [PATCH] autogenerate renamed functions --- cipher.go | 6 +-- cmd/checkheader/main.go | 22 ++++---- cmd/mkcgo/generate.go | 28 +++++++--- ecdh.go | 7 +-- evp.go | 12 +---- hkdf.go | 7 +-- internal/mkcgo/mkcgo.go | 18 +++++-- internal/mkcgo/parse.go | 112 +++++++++++++++++++++++++++------------- rsa.go | 7 +-- shims.h | 15 ++---- zossl.c | 45 ++++------------ zossl.go | 20 ------- 12 files changed, 145 insertions(+), 154 deletions(-) diff --git a/cipher.go b/cipher.go index 39ce683..4884090 100644 --- a/cipher.go +++ b/cipher.go @@ -155,11 +155,7 @@ func newEVPCipher(key []byte, kind cipherKind) (*evpCipher, error) { } c := &evpCipher{key: make([]byte, len(key)), kind: kind} copy(c.key, key) - if vMajor == 1 { - c.blockSize = int(go_openssl_EVP_CIPHER_block_size(cipher)) - } else { - c.blockSize = int(go_openssl_EVP_CIPHER_get_block_size(cipher)) - } + c.blockSize = int(go_openssl_EVP_CIPHER_get_block_size(cipher)) return c, nil } diff --git a/cmd/checkheader/main.go b/cmd/checkheader/main.go index 316179e..3b627ef 100644 --- a/cmd/checkheader/main.go +++ b/cmd/checkheader/main.go @@ -142,17 +142,17 @@ func generate(header string) (string, error) { case "EVP_PKEY_size", "EVP_PKEY_bits": specialCond = "OPENSSL_VERSION_NUMBER >= 0x10101000L" } - switch fn.Tag { - case "legacy_1": - tagCond = "OPENSSL_VERSION_NUMBER < 0x30000000L" - case "111": - tagCond = "OPENSSL_VERSION_NUMBER >= 0x10101000L" - case "3": - tagCond = "OPENSSL_VERSION_NUMBER >= 0x30000000L" - case "": - // No tag, the function is available in all versions. - default: - panic("unexpected tag: " + fn.Tag) + if len(fn.Tags) == 1 { + switch fn.Tags[0].Tag { + case "legacy_1": + tagCond = "OPENSSL_VERSION_NUMBER < 0x30000000L" + case "111": + tagCond = "OPENSSL_VERSION_NUMBER >= 0x10101000L" + case "3": + tagCond = "OPENSSL_VERSION_NUMBER >= 0x30000000L" + default: + panic("unexpected tag: " + fn.Tags[0].Tag) + } } if specialCond != "" { fmt.Fprintf(w, "#if %s\n", specialCond) diff --git a/cmd/mkcgo/generate.go b/cmd/mkcgo/generate.go index 79340ea..070ffbd 100644 --- a/cmd/mkcgo/generate.go +++ b/cmd/mkcgo/generate.go @@ -139,10 +139,12 @@ func generateC(src *mkcgo.Source, w io.Writer) { } fmt.Fprintf(w, "\n") - fmt.Fprintf(w, "#define __mkcgo__dlsym(name) \\\n") - fmt.Fprintf(w, "\t_g_##name = (typeof(_g_##name))dlsym(handle, #name); \\\n") - fmt.Fprintf(w, "\tif (_g_##name == NULL) { \\\n") - fmt.Fprintf(w, "\t\tfprintf(stderr, \"Cannot get required symbol \" #name \"\\n\"); \\\n") + fmt.Fprintf(w, "#define __mkcgo__dlsym(name) __mkcgo__dlsym2(name, name)\n\n") + + fmt.Fprintf(w, "#define __mkcgo__dlsym2(varname, funcname) \\\n") + fmt.Fprintf(w, "\t_g_##varname = (typeof(_g_##varname))dlsym(handle, #funcname); \\\n") + fmt.Fprintf(w, "\tif (_g_##varname == NULL) { \\\n") + fmt.Fprintf(w, "\t\tfprintf(stderr, \"Cannot get required symbol \" #funcname \"\\n\"); \\\n") fmt.Fprintf(w, "\t\tabort(); \\\n") fmt.Fprintf(w, "\t}\n\n") @@ -150,10 +152,24 @@ func generateC(src *mkcgo.Source, w io.Writer) { for _, tag := range src.Tags() { fmt.Fprintf(w, "void __mkcgoLoad_%s(void* handle) {\n", tag) for _, fn := range src.Funcs { - if fn.VariadicInst || fn.Tag != tag { + if fn.VariadicInst { continue } - fmt.Fprintf(w, "\t__mkcgo__dlsym(%s)\n", fn.ImportName) + if len(fn.Tags) == 0 && tag == "" { + // Default tag. + fmt.Fprintf(w, "\t__mkcgo__dlsym(%s)\n", fn.ImportName) + } else { + for _, tagAttr := range fn.Tags { + if tagAttr.Tag == tag { + if tagAttr.Name != "" { + fmt.Fprintf(w, "\t__mkcgo__dlsym2(%s, %s)\n", fn.ImportName, tagAttr.Name) + } else { + fmt.Fprintf(w, "\t__mkcgo__dlsym(%s)\n", fn.ImportName) + } + break + } + } + } } fmt.Fprintf(w, "}\n\n") } diff --git a/ecdh.go b/ecdh.go index 561fb0d..aa5b024 100644 --- a/ecdh.go +++ b/ecdh.go @@ -291,12 +291,7 @@ func GenerateKeyECDH(curve string) (*PrivateKeyECDH, []byte, error) { // The fixed length is the order of the large prime subgroup of the curve, // returned by EVP_PKEY_get_bits, which is generally the upper bound for // generating a private ECDH key. - var bits int32 - if vMajor == 1 { - bits = go_openssl_EVP_PKEY_bits(pkey) - } else { - bits = go_openssl_EVP_PKEY_get_bits(pkey) - } + bits := go_openssl_EVP_PKEY_get_bits(pkey) bytes := make([]byte, (bits+7)/8) if err := bnToBinPad(priv, bytes); err != nil { return nil, nil, err diff --git a/evp.go b/evp.go index d11cc96..704a214 100644 --- a/evp.go +++ b/evp.go @@ -143,13 +143,8 @@ func loadHash(ch crypto.Hash) *hashAlgorithm { return nil } hash.ch = ch - if vMajor == 1 { - hash.size = int(go_openssl_EVP_MD_size(hash.md)) - hash.blockSize = int(go_openssl_EVP_MD_block_size(hash.md)) - } else { - hash.size = int(go_openssl_EVP_MD_get_size(hash.md)) - hash.blockSize = int(go_openssl_EVP_MD_get_block_size(hash.md)) - } + hash.size = int(go_openssl_EVP_MD_get_size(hash.md)) + hash.blockSize = int(go_openssl_EVP_MD_get_block_size(hash.md)) if vMajor == 3 { // On OpenSSL 3, directly operating on a EVP_MD object // not created by EVP_MD_fetch has negative performance @@ -355,9 +350,6 @@ func cryptEVP(withKey withKeyFunc, padding int32, } defer go_openssl_EVP_PKEY_CTX_free(ctx) pkeySize := withKey(func(pkey _EVP_PKEY_PTR) int32 { - if vMajor == 1 { - return go_openssl_EVP_PKEY_size(pkey) - } return go_openssl_EVP_PKEY_get_size(pkey) }) outLen := int(pkeySize) diff --git a/hkdf.go b/hkdf.go index 05c4e8c..42e15a0 100644 --- a/hkdf.go +++ b/hkdf.go @@ -198,12 +198,7 @@ func ExpandHKDF(h func() hash.Hash, pseudorandomKey, info []byte) (io.Reader, er return nil, err } - var size int - if vMajor == 1 { - size = int(go_openssl_EVP_MD_size(md)) - } else { - size = int(go_openssl_EVP_MD_get_size(md)) - } + size := int(go_openssl_EVP_MD_get_size(md)) switch vMajor { case 1: diff --git a/internal/mkcgo/mkcgo.go b/internal/mkcgo/mkcgo.go index 41beea6..940ed5f 100644 --- a/internal/mkcgo/mkcgo.go +++ b/internal/mkcgo/mkcgo.go @@ -19,6 +19,7 @@ type TypeDef struct { Type string } +// Enum describes an enum definition. type Enum struct { Name string Value string @@ -29,7 +30,7 @@ type Func struct { GoName string CName string ImportName string - Tag string + Tags []TagAttr // if TagAttr.Name is set, it's the import name for the tag Params []*Param Ret *Return VariadicInst bool // true if the function is a variadic instantiation @@ -39,6 +40,12 @@ func (f *Func) Variadic() bool { return len(f.Params) > 0 && f.Params[len(f.Params)-1].Variadic() } +// TagAttr is an attribute of a tag with an optional name. +type TagAttr struct { + Tag string + Name string +} + // Param is a function parameter. type Param struct { Name string @@ -56,10 +63,13 @@ type Return struct { } func (src *Source) Tags() []string { - var tags []string + tags := make([]string, 0, len(src.Funcs)+1) + tags = append(tags, "") // default tag for _, fn := range src.Funcs { - if !slices.Contains(tags, fn.Tag) { - tags = append(tags, fn.Tag) + for _, tag := range fn.Tags { + if !slices.Contains(tags, tag.Tag) { + tags = append(tags, tag.Tag) + } } } slices.Sort(tags) diff --git a/internal/mkcgo/parse.go b/internal/mkcgo/parse.go index 2e13ecf..d45041f 100644 --- a/internal/mkcgo/parse.go +++ b/internal/mkcgo/parse.go @@ -10,34 +10,35 @@ import ( ) type fnAttributes struct { - tag string + tags []TagAttr variadic bool importName string } type attribute struct { - name string - description string - hasParameter bool - handle func(string, *fnAttributes) + name string + description string + handle func(*fnAttributes, ...string) } var attributes = [...]attribute{ { - name: "tag", - description: "the function will be loaded together with other functions with the same tag.", - hasParameter: true, - handle: func(s string, opts *fnAttributes) { - opts.tag = s + name: "tag", + description: "The function will be loaded together with other functions with the same tag. It can contain an optional name, which is the import name for the tag.", + handle: func(opts *fnAttributes, s ...string) { + var name string + if len(s) > 1 { + name = s[1] + } + opts.tags = append(opts.tags, TagAttr{Tag: s[0], Name: name}) }, }, { - name: "variadic", - description: "the function has variadic arguments, and its name is a custom wrapper for the actual C name, defined in this attribute.", - hasParameter: true, - handle: func(s string, opts *fnAttributes) { + name: "variadic", + description: "The function has variadic arguments, and its name is a custom wrapper for the actual C name, defined in this attribute.", + handle: func(opts *fnAttributes, s ...string) { opts.variadic = true - opts.importName = s + opts.importName = s[0] }, }, } @@ -180,7 +181,7 @@ func newFn(s string, opts fnAttributes) (*Func, error) { fn := &Func{ Ret: &Return{}, VariadicInst: opts.variadic, - Tag: opts.tag, + Tags: opts.tags, } var err error fn.Params, err = extractParams(body) @@ -245,11 +246,28 @@ func extractSection(s string, start, end string) (prefix, body, suffix string, f prefix = a[0] body = a[1] } - a := strings.SplitN(body, end, 2) - if len(a) != 2 { - return "", "", "", false + idxStart := strings.Index(body, start) + idxEnd := strings.Index(body, end) + needBalancing := idxStart != -1 && idxEnd != -1 && idxStart < idxEnd + if !needBalancing { + a := strings.SplitN(body, end, 2) + if len(a) != 2 { + return "", "", "", false + } + return prefix, a[0], a[1], true + } + depth := 1 + for i := range len(body) { + if strings.HasPrefix(body[i:], start) { + depth++ + } else if strings.HasPrefix(body[i:], end) { + depth-- + if depth == 0 { + return prefix, body[:i], body[i+len(end):], true + } + } } - return prefix, a[0], a[1], true + return "", "", s, false } // processComments removes comments from line and returns the result. @@ -281,39 +299,61 @@ func processComments(line string, inBlockComment *bool) (comment, remmaining str // extractFunctionAttributes extracts mkcgo attributes from string s. // The attributes format follows the GCC __attribute__ syntax as -// described in https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html. +// described in https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html. func extractFunctionAttributes(s string, fnAttrs *fnAttributes) (string, error) { // There can be spaces between __attribute__ and the opening parenthesis. - prefix, after, found := strings.Cut(s, "__attribute__") + prefix, body, found := strings.Cut(s, "__attribute__") if !found { return s, nil } - _, body, suffix, found := extractSection(after, "((", "));") + _, body, suffix, found := extractSection(body, "(", ")") if !found { return s, nil } - for _, v := range strings.Split(body, ",") { - v = trim(v) + if !strings.HasPrefix(body, "(") || !strings.HasSuffix(body, ")") { + // Attributes are enclosed in double parentheses. + return s, nil + } + body = trim(body[1 : len(body)-1]) + for { + if body == "" { + break + } + // Attributes are separated by commas. Get the next attribute. + // We can't just use strings.Split because the attribute argument + // can contain commas. + var name, args string + idxComma := strings.IndexByte(body, ',') + idxParen := strings.IndexByte(body, '(') + if idxComma != -1 && (idxParen == -1 || idxComma < idxParen) { + // The attribute has no arguments. + name = body[:idxComma] + body = body[idxComma+1:] + } else if idxParen != -1 && (idxComma == -1 || idxComma > idxParen) { + // The attribute has arguments, possibly with commas. + name = body[:idxParen] + _, args, body, found = extractSection(body[idxParen:], "(", ")") + if !found { + return "", errors.New("unbalanced parentheses in mkcgo attribute: " + s) + } + body = strings.TrimPrefix(body, ",") + } + name, args = trim(name), trim(args) var handled bool for _, attr := range attributes { - if (!attr.hasParameter && v != attr.name) || - (attr.hasParameter && !strings.HasPrefix(v, attr.name+"(")) { + if name != attr.name { continue } - var arg string - if attr.hasParameter { - var ok bool - if _, arg, _, ok = extractSection(v, "(", ")"); !ok { - return "", errors.New("could not extract mkcgo attribute argument from \"" + v + "\"") - } - arg = strings.Trim(arg, `"`) + vargs := strings.Split(args, ",") + for i := range vargs { + vargs[i] = trim(strings.Trim(vargs[i], `"`)) } - attr.handle(arg, fnAttrs) + attr.handle(fnAttrs, vargs...) handled = true break } if !handled { - return "", errors.New("unknown mkcgo attribute: " + v) + return "", errors.New("unknown mkcgo attribute: " + s) } } return trim(prefix + suffix), nil diff --git a/rsa.go b/rsa.go index 1e31f72..5bd7d83 100644 --- a/rsa.go +++ b/rsa.go @@ -278,12 +278,7 @@ func HashSignRSAPKCS1v15(priv *PrivateKeyRSA, h crypto.Hash, msg []byte) ([]byte func VerifyRSAPKCS1v15(pub *PublicKeyRSA, h crypto.Hash, hashed, sig []byte) error { if pub.withKey(func(pkey _EVP_PKEY_PTR) int32 { - var size int32 - if vMajor == 1 { - size = go_openssl_EVP_PKEY_size(pkey) - } else { - size = go_openssl_EVP_PKEY_get_size(pkey) - } + size := go_openssl_EVP_PKEY_get_size(pkey) if len(sig) < int(size) { return 0 } diff --git a/shims.h b/shims.h index 27a23b1..4fb2950 100644 --- a/shims.h +++ b/shims.h @@ -154,10 +154,8 @@ void EVP_MD_free(_EVP_MD_PTR md) __attribute__((tag("3"))); const char *EVP_MD_get0_name(const _EVP_MD_PTR md) __attribute__((tag("3"))); int EVP_MD_get_type(const _EVP_MD_PTR md) __attribute__((tag("3"))); const _OSSL_PROVIDER_PTR EVP_MD_get0_provider(const _EVP_MD_PTR md) __attribute__((tag("3"))); -int EVP_MD_size(const _EVP_MD_PTR md) __attribute__((tag("legacy_1"))); -int EVP_MD_get_size(const _EVP_MD_PTR md) __attribute__((tag("3"))); -int EVP_MD_block_size(const _EVP_MD_PTR md) __attribute__((tag("legacy_1"))); -int EVP_MD_get_block_size(const _EVP_MD_PTR md) __attribute__((tag("3"))); +int EVP_MD_get_size(const _EVP_MD_PTR md) __attribute__((tag("3"),tag("legacy_1","EVP_MD_size"))); +int EVP_MD_get_block_size(const _EVP_MD_PTR md) __attribute__((tag("3"),tag("legacy_1","EVP_MD_block_size"))); const _EVP_MD_PTR EVP_md5_sha1(void); const _EVP_MD_PTR EVP_ripemd160(void); const _EVP_MD_PTR EVP_md4(void); @@ -219,8 +217,7 @@ const _EVP_CIPHER_PTR EVP_des_cbc(void); const _EVP_CIPHER_PTR EVP_des_ede3_ecb(void); const _EVP_CIPHER_PTR EVP_des_ede3_cbc(void); const _EVP_CIPHER_PTR EVP_rc4(void); -int EVP_CIPHER_block_size(const _EVP_CIPHER_PTR cipher) __attribute__((tag("legacy_1"))); -int EVP_CIPHER_get_block_size(const _EVP_CIPHER_PTR cipher) __attribute__((tag("3"))); +int EVP_CIPHER_get_block_size(const _EVP_CIPHER_PTR cipher) __attribute__((tag("3"),tag("legacy_1","EVP_CIPHER_block_size"))); _EVP_CIPHER_CTX_PTR EVP_CIPHER_CTX_new(void); int EVP_CIPHER_CTX_set_padding(_EVP_CIPHER_CTX_PTR x, int padding); @@ -240,10 +237,8 @@ int EVP_DecryptFinal_ex(_EVP_CIPHER_CTX_PTR ctx, unsigned char *outm, int *outl) _EVP_PKEY_PTR EVP_PKEY_new(void); _EVP_PKEY_PTR EVP_PKEY_new_raw_private_key(int type, _ENGINE_PTR e, const unsigned char *key, size_t keylen) __attribute__((tag("111"))); _EVP_PKEY_PTR EVP_PKEY_new_raw_public_key(int type, _ENGINE_PTR e, const unsigned char *key, size_t keylen) __attribute__((tag("111"))); -int EVP_PKEY_size(const _EVP_PKEY_PTR pkey) __attribute__((tag("legacy_1"))); -int EVP_PKEY_get_size(const _EVP_PKEY_PTR pkey) __attribute__((tag("3"))); -int EVP_PKEY_bits(const _EVP_PKEY_PTR pkey) __attribute__((tag("legacy_1"))); -int EVP_PKEY_get_bits(const _EVP_PKEY_PTR pkey) __attribute__((tag("3"))); +int EVP_PKEY_get_size(const _EVP_PKEY_PTR pkey) __attribute__((tag("3"),tag("legacy_1","EVP_PKEY_size"))); +int EVP_PKEY_get_bits(const _EVP_PKEY_PTR pkey) __attribute__((tag("3"),tag("legacy_1","EVP_PKEY_bits"))); void EVP_PKEY_free(_EVP_PKEY_PTR arg0); _RSA_PTR EVP_PKEY_get1_RSA(_EVP_PKEY_PTR pkey) __attribute__((tag("legacy_1"))); int EVP_PKEY_assign(_EVP_PKEY_PTR pkey, int type, void *key) __attribute__((tag("legacy_1"))); diff --git a/zossl.c b/zossl.c index ea10093..51f9973 100644 --- a/zossl.c +++ b/zossl.c @@ -60,7 +60,6 @@ __mkcgo__funcptr(EVP_CIPHER_CTX_free); __mkcgo__funcptr(EVP_CIPHER_CTX_new); __mkcgo__funcptr(EVP_CIPHER_CTX_set_key_length); __mkcgo__funcptr(EVP_CIPHER_CTX_set_padding); -__mkcgo__funcptr(EVP_CIPHER_block_size); __mkcgo__funcptr(EVP_CIPHER_fetch); __mkcgo__funcptr(EVP_CIPHER_get0_name); __mkcgo__funcptr(EVP_CIPHER_get_block_size); @@ -102,7 +101,6 @@ __mkcgo__funcptr(EVP_MD_CTX_copy); __mkcgo__funcptr(EVP_MD_CTX_copy_ex); __mkcgo__funcptr(EVP_MD_CTX_free); __mkcgo__funcptr(EVP_MD_CTX_new); -__mkcgo__funcptr(EVP_MD_block_size); __mkcgo__funcptr(EVP_MD_fetch); __mkcgo__funcptr(EVP_MD_free); __mkcgo__funcptr(EVP_MD_get0_name); @@ -110,7 +108,6 @@ __mkcgo__funcptr(EVP_MD_get0_provider); __mkcgo__funcptr(EVP_MD_get_block_size); __mkcgo__funcptr(EVP_MD_get_size); __mkcgo__funcptr(EVP_MD_get_type); -__mkcgo__funcptr(EVP_MD_size); __mkcgo__funcptr(EVP_PKEY_CTX_add1_hkdf_info); __mkcgo__funcptr(EVP_PKEY_CTX_ctrl); __mkcgo__funcptr(EVP_PKEY_CTX_free); @@ -124,7 +121,6 @@ __mkcgo__funcptr(EVP_PKEY_CTX_set_hkdf_md); __mkcgo__funcptr(EVP_PKEY_CTX_set_hkdf_mode); __mkcgo__funcptr(EVP_PKEY_Q_keygen); __mkcgo__funcptr(EVP_PKEY_assign); -__mkcgo__funcptr(EVP_PKEY_bits); __mkcgo__funcptr(EVP_PKEY_decrypt); __mkcgo__funcptr(EVP_PKEY_decrypt_init); __mkcgo__funcptr(EVP_PKEY_derive); @@ -157,7 +153,6 @@ __mkcgo__funcptr(EVP_PKEY_set1_EC_KEY); __mkcgo__funcptr(EVP_PKEY_set1_encoded_public_key); __mkcgo__funcptr(EVP_PKEY_sign); __mkcgo__funcptr(EVP_PKEY_sign_init); -__mkcgo__funcptr(EVP_PKEY_size); __mkcgo__funcptr(EVP_PKEY_up_ref); __mkcgo__funcptr(EVP_PKEY_verify); __mkcgo__funcptr(EVP_PKEY_verify_init); @@ -231,10 +226,12 @@ __mkcgo__funcptr(RSA_set0_crt_params); __mkcgo__funcptr(RSA_set0_factors); __mkcgo__funcptr(RSA_set0_key); -#define __mkcgo__dlsym(name) \ - _g_##name = (typeof(_g_##name))dlsym(handle, #name); \ - if (_g_##name == NULL) { \ - fprintf(stderr, "Cannot get required symbol " #name "\n"); \ +#define __mkcgo__dlsym(name) __mkcgo__dlsym2(name, name) + +#define __mkcgo__dlsym2(varname, funcname) \ + _g_##varname = (typeof(_g_##varname))dlsym(handle, #funcname); \ + if (_g_##varname == NULL) { \ + fprintf(stderr, "Cannot get required symbol " #funcname "\n"); \ abort(); \ } @@ -437,16 +434,16 @@ void __mkcgoLoad_legacy_1(void* handle) { __mkcgo__dlsym(EC_KEY_set_public_key_affine_coordinates) __mkcgo__dlsym(EC_POINT_get_affine_coordinates_GFp) __mkcgo__dlsym(ERR_get_error_line) - __mkcgo__dlsym(EVP_CIPHER_block_size) - __mkcgo__dlsym(EVP_MD_block_size) - __mkcgo__dlsym(EVP_MD_size) + __mkcgo__dlsym2(EVP_CIPHER_get_block_size, EVP_CIPHER_block_size) + __mkcgo__dlsym2(EVP_MD_get_block_size, EVP_MD_block_size) + __mkcgo__dlsym2(EVP_MD_get_size, EVP_MD_size) __mkcgo__dlsym(EVP_PKEY_assign) - __mkcgo__dlsym(EVP_PKEY_bits) __mkcgo__dlsym(EVP_PKEY_get0_DSA) __mkcgo__dlsym(EVP_PKEY_get0_EC_KEY) __mkcgo__dlsym(EVP_PKEY_get1_RSA) + __mkcgo__dlsym2(EVP_PKEY_get_bits, EVP_PKEY_bits) + __mkcgo__dlsym2(EVP_PKEY_get_size, EVP_PKEY_size) __mkcgo__dlsym(EVP_PKEY_set1_EC_KEY) - __mkcgo__dlsym(EVP_PKEY_size) __mkcgo__dlsym(FIPS_mode) __mkcgo__dlsym(FIPS_mode_set) __mkcgo__dlsym(HMAC_CTX_copy) @@ -645,10 +642,6 @@ int EVP_CIPHER_CTX_set_padding(_EVP_CIPHER_CTX_PTR _arg0, int _arg1) { return _g_EVP_CIPHER_CTX_set_padding(_arg0, _arg1); } -int EVP_CIPHER_block_size(const _EVP_CIPHER_PTR _arg0) { - return _g_EVP_CIPHER_block_size(_arg0); -} - _EVP_CIPHER_PTR EVP_CIPHER_fetch(_OSSL_LIB_CTX_PTR _arg0, const char* _arg1, const char* _arg2) { return _g_EVP_CIPHER_fetch(_arg0, _arg1, _arg2); } @@ -813,10 +806,6 @@ _EVP_MD_CTX_PTR EVP_MD_CTX_new(void) { return _g_EVP_MD_CTX_new(); } -int EVP_MD_block_size(const _EVP_MD_PTR _arg0) { - return _g_EVP_MD_block_size(_arg0); -} - _EVP_MD_PTR EVP_MD_fetch(_OSSL_LIB_CTX_PTR _arg0, const char* _arg1, const char* _arg2) { return _g_EVP_MD_fetch(_arg0, _arg1, _arg2); } @@ -845,10 +834,6 @@ int EVP_MD_get_type(const _EVP_MD_PTR _arg0) { return _g_EVP_MD_get_type(_arg0); } -int EVP_MD_size(const _EVP_MD_PTR _arg0) { - return _g_EVP_MD_size(_arg0); -} - int EVP_PKEY_CTX_add1_hkdf_info(_EVP_PKEY_CTX_PTR _arg0, const unsigned char* _arg1, int _arg2) { return _g_EVP_PKEY_CTX_add1_hkdf_info(_arg0, _arg1, _arg2); } @@ -909,10 +894,6 @@ int EVP_PKEY_assign(_EVP_PKEY_PTR _arg0, int _arg1, void* _arg2) { return _g_EVP_PKEY_assign(_arg0, _arg1, _arg2); } -int EVP_PKEY_bits(const _EVP_PKEY_PTR _arg0) { - return _g_EVP_PKEY_bits(_arg0); -} - int EVP_PKEY_decrypt(_EVP_PKEY_CTX_PTR _arg0, unsigned char* _arg1, size_t* _arg2, const unsigned char* _arg3, size_t _arg4) { return _g_EVP_PKEY_decrypt(_arg0, _arg1, _arg2, _arg3, _arg4); } @@ -1041,10 +1022,6 @@ int EVP_PKEY_sign_init(_EVP_PKEY_CTX_PTR _arg0) { return _g_EVP_PKEY_sign_init(_arg0); } -int EVP_PKEY_size(const _EVP_PKEY_PTR _arg0) { - return _g_EVP_PKEY_size(_arg0); -} - int EVP_PKEY_up_ref(_EVP_PKEY_PTR _arg0) { return _g_EVP_PKEY_up_ref(_arg0); } diff --git a/zossl.go b/zossl.go index bcb9f03..9f22f91 100644 --- a/zossl.go +++ b/zossl.go @@ -288,10 +288,6 @@ func go_openssl_EVP_CIPHER_CTX_set_padding(x _EVP_CIPHER_CTX_PTR, padding int32) return int32(C.EVP_CIPHER_CTX_set_padding(x, C.int(padding))) } -func go_openssl_EVP_CIPHER_block_size(cipher _EVP_CIPHER_PTR) int32 { - return int32(C.EVP_CIPHER_block_size(cipher)) -} - func go_openssl_EVP_CIPHER_fetch(ctx _OSSL_LIB_CTX_PTR, algorithm *byte, properties *byte) _EVP_CIPHER_PTR { return C.EVP_CIPHER_fetch(ctx, (*C.char)(unsafe.Pointer(algorithm)), (*C.char)(unsafe.Pointer(properties))) } @@ -456,10 +452,6 @@ func go_openssl_EVP_MD_CTX_new() _EVP_MD_CTX_PTR { return C.EVP_MD_CTX_new() } -func go_openssl_EVP_MD_block_size(md _EVP_MD_PTR) int32 { - return int32(C.EVP_MD_block_size(md)) -} - func go_openssl_EVP_MD_fetch(ctx _OSSL_LIB_CTX_PTR, algorithm *byte, properties *byte) _EVP_MD_PTR { return C.EVP_MD_fetch(ctx, (*C.char)(unsafe.Pointer(algorithm)), (*C.char)(unsafe.Pointer(properties))) } @@ -488,10 +480,6 @@ func go_openssl_EVP_MD_get_type(md _EVP_MD_PTR) int32 { return int32(C.EVP_MD_get_type(md)) } -func go_openssl_EVP_MD_size(md _EVP_MD_PTR) int32 { - return int32(C.EVP_MD_size(md)) -} - func go_openssl_EVP_PKEY_CTX_add1_hkdf_info(arg0 _EVP_PKEY_CTX_PTR, arg1 *byte, arg2 int32) int32 { return int32(C.EVP_PKEY_CTX_add1_hkdf_info(arg0, (*C.uchar)(unsafe.Pointer(arg1)), C.int(arg2))) } @@ -552,10 +540,6 @@ func go_openssl_EVP_PKEY_assign(pkey _EVP_PKEY_PTR, __type int32, key unsafe.Poi return int32(C.EVP_PKEY_assign(pkey, C.int(__type), key)) } -func go_openssl_EVP_PKEY_bits(pkey _EVP_PKEY_PTR) int32 { - return int32(C.EVP_PKEY_bits(pkey)) -} - func go_openssl_EVP_PKEY_decrypt(arg0 _EVP_PKEY_CTX_PTR, arg1 *byte, arg2 *int, arg3 *byte, arg4 int) int32 { return int32(C.EVP_PKEY_decrypt(arg0, (*C.uchar)(unsafe.Pointer(arg1)), (*C.size_t)(unsafe.Pointer(arg2)), (*C.uchar)(unsafe.Pointer(arg3)), C.size_t(arg4))) } @@ -684,10 +668,6 @@ func go_openssl_EVP_PKEY_sign_init(arg0 _EVP_PKEY_CTX_PTR) int32 { return int32(C.EVP_PKEY_sign_init(arg0)) } -func go_openssl_EVP_PKEY_size(pkey _EVP_PKEY_PTR) int32 { - return int32(C.EVP_PKEY_size(pkey)) -} - func go_openssl_EVP_PKEY_up_ref(key _EVP_PKEY_PTR) int32 { return int32(C.EVP_PKEY_up_ref(key)) }