|
|
@ -1435,7 +1435,7 @@ parse_pubkey_data(pgp_pubkey_t *key, pgp_region_t *region, |
|
|
|
if (!limread(&c, 1, region, stream)) { |
|
|
|
return 0; |
|
|
|
} |
|
|
|
key->alg = c&0x0f; |
|
|
|
key->alg = c; |
|
|
|
|
|
|
|
switch (key->alg) { |
|
|
|
case PGP_PKA_DSA: |
|
|
@ -1465,9 +1465,15 @@ parse_pubkey_data(pgp_pubkey_t *key, pgp_region_t *region, |
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
|
case PGP_PKA_RESERVED_ELLIPTIC_CURVE: |
|
|
|
case PGP_PKA_RESERVED_ELLIPTIC_CURVE_V3: |
|
|
|
// todo |
|
|
|
printf("Elliptic curves! TODO!!!\n"); |
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
PGP_ERROR_1(&stream->errors, PGP_E_ALG_UNSUPPORTED_PUBLIC_KEY_ALG, "Unsupported Public Key algorithm (%s)", pgp_show_pka(key->alg)); |
|
|
|
printf("Unsupported Public Key algorithm (%x)", key->alg); |
|
|
|
printf("Unsupported Public Key algorithm (%x)\n %s\n", key->alg, pgp_show_pka(key->alg)); |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
@ -1503,7 +1509,7 @@ parse_pubkey(pgp_content_enum tag, pgp_region_t *region, |
|
|
|
|
|
|
|
/* XXX: this test should be done for all packets, surely? */ |
|
|
|
if (region->readc != region->length) { |
|
|
|
printf("Unconsumed data (%d)", region->length - region->readc); |
|
|
|
printf("Unconsumed data (%d)\n", region->length - region->readc); |
|
|
|
PGP_ERROR_1(&stream->errors, PGP_E_R_UNCONSUMED_DATA, "Unconsumed data (%d)", region->length - region->readc); |
|
|
|
return 0; |
|
|
|
} |
|
|
@ -2869,30 +2875,17 @@ parse_seckey(pgp_content_enum tag, pgp_region_t *region, pgp_stream_t *stream) |
|
|
|
break; |
|
|
|
|
|
|
|
case PGP_PKA_DSA: |
|
|
|
//if (!limread_mpi(&pkt.u.seckey.key.dsa.x, region, stream) || |
|
|
|
// !pgp_dsa_private_check(&pkt.u.seckey)) { |
|
|
|
// ret = 0; |
|
|
|
//} |
|
|
|
PGP_ERROR_2(&stream->errors, |
|
|
|
PGP_E_ALG_UNSUPPORTED_PUBLIC_KEY_ALG, |
|
|
|
"Unsupported Public Key algorithm %d (%s)", |
|
|
|
pkt.u.seckey.pubkey.alg, |
|
|
|
pgp_show_pka(pkt.u.seckey.pubkey.alg)); |
|
|
|
ret = 0; |
|
|
|
|
|
|
|
if (!limread_mpi(&pkt.u.seckey.key.dsa.x, region, stream) || |
|
|
|
!pgp_dsa_private_check(&pkt.u.seckey)) { |
|
|
|
ret = 0; |
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
|
case PGP_PKA_ELGAMAL: |
|
|
|
//if (!limread_mpi(&pkt.u.seckey.key.elgamal.x, region, stream) || |
|
|
|
// !pgp_elgamal_private_check(&pkt.u.seckey)) { |
|
|
|
// ret = 0; |
|
|
|
//} |
|
|
|
PGP_ERROR_2(&stream->errors, |
|
|
|
PGP_E_ALG_UNSUPPORTED_PUBLIC_KEY_ALG, |
|
|
|
"Unsupported Public Key algorithm %d (%s)", |
|
|
|
pkt.u.seckey.pubkey.alg, |
|
|
|
pgp_show_pka(pkt.u.seckey.pubkey.alg)); |
|
|
|
ret = 0; |
|
|
|
if (!limread_mpi(&pkt.u.seckey.key.elgamal.x, region, stream) || |
|
|
|
!pgp_elgamal_private_check(&pkt.u.seckey)) { |
|
|
|
ret = 0; |
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|