keyinfo.c (libksba-1.4.0.tar.bz2) | : | keyinfo.c (libksba-1.5.0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 72 | skipping to change at line 72 | |||
} | } | |||
pkalgo_t; | pkalgo_t; | |||
struct algo_table_s { | struct algo_table_s { | |||
const char *oidstring; | const char *oidstring; | |||
const unsigned char *oid; /* NULL indicattes end of table */ | const unsigned char *oid; /* NULL indicattes end of table */ | |||
int oidlen; | int oidlen; | |||
int supported; /* Values > 1 are also used to indicate hacks. */ | int supported; /* Values > 1 are also used to indicate hacks. */ | |||
pkalgo_t pkalgo; | pkalgo_t pkalgo; | |||
const char *algo_string; | const char *algo_string; | |||
const char *elem_string; /* parameter name or '-' */ | const char *elem_string; /* parameter names or '-', 'P' for plain ECDSA */ | |||
const char *ctrl_string; /* expected tag values (value > 127 are raw data)*/ | const char *ctrl_string; /* expected tag values (value > 127 are raw data)*/ | |||
const char *parmelem_string; /* parameter name or '-'. */ | const char *parmelem_string; /* parameter name or '-'. */ | |||
const char *parmctrl_string; /* expected tag values. */ | const char *parmctrl_string; /* expected tag values. */ | |||
const char *digest_string; /* The digest algo if included in the OID. */ | const char *digest_string; /* The digest algo if included in the OID. */ | |||
}; | }; | |||
/* Special values for the supported field. */ | /* Special values for the supported field. */ | |||
#define SUPPORTED_RSAPSS 2 | #define SUPPORTED_RSAPSS 2 | |||
static const struct algo_table_s pk_algo_table[] = { | static const struct algo_table_s pk_algo_table[] = { | |||
skipping to change at line 202 | skipping to change at line 202 | |||
{ /* iso.member-body.us.ansi-x9-62.signatures.ecdsa-with-sha384 */ | { /* iso.member-body.us.ansi-x9-62.signatures.ecdsa-with-sha384 */ | |||
"1.2.840.10045.4.3.3", | "1.2.840.10045.4.3.3", | |||
"\x2a\x86\x48\xce\x3d\x04\x03\x03", 8, | "\x2a\x86\x48\xce\x3d\x04\x03\x03", 8, | |||
1, PKALGO_ECC, "ecdsa", "-rs", "\x30\x02\x02", NULL, NULL, "sha384" }, | 1, PKALGO_ECC, "ecdsa", "-rs", "\x30\x02\x02", NULL, NULL, "sha384" }, | |||
{ /* iso.member-body.us.ansi-x9-62.signatures.ecdsa-with-sha512 */ | { /* iso.member-body.us.ansi-x9-62.signatures.ecdsa-with-sha512 */ | |||
"1.2.840.10045.4.3.4", | "1.2.840.10045.4.3.4", | |||
"\x2a\x86\x48\xce\x3d\x04\x03\x04", 8, | "\x2a\x86\x48\xce\x3d\x04\x03\x04", 8, | |||
1, PKALGO_ECC, "ecdsa", "-rs", "\x30\x02\x02", NULL, NULL, "sha512" }, | 1, PKALGO_ECC, "ecdsa", "-rs", "\x30\x02\x02", NULL, NULL, "sha512" }, | |||
{ /* BSI TR-03111 bsiEcdsaWithSHA1 */ | ||||
"0.4.0.127.0.7.1.1.4.1.1", | ||||
"\x04\x00\x7f\x00\x07\x01\x01\x04\x01\x01", 10, | ||||
1, PKALGO_ECC, "ecdsa", "P", "", NULL, NULL, "sha1" }, | ||||
{ /* BSI TR-03111 bsiEcdsaWithSHA224 */ | ||||
"0.4.0.127.0.7.1.1.4.1.2", | ||||
"\x04\x00\x7f\x00\x07\x01\x01\x04\x01\x02", 10, | ||||
1, PKALGO_ECC, "ecdsa", "P", "", NULL, NULL, "sha224" }, | ||||
{ /* BSI TR-03111 bsiEcdsaWithSHA256 */ | ||||
"0.4.0.127.0.7.1.1.4.1.3", | ||||
"\x04\x00\x7f\x00\x07\x01\x01\x04\x01\x03", 10, | ||||
1, PKALGO_ECC, "ecdsa", "P", "", NULL, NULL, "sha256" }, | ||||
{ /* BSI TR-03111 bsiEcdsaWithSHA384 */ | ||||
"0.4.0.127.0.7.1.1.4.1.4", | ||||
"\x04\x00\x7f\x00\x07\x01\x01\x04\x01\x04", 10, | ||||
1, PKALGO_ECC, "ecdsa", "P", "", NULL, NULL, "sha384" }, | ||||
{ /* BSI TR-03111 bsiEcdsaWithSHA512 */ | ||||
"0.4.0.127.0.7.1.1.4.1.5", | ||||
"\x04\x00\x7f\x00\x07\x01\x01\x04\x01\x05", 10, | ||||
1, PKALGO_ECC, "ecdsa", "P", "", NULL, NULL, "sha512" }, | ||||
{ /* iso.member-body.us.rsadsi.pkcs.pkcs-1.1 */ | { /* iso.member-body.us.rsadsi.pkcs.pkcs-1.1 */ | |||
"1.2.840.113549.1.1.1", /* rsaEncryption used without hash algo*/ | "1.2.840.113549.1.1.1", /* rsaEncryption used without hash algo*/ | |||
"\x2a\x86\x48\x86\xf7\x0d\x01\x01\x01", 9, | "\x2a\x86\x48\x86\xf7\x0d\x01\x01\x01", 9, | |||
1, PKALGO_RSA, "rsa", "s", "\x82" }, | 1, PKALGO_RSA, "rsa", "s", "\x82" }, | |||
{ /* from NIST's OIW - actually belongs in a pure hash table */ | { /* from NIST's OIW - actually belongs in a pure hash table */ | |||
"1.3.14.3.2.26", /* sha1 */ | "1.3.14.3.2.26", /* sha1 */ | |||
"\x2B\x0E\x03\x02\x1A", 5, | "\x2B\x0E\x03\x02\x1A", 5, | |||
0, PKALGO_RSA, "sha-1", "", "", NULL, NULL, "sha1" }, | 0, PKALGO_RSA, "sha-1", "", "", NULL, NULL, "sha1" }, | |||
{ /* As used by telesec cards */ | { /* As used by telesec cards */ | |||
skipping to change at line 1411 | skipping to change at line 1436 | |||
/* fixme: we should calculate the initial length form the size of the | /* fixme: we should calculate the initial length form the size of the | |||
sequence, so that we don't neen a realloc later */ | sequence, so that we don't neen a realloc later */ | |||
init_stringbuf (&sb, 100); | init_stringbuf (&sb, 100); | |||
put_stringbuf (&sb, mode? "(7:enc-val(":"(7:sig-val("); | put_stringbuf (&sb, mode? "(7:enc-val(":"(7:sig-val("); | |||
put_stringbuf_sexp (&sb, algo_table[algoidx].algo_string); | put_stringbuf_sexp (&sb, algo_table[algoidx].algo_string); | |||
/* FIXME: We don't release the stringbuf in case of error | /* FIXME: We don't release the stringbuf in case of error | |||
better let the macro jump to a label */ | better let the macro jump to a label */ | |||
if (!mode && (algo_table[algoidx].pkalgo == PKALGO_ED25519 | if (!mode && (algo_table[algoidx].pkalgo == PKALGO_ED25519 | |||
||algo_table[algoidx].pkalgo == PKALGO_ED448)) | ||algo_table[algoidx].pkalgo == PKALGO_ED448 | |||
{ | || (algo_table[algoidx].pkalgo == PKALGO_ECC | |||
/* EdDSA is special: R and S are simply concatenated; see rfc8410. */ | && *algo_table[algoidx].elem_string == 'P'))) | |||
{ | ||||
/* EdDSA is special: R and S are simply concatenated; see | ||||
* rfc8410. The same code is used for Plain ECDSA format as | ||||
* specified in BSI TR-03111; we indicate this with a 'P' in the | ||||
* elem string. */ | ||||
put_stringbuf (&sb, "(1:r"); | put_stringbuf (&sb, "(1:r"); | |||
put_stringbuf_mem_sexp (&sb, der, derlen/2); | put_stringbuf_mem_sexp (&sb, der, derlen/2); | |||
put_stringbuf (&sb, ")"); | put_stringbuf (&sb, ")"); | |||
der += derlen/2; | der += derlen/2; | |||
derlen /= 2; | derlen /= 2; | |||
put_stringbuf (&sb, "(1:s"); | put_stringbuf (&sb, "(1:s"); | |||
put_stringbuf_mem_sexp (&sb, der, derlen); | put_stringbuf_mem_sexp (&sb, der, derlen); | |||
put_stringbuf (&sb, ")"); | put_stringbuf (&sb, ")"); | |||
} | } | |||
else | else | |||
End of changes. 3 change blocks. | ||||
4 lines changed or deleted | 34 lines changed or added |