fixed wrong encoding of protected Le
This commit is contained in:
13
npa/src/sm.c
13
npa/src/sm.c
@@ -18,11 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
#include "scutil.h"
|
#include "scutil.h"
|
||||||
#include "sm.h"
|
#include "sm.h"
|
||||||
#ifdef _WIN32
|
|
||||||
#include <winsock2.h>
|
|
||||||
#else
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#endif
|
|
||||||
#include <libopensc/asn1.h>
|
#include <libopensc/asn1.h>
|
||||||
#include <libopensc/log.h>
|
#include <libopensc/log.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -150,13 +145,13 @@ static int format_le(size_t le, struct sc_asn1_entry *le_entry,
|
|||||||
p[0] = le;
|
p[0] = le;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
p[0] = htons(le) >> 8;
|
p[0] = le >> 8;
|
||||||
p[1] = htons(le) & 0xff;
|
p[1] = le & 0xff;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
p[0] = 0x00;
|
p[0] = 0x00;
|
||||||
p[1] = htons(le) >> 8;
|
p[1] = le >> 8;
|
||||||
p[2] = htons(le) & 0xff;
|
p[2] = le & 0xff;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return SC_ERROR_INVALID_ARGUMENTS;
|
return SC_ERROR_INVALID_ARGUMENTS;
|
||||||
|
|||||||
Reference in New Issue
Block a user