Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
fc2c1b5d
Commit
fc2c1b5d
authored
May 08, 2020
by
Vijay Kiran Kamuju
Committed by
Alexandre Julliard
May 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msasn1: Add partial implementation of ASN1_CreateDecoder.
Signed-off-by:
Vijay Kiran Kamuju
<
infyquest@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
85dbf7b0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
173 additions
and
1 deletion
+173
-1
main.c
dlls/msasn1/main.c
+43
-0
msasn1.spec
dlls/msasn1/msasn1.spec
+1
-1
asn1.c
dlls/msasn1/tests/asn1.c
+129
-0
No files found.
dlls/msasn1/main.c
View file @
fc2c1b5d
...
@@ -142,3 +142,46 @@ void WINAPI ASN1_CloseEncoder(ASN1encoding_t encoder)
...
@@ -142,3 +142,46 @@ void WINAPI ASN1_CloseEncoder(ASN1encoding_t encoder)
{
{
FIXME
(
"(%p): Stub!
\n
"
,
encoder
);
FIXME
(
"(%p): Stub!
\n
"
,
encoder
);
}
}
ASN1error_e
WINAPI
ASN1_CreateDecoder
(
ASN1module_t
module
,
ASN1decoding_t
*
decoder
,
ASN1octet_t
*
buf
,
ASN1uint32_t
bufsize
,
ASN1decoding_t
parent
)
{
ASN1decoding_t
dec
;
TRACE
(
"(%p %p %p %u %p)
\n
"
,
module
,
decoder
,
buf
,
bufsize
,
parent
);
if
(
!
module
||
!
decoder
)
return
ASN1_ERR_BADARGS
;
dec
=
heap_alloc
(
sizeof
(
dec
));
if
(
!
dec
)
{
return
ASN1_ERR_MEMORY
;
}
if
(
parent
)
FIXME
(
"parent not implemented.
\n
"
);
dec
->
magic
=
0x44434544
;
dec
->
version
=
0
;
dec
->
module
=
module
;
dec
->
buf
=
0
;
dec
->
size
=
bufsize
;
dec
->
len
=
0
;
dec
->
err
=
ASN1_SUCCESS
;
dec
->
bit
=
0
;
dec
->
pos
=
0
;
dec
->
eRule
=
module
->
eRule
;
dec
->
dwFlags
=
module
->
dwFlags
;
if
(
buf
)
{
dec
->
buf
=
buf
;
dec
->
pos
=
buf
;
dec
->
dwFlags
|=
ASN1DECODE_SETBUFFER
;
}
*
decoder
=
dec
;
return
ASN1_SUCCESS
;
}
dlls/msasn1/msasn1.spec
View file @
fc2c1b5d
...
@@ -220,7 +220,7 @@
...
@@ -220,7 +220,7 @@
@ stub ASN1_CloseEncoder2
@ stub ASN1_CloseEncoder2
@ stdcall ASN1_CloseEncoder(ptr)
@ stdcall ASN1_CloseEncoder(ptr)
@ stdcall ASN1_CloseModule(ptr)
@ stdcall ASN1_CloseModule(ptr)
@ st
ub ASN1_CreateDecoder
@ st
dcall ASN1_CreateDecoder(ptr ptr ptr long ptr)
@ stub ASN1_CreateDecoderEx
@ stub ASN1_CreateDecoderEx
@ stdcall ASN1_CreateEncoder(ptr ptr ptr long ptr)
@ stdcall ASN1_CreateEncoder(ptr ptr ptr long ptr)
@ stdcall ASN1_CreateModule(long long long long ptr ptr ptr ptr long)
@ stdcall ASN1_CreateModule(long long long long ptr ptr ptr ptr long)
...
...
dlls/msasn1/tests/asn1.c
View file @
fc2c1b5d
...
@@ -228,8 +228,137 @@ static void test_CreateEncoder(void)
...
@@ -228,8 +228,137 @@ static void test_CreateEncoder(void)
ASN1_CloseModule
(
mod
);
ASN1_CloseModule
(
mod
);
}
}
static
void
test_CreateDecoder
(
void
)
{
const
ASN1GenericFun_t
encfn
[]
=
{
NULL
};
const
ASN1GenericFun_t
decfn
[]
=
{
NULL
};
const
ASN1FreeFun_t
freefn
[]
=
{
NULL
};
const
ASN1uint32_t
size
[]
=
{
0
};
ASN1magic_t
name
=
0x61736e31
;
ASN1decoding_t
decoder
=
NULL
;
ASN1octet_t
buf
[]
=
{
0x54
,
0x65
,
0x73
,
0x74
,
0
};
ASN1module_t
mod
;
ASN1error_e
ret
;
ret
=
ASN1_CreateDecoder
(
NULL
,
NULL
,
NULL
,
0
,
NULL
);
ok
(
ret
==
ASN1_ERR_BADARGS
,
"Got error code %d.
\n
"
,
ret
);
mod
=
ASN1_CreateModule
(
ASN1_THIS_VERSION
,
ASN1_BER_RULE_DER
,
ASN1FLAGS_NOASSERT
,
1
,
encfn
,
decfn
,
freefn
,
size
,
name
);
ret
=
ASN1_CreateDecoder
(
mod
,
NULL
,
NULL
,
0
,
NULL
);
ok
(
ret
==
ASN1_ERR_BADARGS
,
"Got error code %d.
\n
"
,
ret
);
ret
=
ASN1_CreateDecoder
(
mod
,
&
decoder
,
NULL
,
0
,
NULL
);
ok
(
ASN1_SUCCEEDED
(
ret
),
"Got error code %d.
\n
"
,
ret
);
ok
(
!!
decoder
,
"Decoder creation failed.
\n
"
);
ok
(
decoder
->
magic
==
0x44434544
,
"Got invalid magic = %08x.
\n
"
,
decoder
->
magic
);
ok
(
!
decoder
->
version
,
"Got incorrect version = %08x.
\n
"
,
decoder
->
version
);
ok
(
decoder
->
module
==
mod
,
"Got incorrect module = %p.
\n
"
,
decoder
->
module
);
ok
(
!
decoder
->
buf
,
"Got incorrect buf = %p.
\n
"
,
decoder
->
buf
);
ok
(
!
decoder
->
size
,
"Got incorrect size = %u.
\n
"
,
decoder
->
size
);
ok
(
!
decoder
->
len
,
"Got incorrect length = %u.
\n
"
,
decoder
->
len
);
ok
(
decoder
->
err
==
ASN1_SUCCESS
,
"Got incorrect err = %d.
\n
"
,
decoder
->
err
);
ok
(
!
decoder
->
bit
,
"Got incorrect bit = %u.
\n
"
,
decoder
->
bit
);
ok
(
!
decoder
->
pos
,
"Got incorrect pos = %p.
\n
"
,
decoder
->
pos
);
ok
(
decoder
->
eRule
==
ASN1_BER_RULE_DER
,
"Got incorrect eRule = %08x.
\n
"
,
decoder
->
eRule
);
ok
(
decoder
->
dwFlags
==
ASN1DECODE_NOASSERT
,
"Got incorrect dwFlags = %08x.
\n
"
,
decoder
->
dwFlags
);
ret
=
ASN1_CreateDecoder
(
mod
,
&
decoder
,
buf
,
0
,
NULL
);
ok
(
ASN1_SUCCEEDED
(
ret
),
"Got error code %d.
\n
"
,
ret
);
ok
(
!!
decoder
,
"Decoder creation failed.
\n
"
);
ok
(
decoder
->
magic
==
0x44434544
,
"Got invalid magic = %08x.
\n
"
,
decoder
->
magic
);
ok
(
!
decoder
->
version
,
"Got incorrect version = %08x.
\n
"
,
decoder
->
version
);
ok
(
decoder
->
module
==
mod
,
"Got incorrect module = %p.
\n
"
,
decoder
->
module
);
ok
(
decoder
->
buf
==
buf
,
"Got incorrect buf = %s.
\n
"
,
decoder
->
buf
);
ok
(
!
decoder
->
size
,
"Got incorrect size = %u.
\n
"
,
decoder
->
size
);
ok
(
!
decoder
->
len
,
"Got incorrect length = %u.
\n
"
,
decoder
->
len
);
ok
(
decoder
->
err
==
ASN1_SUCCESS
,
"Got incorrect err = %d.
\n
"
,
decoder
->
err
);
ok
(
!
decoder
->
bit
,
"Got incorrect bit = %u.
\n
"
,
decoder
->
bit
);
ok
(
decoder
->
pos
==
buf
,
"Got incorrect pos = %s.
\n
"
,
decoder
->
pos
);
ok
(
decoder
->
eRule
==
ASN1_BER_RULE_DER
,
"Got incorrect eRule = %08x.
\n
"
,
decoder
->
eRule
);
ok
(
decoder
->
dwFlags
==
(
ASN1DECODE_NOASSERT
|
ASN1DECODE_SETBUFFER
),
"Got incorrect dwFlags = %08x.
\n
"
,
decoder
->
dwFlags
);
ret
=
ASN1_CreateDecoder
(
mod
,
&
decoder
,
buf
,
2
,
NULL
);
ok
(
ASN1_SUCCEEDED
(
ret
),
"Got error code %d.
\n
"
,
ret
);
ok
(
!!
decoder
,
"Decoder creation failed.
\n
"
);
ok
(
decoder
->
magic
==
0x44434544
,
"Got invalid magic = %08x.
\n
"
,
decoder
->
magic
);
ok
(
!
decoder
->
version
,
"Got incorrect version = %08x.
\n
"
,
decoder
->
version
);
ok
(
decoder
->
module
==
mod
,
"Got incorrect module = %p.
\n
"
,
decoder
->
module
);
ok
(
decoder
->
buf
==
buf
,
"Got incorrect buf = %p.
\n
"
,
decoder
->
buf
);
ok
(
decoder
->
size
==
2
,
"Got incorrect size = %u.
\n
"
,
decoder
->
size
);
ok
(
!
decoder
->
len
,
"Got incorrect length = %u.
\n
"
,
decoder
->
len
);
ok
(
decoder
->
err
==
ASN1_SUCCESS
,
"Got incorrect err = %d.
\n
"
,
decoder
->
err
);
ok
(
!
decoder
->
bit
,
"Got incorrect bit = %u.
\n
"
,
decoder
->
bit
);
ok
(
decoder
->
pos
==
buf
,
"Got incorrect pos = %p.
\n
"
,
decoder
->
pos
);
ok
(
decoder
->
eRule
==
ASN1_BER_RULE_DER
,
"Got incorrect eRule = %08x.
\n
"
,
decoder
->
eRule
);
ok
(
decoder
->
dwFlags
==
(
ASN1DECODE_NOASSERT
|
ASN1DECODE_SETBUFFER
),
"Got incorrect dwFlags = %08x.
\n
"
,
decoder
->
dwFlags
);
ret
=
ASN1_CreateDecoder
(
mod
,
&
decoder
,
buf
,
4
,
NULL
);
ok
(
ASN1_SUCCEEDED
(
ret
),
"Got error code %d.
\n
"
,
ret
);
ok
(
!!
decoder
,
"Decoder creation failed.
\n
"
);
ok
(
decoder
->
magic
==
0x44434544
,
"Got invalid magic = %08x.
\n
"
,
decoder
->
magic
);
ok
(
!
decoder
->
version
,
"Got incorrect version = %08x.
\n
"
,
decoder
->
version
);
ok
(
decoder
->
module
==
mod
,
"Got incorrect module = %p.
\n
"
,
decoder
->
module
);
ok
(
decoder
->
buf
==
buf
,
"Got incorrect buf = %p.
\n
"
,
decoder
->
buf
);
ok
(
decoder
->
size
==
4
,
"Got incorrect size = %u.
\n
"
,
decoder
->
size
);
ok
(
!
decoder
->
len
,
"Got incorrect length = %u.
\n
"
,
decoder
->
len
);
ok
(
decoder
->
err
==
ASN1_SUCCESS
,
"Got incorrect err = %d.
\n
"
,
decoder
->
err
);
ok
(
!
decoder
->
bit
,
"Got incorrect bit = %u.
\n
"
,
decoder
->
bit
);
ok
(
decoder
->
pos
==
buf
,
"Got incorrect pos = %p.
\n
"
,
decoder
->
pos
);
ok
(
decoder
->
eRule
==
ASN1_BER_RULE_DER
,
"Got incorrect rule = %08x.
\n
"
,
decoder
->
eRule
);
ok
(
decoder
->
dwFlags
==
(
ASN1DECODE_NOASSERT
|
ASN1DECODE_SETBUFFER
),
"Got incorrect dwFlags = %08x.
\n
"
,
decoder
->
dwFlags
);
ASN1_CloseModule
(
mod
);
mod
=
ASN1_CreateModule
(
ASN1_THIS_VERSION
,
ASN1_BER_RULE_DER
,
ASN1FLAGS_NONE
,
1
,
encfn
,
decfn
,
freefn
,
size
,
name
);
ret
=
ASN1_CreateDecoder
(
mod
,
&
decoder
,
buf
,
0
,
NULL
);
ok
(
decoder
->
dwFlags
==
ASN1DECODE_SETBUFFER
,
"Got incorrect dwFlags = %08x.
\n
"
,
decoder
->
dwFlags
);
ret
=
ASN1_CreateDecoder
(
mod
,
&
decoder
,
buf
,
4
,
NULL
);
ok
(
decoder
->
dwFlags
==
ASN1DECODE_SETBUFFER
,
"Got incorrect dwFlags = %08x.
\n
"
,
decoder
->
dwFlags
);
ASN1_CloseModule
(
mod
);
mod
=
ASN1_CreateModule
(
ASN1_THIS_VERSION
,
ASN1_PER_RULE_ALIGNED
,
ASN1FLAGS_NOASSERT
,
1
,
encfn
,
decfn
,
freefn
,
size
,
name
);
ret
=
ASN1_CreateDecoder
(
mod
,
&
decoder
,
buf
,
0
,
NULL
);
ok
(
ASN1_SUCCEEDED
(
ret
),
"Got error code %d.
\n
"
,
ret
);
ok
(
!!
decoder
,
"Decoder creation failed.
\n
"
);
ok
(
decoder
->
magic
==
0x44434544
,
"Got invalid magic = %08x.
\n
"
,
decoder
->
magic
);
ok
(
!
decoder
->
version
,
"Got incorrect version = %08x.
\n
"
,
decoder
->
version
);
ok
(
decoder
->
module
==
mod
,
"Got incorrect module = %p.
\n
"
,
decoder
->
module
);
ok
(
decoder
->
buf
==
buf
,
"Got incorrect buf = %s.
\n
"
,
decoder
->
buf
);
ok
(
!
decoder
->
size
,
"Got incorrect size = %u.
\n
"
,
decoder
->
size
);
ok
(
!
decoder
->
len
,
"Got incorrect length = %u.
\n
"
,
decoder
->
len
);
ok
(
decoder
->
err
==
ASN1_SUCCESS
,
"Got incorrect err = %d.
\n
"
,
decoder
->
err
);
ok
(
!
decoder
->
bit
,
"Got incorrect bit = %u.
\n
"
,
decoder
->
bit
);
ok
(
decoder
->
pos
==
buf
,
"Got incorrect pos = %s.
\n
"
,
decoder
->
pos
);
ok
(
decoder
->
eRule
==
ASN1_PER_RULE_ALIGNED
,
"Got incorrect eRule = %08x.
\n
"
,
decoder
->
eRule
);
ok
(
decoder
->
dwFlags
==
(
ASN1DECODE_NOASSERT
|
ASN1DECODE_SETBUFFER
),
"Got incorrect dwFlags = %08x.
\n
"
,
decoder
->
dwFlags
);
ret
=
ASN1_CreateDecoder
(
mod
,
&
decoder
,
buf
,
4
,
NULL
);
ok
(
!!
decoder
,
"Decoder creation failed.
\n
"
);
ok
(
decoder
->
magic
==
0x44434544
,
"Got invalid magic = %08x.
\n
"
,
decoder
->
magic
);
ok
(
!
decoder
->
version
,
"Got incorrect version = %08x.
\n
"
,
decoder
->
version
);
ok
(
decoder
->
module
==
mod
,
"Got incorrect module = %p.
\n
"
,
decoder
->
module
);
ok
(
decoder
->
buf
==
buf
,
"Got incorrect buf = %p.
\n
"
,
decoder
->
buf
);
ok
(
decoder
->
size
==
4
,
"Got incorrect size = %u.
\n
"
,
decoder
->
size
);
ok
(
!
decoder
->
len
,
"Got incorrect length = %u.
\n
"
,
decoder
->
len
);
ok
(
decoder
->
err
==
ASN1_SUCCESS
,
"Got incorrect err = %d.
\n
"
,
decoder
->
err
);
ok
(
!
decoder
->
bit
,
"Got incorrect bit = %u.
\n
"
,
decoder
->
bit
);
ok
(
decoder
->
pos
==
buf
,
"Got incorrect pos = %p.
\n
"
,
decoder
->
pos
);
ok
(
decoder
->
eRule
==
ASN1_PER_RULE_ALIGNED
,
"Got incorrect rule = %08x.
\n
"
,
decoder
->
eRule
);
ok
(
decoder
->
dwFlags
==
(
ASN1FLAGS_NOASSERT
|
ASN1DECODE_SETBUFFER
),
"Got incorrect dwFlags = %08x.
\n
"
,
decoder
->
dwFlags
);
ASN1_CloseModule
(
mod
);
mod
=
ASN1_CreateModule
(
ASN1_THIS_VERSION
,
ASN1_PER_RULE_ALIGNED
,
ASN1FLAGS_NONE
,
1
,
encfn
,
decfn
,
freefn
,
size
,
name
);
ret
=
ASN1_CreateDecoder
(
mod
,
&
decoder
,
buf
,
0
,
NULL
);
ok
(
decoder
->
dwFlags
==
ASN1DECODE_SETBUFFER
,
"Got incorrect dwFlags = %08x.
\n
"
,
decoder
->
dwFlags
);
ret
=
ASN1_CreateDecoder
(
mod
,
&
decoder
,
buf
,
4
,
NULL
);
ok
(
decoder
->
dwFlags
==
ASN1DECODE_SETBUFFER
,
"Got incorrect dwFlags = %08x.
\n
"
,
decoder
->
dwFlags
);
ASN1_CloseModule
(
mod
);
}
START_TEST
(
asn1
)
START_TEST
(
asn1
)
{
{
test_CreateModule
();
test_CreateModule
();
test_CreateEncoder
();
test_CreateEncoder
();
test_CreateDecoder
();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment