gost: GOST key parameters data type, encode gost parameters procedure
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5520 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
1dd7d1fdeb
commit
a9e9aaee78
|
@ -109,8 +109,22 @@ static int
|
|||
asn1_encode_gostr3410_params(sc_context_t *ctx, void *params,
|
||||
u8 **buf, size_t *buflen, int depth)
|
||||
{
|
||||
(void)ctx, (void)params, (void)buf, (void)buflen, (void)depth; /* no warning */
|
||||
return SC_ERROR_NOT_IMPLEMENTED;
|
||||
struct sc_asn1_entry asn1_gostr3410_params0[2], asn1_gostr3410_params[4];
|
||||
struct sc_pkcs15_gost_parameters *gost_params = (struct sc_pkcs15_gost_parameters *)params;
|
||||
int r;
|
||||
|
||||
sc_copy_asn1_entry(c_asn1_gostr3410_params0, asn1_gostr3410_params0);
|
||||
sc_copy_asn1_entry(c_asn1_gostr3410_params, asn1_gostr3410_params);
|
||||
|
||||
sc_format_asn1_entry(asn1_gostr3410_params0 + 0, asn1_gostr3410_params, NULL, 1);
|
||||
sc_format_asn1_entry(asn1_gostr3410_params + 0, &gost_params->key, NULL, 1);
|
||||
sc_format_asn1_entry(asn1_gostr3410_params + 1, &gost_params->hash, NULL, 1);
|
||||
/* sc_format_asn1_entry(asn1_gostr3410_params + 2, &cipherp, NULL, 1); */
|
||||
|
||||
r = _sc_asn1_encode(ctx, asn1_gostr3410_params0, buf, buflen, depth + 1);
|
||||
|
||||
sc_log(ctx, "encoded-params: %s", sc_dump_hex(*buf, *buflen));
|
||||
return r;
|
||||
}
|
||||
|
||||
static const struct sc_asn1_entry c_asn1_pbkdf2_params[] = {
|
||||
|
@ -555,6 +569,7 @@ sc_asn1_encode_algorithm_id(sc_context_t *ctx,
|
|||
free(obj);
|
||||
}
|
||||
|
||||
sc_log(ctx, "return encoded algorithm ID: %s", sc_dump_hex(*buf, *len));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -162,6 +162,12 @@ struct sc_pkcs15_ec_parameters {
|
|||
size_t field_length; /* in bits */
|
||||
};
|
||||
|
||||
struct sc_pkcs15_gost_parameters {
|
||||
struct sc_object_id key;
|
||||
struct sc_object_id hash;
|
||||
struct sc_object_id cipher;
|
||||
};
|
||||
|
||||
struct sc_pkcs15_pubkey_ec {
|
||||
struct sc_pkcs15_ec_parameters params;
|
||||
sc_pkcs15_der_t ecpointQ; /* note this is der */
|
||||
|
@ -173,11 +179,12 @@ struct sc_pkcs15_prkey_ec {
|
|||
};
|
||||
|
||||
struct sc_pkcs15_pubkey_gostr3410 {
|
||||
struct sc_pkcs15_gost_parameters params;
|
||||
sc_pkcs15_bignum_t xy;
|
||||
};
|
||||
|
||||
struct sc_pkcs15_prkey_gostr3410 {
|
||||
/* private components */
|
||||
struct sc_pkcs15_gost_parameters params;
|
||||
sc_pkcs15_bignum_t d;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue