1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Key server protocol definition 24*7c478bd9Sstevel@tonic-gate * Copyright (C) 1990, 1991 Sun Microsystems, Inc. 25*7c478bd9Sstevel@tonic-gate * 26*7c478bd9Sstevel@tonic-gate * The keyserver is a public key storage/encryption/decryption service 27*7c478bd9Sstevel@tonic-gate * The encryption method used is based on the Diffie-Hellman exponential 28*7c478bd9Sstevel@tonic-gate * key exchange technology. 29*7c478bd9Sstevel@tonic-gate * 30*7c478bd9Sstevel@tonic-gate * The key server is local to each machine, akin to the portmapper. 31*7c478bd9Sstevel@tonic-gate * Under TI-RPC, communication with the keyserver is through the 32*7c478bd9Sstevel@tonic-gate * loopback transport. 33*7c478bd9Sstevel@tonic-gate * 34*7c478bd9Sstevel@tonic-gate * NOTE: This .x file generates the USER level headers for the keyserver. 35*7c478bd9Sstevel@tonic-gate * the KERNEL level headers are created by hand as they kernel has special 36*7c478bd9Sstevel@tonic-gate * requirements. 37*7c478bd9Sstevel@tonic-gate */ 38*7c478bd9Sstevel@tonic-gate 39*7c478bd9Sstevel@tonic-gate %#pragma ident "%Z%%M% %I% %E% SMI" 40*7c478bd9Sstevel@tonic-gate % 41*7c478bd9Sstevel@tonic-gate %/* Copyright (c) 1990, 1991 Sun Microsystems, Inc. */ 42*7c478bd9Sstevel@tonic-gate % 43*7c478bd9Sstevel@tonic-gate %/* 44*7c478bd9Sstevel@tonic-gate % * Compiled from key_prot.x using rpcgen. 45*7c478bd9Sstevel@tonic-gate % * DO NOT EDIT THIS FILE! 46*7c478bd9Sstevel@tonic-gate % * This is NOT source code! 47*7c478bd9Sstevel@tonic-gate % */ 48*7c478bd9Sstevel@tonic-gate 49*7c478bd9Sstevel@tonic-gate /* 50*7c478bd9Sstevel@tonic-gate * PROOT and MODULUS define the way the Diffie-Hellman key is generated. 51*7c478bd9Sstevel@tonic-gate * 52*7c478bd9Sstevel@tonic-gate * MODULUS should be chosen as a prime of the form: MODULUS == 2*p + 1, 53*7c478bd9Sstevel@tonic-gate * where p is also prime. 54*7c478bd9Sstevel@tonic-gate * 55*7c478bd9Sstevel@tonic-gate * PROOT satisfies the following two conditions: 56*7c478bd9Sstevel@tonic-gate * (1) (PROOT ** 2) % MODULUS != 1 57*7c478bd9Sstevel@tonic-gate * (2) (PROOT ** p) % MODULUS != 1 58*7c478bd9Sstevel@tonic-gate * 59*7c478bd9Sstevel@tonic-gate */ 60*7c478bd9Sstevel@tonic-gate 61*7c478bd9Sstevel@tonic-gate const PROOT = 3; 62*7c478bd9Sstevel@tonic-gate const HEXMODULUS = "d4a0ba0250b6fd2ec626e7efd637df76c716e22d0944b88b"; 63*7c478bd9Sstevel@tonic-gate 64*7c478bd9Sstevel@tonic-gate const HEXKEYBYTES = 48; /* HEXKEYBYTES == strlen(HEXMODULUS) */ 65*7c478bd9Sstevel@tonic-gate const KEYSIZE = 192; /* KEYSIZE == bit length of key */ 66*7c478bd9Sstevel@tonic-gate const KEYBYTES = 24; /* byte length of key */ 67*7c478bd9Sstevel@tonic-gate 68*7c478bd9Sstevel@tonic-gate /* 69*7c478bd9Sstevel@tonic-gate * The first 16 hex digits of the encrypted secret key are used as 70*7c478bd9Sstevel@tonic-gate * a checksum in the database. 71*7c478bd9Sstevel@tonic-gate */ 72*7c478bd9Sstevel@tonic-gate const KEYCHECKSUMSIZE = 16; 73*7c478bd9Sstevel@tonic-gate 74*7c478bd9Sstevel@tonic-gate /* 75*7c478bd9Sstevel@tonic-gate * status of operation 76*7c478bd9Sstevel@tonic-gate */ 77*7c478bd9Sstevel@tonic-gate enum keystatus { 78*7c478bd9Sstevel@tonic-gate KEY_SUCCESS, /* no problems */ 79*7c478bd9Sstevel@tonic-gate KEY_NOSECRET, /* no secret key stored */ 80*7c478bd9Sstevel@tonic-gate KEY_UNKNOWN, /* unknown netname */ 81*7c478bd9Sstevel@tonic-gate KEY_SYSTEMERR, /* system error (out of memory, encryption failure) */ 82*7c478bd9Sstevel@tonic-gate KEY_BADALG, /* unknown algorithm type */ 83*7c478bd9Sstevel@tonic-gate KEY_BADLEN /* unsupported keysize */ 84*7c478bd9Sstevel@tonic-gate }; 85*7c478bd9Sstevel@tonic-gate 86*7c478bd9Sstevel@tonic-gate typedef opaque keybuf[HEXKEYBYTES]; /* store key in hex */ 87*7c478bd9Sstevel@tonic-gate typedef opaque keybuf3<>; /* store key in binary */ 88*7c478bd9Sstevel@tonic-gate 89*7c478bd9Sstevel@tonic-gate typedef string netnamestr<MAXNETNAMELEN>; 90*7c478bd9Sstevel@tonic-gate 91*7c478bd9Sstevel@tonic-gate /* 92*7c478bd9Sstevel@tonic-gate * algorithm type & key size 93*7c478bd9Sstevel@tonic-gate */ 94*7c478bd9Sstevel@tonic-gate typedef int keylen_t; 95*7c478bd9Sstevel@tonic-gate typedef int algtype_t; 96*7c478bd9Sstevel@tonic-gate 97*7c478bd9Sstevel@tonic-gate struct mechtype { 98*7c478bd9Sstevel@tonic-gate keylen_t keylen; 99*7c478bd9Sstevel@tonic-gate algtype_t algtype; 100*7c478bd9Sstevel@tonic-gate }; 101*7c478bd9Sstevel@tonic-gate 102*7c478bd9Sstevel@tonic-gate /* 103*7c478bd9Sstevel@tonic-gate * number of keys for KEY_GEN_3 to return 104*7c478bd9Sstevel@tonic-gate */ 105*7c478bd9Sstevel@tonic-gate typedef int keynum_t; 106*7c478bd9Sstevel@tonic-gate 107*7c478bd9Sstevel@tonic-gate /* 108*7c478bd9Sstevel@tonic-gate * Result of KEY_GEN_3 109*7c478bd9Sstevel@tonic-gate */ 110*7c478bd9Sstevel@tonic-gate typedef des_block deskeyarray<>; 111*7c478bd9Sstevel@tonic-gate 112*7c478bd9Sstevel@tonic-gate /* 113*7c478bd9Sstevel@tonic-gate * Argument to ENCRYPT or DECRYPT 114*7c478bd9Sstevel@tonic-gate */ 115*7c478bd9Sstevel@tonic-gate struct cryptkeyarg { 116*7c478bd9Sstevel@tonic-gate netnamestr remotename; 117*7c478bd9Sstevel@tonic-gate des_block deskey; 118*7c478bd9Sstevel@tonic-gate }; 119*7c478bd9Sstevel@tonic-gate 120*7c478bd9Sstevel@tonic-gate /* 121*7c478bd9Sstevel@tonic-gate * Argument to ENCRYPT_PK or DECRYPT_PK 122*7c478bd9Sstevel@tonic-gate */ 123*7c478bd9Sstevel@tonic-gate struct cryptkeyarg2 { 124*7c478bd9Sstevel@tonic-gate netnamestr remotename; 125*7c478bd9Sstevel@tonic-gate netobj remotekey; /* Contains a length up to 1024 bytes */ 126*7c478bd9Sstevel@tonic-gate des_block deskey; 127*7c478bd9Sstevel@tonic-gate }; 128*7c478bd9Sstevel@tonic-gate 129*7c478bd9Sstevel@tonic-gate /* 130*7c478bd9Sstevel@tonic-gate * Argument to ENCRYPT_3, ENCRYPT_PK_3, DECRYPT_3, DECRYPT_PK_3 131*7c478bd9Sstevel@tonic-gate */ 132*7c478bd9Sstevel@tonic-gate struct cryptkeyarg3 { 133*7c478bd9Sstevel@tonic-gate netnamestr remotename; 134*7c478bd9Sstevel@tonic-gate keybuf3 remotekey; 135*7c478bd9Sstevel@tonic-gate deskeyarray deskey; 136*7c478bd9Sstevel@tonic-gate algtype_t algtype; 137*7c478bd9Sstevel@tonic-gate keylen_t keylen; 138*7c478bd9Sstevel@tonic-gate }; 139*7c478bd9Sstevel@tonic-gate 140*7c478bd9Sstevel@tonic-gate /* 141*7c478bd9Sstevel@tonic-gate * Result of ENCRYPT, DECRYPT, ENCRYPT_PK, DECRYPT_PK, KEY_GET_CONV 142*7c478bd9Sstevel@tonic-gate */ 143*7c478bd9Sstevel@tonic-gate union cryptkeyres switch (keystatus status) { 144*7c478bd9Sstevel@tonic-gate case KEY_SUCCESS: 145*7c478bd9Sstevel@tonic-gate des_block deskey; 146*7c478bd9Sstevel@tonic-gate default: 147*7c478bd9Sstevel@tonic-gate void; 148*7c478bd9Sstevel@tonic-gate }; 149*7c478bd9Sstevel@tonic-gate 150*7c478bd9Sstevel@tonic-gate /* 151*7c478bd9Sstevel@tonic-gate * Result of ENCRYPT_3, DECRYPT_3, ENCRYPT_PK_3, DECRYPT_PK_3, KEY_GET_CONV_3 152*7c478bd9Sstevel@tonic-gate */ 153*7c478bd9Sstevel@tonic-gate union cryptkeyres3 switch (keystatus status) { 154*7c478bd9Sstevel@tonic-gate case KEY_SUCCESS: 155*7c478bd9Sstevel@tonic-gate deskeyarray deskey; 156*7c478bd9Sstevel@tonic-gate default: 157*7c478bd9Sstevel@tonic-gate void; 158*7c478bd9Sstevel@tonic-gate }; 159*7c478bd9Sstevel@tonic-gate 160*7c478bd9Sstevel@tonic-gate const MAXGIDS = 16; /* max number of gids in gid list */ 161*7c478bd9Sstevel@tonic-gate 162*7c478bd9Sstevel@tonic-gate /* 163*7c478bd9Sstevel@tonic-gate * Unix credential 164*7c478bd9Sstevel@tonic-gate */ 165*7c478bd9Sstevel@tonic-gate struct unixcred { 166*7c478bd9Sstevel@tonic-gate u_int uid; 167*7c478bd9Sstevel@tonic-gate u_int gid; 168*7c478bd9Sstevel@tonic-gate u_int gids<MAXGIDS>; 169*7c478bd9Sstevel@tonic-gate }; 170*7c478bd9Sstevel@tonic-gate 171*7c478bd9Sstevel@tonic-gate /* 172*7c478bd9Sstevel@tonic-gate * Unix credential, without arbitrary limit 173*7c478bd9Sstevel@tonic-gate */ 174*7c478bd9Sstevel@tonic-gate struct unixcred3 { 175*7c478bd9Sstevel@tonic-gate u_int uid; 176*7c478bd9Sstevel@tonic-gate u_int gid; 177*7c478bd9Sstevel@tonic-gate u_int gids<>; 178*7c478bd9Sstevel@tonic-gate }; 179*7c478bd9Sstevel@tonic-gate 180*7c478bd9Sstevel@tonic-gate /* 181*7c478bd9Sstevel@tonic-gate * Result returned from GETCRED 182*7c478bd9Sstevel@tonic-gate */ 183*7c478bd9Sstevel@tonic-gate union getcredres switch (keystatus status) { 184*7c478bd9Sstevel@tonic-gate case KEY_SUCCESS: 185*7c478bd9Sstevel@tonic-gate unixcred cred; 186*7c478bd9Sstevel@tonic-gate default: 187*7c478bd9Sstevel@tonic-gate void; 188*7c478bd9Sstevel@tonic-gate }; 189*7c478bd9Sstevel@tonic-gate 190*7c478bd9Sstevel@tonic-gate /* 191*7c478bd9Sstevel@tonic-gate * Result returned from GETCRED_3 192*7c478bd9Sstevel@tonic-gate */ 193*7c478bd9Sstevel@tonic-gate union getcredres3 switch (keystatus status) { 194*7c478bd9Sstevel@tonic-gate case KEY_SUCCESS: 195*7c478bd9Sstevel@tonic-gate unixcred3 cred; 196*7c478bd9Sstevel@tonic-gate default: 197*7c478bd9Sstevel@tonic-gate void; 198*7c478bd9Sstevel@tonic-gate }; 199*7c478bd9Sstevel@tonic-gate 200*7c478bd9Sstevel@tonic-gate /* 201*7c478bd9Sstevel@tonic-gate * key_netstarg; 202*7c478bd9Sstevel@tonic-gate */ 203*7c478bd9Sstevel@tonic-gate struct key_netstarg { 204*7c478bd9Sstevel@tonic-gate keybuf st_priv_key; 205*7c478bd9Sstevel@tonic-gate keybuf st_pub_key; 206*7c478bd9Sstevel@tonic-gate netnamestr st_netname; 207*7c478bd9Sstevel@tonic-gate }; 208*7c478bd9Sstevel@tonic-gate 209*7c478bd9Sstevel@tonic-gate struct key_netstarg3 { 210*7c478bd9Sstevel@tonic-gate keybuf3 st_priv_key; 211*7c478bd9Sstevel@tonic-gate keybuf3 st_pub_key; 212*7c478bd9Sstevel@tonic-gate netnamestr st_netname; 213*7c478bd9Sstevel@tonic-gate algtype_t algtype; 214*7c478bd9Sstevel@tonic-gate keylen_t keylen; 215*7c478bd9Sstevel@tonic-gate des_block userkey; 216*7c478bd9Sstevel@tonic-gate }; 217*7c478bd9Sstevel@tonic-gate 218*7c478bd9Sstevel@tonic-gate union key_netstres switch (keystatus status){ 219*7c478bd9Sstevel@tonic-gate case KEY_SUCCESS: 220*7c478bd9Sstevel@tonic-gate key_netstarg knet; 221*7c478bd9Sstevel@tonic-gate default: 222*7c478bd9Sstevel@tonic-gate void; 223*7c478bd9Sstevel@tonic-gate }; 224*7c478bd9Sstevel@tonic-gate 225*7c478bd9Sstevel@tonic-gate union key_netstres3 switch (keystatus status){ 226*7c478bd9Sstevel@tonic-gate case KEY_SUCCESS: 227*7c478bd9Sstevel@tonic-gate key_netstarg3 knet; 228*7c478bd9Sstevel@tonic-gate default: 229*7c478bd9Sstevel@tonic-gate void; 230*7c478bd9Sstevel@tonic-gate }; 231*7c478bd9Sstevel@tonic-gate 232*7c478bd9Sstevel@tonic-gate /* 233*7c478bd9Sstevel@tonic-gate * Argument to KEY_GET_CONV_3 234*7c478bd9Sstevel@tonic-gate */ 235*7c478bd9Sstevel@tonic-gate struct deskeyarg3 { 236*7c478bd9Sstevel@tonic-gate keybuf3 pub_key; 237*7c478bd9Sstevel@tonic-gate int nkeys; 238*7c478bd9Sstevel@tonic-gate algtype_t algtype ; 239*7c478bd9Sstevel@tonic-gate keylen_t keylen; 240*7c478bd9Sstevel@tonic-gate }; 241*7c478bd9Sstevel@tonic-gate 242*7c478bd9Sstevel@tonic-gate /* 243*7c478bd9Sstevel@tonic-gate * Argument to KEY_SET_3 244*7c478bd9Sstevel@tonic-gate */ 245*7c478bd9Sstevel@tonic-gate struct setkeyarg3 { 246*7c478bd9Sstevel@tonic-gate keybuf3 key; 247*7c478bd9Sstevel@tonic-gate des_block userkey; 248*7c478bd9Sstevel@tonic-gate algtype_t algtype ; 249*7c478bd9Sstevel@tonic-gate keylen_t keylen; 250*7c478bd9Sstevel@tonic-gate }; 251*7c478bd9Sstevel@tonic-gate 252*7c478bd9Sstevel@tonic-gate #ifdef RPC_HDR 253*7c478bd9Sstevel@tonic-gate % 254*7c478bd9Sstevel@tonic-gate %#ifndef opaque 255*7c478bd9Sstevel@tonic-gate %#define opaque char 256*7c478bd9Sstevel@tonic-gate %#endif 257*7c478bd9Sstevel@tonic-gate % 258*7c478bd9Sstevel@tonic-gate #endif 259*7c478bd9Sstevel@tonic-gate program KEY_PROG { 260*7c478bd9Sstevel@tonic-gate version KEY_VERS { 261*7c478bd9Sstevel@tonic-gate 262*7c478bd9Sstevel@tonic-gate /* 263*7c478bd9Sstevel@tonic-gate * This is my secret key. 264*7c478bd9Sstevel@tonic-gate * Store it for me. 265*7c478bd9Sstevel@tonic-gate */ 266*7c478bd9Sstevel@tonic-gate keystatus 267*7c478bd9Sstevel@tonic-gate KEY_SET(keybuf) = 1; 268*7c478bd9Sstevel@tonic-gate 269*7c478bd9Sstevel@tonic-gate /* 270*7c478bd9Sstevel@tonic-gate * I want to talk to X. 271*7c478bd9Sstevel@tonic-gate * Encrypt a conversation key for me. 272*7c478bd9Sstevel@tonic-gate */ 273*7c478bd9Sstevel@tonic-gate cryptkeyres 274*7c478bd9Sstevel@tonic-gate KEY_ENCRYPT(cryptkeyarg) = 2; 275*7c478bd9Sstevel@tonic-gate 276*7c478bd9Sstevel@tonic-gate /* 277*7c478bd9Sstevel@tonic-gate * X just sent me a message. 278*7c478bd9Sstevel@tonic-gate * Decrypt the conversation key for me. 279*7c478bd9Sstevel@tonic-gate */ 280*7c478bd9Sstevel@tonic-gate cryptkeyres 281*7c478bd9Sstevel@tonic-gate KEY_DECRYPT(cryptkeyarg) = 3; 282*7c478bd9Sstevel@tonic-gate 283*7c478bd9Sstevel@tonic-gate /* 284*7c478bd9Sstevel@tonic-gate * Generate a secure conversation key for me 285*7c478bd9Sstevel@tonic-gate */ 286*7c478bd9Sstevel@tonic-gate des_block 287*7c478bd9Sstevel@tonic-gate KEY_GEN(void) = 4; 288*7c478bd9Sstevel@tonic-gate 289*7c478bd9Sstevel@tonic-gate /* 290*7c478bd9Sstevel@tonic-gate * Get me the uid, gid and group-access-list associated 291*7c478bd9Sstevel@tonic-gate * with this netname (for kernel which cannot use NIS) 292*7c478bd9Sstevel@tonic-gate */ 293*7c478bd9Sstevel@tonic-gate getcredres 294*7c478bd9Sstevel@tonic-gate KEY_GETCRED(netnamestr) = 5; 295*7c478bd9Sstevel@tonic-gate } = 1; 296*7c478bd9Sstevel@tonic-gate version KEY_VERS2 { 297*7c478bd9Sstevel@tonic-gate 298*7c478bd9Sstevel@tonic-gate /* 299*7c478bd9Sstevel@tonic-gate * ####### 300*7c478bd9Sstevel@tonic-gate * Procedures 1-5 are identical to version 1 301*7c478bd9Sstevel@tonic-gate * ####### 302*7c478bd9Sstevel@tonic-gate */ 303*7c478bd9Sstevel@tonic-gate 304*7c478bd9Sstevel@tonic-gate /* 305*7c478bd9Sstevel@tonic-gate * This is my secret key. 306*7c478bd9Sstevel@tonic-gate * Store it for me. 307*7c478bd9Sstevel@tonic-gate */ 308*7c478bd9Sstevel@tonic-gate keystatus 309*7c478bd9Sstevel@tonic-gate KEY_SET(keybuf) = 1; 310*7c478bd9Sstevel@tonic-gate 311*7c478bd9Sstevel@tonic-gate /* 312*7c478bd9Sstevel@tonic-gate * I want to talk to X. 313*7c478bd9Sstevel@tonic-gate * Encrypt a conversation key for me. 314*7c478bd9Sstevel@tonic-gate */ 315*7c478bd9Sstevel@tonic-gate cryptkeyres 316*7c478bd9Sstevel@tonic-gate KEY_ENCRYPT(cryptkeyarg) = 2; 317*7c478bd9Sstevel@tonic-gate 318*7c478bd9Sstevel@tonic-gate /* 319*7c478bd9Sstevel@tonic-gate * X just sent me a message. 320*7c478bd9Sstevel@tonic-gate * Decrypt the conversation key for me. 321*7c478bd9Sstevel@tonic-gate */ 322*7c478bd9Sstevel@tonic-gate cryptkeyres 323*7c478bd9Sstevel@tonic-gate KEY_DECRYPT(cryptkeyarg) = 3; 324*7c478bd9Sstevel@tonic-gate 325*7c478bd9Sstevel@tonic-gate /* 326*7c478bd9Sstevel@tonic-gate * Generate a secure conversation key for me 327*7c478bd9Sstevel@tonic-gate */ 328*7c478bd9Sstevel@tonic-gate des_block 329*7c478bd9Sstevel@tonic-gate KEY_GEN(void) = 4; 330*7c478bd9Sstevel@tonic-gate 331*7c478bd9Sstevel@tonic-gate /* 332*7c478bd9Sstevel@tonic-gate * Get me the uid, gid and group-access-list associated 333*7c478bd9Sstevel@tonic-gate * with this netname (for kernel which cannot use NIS) 334*7c478bd9Sstevel@tonic-gate */ 335*7c478bd9Sstevel@tonic-gate getcredres 336*7c478bd9Sstevel@tonic-gate KEY_GETCRED(netnamestr) = 5; 337*7c478bd9Sstevel@tonic-gate 338*7c478bd9Sstevel@tonic-gate /* 339*7c478bd9Sstevel@tonic-gate * I want to talk to X. and I know X's public key 340*7c478bd9Sstevel@tonic-gate * Encrypt a conversation key for me. 341*7c478bd9Sstevel@tonic-gate */ 342*7c478bd9Sstevel@tonic-gate cryptkeyres 343*7c478bd9Sstevel@tonic-gate KEY_ENCRYPT_PK(cryptkeyarg2) = 6; 344*7c478bd9Sstevel@tonic-gate 345*7c478bd9Sstevel@tonic-gate /* 346*7c478bd9Sstevel@tonic-gate * X just sent me a message. and I know X's public key 347*7c478bd9Sstevel@tonic-gate * Decrypt the conversation key for me. 348*7c478bd9Sstevel@tonic-gate */ 349*7c478bd9Sstevel@tonic-gate cryptkeyres 350*7c478bd9Sstevel@tonic-gate KEY_DECRYPT_PK(cryptkeyarg2) = 7; 351*7c478bd9Sstevel@tonic-gate 352*7c478bd9Sstevel@tonic-gate /* 353*7c478bd9Sstevel@tonic-gate * Store my public key, netname and private key. 354*7c478bd9Sstevel@tonic-gate */ 355*7c478bd9Sstevel@tonic-gate keystatus 356*7c478bd9Sstevel@tonic-gate KEY_NET_PUT(key_netstarg) = 8; 357*7c478bd9Sstevel@tonic-gate 358*7c478bd9Sstevel@tonic-gate /* 359*7c478bd9Sstevel@tonic-gate * Retrieve my public key, netname and private key. 360*7c478bd9Sstevel@tonic-gate */ 361*7c478bd9Sstevel@tonic-gate key_netstres 362*7c478bd9Sstevel@tonic-gate KEY_NET_GET(void) = 9; 363*7c478bd9Sstevel@tonic-gate 364*7c478bd9Sstevel@tonic-gate /* 365*7c478bd9Sstevel@tonic-gate * Return me the conversation (common) key that is constructed 366*7c478bd9Sstevel@tonic-gate * from my secret key and this publickey. 367*7c478bd9Sstevel@tonic-gate */ 368*7c478bd9Sstevel@tonic-gate cryptkeyres 369*7c478bd9Sstevel@tonic-gate KEY_GET_CONV(keybuf) = 10; 370*7c478bd9Sstevel@tonic-gate } = 2; 371*7c478bd9Sstevel@tonic-gate version KEY_VERS3 { 372*7c478bd9Sstevel@tonic-gate 373*7c478bd9Sstevel@tonic-gate /* 374*7c478bd9Sstevel@tonic-gate * ####### 375*7c478bd9Sstevel@tonic-gate * Procedures 1-10 are identical to versions 1 & 2 376*7c478bd9Sstevel@tonic-gate * ####### 377*7c478bd9Sstevel@tonic-gate */ 378*7c478bd9Sstevel@tonic-gate 379*7c478bd9Sstevel@tonic-gate /* 380*7c478bd9Sstevel@tonic-gate * This is my secret key. 381*7c478bd9Sstevel@tonic-gate * Store it for me. 382*7c478bd9Sstevel@tonic-gate */ 383*7c478bd9Sstevel@tonic-gate keystatus 384*7c478bd9Sstevel@tonic-gate KEY_SET(keybuf) = 1; 385*7c478bd9Sstevel@tonic-gate 386*7c478bd9Sstevel@tonic-gate /* 387*7c478bd9Sstevel@tonic-gate * I want to talk to X. 388*7c478bd9Sstevel@tonic-gate * Encrypt a conversation key for me. 389*7c478bd9Sstevel@tonic-gate */ 390*7c478bd9Sstevel@tonic-gate cryptkeyres 391*7c478bd9Sstevel@tonic-gate KEY_ENCRYPT(cryptkeyarg) = 2; 392*7c478bd9Sstevel@tonic-gate 393*7c478bd9Sstevel@tonic-gate /* 394*7c478bd9Sstevel@tonic-gate * X just sent me a message. 395*7c478bd9Sstevel@tonic-gate * Decrypt the conversation key for me. 396*7c478bd9Sstevel@tonic-gate */ 397*7c478bd9Sstevel@tonic-gate cryptkeyres 398*7c478bd9Sstevel@tonic-gate KEY_DECRYPT(cryptkeyarg) = 3; 399*7c478bd9Sstevel@tonic-gate 400*7c478bd9Sstevel@tonic-gate /* 401*7c478bd9Sstevel@tonic-gate * Generate a secure conversation key for me 402*7c478bd9Sstevel@tonic-gate */ 403*7c478bd9Sstevel@tonic-gate des_block 404*7c478bd9Sstevel@tonic-gate KEY_GEN(void) = 4; 405*7c478bd9Sstevel@tonic-gate 406*7c478bd9Sstevel@tonic-gate /* 407*7c478bd9Sstevel@tonic-gate * Get me the uid, gid and group-access-list associated 408*7c478bd9Sstevel@tonic-gate * with this netname (for kernel which cannot use NIS) 409*7c478bd9Sstevel@tonic-gate */ 410*7c478bd9Sstevel@tonic-gate getcredres 411*7c478bd9Sstevel@tonic-gate KEY_GETCRED(netnamestr) = 5; 412*7c478bd9Sstevel@tonic-gate 413*7c478bd9Sstevel@tonic-gate /* 414*7c478bd9Sstevel@tonic-gate * I want to talk to X. and I know X's public key 415*7c478bd9Sstevel@tonic-gate * Encrypt a conversation key for me. 416*7c478bd9Sstevel@tonic-gate */ 417*7c478bd9Sstevel@tonic-gate cryptkeyres 418*7c478bd9Sstevel@tonic-gate KEY_ENCRYPT_PK(cryptkeyarg2) = 6; 419*7c478bd9Sstevel@tonic-gate 420*7c478bd9Sstevel@tonic-gate /* 421*7c478bd9Sstevel@tonic-gate * X just sent me a message. and I know X's public key 422*7c478bd9Sstevel@tonic-gate * Decrypt the conversation key for me. 423*7c478bd9Sstevel@tonic-gate */ 424*7c478bd9Sstevel@tonic-gate cryptkeyres 425*7c478bd9Sstevel@tonic-gate KEY_DECRYPT_PK(cryptkeyarg2) = 7; 426*7c478bd9Sstevel@tonic-gate 427*7c478bd9Sstevel@tonic-gate /* 428*7c478bd9Sstevel@tonic-gate * Store my public key, netname and private key. 429*7c478bd9Sstevel@tonic-gate */ 430*7c478bd9Sstevel@tonic-gate keystatus 431*7c478bd9Sstevel@tonic-gate KEY_NET_PUT(key_netstarg) = 8; 432*7c478bd9Sstevel@tonic-gate 433*7c478bd9Sstevel@tonic-gate /* 434*7c478bd9Sstevel@tonic-gate * Retrieve my public key, netname and private key. 435*7c478bd9Sstevel@tonic-gate */ 436*7c478bd9Sstevel@tonic-gate key_netstres 437*7c478bd9Sstevel@tonic-gate KEY_NET_GET(void) = 9; 438*7c478bd9Sstevel@tonic-gate 439*7c478bd9Sstevel@tonic-gate /* 440*7c478bd9Sstevel@tonic-gate * Return me the conversation (common) key that is constructed 441*7c478bd9Sstevel@tonic-gate * from my secret key and this publickey. 442*7c478bd9Sstevel@tonic-gate */ 443*7c478bd9Sstevel@tonic-gate cryptkeyres 444*7c478bd9Sstevel@tonic-gate KEY_GET_CONV(keybuf) = 10; 445*7c478bd9Sstevel@tonic-gate 446*7c478bd9Sstevel@tonic-gate /* 447*7c478bd9Sstevel@tonic-gate * ####### 448*7c478bd9Sstevel@tonic-gate * Procedures new in version 3 follow... 449*7c478bd9Sstevel@tonic-gate * ####### 450*7c478bd9Sstevel@tonic-gate */ 451*7c478bd9Sstevel@tonic-gate 452*7c478bd9Sstevel@tonic-gate /* 453*7c478bd9Sstevel@tonic-gate * This is my secret key. 454*7c478bd9Sstevel@tonic-gate * Store it for me. 455*7c478bd9Sstevel@tonic-gate */ 456*7c478bd9Sstevel@tonic-gate keystatus 457*7c478bd9Sstevel@tonic-gate KEY_SET_3(setkeyarg3) = 11; 458*7c478bd9Sstevel@tonic-gate 459*7c478bd9Sstevel@tonic-gate /* 460*7c478bd9Sstevel@tonic-gate * I want to talk to X. 461*7c478bd9Sstevel@tonic-gate * Encrypt a conversation key for me. 462*7c478bd9Sstevel@tonic-gate */ 463*7c478bd9Sstevel@tonic-gate cryptkeyres3 464*7c478bd9Sstevel@tonic-gate KEY_ENCRYPT_3(cryptkeyarg3) = 12; 465*7c478bd9Sstevel@tonic-gate 466*7c478bd9Sstevel@tonic-gate /* 467*7c478bd9Sstevel@tonic-gate * X just sent me a message. 468*7c478bd9Sstevel@tonic-gate * Decrypt the conversation key for me. 469*7c478bd9Sstevel@tonic-gate */ 470*7c478bd9Sstevel@tonic-gate cryptkeyres3 471*7c478bd9Sstevel@tonic-gate KEY_DECRYPT_3(cryptkeyarg3) = 13; 472*7c478bd9Sstevel@tonic-gate 473*7c478bd9Sstevel@tonic-gate /* 474*7c478bd9Sstevel@tonic-gate * Generate secure conversation key(s) for me 475*7c478bd9Sstevel@tonic-gate */ 476*7c478bd9Sstevel@tonic-gate deskeyarray 477*7c478bd9Sstevel@tonic-gate KEY_GEN_3(keynum_t) = 14; 478*7c478bd9Sstevel@tonic-gate 479*7c478bd9Sstevel@tonic-gate /* 480*7c478bd9Sstevel@tonic-gate * Get me the uid, gid and group-access-list associated 481*7c478bd9Sstevel@tonic-gate * with this netname (for kernel which cannot use NIS) 482*7c478bd9Sstevel@tonic-gate */ 483*7c478bd9Sstevel@tonic-gate getcredres3 484*7c478bd9Sstevel@tonic-gate KEY_GETCRED_3(netnamestr) = 15; 485*7c478bd9Sstevel@tonic-gate 486*7c478bd9Sstevel@tonic-gate /* 487*7c478bd9Sstevel@tonic-gate * I want to talk to X. and I know X's public key 488*7c478bd9Sstevel@tonic-gate * Encrypt a conversation key for me. 489*7c478bd9Sstevel@tonic-gate */ 490*7c478bd9Sstevel@tonic-gate cryptkeyres3 491*7c478bd9Sstevel@tonic-gate KEY_ENCRYPT_PK_3(cryptkeyarg3) = 16; 492*7c478bd9Sstevel@tonic-gate 493*7c478bd9Sstevel@tonic-gate /* 494*7c478bd9Sstevel@tonic-gate * X just sent me a message. and I know X's public key 495*7c478bd9Sstevel@tonic-gate * Decrypt the conversation key for me. 496*7c478bd9Sstevel@tonic-gate */ 497*7c478bd9Sstevel@tonic-gate cryptkeyres3 498*7c478bd9Sstevel@tonic-gate KEY_DECRYPT_PK_3(cryptkeyarg3) = 17; 499*7c478bd9Sstevel@tonic-gate 500*7c478bd9Sstevel@tonic-gate /* 501*7c478bd9Sstevel@tonic-gate * Store my public key, netname and private key. 502*7c478bd9Sstevel@tonic-gate */ 503*7c478bd9Sstevel@tonic-gate keystatus 504*7c478bd9Sstevel@tonic-gate KEY_NET_PUT_3(key_netstarg3) = 18; 505*7c478bd9Sstevel@tonic-gate 506*7c478bd9Sstevel@tonic-gate /* 507*7c478bd9Sstevel@tonic-gate * Retrieve my public key, netname and private key. 508*7c478bd9Sstevel@tonic-gate */ 509*7c478bd9Sstevel@tonic-gate key_netstres3 510*7c478bd9Sstevel@tonic-gate KEY_NET_GET_3(key_netstarg3) = 19; 511*7c478bd9Sstevel@tonic-gate 512*7c478bd9Sstevel@tonic-gate /* 513*7c478bd9Sstevel@tonic-gate * Return me the conversation (common) key that is constructed 514*7c478bd9Sstevel@tonic-gate * from my secret key and this publickey. 515*7c478bd9Sstevel@tonic-gate */ 516*7c478bd9Sstevel@tonic-gate cryptkeyres3 517*7c478bd9Sstevel@tonic-gate KEY_GET_CONV_3(deskeyarg3) = 20; 518*7c478bd9Sstevel@tonic-gate 519*7c478bd9Sstevel@tonic-gate /* 520*7c478bd9Sstevel@tonic-gate * Clear all the secret/public/netname triplets for the caller 521*7c478bd9Sstevel@tonic-gate */ 522*7c478bd9Sstevel@tonic-gate keystatus 523*7c478bd9Sstevel@tonic-gate KEY_CLEAR_3(void) = 21; 524*7c478bd9Sstevel@tonic-gate 525*7c478bd9Sstevel@tonic-gate } = 3; 526*7c478bd9Sstevel@tonic-gate } = 100029; 527