jdk/src/jdk.crypto.ec/share/native/libsunec/impl/ec.c
changeset 31710 02dacd0f7b79
parent 25859 3317bb8137f4
child 31713 8d27f9edac84
equal deleted inserted replaced
31709:885627926ab1 31710:02dacd0f7b79
     1 /*
     1 /*
     2  * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
     3  * Use is subject to license terms.
     3  * Use is subject to license terms.
     4  *
     4  *
     5  * This library is free software; you can redistribute it and/or
     5  * This library is free software; you can redistribute it and/or
     6  * modify it under the terms of the GNU Lesser General Public
     6  * modify it under the terms of the GNU Lesser General Public
     7  * License as published by the Free Software Foundation; either
     7  * License as published by the Free Software Foundation; either
   583         !derivedSecret) {
   583         !derivedSecret) {
   584         PORT_SetError(SEC_ERROR_INVALID_ARGS);
   584         PORT_SetError(SEC_ERROR_INVALID_ARGS);
   585         return SECFailure;
   585         return SECFailure;
   586     }
   586     }
   587 
   587 
       
   588     if (EC_ValidatePublicKey(ecParams, publicValue, kmflag) != SECSuccess) {
       
   589         return SECFailure;
       
   590     }
       
   591 
   588     memset(derivedSecret, 0, sizeof *derivedSecret);
   592     memset(derivedSecret, 0, sizeof *derivedSecret);
   589     len = (ecParams->fieldID.size + 7) >> 3;
   593     len = (ecParams->fieldID.size + 7) >> 3;
   590     pointQ.len = 2*len + 1;
   594     pointQ.len = 2*len + 1;
   591     if ((pointQ.data = PORT_Alloc(2*len + 1, kmflag)) == NULL) goto cleanup;
   595     if ((pointQ.data = PORT_Alloc(2*len + 1, kmflag)) == NULL) goto cleanup;
   592 
   596