X-Git-Url: https://the.earth.li/gitweb/?a=blobdiff_plain;ds=sidebyside;f=keyindex.c;h=c656bd142e9f7f500965c182bdecb3b6c83d3c6b;hb=adc800dbc424a1e246dd4a82a0c2e88eeda25531;hp=a26d458cdbb39cb6adee0acab85d379be231306e;hpb=a8fdcdb2112c5cdb795818fe5a6c9e4261713d90;p=onak.git
diff --git a/keyindex.c b/keyindex.c
index a26d458..c656bd1 100644
--- a/keyindex.c
+++ b/keyindex.c
@@ -13,8 +13,7 @@
* more details.
*
* You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 51
- * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * this program. If not, see .
*/
#include
@@ -26,14 +25,12 @@
#include "decodekey.h"
#include "getcgi.h"
-#include "hash.h"
#include "keydb.h"
#include "keyid.h"
#include "keyindex.h"
#include "keystructs.h"
#include "log.h"
#include "onak.h"
-#include "onak-conf.h"
#include "openpgp.h"
/*
@@ -48,6 +45,7 @@ char pkalgo2char(uint8_t algo)
typech = 'D';
break;
case OPENPGP_PKALGO_ECDSA:
+ case OPENPGP_PKALGO_EDDSA:
typech = 'E';
break;
case OPENPGP_PKALGO_EC:
@@ -93,9 +91,23 @@ unsigned int keylength(struct openpgp_packet *keydata)
switch (keydata->data[5]) {
case OPENPGP_PKALGO_EC:
case OPENPGP_PKALGO_ECDSA:
+ case OPENPGP_PKALGO_EDDSA:
/* Elliptic curve key size is based on OID */
+ /* Curve25519 / 1.3.6.1.4.1.3029.1.5.1 */
+ if ((keydata->data[6] == 10) &&
+ (keydata->data[7] == 0x2B) &&
+ (keydata->data[8] == 0x06) &&
+ (keydata->data[9] == 0x01) &&
+ (keydata->data[10] == 0x04) &&
+ (keydata->data[11] == 0x01) &&
+ (keydata->data[12] == 0x97) &&
+ (keydata->data[13] == 0x55) &&
+ (keydata->data[14] == 0x01) &&
+ (keydata->data[15] == 0x05) &&
+ (keydata->data[16] == 0x01)) {
+ length = 255;
/* Ed25519 / 1.3.6.1.4.1.11591.15.1 */
- if ((keydata->data[6] == 9) &&
+ } else if ((keydata->data[6] == 9) &&
(keydata->data[7] == 0x2B) &&
(keydata->data[8] == 0x06) &&
(keydata->data[9] == 0x01) &&
@@ -105,7 +117,7 @@ unsigned int keylength(struct openpgp_packet *keydata)
(keydata->data[13] == 0x47) &&
(keydata->data[14] == 0x0F) &&
(keydata->data[15] == 0x01)) {
- length = 256;
+ length = 255;
/* nistp256 / 1.2.840.10045.3.1.7 */
} else if ((keydata->data[6] == 8) &&
(keydata->data[7] == 0x2A) &&