- A0B28117315BD9560BE404C97E44252316FD19FF9CBC762BF5D46235034846155D5058E22A73D7010F78CF7442BA6624E2417A719FFCBE2F8A163090706E069C
+ 914398E87EDAF3B4ED8010EC6795C55F1A46B7C112D8DF2A28B9B73C4A786AB7335A662B097522FCF79695B5DBEE04C7AD8F2C8E70CAECA39C40430B7BC2FEB8
mpi/secmem.c
(1 . 24)(1 . 27)
5330 /* secmem.c - memory allocation from a secure heap
5331 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
5332 * 2007 Free Software Foundation, Inc.
5333 * Modified by No Such Labs. (C) 2015. See README.
5334 *
5335 * This file is part of GnuPG.
5336 * This file was originally part of Gnu Privacy Guard (GPG), ver. 1.4.10,
5337 * SHA256(gnupg-1.4.10.tar.gz):
5338 * 0bfd74660a2f6cedcf7d8256db4a63c996ffebbcdc2cf54397bfb72878c5a85a
5339 * (C) 1994-2005 Free Software Foundation, Inc.
5340 *
5341 * GnuPG is free software; you can redistribute it and/or modify
5342 * This program is free software: you can redistribute it and/or modify
5343 * it under the terms of the GNU General Public License as published by
5344 * the Free Software Foundation; either version 3 of the License, or
5345 * the Free Software Foundation, either version 3 of the License, or
5346 * (at your option) any later version.
5347 *
5348 * GnuPG is distributed in the hope that it will be useful,
5349 * This program is distributed in the hope that it will be useful,
5350 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5351 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5352 * GNU General Public License for more details.
5353 *
5354 * You should have received a copy of the GNU General Public License
5355 * along with this program; if not, see <http://www.gnu.org/licenses/>.
5356 * along with this program. If not, see <http://www.gnu.org/licenses/>.
5357 */
5358
5359 #include <config.h>
5360 #include "knobs.h"
5361
5362 #include <stdio.h>
5363 #include <stdlib.h>
5364 #include <string.h>
(92 . 9)(95 . 7)
5366 {
5367 if (!no_warning)
5368 {
5369 log_info(_("WARNING: using insecure memory!\n"));
5370 log_info(_("please see http://www.gnupg.org/faq.html"
5371 " for more information\n"));
5372 log_info("WARNING: using insecure memory!\n");
5373 }
5374 }
5375
(202 . 11)(203 . 6)
5377 /* It does not make sense to print such a warning, given the fact that
5378 * this whole Windows !@#$% and their user base are inherently insecure
5379 */
5380 #elif defined (__riscos__)
5381 /* no virtual memory on RISC OS, so no pages are swapped to disc,
5382 * besides we don't have mmap, so we don't use it! ;-)
5383 * But don't complain, as explained above.
5384 */
5385 #else
5386 log_info("Please note that you don't have secure memory on this system\n");
5387 #endif
(313 . 14)(309 . 11)
5389 secmem_init( size_t n )
5390 {
5391 if( !n ) {
5392 #ifndef __riscos__
5393 #ifdef USE_CAPABILITIES
5394 /* drop all capabilities */
5395 cap_set_proc( cap_from_text("all-eip") );
5396
5397 #elif !defined(HAVE_DOSISH_SYSTEM)
5398 uid_t uid;
5399
5400 disable_secmem=1;
5401 uid = getuid();
5402 if( uid != geteuid() ) {
(328 . 7)(321 . 6)
5404 log_fatal("failed to drop setuid\n" );
5405 }
5406 #endif
5407 #endif /* !__riscos__ */
5408 }
5409 else {
5410 if( n < DEFAULT_POOLSIZE )
(351 . 8)(343 . 8)
5412
5413 if( !pool_okay ) {
5414 log_info(
5415 _("operation is not possible without initialized secure memory\n"));
5416 log_info(_("(you may have used the wrong program for this task)\n"));
5417 "operation is not possible without initialized secure memory\n");
5418 log_info("(you may have used the wrong program for this task)\n");
5419 exit(2);
5420 }
5421 if( show_warning && !suspend_warning ) {