1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- /* This file is part of libmissive.
- *
- * libmissive is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * libmissive is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with libmissive. If not, see <http://www.gnu.org/licenses/>.
- */
- #include <string.h>
- #include "crypt.h"
- int
- nonce_update(Nonce current, const Nonce newer)
- {
- switch (sodium_compare(current, newer, sizeof(Nonce))) {
- case 1:
- memcpy(current, newer, sizeof(Nonce));
- /* fallthru */
- case 0:
- sodium_increment(current, sizeof(Nonce));
- return 0;
- case -1:
- break;
- }
- return -1;
- }
- void
- box_keys(Box_skey skey, Box_pkey pkey)
- {
- crypto_box_keypair(pkey, skey);
- }
- void
- sign_keys(Sign_skey skey, Sign_pkey pkey)
- {
- crypto_sign_keypair(pkey, skey);
- }
|