mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-08-08 23:13:38 +08:00
bug fixed: no fixed order in map, which may cause GeneratePrivateKey throw an error.
This commit is contained in:
@@ -667,7 +667,7 @@ type PrivateKey struct {
|
||||
pkey *C.EVP_PKEY
|
||||
}
|
||||
|
||||
func GeneratePrivateKey(alg string, args map[string]string, eng *Engine) (*PrivateKey, error) {
|
||||
func GeneratePrivateKey(alg string, args [][2]string, eng *Engine) (*PrivateKey, error) {
|
||||
calg := C.CString(alg)
|
||||
defer C.free(unsafe.Pointer(calg))
|
||||
|
||||
@@ -688,7 +688,9 @@ func GeneratePrivateKey(alg string, args map[string]string, eng *Engine) (*Priva
|
||||
if 1 != C.EVP_PKEY_paramgen_init(ctx) {
|
||||
return nil, GetErrors()
|
||||
}
|
||||
for name, value := range args {
|
||||
for _, arg := range args {
|
||||
name := arg[0]
|
||||
value := arg[1]
|
||||
cname := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(cname))
|
||||
cvalue := C.CString(value)
|
||||
@@ -712,7 +714,9 @@ func GeneratePrivateKey(alg string, args map[string]string, eng *Engine) (*Priva
|
||||
return nil, GetErrors()
|
||||
}
|
||||
|
||||
for name, value := range args {
|
||||
for _, arg := range args {
|
||||
name := arg[0]
|
||||
value := arg[1]
|
||||
cname := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(cname))
|
||||
cvalue := C.CString(value)
|
||||
|
||||
Reference in New Issue
Block a user