Main Page Modules Data Structures File List Data Fields Globals Related Pages

# beecrypt/rsapk.c

Go to the documentation of this file.

    00001
    00007 /*
    00008  * <conformance statement for IEEE P1363 needed here>
    00009  *
    00010  * Copyright (c) 2000, 2001 Virtual Unlimited B.V.
    00011  *
    00012  * Author: Bob Deblier <bob@virtualunlimited.com>
    00013  *
    00014  * This library is free software; you can redistribute it and/or
    00015  * modify it under the terms of the GNU Lesser General Public
    00016  * License as published by the Free Software Foundation; either
    00017  * version 2.1 of the License, or (at your option) any later version.
    00018  *
    00019  * This library is distributed in the hope that it will be useful,
    00020  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00022  * Lesser General Public License for more details.
    00023  *
    00024  * You should have received a copy of the GNU Lesser General Public
    00025  * License along with this library; if not, write to the Free Software
    00026  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00027  *
    00028  */
    00029
    00030 #include "system.h"
    00031 #include "rsapk.h"
    00032 #include "debug.h"
    00033
    00034 /*@-boundswrite@*/
    00035 int rsapkInit(rsapk* pk)
    00036 {
    00037         memset(pk, 0, sizeof(*pk));
    00038         /* or
    00039         mp32bzero(&pk->n);
    00040         mp32nzero(&pk->e);
    00041         */
    00042
    00043         return 0;
    00044 }
    00045 /*@=boundswrite@*/
    00046
    00047 int rsapkFree(rsapk* pk)
    00048 {
    00049         /*@-usereleased -compdef @*/ /* pk->n.modl is OK */
    00050         mp32bfree(&pk->n);
    00051         mp32nfree(&pk->e);
    00052
    00053         return 0;
    00054         /*@=usereleased =compdef @*/
    00055 }
    00056
    00057 int rsapkCopy(rsapk* dst, const rsapk* src)
    00058 {
    00059         mp32bcopy(&dst->n, &src->n);
    00060         mp32ncopy(&dst->e, &src->e);
    00061
    00062         return 0;
    00063 }